Selaa lähdekoodia

申购单保存草稿功能

lxf 1 vuosi sitten
vanhempi
commit
8cffa0bc3f

+ 2 - 2
src/components/process/subscribe.vue

@@ -187,8 +187,8 @@ watch(
   () => props.queryData,
   (newValue) => {
     formOption.disabled = judgeStatus();
-    if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
-      formData.data = proxy.deepClone(newValue)
+    if (props.queryData && ["10", "20", "30", "40"].includes(route.query.processType)) {
+      formData.data = proxy.deepClone(newValue);
     }
   },
   {

+ 44 - 6
src/views/group/oa/subscribe/index.vue

@@ -32,10 +32,6 @@ import byTable from "@/components/byTable/index";
 const { proxy } = getCurrentInstance();
 const flowStatus = ref([
   {
-    dictKey: "-1",
-    dictValue: "草稿",
-  },
-  {
     dictKey: "0",
     dictValue: "未发起",
   },
@@ -51,6 +47,10 @@ const flowStatus = ref([
     dictKey: "3",
     dictValue: "已驳回",
   },
+  {
+    dictKey: "4",
+    dictValue: "已采购",
+  },
 ]);
 const sourceList = ref({
   data: [],
@@ -125,6 +125,31 @@ const config = computed(() => {
         prop: "remark",
       },
     },
+    {
+      attrs: {
+        label: "操作",
+        width: 80,
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
+          row.flowStatus == "0"
+            ? {
+                attrs: {
+                  label: "编辑",
+                  type: "primary",
+                  text: true,
+                },
+                el: "button",
+                click() {
+                  clickUpdate(row);
+                },
+              }
+            : {},
+        ];
+      },
+    },
   ];
 });
 const getList = async (req, status) => {
@@ -165,8 +190,21 @@ const clickCode = (item) => {
     query: {
       flowKey: "apply_buy",
       flowName: "申购流程",
-      processType: 20,
-      id: item.flowId,
+      processType: '20',
+      id: item.id,
+      flowId: item.flowId,
+      random: proxy.random(),
+    },
+  });
+};
+const clickUpdate = (item) => {
+  proxy.$router.replace({
+    path: "/platform_manage/process/processApproval",
+    query: {
+      flowKey: "apply_buy",
+      flowName: "申购流程",
+      processType: '40',
+      id: item.id,
       random: proxy.random(),
     },
   });

+ 4 - 2
src/views/process/dealWith/index.vue

@@ -78,7 +78,8 @@ const config = computed(() => {
                   path: "/platform_manage/process/processApproval",
                   query: {
                     flowKey: row.flowKey,
-                    id: row.id,
+                    id: row.businessId,
+                    flowId: row.id,
                     processType: 20,
                     version: row.version,
                   },
@@ -96,7 +97,8 @@ const config = computed(() => {
                     path: "/platform_manage/process/processApproval",
                     query: {
                       flowKey: row.flowKey,
-                      id: row.id,
+                      id: row.businessId,
+                      flowId: row.id,
                       processType: nodeType == 1 ? 30 : 10,
                       businessId: row.businessId,
                       version: row.version,

+ 42 - 36
src/views/process/processApproval/index.vue

@@ -19,8 +19,11 @@
             <el-input type="textarea" placeholder="请输入" v-model="flowForm.remark"> </el-input>
           </el-form-item>
           <el-form-item>
-            <el-button type="primary" v-if="approvalRecordData.buttonInfoList.length == 0" @click="handleSubmit" :loading="btnLoading">提交</el-button>
-            <el-button type="primary" v-else v-for="i in approvalRecordData.buttonInfoList" :key="i.type" :loading="btnLoading" @click="handleSubmit(i.type)">
+            <el-button type="primary" v-if="!route.query.processType || ['30', '40'].includes(route.query.processType)" @click="handleSaveDraft" v-preReClick>
+              保存草稿
+            </el-button>
+            <el-button type="primary" v-if="approvalRecordData.buttonInfoList.length == 0" @click="handleSubmit" v-preReClick>提交</el-button>
+            <el-button type="primary" v-else v-for="i in approvalRecordData.buttonInfoList" :key="i.type" @click="handleSubmit(i.type)" v-preReClick>
               {{ i.name }}
             </el-button>
           </el-form-item>
@@ -35,13 +38,13 @@
               v-for="item in recordList"
               :key="item.id"
               :class="
-                !route.query.id
+                !route.query.flowId
                   ? ''
                   : item.status == 2
                   ? 'flow-orange'
-                  : item.status == 3 && !route.query.id
+                  : item.status == 3 && !route.query.flowId
                   ? 'flow-orange'
-                  : item.status == 3 && route.query.id
+                  : item.status == 3 && route.query.flowId
                   ? 'flow-grey'
                   : ''
               ">
@@ -104,7 +107,6 @@ const router = useRouter();
 const route = useRoute();
 // tab切换逻辑
 const activeName = ref("first");
-const btnLoading = ref(false);
 // 意见表单
 const flowForm = reactive({
   flowKey: "",
@@ -146,14 +148,13 @@ const handleSubmit = async (_type) => {
     const flag = await proxy.$refs.makeDom.handleSubmit();
     if (flag) {
       flowFormDom.value.validate((valid) => {
-        btnLoading.value = true;
         if (valid) {
           const data = { ...proxy.$refs.makeDom.getFormData() };
-          if (route.query.processType == 10 || route.query.processType == 30) {
+          if (route.query.processType == '10' || route.query.processType == '30') {
             if (_type && _type == 1) {
               proxy
                 .post("/flowExample/setStartData", {
-                  exampleId: route.query.id,
+                  exampleId: route.query.flowId,
                   startData: data,
                 })
                 .then();
@@ -164,16 +165,11 @@ const handleSubmit = async (_type) => {
                 data,
                 handleType: _type,
                 version: route.query.version,
-                flowId: route.query.id,
+                flowId: route.query.flowId,
               })
-              .then(
-                (res) => {
-                  handleResult(res);
-                },
-                () => {
-                  btnLoading.value = false;
-                }
-              );
+              .then((res) => {
+                handleResult(res);
+              });
             return;
           } else {
             proxy
@@ -181,14 +177,9 @@ const handleSubmit = async (_type) => {
                 ...flowForm,
                 data,
               })
-              .then(
-                (res) => {
-                  handleResult(res);
-                },
-                () => {
-                  btnLoading.value = false;
-                }
-              );
+              .then((res) => {
+                handleResult(res);
+              });
           }
         }
       });
@@ -201,7 +192,7 @@ const handleSubmit = async (_type) => {
 const skipPage = () => {
   const useTagsStore = useTagsViewStore();
   useTagsStore.delVisitedView(router.currentRoute.value);
-  if (route.query.processType) {
+  if (route.query.processType && route.query.processType != '40') {
     router.replace({
       path: "/oa/1/dealWith",
     });
@@ -251,7 +242,27 @@ const getRecords = (_id) => {
       });
   }
 };
-onMounted(async () => {
+const handleSaveDraft = async () => {
+  const flag = await proxy.$refs.makeDom.handleSubmit();
+  if (flag) {
+    if (flowForm.flowKey == "apply_buy") {
+      let data = proxy.$refs.makeDom.getFormData();
+      if (data.id) {
+        proxy.post("/applyBuy/edit", data).then(() => {
+          skipPage();
+        });
+      } else {
+        proxy.post("/applyBuy/add", data).then(() => {
+          skipPage();
+        });
+      }
+    }
+  }
+};
+onMounted(() => {
+  //processType 10 为修改 20为查看 30回退发起
+  flowForm.flowKey = route.query.flowKey;
+  flowForm.tenantType = route.query.tenantType;
   if (route.query.random) {
     useTagsViewStore().visitedViews = useTagsViewStore().visitedViews.map((item) => {
       if (item.query && item.query.random === route.query.random) {
@@ -267,17 +278,12 @@ onMounted(async () => {
       }
     });
   }
-  //processType 10 为修改 20为查看 30回退发起
-  if (route.query.processType == 10 || route.query.processType == 20 || route.query.processType == 30) {
-    await proxy.post("/flowProcess/getStartData", { flowId: route.query.id }).then((res) => {
+  if (route.query.flowKey == "apply_buy") {
+    proxy.post("/applyBuy/detail", { id: route.query.id }).then((res) => {
       queryData.data = { ...res };
     });
-  } else {
-    queryData.data = { ...route.query };
   }
-  flowForm.flowKey = route.query.flowKey;
-  flowForm.tenantType = route.query.tenantType;
-  getRecords(route.query.id);
+  getRecords(route.query.flowId);
 });
 </script>
 <style>