Forráskód Böngészése

feat:物料替换增加审批流程

lupeng 2 hónapja
szülő
commit
06c1de0cf6

+ 3 - 4
src/api/apply/index.ts

@@ -16,11 +16,10 @@ export function toCheck(data: string) {
   });
 }
 //获取历史记录
-export function logList(data: string) {
+export function logList(flowIns: string) {
   return request({
-    url: "/api/v1/process/excel/log/list",
-    method: "post",
-    data,
+    url: `/api/v1/flowTask/list/${flowIns}`,
+    method: "get",
   });
 }
 //获取提交审核后的信息

+ 17 - 0
src/api/flow/index.ts

@@ -140,3 +140,20 @@ export function cancelFormDataFlow(data: object) {
     data: data,
   });
 }
+
+// 提交流程
+export function submitReplaceFlow(data: object) {
+  return request({
+    url: `/api/v1/processReplace/startFlow`,
+    method: "post",
+    data: data,
+  });
+}
+// 流程撤销
+export function cancelReplaceFlow(data: object) {
+  return request({
+    url: `/api/v1/processReplace/cancelFlow`,
+    method: "post",
+    data: data,
+  });
+}

+ 1 - 1
src/api/replace/index.ts

@@ -17,7 +17,7 @@ export function getOperations(workOrderCode: string) {
 
 export function getSeqList(workOrderCode: string, operationId: number) {
   return request({
-    url: `/api/v1/plan/task/station/${workOrderCode}/${operationId}`,
+    url: `/api/v1/processReplace/station/${workOrderCode}/${operationId}`,
     method: "get",
   });
 }

+ 21 - 13
src/views/base/apply/apply.vue

@@ -12,15 +12,20 @@
             placement="top"
           >
             <el-card>
-              <h4>阶段:{{ item.positionName }}</h4>
-              <h4>
-                结果:<span
-                  :class="item.examineResult == 1 ? 'green' : 'red'"
-                  >{{ item.examineResult == 1 ? "通过" : "驳回" }}</span
-                >
+              <h4>阶段:{{ item.currentStep }}
+                <el-tag v-if="item.currentType === 'start'" type="success">发起</el-tag>
+                <el-tag v-if="item.currentType === 'end'" type="success">结束</el-tag>
+                <el-tag v-if="item.currentType === 'audit' && item.state === '0'" type="info">待审核</el-tag>
+                <el-tag v-if="item.currentType === 'audit' && item.state === '1'" type="success">通过</el-tag>
+                <el-tag v-if="item.currentType === 'audit' && item.state === '-1'" type="error">驳回</el-tag>
+                <el-tag v-if="item.currentType === 'audit' && item.state === '2'" type="error">已撤回</el-tag>
               </h4>
-              <p v-if="item.remark">备注:{{ item.remark }}</p>
-              <p>操作人:{{ item.userName }}</p>
+              <h4 v-if="item.currentType !== 'end'">
+                审核意见:{{ item.opinion }}
+              </h4>
+              <h4 v-if="item.currentType !== 'end'">接收时间:{{ item.created }}</h4>
+              <h4 v-if="item.currentType !== 'end'">审核时间:{{ item.auditTime }}</h4>
+              <p v-if="item.currentType !== 'end'">操作人:{{ item.auditUser }}</p>
             </el-card>
           </el-timeline-item>
         </template>
@@ -45,7 +50,7 @@
           <el-descriptions-item label="订单名称">
             {{ props.rowData.orderName }}
           </el-descriptions-item>
-          <el-descriptions-item label="订单状态">
+          <el-descriptions-item label="归档状态">
             {{ getStatus(props.rowData.state) }}
           </el-descriptions-item>
         </el-descriptions>
@@ -120,7 +125,7 @@ import {
   examineList,
   getExcelData,
 } from "@/api/apply";
-import {getNextUser, queryFlowDataList, submitFlow, submitFormDataFlow} from "@/api/flow";
+import {getNextUser, queryFlowDataList, submitFormDataFlow} from "@/api/flow";
 import { getUserTree } from "@/api/system/user";
 import ExcelDataBbox from "@/views/base/apply/excelDataBbox.vue";
 const props = defineProps({
@@ -188,13 +193,16 @@ const getStatus = (val) => {
       return "待发起";
       break;
     case "1":
+      return "完成";
+      break;
+    case "-1":
       return "驳回";
       break;
     case "2":
-      return "审核中";
+      return "撤回";
       break;
     case "3":
-      return "已完成";
+      return "审核中";
       break;
   }
 };
@@ -204,7 +212,7 @@ const userList = ref([]);
 const submitList = ref([]);
 const LogList = ref([]);
 const getlogList = async () => {
-  const { data } = await logList({ excelFormId: props.rowData.id });
+  const { data } = await logList(props.rowData.flowIns);
   LogList.value = data;
 };
 const submit = async () => {

+ 7 - 2
src/views/quality/replace/components/replace-material.vue

@@ -17,7 +17,7 @@
       @selection-change="selectionChange"
     >
       <template #menu="{ size, row, index }">
-        <el-button
+        <el-button v-if="props.flowState == '0'||props.flowState == '2'||props.flowState == '-1'"
           type="primary"
           link
           size="small"
@@ -65,6 +65,12 @@ const props = defineProps({
       return 0;
     },
   },
+  flowState: {
+    type: String,
+    default: () => {
+      return 0;
+    },
+  },
   dialog: {
     type: Object,
     default: () => {
@@ -139,7 +145,6 @@ option.value = Object.assign(option.value, {
   ],
 });
 onMounted(() => {
-  // console.log("crudRef", crudRef)
   search.value.replaceId = props.replaceId;
   dataList();
 });

+ 185 - 101
src/views/quality/replace/index.vue

@@ -1,26 +1,25 @@
 <template>
   <div class="mainContentBox">
-    <Search :searchOptions="searchForm" @data-list="getList" ref="searchRef" />
-    <div class="btns">
-      <el-button type="primary" @click="add">新增</el-button>
-    </div>
-    <el-table :data="tableData" border>
-      <el-table-column type="index" label="序号" width="80" />
-      <el-table-column prop="workOrderCode" label="工单编码" />
-      <el-table-column prop="materialCode" label="物料编码" />
-      <el-table-column prop="materialModel" label="物料型号" />
-      <el-table-column prop="materialName" label="物料名称" />
-      <el-table-column prop="orderCode" label="订单编号" />
-      <el-table-column prop="operationName" label="工序名称" />
-      <el-table-column prop="creator" label="创建人" />
-      <el-table-column prop="created" label="创建时间" />
-      <!-- <el-table-column prop="seqNoList" label="管号">
-        <template #default="scope">
-          {{ scope.row.seqNoList.join(", ") }}
-        </template>
-      </el-table-column> -->
-      <el-table-column label="操作">
-        <template #default="{ row }">
+    <avue-crud
+        ref="crudRef"
+        v-model:search="search"
+        v-model="form"
+        :data="data"
+        :option="option"
+        v-model:page="page"
+        @row-save="createRow"
+        @row-update="updateRow"
+        @row-del="deleteRow"
+        @search-change="searchChange"
+        @search-reset="resetChange"
+        @size-change="dataList"
+        @current-change="dataList"
+        @selection-change="selectionChange"
+    >
+      <template #menu-left="{ size }">
+        <el-button type="primary" @click="add">新增</el-button></template>
+      <template #menu="{ row, index, type }">
+
           <el-button
             link
             type="primary"
@@ -32,29 +31,38 @@
             link
             type="primary"
             size="small"
-            @click="showMaterial(row.id)"
+            @click="showMaterial(row)"
             >采集替换</el-button
           >
           <el-button
             link
-            type="primary"
+            type="danger"
             size="small"
-            v-if="row?.state != '3'"
+            v-if="row?.flowState == '0'||row?.flowState == '2'||row?.flowState == '-1'"
             v-hasPerm="[ButtonPermKeys.PLAN.BTNS.filtersheet_del]"
             @click="deleteReplace(row.id)"
             >删除</el-button
           >
-        </template>
-      </el-table-column>
-    </el-table>
-    <div style="float: right">
-      <pagination
-        v-model:total="paginationObj.total"
-        v-model:page="paginationObj.pageNo"
-        v-model:limit="paginationObj.pageSize"
-        @pagination="getList"
-      />
-    </div>
+        <el-button
+            link
+            icon="el-icon-copy-document"
+            v-if="row.flowState == '0' || row.flowState == '2' || row.flowState == '-1'"
+            @click="openCheckView(row)"
+        >提审</el-button
+        >
+
+        <el-button link v-if="row.flowState !== '0'" icon="el-icon-copy-document" @click="showFlowSteps(row)"
+        >流程</el-button>
+
+        <el-button
+            link
+            icon="el-icon-copy-document"
+            v-if="row.flowState == '3'"
+            @click="cancelFlow(row)"
+        >撤销</el-button
+        >
+    </template>
+    </avue-crud>
 
     <el-dialog
       v-model="dialog.visible"
@@ -73,7 +81,7 @@
         >{{ item.formName }}</el-card
       > -->
       <el-form
-        :model="form"
+        :model="formSeq"
         ref="formRef"
         label-width="auto"
         style="max-width: 800px"
@@ -92,7 +100,7 @@
           <el-select
             class="tep"
             :disabled="!addStatus"
-            v-model="form.workOrderCode"
+            v-model="formSeq.workOrderCode"
             @click="dialog1.visible = true"
           />
         </el-form-item>
@@ -110,7 +118,7 @@
           <el-select
             filterable
             class="tep"
-            v-model="form.operationId"
+            v-model="formSeq.operationId"
             @change="setSeqList"
           >
             <el-option
@@ -132,7 +140,7 @@
           seqNoList
           prop=""
         >
-          <el-select class="tep" v-model="form.seqNoList" multiple filterable>
+          <el-select class="tep" v-model="formSeq.seqNoList" multiple filterable>
             <template #header>
               <el-checkbox v-model="checkAll" @change="handleCheckAll">
                 全选
@@ -193,8 +201,13 @@
       @close="dialog3.visible = false"
       :destroy-on-close="true"
     >
-      <Replace :replaceId="replace.id" :dialog="dialog3" />
+      <Replace :replaceId="replace.id" :dialog="dialog3" :flowState="replace.flowState" />
     </el-dialog>
+    <LookFlowStep ref="LookFlowStepRef"></LookFlowStep>
+    <WorkFlowCheck
+        ref="workFlowCheckRef"
+        @sureToSave="onWFSave"
+    ></WorkFlowCheck>
   </div>
 </template>
 <script setup>
@@ -211,6 +224,7 @@ import {
   getReplace,
   getSeqList,
 } from "@/api/replace";
+import {useCrud} from "@/hooks/userCrud";
 const updateTitle = ref("筛选单详情");
 const tableData = ref([]);
 const formRef = ref(null);
@@ -223,14 +237,42 @@ const showSeq = (seqs) => {
   showSeqList.value = seqs;
   dialog2.visible = true;
 };
-const showMaterial = (id) => {
-  replace.value.id = id;
+
+const LookFlowStepRef = ref(null);
+const showFlowSteps = (row) => {
+  LookFlowStepRef.value && LookFlowStepRef.value.openFlowStepDrawer(row.flowIns);
+};
+
+const cancelFlow=(row)=>{
+   cancelReplaceFlow(row).then(() => {
+     ElMessage.success("提交成功");
+     dataList();
+   });
+}
+const onWFSave = (flowForm) => {
+  submitReplaceFlow(flowForm).then(() => {
+    ElMessage.success("提交成功");
+    workFlowCheckRef.value && workFlowCheckRef.value.close();
+    dataList();
+  });
+};
+const showMaterial = (row) => {
+  replace.value = row;
   dialog3.visible = true;
 };
 const dialog = reactive({
   visible: false,
   title: "新增替换记录",
 });
+const workFlowCheckRef = ref(null);
+import WorkFlowCheck from "@/components/WorkFlows/workFlowCheck.vue";
+import LookFlowStep from "@/views/flow/common/LookFlowStep.vue";
+import RouteChangeLog from "@/views/base/craftManagement/route/components/routeChangeLog.vue";
+import {submitReplaceFlow,cancelReplaceFlow} from "@/api/flow";
+const openCheckView = (row) => {
+  row.businessId = row.id
+  workFlowCheckRef.value && workFlowCheckRef.value.openDialog(row, "itemReplaceService");
+};
 const dialog1 = reactive({
   visible: false,
   title: "工单编码选择",
@@ -243,11 +285,6 @@ const dialog3 = reactive({
   title: "物料替换",
   visible: false,
 });
-const paginationObj = reactive({
-  pageNo: 1,
-  pageSize: 10,
-  total: 0,
-});
 const submit = async () => {
   formRef.value.validate((valid) => {
     if (valid) {
@@ -265,26 +302,33 @@ const closeShow = () => {
   workOderShow.value = false;
 };
 const resetForm = () => {
-  form.value.id = "";
-  form.value.seqNoList = [];
-  form.value.workOrderCode = "";
-  form.value.operationId = "";
+  formSeq.value.id = "";
+  formSeq.value.seqNoList = [];
+  formSeq.value.workOrderCode = "";
+  formSeq.value.operationId = "";
 };
 const toAdd = async () => {
-  const { code } = await addReplace({ ...form.value });
+  const { code } = await addReplace({ ...formSeq.value });
   if (code == "200") {
     ElMessage.success("新增成功");
     resetForm();
-    getList();
+    dataList();
     dialog.visible = false;
   }
 };
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+    useCrud({
+      src: "/api/v1/processReplace",
+    });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+    Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const toEdiet = async () => {
-  const { code } = await updateFilter({ ...form.value });
+  const { code } = await updateFilter({ ...formSeq.value });
   if (code == "200") {
     ElMessage.success("修改成功");
     resetForm();
-    getList();
+    dataList();
     dialog.visible = false;
   }
 };
@@ -292,7 +336,7 @@ const deleteReplace = async (id) => {
   const { code } = await delReplace({ id });
   if (code === "200") {
     ElMessage.success("删除成功");
-    getList();
+    dataList();
   }
 };
 const options = ref([]);
@@ -301,46 +345,29 @@ const checkAll = ref(false);
 
 const handleCheckAll = (val) => {
   if (val) {
-    form.value.seqNoList = options.value
+    formSeq.value.seqNoList = options.value
       .filter((item) => !item.disabled)
       .map((item) => item.value);
   } else {
-    form.value.seqNoList = [];
+    formSeq.value.seqNoList = [];
   }
 };
 
 const searchRef = ref(null);
-const form = ref({ seqNoList: [] });
-const searchForm = [
-  {
-    label: "工单编码",
-    prop: "workOrderCode",
-    type: "input",
-  },
-  {
-    label: "物料编码",
-    prop: "materialCode",
-    type: "input",
-  },
-  {
-    label: "物料名称",
-    prop: "materialName",
-    type: "input",
-  },
-];
+const formSeq = ref({ seqNoList: [] });
 const materialInfo1 = async (value) => {
-  form.value.workOrderCode = value.workOrderCode;
+  formSeq.value.workOrderCode = value.workOrderCode;
   await setOperationList();
-  form.value.operationId = "";
+  formSeq.value.operationId = "";
   options.value = [];
-  form.value.seqNoList = [];
+  formSeq.value.seqNoList = [];
   dialog1.visible = false;
 };
 const operations = ref([]);
 const setOperationList = async () => {
-  const { data } = await getOperations(form.value.workOrderCode);
+  const { data } = await getOperations(formSeq.value.workOrderCode);
   operations.value = [];
-  form.value.seqNoList = [];
+  formSeq.value.seqNoList = [];
   data.forEach((element) => {
     operations.value.push({
       value: element.operationId,
@@ -351,10 +378,10 @@ const setOperationList = async () => {
 
 const seqListlength = ref(null);
 const setSeqList = async () => {
-  form.value.seqNoList = [];
+  formSeq.value.seqNoList = [];
   const { data } = await getSeqList(
-    form.value.workOrderCode,
-    form.value.operationId
+      formSeq.value.workOrderCode,
+      formSeq.value.operationId
   );
   options.value = [];
   data.sort((a, b) => a.seqNo.localeCompare(b.seqNo));
@@ -365,26 +392,13 @@ const setSeqList = async () => {
     });
   });
 };
-const getList = async () => {
-  const { data, totalCount } = await getReplace({
-    ...searchRef.value.searchForm,
-    pageNo: paginationObj.pageNo,
-    pageSize: paginationObj.pageSize,
-  });
-  tableData.value = data.records;
-  paginationObj.total = data.totalCount;
-};
+
 const add = () => {
   resetForm();
   addStatus.value = true;
   dialog.visible = true;
 };
-const edit = async (row) => {
-  addStatus.value = false;
-  form.value = row;
-  await setSeqList();
-  dialog.visible = true;
-};
+
 const cancel = () => {
   resetForm();
   dialog.visible = false;
@@ -395,13 +409,83 @@ const startToSelectAheads = () => {
   if (Number(toSelectCount.value)) {
     const count = Number(toSelectCount.value);
     const seqNoList = options.value.map((item) => item.value);
-    form.value.seqNoList = seqNoList.slice(0, count);
+    formSeq.value.seqNoList = seqNoList.slice(0, count);
   } else {
     ElMessage.error("请输入数字");
   }
 };
 onMounted(() => {
-  getList();
+  dataList();
+});
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  searchEnter: true,
+  selection: false,
+  addBtn: false,
+  delBtn: false,
+  editBtn: false,
+  viewBtn: false,
+  column: [
+    {
+      label: "生产批号",
+      prop: "workOrderCode",
+      editDisabled: true,
+      overHidden: true,
+      search: true,
+    },
+    {
+      label: "产品名称",
+      prop: "materialName",
+      editDisabled: true,
+      search: true,
+    },
+    {
+      label: "产品编码",
+      prop: "materialCode",
+      editDisabled: true,
+      search: true,
+    },
+    {
+      label: "产品规格",
+      prop: "materialModel",
+      search: true,
+      overHidden: true,
+    },
+    {
+      label: "订单编号",
+      prop: "orderCode",
+    },
+    {
+      label: "工序名称",
+      prop: "operationName",
+    },
+
+    {
+      label: "创建人",
+      prop: "creator",
+      editDisplay: false,
+    },
+    {
+      label: "创建时间",
+      prop: "created",
+    },
+    /*{
+      label: "日期",
+      prop: "createdSearch",
+      width: 160,
+      type: "daterange",
+      searchRange: true,
+      display: false,
+      hide: true,
+      startPlaceholder: "开始范围",
+      endPlaceholder: "结束范围",
+      format: "YYYY-MM-DD",
+      valueFormat: "YYYY-MM-DD",
+      overHidden: true,
+      search: true,
+    },*/
+  ],
 });
 </script>