Browse Source

订单-离职交接

zhangjinxing 3 years ago
parent
commit
5de0b0140c

+ 64 - 13
src/views/interest/handover/addDetail.vue

@@ -3,24 +3,34 @@
     <div
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
-      <!-- v-if="showModel" -->
-      <div style="width: 500px" v-if="status === 0">
+      <!-- v-if="v-if="status === 0"" -->
+      <div style="width: 500px">
         <add-edit-form
           :id="this.$route.query.id"
+          :sitem="sitem"
+          :newTime="newTime"
           :show-model="showModel"
           :is-detail="!isDetail"
-          @refreshList="searchList"
+          @resData="initForm"
+          @refreshDom="refreshDom"
         />
       </div>
-      type:{{ type == 1 }}
-      <div style="width: 500px">
+      <!-- 
+
+  <exam-form :id="$route.query.id" v-if="status==1"
+          :newTime="newTime"/>
+
+          status 0:新建后未发起流程   1 :已发起流程 未审核  2:审核已完成
+-->
+
+      <!-- <div style="width: 500px">
         <add-edit-form
           :id="this.$route.query.id"
           :show-model="showModel"
           :is-detail="isDetail"
           @refreshList="searchList"
         />
-      </div>
+      </div> -->
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -56,6 +66,8 @@ export default {
   },
   data() {
     return {
+      sitem: null,
+      newTime: 0,
       type: "", //模拟节点
       parmValue1: {
         id: "",
@@ -63,27 +75,66 @@ export default {
     };
   },
 
-  mounted() {},
+  mounted() {
+    this.restSearch();
+    this.setTime();
+  },
 
   methods: {
+    initForm() {
+      console.log("刷新详情接口!");
+      this.setTime();
+    },
+    setTime() {
+      this.newTime = new Date().valueOf();
+    },
     restSearch() {
       this.parmValue = {};
-      this.searchList();
     },
-    async searchList() {
+    async refreshDom(val) {
+      console.log("子组件抛出");
+      // console.log(val);
+      val.hand_uid = val.hand_uid.toString();
+      val.resign_uid = val.resign_uid.toString();
       this.loading = true;
-      const res = await asyncRequest.list(this.parmValue);
+      const res = await asyncRequest.update(val);
       if (res && res.code === 0 && res.data) {
         // 获取到当前的type值,
-        this.type = 1;
+        // this.type = 1;
+        // console.log(res.data);
+        this.updateStatus(val);
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
-        this.tableData = [];
-        this.pageInfo.total = 0;
+        // this.tableData = [];
+        // this.pageInfo.total = 0;
       }
       this.loading = false;
     },
+    async updateStatus(val) {
+      let { id, type } = val;
+      let model = {
+        id: id,
+        remark: "123",
+        status: type,
+      };
+      console.log(model);
+      const res = await asyncRequest.updateStatus(model);
+      if (res && res.code === 0) {
+        const title = this.id === "add" ? "添加成功!" : "修改成功!";
+        this.$notify.success({
+          title,
+          message: "",
+        });
+        this.showModelThis = false;
+        // 刷新
+        this.$emit("refresh", false);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
   },
 };
 </script>

+ 89 - 65
src/views/interest/handover/components/addEditForm.vue

@@ -12,7 +12,7 @@
         <el-form-item label="离职人" prop="resign_uid">
           <!-- :disabled="parmValue1.type == 1" -->
           <search-account
-            :disabled="isDetail"
+            :disabled="status != 0"
             :is-detail="isDetail"
             :value="ruleForm.resign_uid"
             :size="searchSize"
@@ -25,7 +25,7 @@
           <!-- 
              -->
           <search-account
-            :disabled="isDetail"
+            :disabled="status != 0"
             :is-detail="isDetail"
             :value="ruleForm.hand_uid"
             :size="searchSize"
@@ -34,20 +34,32 @@
             @searchChange="handleHandoverName"
           />
         </el-form-item>
-        isDetail:{{ isDetail }} ---------id:{{ id }}-------status{{ status }}
+        isDetail:{{ isDetail }} ---------id:{{ id }}-------status{{
+          status == 0
+        }}
       </el-form>
     </el-col>
     <el-col :span="24" style="text-align: right">
-      <el-button type="primary" @click="submitForm" v-if="id === 'add'">{{
-        id === "add" ? "保 存" : "关 闭"
-      }}</el-button>
-      <!-- <el-button type="primary" @click="submitForm('flow')" v-if="isBtn"
+      <el-button
+        type="primary"
+        @click="submitForm"
+        v-if="id === 'add' || status != 1"
+        >{{ id === "add" || status != 1 ? "保 存" : "关 闭" }}</el-button
+      >
+      <el-button
+        type="primary"
+        @click="submitForm('flow')"
+        v-if="status == 0 && id != 'add'"
         >保 存 并 发 起 流 程
-      </el-button> -->
-      <!-- <el-button @click="closeAddEdit" v-if="isBtn"
-        >取 消 审 核 流 程</el-button
-      > -->
-      <el-button @click="closeAdd"> 关 闭</el-button>
+      </el-button>
+      <el-button
+        @click="closeAddEdit"
+        v-if="status == 0 && id != 'add'"
+        type="danger"
+        >作 废 审 核 流 程</el-button
+      >
+
+      <el-button @click="closeAdd" v-if="id == 'add'"> 关 闭</el-button>
     </el-col>
   </el-row>
 </template>
@@ -56,7 +68,7 @@ import asyncRequest from "@/apis/service/interest/handover";
 import resToken from "@/mixins/resToken";
 export default {
   name: "handover",
-  props: ["id", "isDetail", "showModelThis"],
+  props: ["id", "isDetail", "showModelThis", "newTime"],
   mixins: [resToken],
   data() {
     return {
@@ -107,12 +119,19 @@ export default {
         this.initForm();
       }
     },
+    newTime: function (val) {
+      console.log(val);
+      if (val) {
+        this.initForm();
+      }
+    },
   },
   methods: {
     //   关闭弹窗,直接隐藏表单
     async closeAddEdit() {
-      this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
-      const res = await asyncRequest.delete({ id: this.parmValue1.id });
+      // this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
+      console.log("121");
+      const res = await asyncRequest.delete({ id: this.id });
       console.log(res);
       if (res && res.code === 0) {
         window.vm.$router.push({
@@ -125,7 +144,10 @@ export default {
       }
     },
     closeAdd() {
-      this.$emit("closeModel", false);
+      // window.vm.$router.push({
+      //   path: "handover",
+      // });
+      this.showModelThis = false;
     },
     async initForm() {
       this.loading = true;
@@ -135,7 +157,7 @@ export default {
         this.rulesThis = this.rules;
         await this.resetForm();
       } else {
-        if (this.isDetail) {
+        if (this.status == 1) {
           this.rulesThis = {};
         } else {
           this.rulesThis = this.rules;
@@ -150,7 +172,7 @@ export default {
       const model = {
         // id: this.parmValue1.id,
       };
-      console.log(model);
+      // console.log(model);
       const res = await asyncRequest.detail({ id: this.id });
       if (res && res.code === 0 && res.data) {
         let { hand_name, resign_name, hand_uid, resign_uid, id, status } =
@@ -187,53 +209,55 @@ export default {
       });
     },
     async submitForm(flow) {
-      await this.$refs.ruleForm.validate(async (valid) => {
-        if (valid) {
-          let resign_uid = this.ruleForm.resign_uid;
-          let hand_uid = this.ruleForm.hand_uid;
-          if (resign_uid.toString() !== hand_uid.toString()) {
-            this.loading = true;
-            const model = {
-              id: this.ruleForm.id,
-              resign_uid: resign_uid.toString(),
-              hand_uid: hand_uid.toString(),
-            };
-            let res = {};
-            if (this.id === "add") {
-              delete model["id"];
-              res = await asyncRequest.add(model);
-            } else {
-              res = await asyncRequest.update(model);
-              if (flow == "flow") {
-                this.updateStatus();
-              }
-            }
-            window.vm.$router.push({
-              path: "handover",
-            });
-            this.loading = false;
-            if (res && res.code === 0) {
-              const title = this.id === "add" ? "添加成功!" : "修改成功!";
-              this.$notify.success({
-                title,
-                message: "",
-              });
-              this.showModelThis = false;
-              // 刷新
-              this.$emit("refresh", false);
-            } else if (res && res.code >= 100 && res.code <= 104) {
-              await this.logout();
-            } else {
-              this.$message.warning(res.message);
-            }
-          } else {
-            this.$message.error("离职人和接收人不能相同");
-          }
-        } else {
-          console.log("error submit!!");
-          return false;
-        }
-      });
+      console.log("12");
+      this.$emit("refreshDom",this.ruleForm);
+      // await this.$refs.ruleForm.validate(async (valid) => {
+      //   if (valid) {
+      //     let resign_uid = this.ruleForm.resign_uid;
+      //     let hand_uid = this.ruleForm.hand_uid;
+      //     if (resign_uid.toString() !== hand_uid.toString()) {
+      //       this.loading = true;
+      //       const model = {
+      //         id: this.ruleForm.id,
+      //         resign_uid: resign_uid.toString(),
+      //         hand_uid: hand_uid.toString(),
+      //       };
+      //       let res = {};
+      //       if (this.id === "add") {
+      //         delete model["id"];
+      //         res = await asyncRequest.add(model);
+      //       } else {
+      //         res = await asyncRequest.update(model);
+      //         if (flow == "flow") {
+      //           this.updateStatus();
+      //         }
+      //       }
+      //       // window.vm.$router.push({
+      //       //   path: "handover",
+      //       // });
+      //       this.loading = false;
+      //       if (res && res.code === 0) {
+      //         const title = this.id === "add" ? "添加成功!" : "修改成功!";
+      //         this.$notify.success({
+      //           title,
+      //           message: "",
+      //         });
+      //         this.showModelThis = false;
+      //         // 刷新
+      //         this.$emit("refresh", false);
+      //       } else if (res && res.code >= 100 && res.code <= 104) {
+      //         await this.logout();
+      //       } else {
+      //         this.$message.warning(res.message);
+      //       }
+      //     } else {
+      //       this.$message.error("离职人和接收人不能相同");
+      //     }
+      //   } else {
+      //     console.log("error submit!!");
+      //     return false;
+      //   }
+      // });
     },
     async updateStatus() {
       let { id, type } = this.ruleForm;

+ 16 - 21
src/views/interest/handover/index.vue

@@ -116,9 +116,10 @@
           </div>
         </template>
         <template #status="{ scope }">
+          <!-- :type="scope.row.status == '0' ? 'warning' : ''" -->
           <el-tag
             :size="tablebtnSize"
-            :type="scope.row.status == '0' ? 'warning' : ''"
+            :type="getType(scope.row.status)"
             v-text="
               (statusOptions.find((item) => item.id == scope.row.status) || {})
                 .label || '--'
@@ -134,7 +135,7 @@
           >
             <i
               class="el-icon-view tb-icon"
-              @click="gotoDetail(scope.row.id)"
+              @click="routeGoto('newProcess', { id: scope.row.id })"
             ></i>
           </el-tooltip>
         </template>
@@ -185,8 +186,9 @@ export default {
     return {
       // 状态
       statusOptions: [
-        { id: "0", label: "禁用" },
-        { id: "1", label: "启用" },
+        { id: "0", label: "待发起流程" },
+        { id: "1", label: "发起流程" },
+        { id: "2", label: "审核完成" },
       ],
       type: "",
       status_options: [
@@ -268,13 +270,14 @@ export default {
     this.searchList();
   },
   methods: {
-    gotoDetail(id) {
-      window.vm.$router.push({
-        path: "newProcess",
-        query: {
-          id: id,
-        },
-      });
+    getType(status) {
+      if (status == 0) {
+        return "";
+      } else if (status == 1) {
+        return "warning";
+      } else {
+        return "success";
+      }
     },
 
     restSearch() {
@@ -313,21 +316,13 @@ export default {
       }
       this.loading = false;
     },
-    // 离职人部门
-    handleResignPart(e) {
-      console.log(e);
-      this.parmValue.resign_part = e;
-    },
+
     // 离职人姓名
     handleResignName(e) {
       console.log(e);
       this.parmValue.resign_uid = e.id;
     },
-    // 接收人部门
-    handleHandoverPart(e) {
-      console.log(e);
-      this.parmValue.handover_part = e;
-    },
+
     // 接收人姓名
     handleHandoverName(e) {
       console.log(e);

+ 20 - 54
src/views/purchaseIn/storeGoods/index.vue

@@ -27,12 +27,12 @@
           <div style="width: 100%">
             <el-row style="padding: 0 0 0 80px">
               <el-col :span="24">
-                <el-col :span="8" style="width: 200px">
+                <el-col :span="8" style="width: 280px">
                   <search-supplier
                     :placeholder="'供应商名称'"
                     :size="searchSize"
                     :value="parmValue.supplierNo"
-                    :names="parmValue.gys_names"
+                    :names="''"
                     @searchChange="handleValue"
                   />
                 </el-col>
@@ -128,14 +128,6 @@
           </el-tooltip>
         </template>
       </ex-table>
-      <add-edit
-        :id="modelId"
-        :sitem="sitem"
-        :show-model="showModel"
-        :is-detail="isDetail"
-        @refresh="searchList"
-        @cancel="showModel = false"
-      />
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -169,11 +161,6 @@ export default {
   },
   data() {
     return {
-      wsmcode: "",
-      product_code: "", //商品编码
-      product_name: "", //商品名称
-      product: "", //商品名称绑定的数据
-      sitem: null,
       // 渲染当前状态
       statusOptions: [
         { id: "0", label: "使用中" },
@@ -181,24 +168,15 @@ export default {
       ],
       statusList: statusList,
       loading: true,
-      showModel: false,
-      isDetail: false,
-      modelId: 0,
       parmValue: {
-        gys_names: "", //供应商名称
-
         wsmcode: "", //仓库编码
         type_code: "", //仓库属性code
         good_code: "", //商品编码
         good_name: "", //商品名称
-        supplierNo: "", //供应商编码
+        supplierNo: [], //供应商编码
         page: 1, // 页码
         size: 15, // 每页显示条数
       },
-      tableData: [],
-      passwordModel: false,
-      passwordModelId: 0,
-      isPasswordDetail: false,
       // 表格 - 数据
       tableData: [],
       // 表格 - 参数
@@ -281,15 +259,11 @@ export default {
         {
           prop: "",
           label: "操作",
-          width: "80px",
+          width: "50px",
           fixed: "right",
           _noset_: true,
           _slot_: "operation",
         },
-        {
-          prop: "good_type",
-          label: "商品类型",
-        },
       ],
     };
   },
@@ -303,7 +277,7 @@ export default {
         wsmcode: "", //仓库编码
         good_code: "", //商品编码
         good_name: "", //商品名称
-        supplierNo: "", //供应商编码
+        supplierNo: [], //供应商编码
         page: 1, // 页码
         size: 15, // 每页显示条数
       };
@@ -312,16 +286,18 @@ export default {
     // 获取商品列表功能函数
     async searchList() {
       this.loading = true;
-      let { good_code, good_name, page, size, supplierNo, wsmcode } =
-        this.parmValue;
-      let model = {
-        good_code,
-        good_name,
-        page,
-        size,
-        supplierNo: supplierNo.toString(),
-        wsmcode,
-      };
+      let model = JSON.parse(JSON.stringify(this.parmValue));
+      model.supplierNo = model.supplierNo.toString();
+      // let { good_code, good_name, page, size, supplierNo, wsmcode } =
+      //   this.parmValue;
+      // let model = {
+      //   good_code,
+      //   good_name,
+      //   page,
+      //   size,
+      //   supplierNo: supplierNo.toString(),
+      //   wsmcode,
+      // };
       const res = await asyncRequest.list(model);
       if (res && res.code === 0 && res.data) {
         res.data.list.forEach((element) => {
@@ -339,7 +315,6 @@ export default {
     },
     // 上下架功能的切换
     async statusConfirm(id, status) {
-      console.log(id, status);
       let str = status === "1" ? "下架" : "上架";
       await this.$confirm("确定要改为" + str + "?", {
         confirmButtonText: "确定",
@@ -348,7 +323,6 @@ export default {
       })
         .then(async () => {
           this.loading = true;
-          console.log("修改成功");
           const model = {
             id: id,
             status: status === "1" ? "0" : "1",
@@ -371,26 +345,18 @@ export default {
           console.log("取消");
         });
     },
+    // 供应商选择
     handleValue(e) {
-      console.log(e);
       if (e && e.id) {
         this.parmValue.supplierNo = [e.code];
         this.parmValue.gys_names = e.label;
-        console.log(this.parmValue);
       } else {
         this.parmValue.supplierNo = [];
         this.parmValue.gys_names = "";
       }
+      this.parmValue.page = 1;
+      this.searchList();
     },
-    // handleStock(e) {
-    //   console.log(e);
-    //   if (e && e.id) {
-    //     this.parmValue.wsmcode = [e.code];
-    //     console.log(this.parmValue);
-    //   } else {
-    //     this.parmValue.wsmcode = [];
-    //   }
-    // },
   },
 };
 </script>