ouyj 6 meses atrás
pai
commit
1b94a9e1a9
1 arquivos alterados com 231 adições e 1 exclusões
  1. 231 1
      ygtx-ui/src/views/gxt/orderMyTodo/index.vue

+ 231 - 1
ygtx-ui/src/views/gxt/orderMyTodo/index.vue

@@ -1298,6 +1298,101 @@
       </template>
     </el-dialog>
 
+
+    <!-- 维修工单下发对话框 -->
+    <el-dialog title="下发" v-model="assignRepairDialogVisible" width="800px" append-to-body >
+      <el-form ref="repairOrderRef" :model="assignRepairForm" :rules="assignRepairRules" label-width="120px" label-position="top">
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="工单编码" prop="workOrderProjectNo" >
+              <el-input v-model="assignRepairForm.workOrderProjectNo" placeholder="请输入工单编码" disabled readonly maxlength="50" show-word-limit v-chinese-limit/>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="风机编号" prop="pcsDeviceName">
+              <el-input v-model="assignRepairForm.pcsDeviceName" placeholder="请选择风机编号" readonly>
+                <template #append>
+                  <el-button @click="handleSelectEquipment" icon="Search"></el-button>
+                </template>
+              </el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="维保中心" prop="gxtCenter">
+              <el-input v-model="assignRepairForm.gxtCenter" placeholder="请选择风机编号自动填充" readonly />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="场站" prop="pcsStationName">
+              <el-input v-model="assignRepairForm.pcsStationName" placeholder="请选择风机编号自动填充" readonly />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="品牌" prop="brand">
+              <el-input v-model="assignRepairForm.brand" placeholder="请选择风机编号自动填充" readonly />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="机型" prop="model">
+              <el-input v-model="assignRepairForm.model" placeholder="请选择风机编号自动填充" readonly />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="12">
+            <el-form-item label="发生时间" prop="occurTime">
+              <el-date-picker
+                  v-model="assignRepairForm.occurTime"
+                  type="datetime"
+                  format="YYYY-MM-DD HH:mm"
+                  value-format="YYYY-MM-DD HH:mm"
+                  placeholder="请选择发生时间"
+                  style="width: 100%"
+                  :disabled-date="disabledDate"
+                  :disabled-time="disabledTime"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="故障代码" prop="faultCode">
+              <el-input
+                  v-model="assignRepairForm.faultCode"
+                  placeholder="请输入故障代码"
+                  maxlength="20"
+                  show-word-limit
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item label="故障信息" prop="faultBarcode">
+              <el-input
+                  v-model="assignRepairForm.faultBarcode"
+                  type="textarea"
+                  placeholder="请输入故障信息"
+                  maxlength="100"
+                  show-word-limit
+                  :rows="3"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button @click="assignRepairDialogVisible = false">取 消</el-button>
+          <el-button type="primary" @click="submitFormAndIssue">确认下发</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
+    <!-- 设备选择组件 -->
+    <equipment-select-single v-model="equipmentSelectVisible" @onSelected="onEquipmentSelected"></equipment-select-single>
   </div>
 </template>
 
@@ -1323,8 +1418,9 @@ import preview from '@/components/FileUpload/preview.vue'
 import MisInfoSelectSingle from "@/components/misInfoSelect/single.vue";
 import useUserStore from '@/store/modules/user'
 import {
-  listRepairOrder,
+  listRepairOrder,updateRepairOrder,
 } from "@/api/gxt/repairOrder";
+import EquipmentSelectSingle from "@/components/equipmentSelect/single.vue"
 
 const { proxy } = getCurrentInstance();
 const userStore = useUserStore();
@@ -1363,6 +1459,9 @@ const approveWorkDialogVisible = ref(false);
 const restartRepairDialogVisible = ref(false);
 const restartWorkDialogVisible = ref(false);
 
+// 下发对话框可见性
+const assignRepairDialogVisible = ref(false);
+const assignWorkDialogVisible = ref(false);
 
 // 维保中心选项
 const maintenanceCenterOptions = ref([]);
@@ -1398,6 +1497,9 @@ const approveWorkForm = ref({});
 const restartRepairForm = ref({});
 const restartWorkForm = ref({});
 
+// 下发表单数据
+const assignRepairForm = ref({});
+const assignWorkForm = ref({});
 
 // 工作负责人快速检索相关响应式数据
 const showTeamLeaderQuickSelect = ref(false);
@@ -1414,6 +1516,7 @@ const allMisNoList = ref([]); // 存储所有MIS工单数据用于快速检索
 const misNoLoading = ref(false);
 const misNoSearchTimer = ref(null);
 const misInfoSelectVisible = ref(false);
+const equipmentSelectVisible = ref(false)
 
 let commonKey = 0;
 
@@ -1533,6 +1636,37 @@ const restartWorkRules = ref({
   ]
 });
 
+const assignRepairRules = ref({
+  workOrderProjectNo: [
+    { required: true, message: "工单编码不能为空", trigger: "blur" }
+  ],
+  pcsDeviceName: [
+    { required: true, message: "风机编号不能为空", trigger: "blur" }
+  ],
+  occurTime: [
+    { required: true, message: "请选择发生时间", trigger: "change" },
+    {
+      validator: (rule, value, callback) => {
+        if (value && new Date(value) > new Date()) {
+          callback(new Error('发生时间不能大于当前时间'));
+        } else {
+          callback();
+        }
+      },
+      trigger: 'change'
+    }
+  ],
+  faultBarcode: [
+    { required: true, message: "故障信息不能为空", trigger: "blur" }
+  ],
+});
+
+const assignWorkRules = ref({
+ /* rejectionReason: [
+    { required: true, message: "请输入审批意见", trigger: "blur" }
+  ]*/
+});
+
 // 页面加载时执行
 onMounted(() => {
   getList();
@@ -2078,6 +2212,43 @@ const handleMisNoClear = () => {
   showMisNoQuickSelect.value = false;
 }
 
+const disabledDate = (time) => {
+  return time.getTime() > Date.now();
+};
+
+const disabledTime = (date) => {
+  const now = new Date();
+  if (date && date.toDateString() === now.toDateString()) {
+    const currentHour = now.getHours();
+    const currentMinute = now.getMinutes();
+
+    const disabledHours = () => {
+      const hours = [];
+      for (let i = currentHour + 1; i < 24; i++) {
+        hours.push(i);
+      }
+      return hours;
+    };
+
+    const disabledMinutes = (hour) => {
+      if (hour === currentHour) {
+        const minutes = [];
+        for (let i = currentMinute + 1; i < 60; i++) {
+          minutes.push(i);
+        }
+        return minutes;
+      }
+      return [];
+    };
+
+    return {
+      disabledHours,
+      disabledMinutes
+    };
+  };
+  return {};
+};
+
 // 打开设备选择对话框
 function handleSelectMisInfo() {
   misInfoSelectVisible.value = true;
@@ -2175,6 +2346,65 @@ function submitRestartWork() {
     }
   })
 }
+
+// 处理下发
+function handleUpdate(row) {
+  getOrderInfo(row.orderType, row.id).then(response => {
+    if (row.orderType === 1) {
+      // 维修工单
+      assignRepairForm.value = response.data;
+      assignRepairDialogVisible.value = true;
+    } else {
+      // 维保工单
+      assignWorkForm.value = response.data;
+      assignWorkDialogVisible.value = true;
+    }
+  });
+}
+
+/** 打开设备选择对话框 */
+function handleSelectEquipment() {
+  equipmentSelectVisible.value = true
+}
+
+/** 设备选择回调 */
+function onEquipmentSelected(row) {
+  if (row) {
+    // 检查维保中心ID和场站ID是否存在
+    if (!row.maintenanceCenterId) {
+      proxy.$modal.msgError("该设备的维保中心没有对应的部门,请完善部门信息后再更新设备数据!");
+      return;
+    }
+    if (!row.stationId) {
+      proxy.$modal.msgError("该设备的场站没有对应的部门,请完善部门信息后再更新设备数据!");
+      return;
+    }
+    assignRepairForm.value.pcsDeviceId = row.equipmentId
+    assignRepairForm.value.pcsDeviceName = row.equipmentCode
+    assignRepairForm.value.gxtCenterId = row.maintenanceCenterId
+    assignRepairForm.value.gxtCenter = row.maintenanceCenter
+    assignRepairForm.value.pcsStationId = row.stationId
+    assignRepairForm.value.pcsStationName = row.station
+    assignRepairForm.value.brand = row.brand
+    assignRepairForm.value.model = row.model
+  }
+  equipmentSelectVisible.value = false
+}
+
+/** 保存并下发 */
+function submitFormAndIssue() {
+  proxy.$refs["repairOrderRef"].validate(valid => {
+    if (valid) {
+      // 设置状态为待接单
+      assignRepairForm.value.workOrderStatus = "assigned"
+      updateRepairOrder(assignRepairForm.value).then(response => {
+        proxy.$modal.msgSuccess("下发成功")
+        assignRepairDialogVisible.value = false
+        getList()
+      })
+    }
+  })
+}
 </script>
 
 <style scoped>