Bläddra i källkod

Merge branch 'release_v1.0.0' of http://git.qmth.com.cn/sop/web into dev_1.0.1

刘洋 1 år sedan
förälder
incheckning
0450a33ef3

+ 7 - 0
src/api/my-workbenches.js

@@ -22,3 +22,10 @@ export const setMyMessagesRead = (id) =>
         url: '/api/sys/message/read',
         params: { id },
     });
+
+export const getViolationBy = (code) =>
+    request({
+        url: '/api/admin/tb/violation/getByCode?code=' + code,
+        method: 'get',
+        loading: true,
+    });

+ 105 - 8
src/views/my-workbenches/workbenches/message-reminder/message-list.vue

@@ -4,18 +4,18 @@
       class="message-item cursor-pointer"
       v-for="item in tableData"
       :key="item.id"
-      @click="open(item)"
+
     >
       <div class="m-head">
         <div
           class="m-title flex items-center"
           style="max-width: calc(100% - 180px)"
         >
-          <!-- <t-link hover="color"> -->
-          <!-- <span>{{ messageTypeFilter(item.messageType) }}</span> -->
-          <span class="ellipsis">{{ item.content }}</span>
+          <t-link hover="color" @click="editSopFlowHandle(item)">
+          <span>{{ messageTypeFilter(item.messageType) }}</span>
+<!--          <span class="ellipsis">{{ item.content }}</span>-->
 
-          <!-- </t-link> -->
+          </t-link>
           <t-tag
             theme="danger"
             variant="light"
@@ -27,8 +27,8 @@
 
         <div class="m-time">{{ timestampFilter(item.sendTime, 'mm') }}</div>
       </div>
-      <div class="m-body m-t-10px">
-        <!-- <div class="m-content">{{ item.content }}</div> -->
+      <div class="m-body m-t-10px" @click="open(item)">
+         <div class="m-content">{{ item.content }}</div>
         <t-space class="m-info" :size="5">
           <p>发起人:{{ item.formUser }}</p>
           <p>服务单元:{{ item.service }} </p>
@@ -56,11 +56,47 @@
       <img src="../../../../assets/none_message.png" />
       <p>暂无数据</p>
     </div>
+
+    <!-- SopStepDialog -->
+    <sop-step-dialog
+        v-model:visible="showSopStepDialog"
+        :sop="curSopData"
+        type="fill"
+        @confirm="sopStepConfirm"
+    ></sop-step-dialog>
+    <!-- PlanChangeDialog -->
+    <plan-change-dialog
+        v-model:visible="showPlanChangeDialog"
+        :sop="curSopData"
+        type="fill"
+        @confirm="sopStepConfirm"
+    ></plan-change-dialog>
+    <!-- QualityIssueDialog -->
+    <quality-issue-dialog
+        v-model:visible="showQualityIssueDialog"
+        :sop="curSopData"
+        type="fill"
+        @confirm="sopStepConfirm"
+    ></quality-issue-dialog>
+    <violation-flow-dialog
+        v-model:visible="showViolationFlowDialog"
+        :curRow="curSopData"
+        @confirm="sopStepConfirm"
+    ></violation-flow-dialog>
   </div>
 </template>
 
 <script setup name="MessageList">
-import { timestampFilter, customerTypeFilter } from '@/utils/filter';
+import {timestampFilter, customerTypeFilter, messageTypeFilter} from '@/utils/filter';
+import QualityIssueDialog from "@/views/sop/sop-manage/quality-issue/quality-issue-dialog.vue";
+import SopStepDialog from "@/views/sop/sop-manage/sop-step/sop-step-dialog.vue";
+import AbnormalAudit from "@/views/work-hours/work-hours-manage/abnormal-check/abnormal-audit.vue";
+import PlanChangeDialog from "@/views/sop/sop-manage/plan-change/plan-change-dialog.vue";
+import {reactive, ref} from "vue";
+import {MessagePlugin} from "tdesign-vue-next";
+import ViolationFlowDialog from "@/views/sop/sop-monitor/violation-registration/flow-dialog.vue";
+import {getViolationBy, setMyMessagesRead} from "@/api/my-workbenches";
+import {sopListApi} from "@/api/sop";
 
 const { tableData, pagination, onChange } = defineProps([
   'tableData',
@@ -71,4 +107,65 @@ const emit = defineEmits(['open']);
 const open = (row) => {
   emit('open', row);
 };
+const showSopStepDialog = ref(false);
+const showPlanChangeDialog = ref(false);
+const showQualityIssueDialog = ref(false);
+const showViolationFlowDialog = ref(false);
+const curSopData = ref({});
+const curRow = ref({});
+
+
+
+
+
+const editSopFlowHandle = (row) => {
+  curRow.value = row;
+  if (row.messageType === 'AFTER' || row.messageType === 'BEFORE') {
+    const params = reactive({
+      pageNumber: 1,
+      pageSize: 10,
+      serviceId: "",
+      formWidgetMetadataViewList: [],
+      formWidgetMetadataConditionList: [{fieldId: "sopNo", operator: "EQ", fieldValue: row.code}],
+      type: row.objType
+    });
+    sopListApi(params).then(res => {
+      if (res.records.length) {
+        curSopData.value = res.records[0];
+        showSopStepDialog.value = true;
+      } else {
+        MessagePlugin.error('未找到对应的SOP');
+      }
+    })
+
+    return;
+  }
+  if (row.messageType === 'VIOLATION') {
+    getViolationBy(row.code)
+      .then(res=>{
+          curSopData.value = res;
+          showViolationFlowDialog.value = true;
+      })
+    return;
+  }
+  // if (row.messageType === 'SYSTEM_PLAN_CHANGE') {
+  //   curSopData.value = row;
+  //   showPlanChangeDialog.value = true;
+  //   return;
+  // }
+  // if (row.messageType === 'QUALITY') {
+  //   showQualityIssueDialog.value = true;
+  //   return;
+  // }
+
+
+  MessagePlugin.error('未知类型待办');
+};
+const sopStepConfirm = () => {
+  setMyMessagesRead(curRow.id).then(() => {
+    // search()
+    workStore.updateWorkCounts();
+  });
+  emit('success');
+};
 </script>

+ 25 - 3
src/views/sop/sop-manage/quality-issue/index.vue

@@ -256,6 +256,10 @@ const currFlowTaskResultSetup = ref(null);
 const curStepSetup = ref(1);
 const flowId = props.sop.flowId;
 const crmInfo = ref({});
+const approveRejectFormIds = {
+  f_usertask_quality_problem_check_3: ['approve_radio_3'],
+  f_usertask_quality_problem_third_check_4: ['approve_radio_4'],
+};
 
 const initNew = async () => {
   loading.value = true;
@@ -415,19 +419,37 @@ const getFormData = () => {
 
 // 填报-提交
 const submitHandle = async (flowApprove = 'START') => {
+  const curStepData = allSteps.value.find(
+    (item) => item.taskName === curStep.value
+  );
   if (flowApprove === 'START') {
     const valid = await form.value[0].validate();
     if (valid !== true) return;
 
-    flowApprove = curStepSetup.value === 1 ? 'START' : 'PASS';
+    if (curStepSetup.value !== 1) {
+      const rejectFormIds = approveRejectFormIds[curStepData.taskKey];
+      if (
+        rejectFormIds &&
+        rejectFormIds.some((fid) => formData.value[fid] === '0')
+      ) {
+        flowApprove = 'REJECT';
+      } else {
+        flowApprove = 'PASS';
+      }
+    }
   }
 
   if (IS_FILL_MODE.value) {
-    const res = await issuesFeedbackApproveApi({
+    let data = {
       taskId: props.sop.taskId,
       formProperties: getFormData(),
       approve: flowApprove,
-    }).catch(() => {});
+    };
+    if (flowApprove === 'REJECT') {
+      // 目前只打回给定的允许打回的第一个选项
+      data.setup = curStepData.approveRejectList[0].setup;
+    }
+    const res = await issuesFeedbackApproveApi(data).catch(() => {});
     if (!res) return;
   } else if (IS_NEW_MODE.value) {
     const res = await issuesFeedbackSaveApi({