Explorar el Código

订单 -离职详情

zhangjinxing hace 3 años
padre
commit
40fc368ec0

+ 2 - 2
src/components/search-account/main.vue

@@ -1,6 +1,6 @@
 <template>
   <el-select
-    v-model="code"
+    v-model="value"
     multiple
     filterable
     remote
@@ -44,7 +44,7 @@ export default {
    * @param {String}        size             : 组件大小            非必填
    * @param {Array}         value            : 选中值              必填
    * @param {String}        placeholder      : 提示信息            非必填
-   * @param {Boolean}       sDetail          : 是否是详情逻辑       必填
+   * @param {Boolean}       isDetail          : 是否是详情逻辑       必填
    * @param {Boolean}       disabled         : 是否禁用            必填
    * @param {String}        names            : 选中值label         展示详情必填
    * @param {String}        itemid           : 组织id              非必填

+ 2 - 2
src/components/search-stock/main.vue

@@ -53,8 +53,8 @@ export default {
     };
   },
   watch: {
-    names: function (val,old) {
-      console.log(val,old)
+    names: function (val, old) {
+      console.log(val, old);
       this.searchName = val;
       if (this.isDetail && this.searchName) {
         this.remoteMethod(this.searchName);

+ 39 - 23
src/views/interest/handover/components/addEditForm.vue

@@ -11,9 +11,10 @@
       >
         <el-form-item label="离职人" prop="resign_name">
           <search-account
-            :value="ruleForm.id"
+            :value="ruleForm.resign_uid"
             :size="searchSize"
-            :names="ruleForm.resign_name[0]"
+            :names="ruleForm.resign_name"
+            :is-detail="isDetail"
             :disabled="isDetail"
             :placeholder="'离职人名称'"
             @searchChange="handleResignName"
@@ -21,22 +22,22 @@
         </el-form-item>
         <el-form-item label="接受人" prop="hand_name">
           <search-account
-            :value="ruleForm.id"
+            :value="ruleForm.hand_uid"
             :size="searchSize"
-            :names="ruleForm.hand_name[0]"
+            :names="ruleForm.hand_name"
+            :is-detail="isDetail"
             :disabled="isDetail"
             :placeholder="'接受人名称'"
             @searchChange="handleHandoverName"
           />
         </el-form-item>
       </el-form>
-      123:{{ ruleForm.id }}{{ ruleForm.resign_name[0] }}
     </el-col>
     <el-col :span="24" style="text-align: right">
       <el-button v-if="!isDetail" type="primary" @click="submitForm"
         >保 存
       </el-button>
-      <el-button @click="closeAddEdit">{{
+      <el-button @click="closeAddEdit" v-if="!isDetail">{{
         isDetail ? "关 闭" : "取 消"
       }}</el-button>
     </el-col>
@@ -55,14 +56,15 @@ export default {
       roleList: [],
       loading: false,
       showModelThis: this.showModel,
+      resign_name: "", //离职人
+      hand_name: "", //交接人
       ruleForm: {
-        resign_name: [], //离职人
-        hand_name: [], //交接人
-        id: [],
+        hand_uid: [],
+        resign_uid: [],
       },
       rulesThis: this.rules,
       rules: {
-        resign_name: [
+        resign_uid: [
           {
             type: "array",
             required: true,
@@ -70,7 +72,7 @@ export default {
             trigger: "change",
           },
         ],
-        hand_name: [
+        hand_uid: [
           {
             type: "array",
             required: true,
@@ -125,13 +127,15 @@ export default {
       const res = await asyncRequest.detail({ id: this.parmValue1.id });
       if (res && res.code === 0 && res.data) {
         console.log(res);
-        let { hand_name, resign_name, id } = res.data;
-        this.ruleForm.resign_name = hand_name.split(",");
-        this.ruleForm.hand_name = resign_name.split(",");
-        // this.ruleForm.id = id.split(",");
-        this.ruleForm.id = id.split(",");
-
-        console.log(this.ruleForm.id);
+        let { hand_name, resign_name, hand_uid, resign_uid } = res.data;
+        this.ruleForm = {
+          resign_name,
+          hand_name,
+          hand_uid: hand_uid.split(","),
+          resign_uid: resign_uid.split(","),
+        };
+        console.log(this.ruleForm);
+        this.$emit("refreshList");
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
@@ -145,8 +149,10 @@ export default {
           this.$refs.ruleForm.resetFields();
           this.$refs.ruleForm.clearValidate();
           this.ruleForm = {
-            resign_name: [], //离职人
-            hand_name: [], //交接人
+            resign_name: "", //离职人
+            hand_name: "", //交接人
+            hand_uid: [],
+            resign_uid: [],
           };
         }
       });
@@ -200,11 +206,21 @@ export default {
     },
 
     handleResignName(e) {
-      this.ruleForm.resign_name.push(e.code);
+      if (e && e.id) {
+        this.ruleForm.resign_uid = [e.id];
+      } else {
+        this.ruleForm.resign_uid = [];
+      }
+      this.$refs.ruleForm.validateField("resign_uid");
     },
     handleHandoverName(e) {
-      console.log();
-      this.ruleForm.hand_name.push(e.code);
+      console.log(e);
+      if (e && e.id) {
+        this.ruleForm.hand_uid = [e.id];
+      } else {
+        this.ruleForm.hand_uid = [];
+      }
+      this.$refs.ruleForm.validateField("hand_uid");
     },
   },
 };

+ 238 - 0
src/views/interest/handover/components/editForm.vue

@@ -0,0 +1,238 @@
+<template>
+  <el-row :gutter="10" :loading="loading">
+    <el-col :span="24">
+      <el-form
+        ref="ruleForm"
+        :model="ruleForm"
+        status-icon
+        :rules="rules"
+        label-width="100px"
+        class="demo-ruleForm"
+      >
+        <el-form-item label="离职人" prop="resign_name">
+          <search-account
+            :value="ruleForm.resign_uid"
+            :size="searchSize"
+            :names="ruleForm.resign_name"
+            :is-detail="isDetail"
+            :disabled="!isDetail"
+            :placeholder="'离职人名称'"
+            @searchChange="handleResignName"
+          />
+        </el-form-item>
+        <el-form-item label="接受人" prop="hand_name">
+          <search-account
+            :value="ruleForm.hand_uid"
+            :size="searchSize"
+            :names="ruleForm.hand_name"
+            :is-detail="isDetail"
+            :disabled="!isDetail"
+            :placeholder="'接受人名称'"
+            @searchChange="handleHandoverName"
+          />
+        </el-form-item>
+        12{{ edit_form }}
+      </el-form>
+    </el-col>
+    <el-col :span="24" style="text-align: right">
+      <el-button v-if="isDetail" type="primary" @click="submitForm"
+        >保 存
+      </el-button>
+
+      <el-button v-if="isDetail" type="primary" @click="submitForm12"
+        >保 存 并 发 起 流 程
+      </el-button>
+      <el-button @click="closeAddEdit" v-if="isDetail">{{
+        isDetail ? "关 闭" : "取 消"
+      }}</el-button>
+    </el-col>
+  </el-row>
+</template>
+<script>
+import asyncRequest from "@/apis/service/interest/handover";
+import resToken from "@/mixins/resToken";
+export default {
+  name: "handover",
+  props: ["id", "isDetail", "showModelThis", "edit_form"],
+  mixins: [resToken],
+  data() {
+    return {
+      parmValue: "parmValue",
+      roleList: [],
+      loading: false,
+      showModelThis: this.showModel,
+      resign_name: "", //离职人
+      hand_name: "", //交接人
+      ruleForm: {
+        hand_uid: [],
+        resign_uid: [],
+      },
+      rulesThis: this.rules,
+      rules: {
+        resign_uid: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择离职人",
+            trigger: "change",
+          },
+        ],
+        hand_uid: [
+          {
+            type: "array",
+            required: true,
+            message: "请选择接受人",
+            trigger: "change",
+          },
+        ],
+      },
+    };
+  },
+  mounted() {
+    this.initForm();
+    console.log(this.ruleForm);
+    console.log(this.parmValue1);
+  },
+  // watch: {
+  //   parmValue: function (newV, oldV) {
+  //     console.log(newV);
+  //     console.log(oldV);
+  //   },
+  // },
+  methods: {
+    //   关闭弹窗,直接隐藏表单
+    closeAddEdit() {
+      this.isShowForm = false;
+      this.$emit("closeModel", false); //抛出一个事件,关闭弹窗
+    },
+
+    async initForm() {
+      this.loading = true;
+      // if (this.id === "add") {
+      //   // this.title = "添加离职交接";
+      //   this.rulesThis = this.rules;
+      //   await this.resetForm();
+      // } else {
+      //   if (this.isDetail) {
+      //     this.rulesThis = {};
+      //   }
+      //   await this.resetForm();
+      //   await this.initData();
+      // }
+      console.log("initform");
+      if (this.isDetail) {
+        this.rulesThis = {};
+      }
+      await this.resetForm();
+      await this.initData();
+      this.loading = false;
+    },
+    async initData() {
+      console.log(this.parmValue1);
+      const res = await asyncRequest.detail({ id: this.edit_form.id });
+      if (res && res.code === 0 && res.data) {
+        console.log(res);
+        let { hand_name, resign_name, hand_uid, resign_uid } = res.data;
+        this.ruleForm = {
+          resign_name,
+          hand_name,
+          hand_uid: hand_uid.split(","),
+          resign_uid: resign_uid.split(","),
+        };
+        console.log(this.ruleForm);
+        this.$emit("refreshList");
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.ruleForm = {
+            resign_name: "", //离职人
+            hand_name: "", //交接人
+            hand_uid: [],
+            resign_uid: [],
+          };
+        }
+      });
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        console.log(valid);
+        if (valid) {
+          let resign_name1 = this.ruleForm.resign_name;
+          let hand_name1 = this.ruleForm.hand_name;
+          if (resign_name1.toString() !== hand_name1.toString()) {
+            this.loading = true;
+            const model = {
+              id: this.id,
+              resign_uid: resign_name1.toString(),
+              hand_uid: hand_name1.toString(),
+            };
+            let res = {};
+            console.log(this.id);
+            if (this.id === "add") {
+              delete model["id"];
+              res = await asyncRequest.add(model);
+              console.log(res);
+            } else {
+              res = await asyncRequest.update(model);
+            }
+            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 {
+            console.log("12");
+
+            this.$message.error("离职人和接收人不能相同");
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+
+    handleResignName(e) {
+      if (e && e.id) {
+        this.ruleForm.resign_uid = [e.id];
+      } else {
+        this.ruleForm.resign_uid = [];
+      }
+      // this.$refs.ruleForm.validateField("resign_uid");
+    },
+    handleHandoverName(e) {
+      console.log(e);
+      if (e && e.id) {
+        this.ruleForm.hand_uid = [e.id];
+      } else {
+        this.ruleForm.hand_uid = [];
+      }
+      // this.$refs.ruleForm.validateField("hand_uid");
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.account {
+}
+</style>

+ 1 - 4
src/views/interest/handover/index.vue

@@ -366,12 +366,9 @@ export default {
         path: "newProcess",
         query: {
           id: e.id,
-          // resign_name: e.resign_name,
-          // handover_name: e.hand_name,
-          // sDetail: true,
+          
         },
       });
-      // this.openModal(e.id, true);
     },
     restSearch() {
       this.parmValue = {

+ 24 - 16
src/views/interest/newProcess/index.vue

@@ -4,21 +4,23 @@
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
       <!-- v-if="showModel" -->
-
-      <p>离职人详情</p>
-      <p>
-        id:{{ id }} handover_name:{{ handover_name }}resign_name:{{
-          resign_name
-        }}
-      </p>
-
+      <el-divider content-position="center">详情组件</el-divider>
       <div style="width: 500px">
         <add-edit-form
           :parmValue1="parmValue1"
           :show-model="showModel"
           :is-detail="!isDetail"
-          @closeModel="handClick"
-          @refresh="refresh"
+          @refreshList="searchList"
+        />
+        <!-- @closeModel="handClick" @closeModel="handClick" -->
+      </div>
+      <el-divider content-position="center">编辑组件</el-divider>
+      <div style="width: 500px">
+        <edit-form
+          :edit_form="edit_form"
+          :show-model="showModel"
+          :is-detail="!isDetail"
+          @refreshList="searchList"
         />
       </div>
     </div>
@@ -43,13 +45,15 @@ import asyncRequest from "@/apis/service/interest/newProcess";
 // import addEdit from "./addEdit";
 import { mapGetters } from "vuex";
 import addEditForm from "@/views/interest/handover/components/addEditForm.vue";
+import editForm from "@/views/interest/handover/components/editForm.vue";
 
 export default {
   name: "newProcess",
   mixins: [mixinPage, resToken],
   components: {
     // addEdit,
-    addEditForm,
+    addEditForm, //详情组件
+    editForm, //编辑组件
   },
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
@@ -77,16 +81,20 @@ export default {
         id: "",
         sDetail: "",
       },
+      edit_form: {
+        id: "",
+        hand_uid: "",
+        resign_uid: "",
+        is_hand: "",
+        resgin_date: "",
+      },
     };
   },
 
   mounted() {
-    let { resign_name, handover_name, id, sDetail } = this.$route.query;
-    this.parmValue1.resign_name = resign_name;
-    this.parmValue1.handover_name = handover_name;
+    let { id } = this.$route.query;
     this.parmValue1.id = id;
-    this.parmValue1.sDetail = sDetail;
-    console.log();
+    this.edit_form.id = id;
     this.searchList();
   },
 

+ 21 - 10
src/views/purchaseIn/storeGoods/index.vue

@@ -39,6 +39,7 @@
                   <search-stock
                     :placeholder="'仓库编码'"
                     :size="searchSize"
+                    :value="parmValue.wsmcode"
                     @searchChange="handleStock"
                   ></search-stock>
                 </el-col>
@@ -111,7 +112,7 @@
               powers.some((item) => item == '004') && scope.row.bstatus === '1'
             "
             effect="dark"
-            content="架"
+            content="架"
             placement="top"
           >
             <i
@@ -124,7 +125,7 @@
               powers.some((item) => item == '004') && scope.row.bstatus === '0'
             "
             effect="dark"
-            content="架"
+            content="架"
             placement="top"
           >
             <i
@@ -186,6 +187,7 @@ export default {
   },
   data() {
     return {
+      wsmcode: "",
       gys_code: "", //供应商编码
       product_code: "", //商品编码
       product_name: "", //商品名称
@@ -308,20 +310,21 @@ export default {
     };
   },
   mounted() {
-    this.searchList();
+    this.restSearch();
+    // this.searchList();
   },
 
   methods: {
     restSearch() {
       this.parmValue = {
         wsmcode: "", //仓库编码
-        type_code: "", //仓库属性code
         good_code: "", //商品编码
         good_name: "", //商品名称
         supplierNo: "", //供应商编码
         page: 1, // 页码
         size: 15, // 每页显示条数
       };
+      console.log(this.parmValue);
       this.searchList();
     },
 
@@ -370,10 +373,6 @@ export default {
         res.data.list.forEach((element) => {
           element.classArr = `${element.sort_f}/${element.sort_s}${element.sort_t}`;
         });
-
-        res.data.list.forEach((ele) => {
-          // ele.good_name.
-        });
         this.tableData = res.data.list;
         this.pageInfo.total = Number(res.data.count);
       } else if (res && res.code >= 100 && res.code <= 104) {
@@ -422,11 +421,23 @@ export default {
     },
     handleValue(e) {
       console.log(e);
-      this.parmValue.supplierNo = e.code;
+      if (e && e.id) {
+        this.parmValue.supplierNo = e.code;
+        console.log(this.parmValue);
+      } else {
+        this.parmValue.supplierNo = [];
+      }
+      // this.$refs.ruleForm.validateField("supplierNo");
     },
     handleStock(e) {
       console.log(e);
-      this.parmValue.wsmcode = e.code;
+      // this.parmValue.wsmcode = e.code;
+      if (e && e.id) {
+        this.parmValue.wsmcode = e.code;
+        console.log(this.parmValue);
+      } else {
+        this.parmValue.wsmcode = [];
+      }
     },
   },
 };