Sfoglia il codice sorgente

转执行 转运营 功能

XuZinan 2 anni fa
parent
commit
ea779340a4
2 ha cambiato i file con 130 aggiunte e 25 eliminazioni
  1. 117 24
      pages/Project/detail.vue
  2. 13 1
      services/project.js

+ 117 - 24
pages/Project/detail.vue

@@ -134,32 +134,59 @@
 
     <uni-popup ref="exePopup" type="dialog">
       <uni-popup-dialog title="转执行" type="info">
-        <uni-data-picker
-          class="depSelect"
-          placeholder="请选择执行经理"
-          :localdata="depUserTree"
-          @change="changeManager"
-        />
+        <uni-forms
+          ref="exe"
+          :modelValue="formData"
+          label-position="left"
+          :rules="exeRules"
+        >
+          <uni-forms-item required label="执行经理:" name="manager">
+            <uni-data-picker
+              class="depSelect"
+              placeholder="请选择执行经理"
+              :localdata="depUserTree"
+              @change="changeManager"
+            />
+          </uni-forms-item>
+        </uni-forms>
       </uni-popup-dialog>
     </uni-popup>
     <uni-popup ref="wtyPopup" type="dialog">
       <uni-popup-dialog title="转质保" type="info" @confirm="submitWarranty">
-        <uni-data-picker
-          class="depSelect"
-          placeholder="请选择质保经理"
-          :localdata="depUserTree"
-          @change="changeManager"
-        />
+        <uni-forms
+          ref="wty"
+          :modelValue="formData"
+          label-position="left"
+          :rules="wtyRules"
+        >
+          <uni-forms-item required label="质保经理:" name="manager">
+            <uni-data-picker
+              class="depSelect"
+              placeholder="请选择质保经理"
+              :localdata="depUserTree"
+              @change="changeManager"
+            />
+          </uni-forms-item>
+        </uni-forms>
       </uni-popup-dialog>
     </uni-popup>
     <uni-popup ref="optPopup" type="dialog">
       <uni-popup-dialog title="转运营" type="info" @confirm="submitOperate">
-        <uni-data-picker
-          class="depSelect"
-          placeholder="请选择运营经理"
-          :localdata="depUserTree"
-          @change="changeManager"
-        />
+        <uni-forms
+          ref="opt"
+          :modelValue="formData"
+          label-position="left"
+          :rules="optRules"
+        >
+          <uni-forms-item required label="运营经理:" name="manager">
+            <uni-data-picker
+              class="depSelect"
+              placeholder="请选择运营经理"
+              :localdata="depUserTree"
+              @change="changeManager"
+            />
+          </uni-forms-item>
+        </uni-forms>
       </uni-popup-dialog>
     </uni-popup>
   </view>
@@ -173,8 +200,13 @@ import {
   submitAudit,
   queryUserDetail,
   authApproval,
+  startExecution,
+  startWarranty,
+  startOperate,
 } from "@/services/project";
+import uniFormsItem from "../../uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue";
 export default {
+  components: { uniFormsItem },
   data() {
     return {
       auth: false,
@@ -183,6 +215,25 @@ export default {
       depRole: [],
       user: {},
       manager: "",
+      formData: {
+        manager: "",
+        contract: 0,
+      },
+      exeRules: {
+        manager: {
+          rules: [{ required: true, errorMessage: "请选择质保经理" }],
+        },
+      },
+      wtyRules: {
+        manager: {
+          rules: [{ required: true, errorMessage: "请选择质保经理" }],
+        },
+      },
+      optRules: {
+        manager: {
+          rules: [{ required: true, errorMessage: "请选择运营经理" }],
+        },
+      },
     };
   },
   computed: {
@@ -433,8 +484,7 @@ export default {
       });
     },
     changeManager(e) {
-      this.manager = e.detail.value[e.detail.value.length - 1].value;
-      console.log(this.manager);
+      this.formData.manager = e.detail.value[e.detail.value.length - 1].value;
     },
     onExecute() {
       this.$refs.exePopup.open();
@@ -444,16 +494,59 @@ export default {
       this.$refs.wtyPopup.open();
       return;
     },
-    submitWarranty(value) {
-      return;
+    async submitWarranty() {
+      this.$refs.wty.validate(async (err) => {
+        if (!err) {
+          const [dep_id, manager_id] = this.formData.manager.split("-");
+          let payload = {
+            project_code_id: this.currentProject.id,
+            dep_id: Number(dep_id),
+            wty_manager_id: Number(manager_id),
+          };
+          await startWarranty(payload);
+          uni.showToast({
+            title: "转质保送审成功",
+          });
+          setTimeout(function () {
+            uni.hideToast();
+            uni.navigateTo({
+              url: "./list",
+            });
+          }, 1800);
+        }
+      });
     },
     onOperate() {
       this.$refs.optPopup.open();
       return;
     },
-    submitOperate(value) {
-      return;
+    async submitOperate() {
+      this.$refs.opt.validate(async (err) => {
+        if (!err) {
+          const [dep_id, manager_id] = this.formData.manager.split("-");
+          let payload = {
+            project_code_id: this.currentProject.id,
+            dep_id: Number(dep_id),
+            opt_manager_id: Number(manager_id),
+          };
+          await startOperate(payload);
+          uni.showToast({
+            title: "转运营送审成功",
+          });
+          setTimeout(function () {
+            uni.hideToast();
+            uni.navigateTo({
+              url: "./list",
+            });
+          }, 1800);
+        }
+      });
     },
+    // onCancel() {
+    //   this.$refs.exe.close();
+    //   this.$refs.wty.close();
+    //   this.$refs.opt.close();
+    // }
   },
 };
 </script>

+ 13 - 1
services/project.js

@@ -57,4 +57,16 @@ export async function updateApproval(data) {
 
 export async function queryDep(data) {
   return request(`v2/dep`, "GET", data);
-}
+}
+
+export async function startExecution(data) {
+  return request(`v2/project_code/to_exe`, "POST", data);
+}
+
+export async function startOperate(data) {
+  return request(`v2/project_code/to_opt`, "POST", data);
+}
+
+export async function startWarranty(data) {
+  return request(`v2/project_code/to_wty`, "POST", data);
+}