zhangjinxing 3 роки тому
батько
коміт
dcb53a5a9b

+ 2 - 2
src/App.vue

@@ -16,8 +16,8 @@ export default {
     };
   },
   async created() {
-    const res = await asyncRequest.list({type_code:"WSM8b49211013191450"});
-    console.log(res);
+    // const res = await asyncRequest.list({type_code:"WSM8b49211013191450"});
+    // console.log(res);
     // if (res && res.code === 0 && res.data) {
     //   this.tableData = res.data.list;
     //   this.pageInfo.total = Number(res.data.count);

+ 18 - 0
src/apis/service/interest/newProcess/index.js

@@ -0,0 +1,18 @@
+import http from '@/apis/axios'
+const api = 'admin/'
+export default {
+  // 离职交接列表
+  list: (data, params) => http(api + 'Resigninfolist', data, 'post', params),
+  // 获取交接详情
+  detail: (data, params) => http(api + 'Resigninfoselect', data, 'post', params),
+  // 更新
+  update: (data, params) => http(api + 'Resigninfoedit', data, 'post', params),
+  // 新建离职交接
+  add: (data, params) => http(api + 'Resigninfocreate', data, 'post', params),
+  //离职交接删除
+  delete: (data, params) => http(api + 'Resigninfodel', data, 'post', params),
+  // 离职交接状态
+  status: (data, params) => http(api + 'Resigninfostatu', data, 'post', params),
+  // 拉取角色列表
+  getRole: (data, params) => http(api + 'roleall', data, 'post', params)
+}

+ 1 - 1
src/components/ex-table/main.vue

@@ -338,7 +338,7 @@ export default {
       }
     },
     RowClick(e) {
-      this.$$emit("RowClick", e);
+      this.$emit("RowClick", e);
     },
     //行拖拽
     rowDrop() {

+ 7 - 27
src/views/interest/handover/addEdit.vue

@@ -14,9 +14,6 @@
     @close="closeModel"
   >
     <el-card style="margin-top: -20px">
-
-
-
       <el-row :gutter="10">
         <el-col :span="24">
           <el-form
@@ -27,14 +24,6 @@
             label-width="100px"
             class="demo-ruleForm"
           >
-            <!-- <el-form-item label="离职人部门" prop="leaves_part">
-              <all-organize
-                :placeholder="'请输入部门名称'"
-                :disabled="isDetail"
-                @searchChange="handleleaves"
-                :value="ruleForm.leaves_part"
-              />
-            </el-form-item> -->
             <el-form-item label="离职人" prop="resign_name">
               <search-account
                 :value="ruleForm.resign_name"
@@ -44,14 +33,6 @@
                 @searchChange="handleResignName"
               />
             </el-form-item>
-            <!-- <el-form-item label="接受人部门" prop="Handover_part">
-              <all-organize
-                :placeholder="'请输入部门名称'"
-                :disabled="isDetail"
-                @searchChange="handleHandover"
-                :value="ruleForm.Handover_part"
-              />
-            </el-form-item> -->
             <el-form-item label="接受人" prop="hand_name">
               <search-account
                 :value="ruleForm.hand_name"
@@ -72,7 +53,6 @@
           }}</el-button>
         </el-col>
       </el-row>
-      
     </el-card>
   </el-dialog>
 </template>
@@ -159,10 +139,10 @@ export default {
         await this.resetForm();
       } else {
         if (this.isDetail) {
-          this.title = "离职交接详情";
+          // this.title = "离职交接详情";
           this.rulesThis = {};
         } else {
-          this.title = "修改离职交接";
+          // this.title = "修改离职交接";
           this.rulesThis = this.rules;
         }
         await this.resetForm();
@@ -213,15 +193,15 @@ export default {
       });
     },
     async submitForm() {
-      console.log(this.resign_uid);
-      console.log(this.hand_uid);
-      console.log(this.ruleForm.leaves_part);
-      console.log(this.ruleForm.Handover_part);
+      // console.log(this.resign_uid);
+      // console.log(this.hand_uid);
+      // console.log(this.ruleForm.leaves_part);
+      // console.log(this.ruleForm.Handover_part);
 
       await this.$refs.ruleForm.validate(async (valid) => {
         if (valid) {
           this.loading = true;
-          const { name } = JSON.parse(JSON.stringify(this.ruleForm));
+          // const { name } = JSON.parse(JSON.stringify(this.ruleForm));
           const model = {
             id: this.id,
             resign_uid: this.ruleForm.resign_name,

+ 1 - 154
src/views/interest/handover/components/addEdit.vue

@@ -1,6 +1,5 @@
 <template>
   <el-dialog
-    v-loading="loading"
     :title="title"
     :center="true"
     align="left"
@@ -13,7 +12,7 @@
     element-loading-background="rgba(0, 0, 0, 0.8)"
     @close="closeModel"
   >
-    <el-card style="margin-top: -20px">
+    <el-card style="margin-top: -20px" v-loading="loading">
       <add-edit-form
         v-if="showModel"
         :id="id"
@@ -22,69 +21,21 @@
         @closeModel="handClick"
         @refresh="refresh"
       />
-      <!-- 123 showModel:{{ showModel }} + id:{{ id }} + isDetail:{{ isDetail }} -->
     </el-card>
   </el-dialog>
 </template>
 <script>
-// import AddEdit from "../../account/addEdit.vue";
 import addEditForm from "./addEditForm.vue";
 export default {
   name: "handover",
   props: ["showModel", "id", "isDetail"],
-  //   mixins: [resToken],
   components: {
     addEditForm,
-    // AddEdit,
   },
   data() {
     return {
-      //   roleList: [],
-      //   loading: false,
       title: "添加离职交接",
       showModelThis: this.showModel,
-      //   hand_uid: "", //接受人ID
-      //   resign_uid: "", //离职人ID
-      //   ruleForm: {
-      //     resign_name: "", //离职人
-      //     leaves_part: [], //离职人部门
-      //     hand_name: "", //交接人
-      //     Handover_part: [], //交接人部门
-      //   },
-      //   rulesThis: this.rules,
-      //   rules: {
-      //     leaves_part: [
-      //       {
-      //         type: "array",
-      //         required: true,
-      //         message: "请选择离职人部门",
-      //         trigger: "change",
-      //       },
-      //     ],
-
-      //     resign_name: [
-      //       {
-      //         required: true,
-      //         message: "请选择离职人",
-      //         trigger: "blur",
-      //       },
-      //     ],
-      //     Handover_part: [
-      //       {
-      //         type: "array",
-      //         message: "请选择接受人部门",
-      //         required: true,
-      //         trigger: "change",
-      //       },
-      //     ],
-      //     hand_name: [
-      //       {
-      //         required: true,
-      //         message: "请选择接受人",
-      //         trigger: "blur",
-      //       },
-      //     ],
-      //   },
     };
   },
   watch: {
@@ -117,7 +68,6 @@ export default {
           this.title = "离职交接详情";
           this.rulesThis = {};
         } else {
-          this.title = "修改离职交接";
           this.rulesThis = this.rules;
         }
         // await this.resetForm();
@@ -134,109 +84,6 @@ export default {
       this.showModelThis = e;
       this.$emit("refresh", true);
     },
-    // async initData() {
-    //   const res = await asyncRequest.detail({ id: this.id });
-    //   console.log(res);
-    //   if (res && res.code === 0 && res.data) {
-    //     let {
-    //       resign_name,
-    //       leaves_part,
-    //       hand_name,
-    //       Handover_part,
-    //       hand_uid,
-    //       resign_uid,
-    //     } = res.data;
-    //     this.ruleForm = {
-    //       resign_name,
-    //       leaves_part: leaves_part || [],
-    //       hand_name,
-    //       Handover_part: Handover_part || [],
-    //     };
-    //     this.hand_uid = hand_uid;
-    //     this.resign_uid = resign_uid;
-    //   } 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: "", //离职人
-    //         leaves_part: [], //离职人部门
-    //         hand_name: "", //交接人
-    //         Handover_part: [], //交接人部门
-    //       };
-    //     }
-    //   });
-    // },
-    //     async submitForm() {
-    //       console.log(this.resign_uid);
-    //       console.log(this.hand_uid);
-    //       console.log(this.ruleForm.leaves_part);
-    //       console.log(this.ruleForm.Handover_part);
-
-    //       await this.$refs.ruleForm.validate(async (valid) => {
-    //         if (valid) {
-    //           this.loading = true;
-    //           const { name } = JSON.parse(JSON.stringify(this.ruleForm));
-    //           const model = {
-    //             id: this.id,
-    //             resign_uid: this.ruleForm.resign_name,
-    //             hand_uid: this.ruleForm.hand_name,
-    //             leaves_part: this.ruleForm.leaves_part,
-    //             Handover_part: this.ruleForm.Handover_part,
-    //           };
-    //           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");
-    //           } else if (res && res.code >= 100 && res.code <= 104) {
-    //             await this.logout();
-    //           } else {
-    //             this.$message.warning(res.message);
-    //           }
-    //         } else {
-    //           console.log("error submit!!");
-    //           return false;
-    //         }
-    //       });
-    //     },
-    //     handleleaves(e) {
-    //       console.log(e);
-    //       this.ruleForm.leaves_part = e;
-    //     },
-    //     handleHandover(e) {
-    //       this.ruleForm.Handover_part = e;
-    //     },
-    //     handleResignName(e) {
-    //       this.ruleForm.resign_name = e.code;
-    //       console.log(e);
-    //     },
-    //     handleHandoverName(e) {
-    //       this.ruleForm.hand_name = e.code;
-    //       console.log(e);
-    //     },
   },
 };
 </script>

+ 56 - 78
src/views/interest/handover/components/addEditForm.vue

@@ -1,6 +1,5 @@
 <template>
-  <el-row :gutter="10">
-    <!-- v-if="isShowForm" -->
+  <el-row :gutter="10" :loading="loading">
     <el-col :span="24">
       <el-form
         ref="ruleForm"
@@ -12,8 +11,9 @@
       >
         <el-form-item label="离职人" prop="resign_name">
           <search-account
-            :value="ruleForm.resign_name"
+            :value="ruleForm.id"
             :size="searchSize"
+            :names="ruleForm.resign_name[0]"
             :disabled="isDetail"
             :placeholder="'离职人名称'"
             @searchChange="handleResignName"
@@ -21,18 +21,16 @@
         </el-form-item>
         <el-form-item label="接受人" prop="hand_name">
           <search-account
-            :value="ruleForm.hand_name"
+            :value="ruleForm.id"
             :size="searchSize"
+            :names="ruleForm.hand_name[0]"
             :disabled="isDetail"
             :placeholder="'接受人名称'"
             @searchChange="handleHandoverName"
           />
         </el-form-item>
       </el-form>
-      123 showModel:{{ showModel }} + id:{{ id }} + isDetail:{{
-        isDetail
-      }}
-      showModelThis:{{ showModelThis }}
+      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"
@@ -48,35 +46,22 @@
 import asyncRequest from "@/apis/service/interest/handover";
 import resToken from "@/mixins/resToken";
 export default {
-  name: "Account",
-  props: ["id", "isDetail", "showModelThis"],
+  name: "handover",
+  props: ["id", "isDetail", "showModelThis", "parmValue1"],
   mixins: [resToken],
   data() {
     return {
-      isShowForm: true, //控制表格显示隐藏
+      parmValue: "parmValue",
       roleList: [],
       loading: false,
-      //   title: "添加离职交接",
       showModelThis: this.showModel,
-      //   hand_uid: "", //接受人ID
-      //   resign_uid: "", //离职人ID
       ruleForm: {
         resign_name: [], //离职人
-        // leaves_part: [], //离职人部门
         hand_name: [], //交接人
-        // Handover_part: [], //交接人部门
+        id: [],
       },
       rulesThis: this.rules,
       rules: {
-        // leaves_part: [
-        //   {
-        //     type: "array",
-        //     required: true,
-        //     message: "请选择离职人部门",
-        //     trigger: "change",
-        //   },
-        // ],
-
         resign_name: [
           {
             type: "array",
@@ -85,14 +70,6 @@ export default {
             trigger: "change",
           },
         ],
-        // Handover_part: [
-        //   {
-        //     type: "array",
-        //     message: "请选择接受人部门",
-        //     required: true,
-        //     trigger: "change",
-        //   },
-        // ],
         hand_name: [
           {
             type: "array",
@@ -104,24 +81,17 @@ export default {
       },
     };
   },
-  //   watch: {
-  //     showModel: function (val) {
-  //       this.showModelThis = val;
-  //       if (val) {
-  //         console.log("初始化");
-  //         this.initForm();
-  //       }
-  //     },
-  //     showModelThis(val) {
-  //       if (!val) {
-  //         this.$emit("cancel");
-  //       }
-  //     },
-  //   },
-  // created
   mounted() {
     this.initForm();
+    console.log(this.ruleForm);
+    console.log(this.parmValue1);
   },
+  // watch: {
+  //   parmValue: function (newV, oldV) {
+  //     console.log(newV);
+  //     console.log(oldV);
+  //   },
+  // },
   methods: {
     //   关闭弹窗,直接隐藏表单
     closeAddEdit() {
@@ -131,30 +101,37 @@ export default {
 
     async initForm() {
       this.loading = true;
-      // console.log(this.id);add
-      if (this.id === "add") {
-        this.title = "添加离职交接";
-        this.rulesThis = this.rules;
-        await this.resetForm();
-      } else {
-        if (this.isDetail) {
-          //   this.title = "离职交接详情";
-          this.rulesThis = {};
-        }
-        await this.resetForm();
-        await this.initData();
+      // 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() {
-      const res = await asyncRequest.detail({ id: this.id });
+      console.log(this.parmValue1);
+      const res = await asyncRequest.detail({ id: this.parmValue1.id });
       if (res && res.code === 0 && res.data) {
         console.log(res);
-        let { hand_name, resign_name } = res.data;
-        console.log(hand_name + "12" + resign_name);
+        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);
       } else if (res && res.code >= 100 && res.code <= 104) {
         await this.logout();
       } else {
@@ -175,17 +152,16 @@ export default {
       });
     },
     async submitForm() {
-      let resign_name = this.ruleForm.resign_name;
-      let hand_name = this.ruleForm.hand_name;
-      if (resign_name != "" && resign_name !== hand_name) {
-        await this.$refs.ruleForm.validate(async (valid) => {
-          if (valid) {
+      await this.$refs.ruleForm.validate(async (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;
-            console.log();
             const model = {
               id: this.id,
-              resign_uid: this.ruleForm.resign_name.toString(),
-              hand_uid: this.ruleForm.hand_name.toString(),
+              resign_uid: resign_name1.toString(),
+              hand_uid: hand_name1.toString(),
             };
             let res = {};
             console.log(this.id);
@@ -212,13 +188,15 @@ export default {
               this.$message.warning(res.message);
             }
           } else {
-            console.log("error submit!!");
-            return false;
+            console.log("12");
+
+            this.$message.error("离职人和接收人不能相同");
           }
-        });
-      } else {
-        this.$message.error("离职人和接收人不能相同");
-      }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
     },
 
     handleResignName(e) {

+ 26 - 12
src/views/interest/handover/index.vue

@@ -13,6 +13,7 @@
         :columns="columns"
         :page="pageInfo"
         :size="size"
+        @RowClick="RowClick"
         @page-curr-change="handlePageChange"
         @page-size-change="handleSizeChange"
         @screen-reset="
@@ -83,7 +84,6 @@
                   style="width: 66px; float: right"
                   v-if="powers.some((item) => item == '003')"
                 >
-                  <!--  -->
                   <el-button
                     :size="searchSize"
                     type="success"
@@ -143,7 +143,7 @@
             "
           ></el-tag>
         </template>
-        <template #operation="{ scope }">
+        <!-- <template #operation="{ scope }">
           <el-tooltip
             v-if="powers.some((item) => item == '007')"
             effect="dark"
@@ -203,7 +203,7 @@
               @click="deleteItem(scope.row.id)"
             ></i>
           </el-tooltip>
-        </template>
+        </template> -->
       </ex-table>
       <add-edit
         :id="modelId"
@@ -344,14 +344,14 @@ export default {
           sortable: true,
           width: "140",
         },
-        {
-          prop: "",
-          label: "操作",
-          fixed: "right",
-          _noset_: true,
-          _slot_: "operation",
-          width: "150px",
-        },
+        // {
+        //   prop: "",
+        //   label: "操作",
+        //   fixed: "right",
+        //   _noset_: true,
+        //   _slot_: "operation",
+        //   width: "150px",
+        // },
       ],
     };
   },
@@ -359,6 +359,20 @@ export default {
     this.searchList();
   },
   methods: {
+    // 表格行选中的方法
+    RowClick(e) {
+      console.log(e);
+      this.$router.push({
+        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 = {
         startTime: "",
@@ -416,7 +430,7 @@ export default {
     },
     // 获取离职交接列表
     async searchList() {
-      console.log(this.parmValue);
+      // console.log(this.parmValue);
       this.loading = true;
       const res = await asyncRequest.list(this.parmValue);
       if (res && res.code === 0 && res.data) {

+ 362 - 0
src/views/interest/newProcess/addEdit.vue

@@ -0,0 +1,362 @@
+<template>
+  <el-dialog
+    :title="title"
+    :center="true"
+    align="left"
+    top="5vh"
+    width="1040px"
+    @close="closeModel"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    v-loading="loading"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+  >
+    <el-card>
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            ref="ruleForm"
+            label-width="110px"
+            class="demo-ruleForm"
+          >
+            <el-form-item
+              label="登录名"
+              prop="loginName"
+              v-if="id === 'add' || isDetail"
+            >
+              <el-input
+                v-model="ruleForm.loginName"
+                :disabled="isDetail"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="姓名" prop="fullName">
+              <el-input
+                v-model="ruleForm.fullName"
+                :disabled="isDetail"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="手机号" prop="tel">
+              <el-input v-model="ruleForm.tel" :disabled="isDetail"></el-input>
+            </el-form-item>
+            <el-form-item label="密码" prop="password" v-if="id === 'add'">
+              <el-input
+                type="password"
+                placeholder="密码"
+                :maxlength="20"
+                v-model="ruleForm.password"
+              ></el-input>
+            </el-form-item>
+            <el-form-item label="确认密码" prop="password2" v-if="id === 'add'">
+              <el-input
+                type="password"
+                placeholder="再次输入密码"
+                :maxlength="20"
+                v-model="ruleForm.password2"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+        </el-col>
+        <el-col :span="24" style="text-align: right;">
+          <el-button type="primary" @click="submitForm" v-if="!isDetail"
+            >保 存
+          </el-button>
+          <el-button @click="showModelThis = false">{{ isDetail ? "关 闭" : "取 消" }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+   </template>
+   <script>
+   import asyncRequest from "@/apis/service/interest/newProcess";
+   import resToken from "@/mixins/resToken";
+   import {
+    isnumber,
+    isMobile,
+    validEmail,
+    isAlphanumeric,
+    isChinese,
+    isEmoticon,
+    validAlphabets,
+  } from "@/utils/validate";
+   export default {
+    name: 'newProcess',
+    props: ["showModel", "id", "isDetail","sitem"],
+    mixins: [resToken],
+    data() {
+      const validateusername = (rule, value, callback) => {
+        if (value === "") {
+          callback(new Error("账号不能为空!"));
+        } else {
+          if (value.length < 6 || value.length > 18) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else {
+            if (isnumber(value)) {
+              callback(new Error("账号规则为6~18位数字与字母组合!"));
+            } else if (validAlphabets(value)) {
+              callback(new Error("账号规则为6~18位数字与字母组合!"));
+            } else if (!isAlphanumeric(value)) {
+              callback(new Error("账号规则为6~18位数字与字母组合!"));
+            } else {
+              callback();
+            }
+          }
+        }
+      };
+      const validatename = (rule, value, callback) => {
+        if (value === "") {
+          callback(new Error("真实姓名不能为空!"));
+        } else {
+          if (value.length < 2 || value.length > 12) {
+            callback(new Error("真实姓名规则为2~12位汉字!"));
+          } else {
+            if (!isChinese(value)) {
+              console.log(9999);
+              callback(new Error("真实姓名规则为2~12位汉字!"));
+            } else if (isEmoticon(value)) {
+              console.log(2345);
+              callback(new Error("真实姓名规则为2~12位汉字!"));
+            } else {
+              callback();
+            }
+          }
+        }
+      };
+      const validatemobile = (rule, value, callback) => {
+        if (value === "") {
+          callback(new Error("手机号不能为空!"));
+        } else {
+          if (!isMobile(value)) {
+            callback(new Error("手机号格式不正确!"));
+          } else {
+            callback();
+          }
+        }
+      };
+  
+      const validateEmail = (rule, value, callback) => {
+        if (value === "") {
+          callback();
+        } else {
+          if (!validEmail(value)) {
+            callback(new Error("邮箱格式不正确!"));
+          } else {
+            callback();
+          }
+        }
+      };
+      return {
+        loading: false,
+        title: "添加账号",
+        showModelThis: this.showModel,
+        ruleForm: {
+          username: "", // 账号
+          name: "", // 真实姓名
+          mobile: "",
+          email: "",
+          role_id: "",
+          status: "1",
+          item: [],
+        },
+        rulesThis: this.rules,
+        rules: {
+          name: [
+            {
+              required: true,
+              validator: validatename,
+              trigger: "blur",
+            },
+          ],
+          username: [
+            {
+              required: true,
+              validator: validateusername,
+              trigger: "blur",
+            },
+          ],
+          mobile: [
+            {
+              required: true,
+              validator: validatemobile,
+              trigger: "blur",
+            },
+          ],
+          email: [
+            {
+              required: false,
+              validator: validateEmail,
+              trigger: "blur",
+            },
+          ],
+          role_id: [
+            {
+              required: true,
+              message: "请选择角色",
+              trigger: "change",
+            },
+          ],
+          item: [
+            {
+              type: "array",
+              required: true,
+              message: "请选择所在部门",
+              trigger: "change",
+            },
+          ],
+          status: [
+            {
+              required: true,
+              message: "请选择状态",
+              trigger: "change",
+            },
+          ],
+        }
+      };
+    },
+    watch: {
+      showModel: function(val) {
+        this.showModelThis = val;
+        if (val) {
+          this.initForm();
+        }
+      },
+      showModelThis(val) {
+        if (!val) {
+          this.$emit("cancel");
+        }
+      }
+    },
+    methods: {
+      closeModel() {
+        console.log("closeModel!!");
+      },
+      async initForm() {
+        this.loading = true;
+        // await this.getRole();
+        if (this.id === "add") {
+          this.title = "添加账号";
+          this.rulesThis = this.rules;
+          await this.resetForm();
+        } else {
+          if (this.isDetail) {
+            this.title = "账号详情";
+            this.rulesThis = {};
+          } else {
+            this.title = "修改账号";
+            this.rulesThis = this.rules;
+          }
+          await this.resetForm(this.sitem);
+          // await this.initData()
+        }
+        this.loading = false;
+      },
+      // async getRole() {
+      //   const model = {
+      //     status: "", // 状态
+      //     level: "", // 姓名
+      //     role_name: "",
+      //   };
+      //   const res = await asyncRequest.getRole(model);
+      //   if (res && res.code === 0 && res.data) {
+      //     this.roleList = res.data;
+      //     this.roleList.map((v1) => {
+      //       v1.id += "";
+      //       v1.status += "";
+      //       return v1;
+      //     });
+      //   }
+      // },
+      async initData() {
+        const res = await asyncRequest.detail({ id: this.id });
+      if (res && res.code === 0 && res.data) {
+        this.ruleForm = res.data;
+        this.ruleForm.role_id = this.ruleForm.role;
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+      },
+      async resetForm(sitem) {
+        // 重置
+        await this.$nextTick(() => {
+          if (this.$refs.ruleForm) {
+            this.$refs.ruleForm.resetFields();
+            this.$refs.ruleForm.clearValidate();
+            const { username, nickname, mobile, email, roleid, status, item } =
+              sitem;
+            this.ruleForm = {
+              username: username || "", // 账号
+              name: nickname || "", // 真实姓名
+              mobile: mobile || "",
+              email: email || "",
+              role_id: roleid || "",
+              status: status || "",
+              item: item || [],
+            };
+            if (this.id === "add" || this.isDetail) {
+              this.rules.username[0].required = false;
+            }
+          }
+        });
+      },
+    
+      async submitForm() {
+        await this.$refs.ruleForm.validate(async (valid) => {
+          if (valid) {
+            this.loading = true;
+            const { username, name, mobile, email, role_id, status } = JSON.parse(
+              JSON.stringify(this.ruleForm)
+            );
+            const model = {
+              id: this.id,
+              username: username || "", // 账号
+              nickname: name || "", // 真实姓名
+              mobile: mobile || "",
+              email: email || "",
+              role: role_id || "",
+              status: status || "",
+            };
+            let res = {};
+            if (this.id === "add") {
+              delete model["id"];
+              res = await asyncRequest.add(model);
+            } 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");
+            } else if (res && res.code >= 100 && res.code <= 104) {
+              await this.logout();
+            } else {
+              this.$message.warning(res.message);
+            }
+          } else {
+            console.log("error submit!!");
+            return false;
+          }
+        });
+      },
+    },
+ 
+  };
+  </script>
+
+   <style lang="scss" scoped>
+   .newProcess {
+    
+   }
+   </style>
+   

+ 186 - 0
src/views/interest/newProcess/index.vue

@@ -0,0 +1,186 @@
+<template>
+  <div class="newProcess pagePadding">
+    <div
+      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>
+
+      <div style="width: 500px">
+        <add-edit-form
+          :parmValue1="parmValue1"
+          :show-model="showModel"
+          :is-detail="!isDetail"
+          @closeModel="handClick"
+          @refresh="refresh"
+        />
+      </div>
+    </div>
+    <div v-else>
+      <no-auth></no-auth>
+    </div>
+
+    <add-edit
+      :showModel="showModel"
+      :id="modelId"
+      :isDetail="isDetail"
+      @refresh="searchList"
+      @cancel="showModel = false"
+    ></add-edit>
+  </div>
+</template>
+   <script>
+import mixinPage from "@/mixins/elPaginationHandle";
+import resToken from "@/mixins/resToken";
+// import statusList from "@/assets/js/statusList";
+import asyncRequest from "@/apis/service/interest/newProcess";
+// import addEdit from "./addEdit";
+import { mapGetters } from "vuex";
+import addEditForm from "@/views/interest/handover/components/addEditForm.vue";
+
+export default {
+  name: "newProcess",
+  mixins: [mixinPage, resToken],
+  components: {
+    // addEdit,
+    addEditForm,
+  },
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "newProcess"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  mounted() {
+    console.log("123");
+    console.log(this.$route);
+  },
+  data() {
+    return {
+      parmValue1: {
+        resign_name: "",
+        handover_name: "",
+        id: "",
+        sDetail: "",
+      },
+    };
+  },
+
+  mounted() {
+    let { resign_name, handover_name, id, sDetail } = this.$route.query;
+    this.parmValue1.resign_name = resign_name;
+    this.parmValue1.handover_name = handover_name;
+    this.parmValue1.id = id;
+    this.parmValue1.sDetail = sDetail;
+    console.log();
+    this.searchList();
+  },
+
+  methods: {
+    restSearch() {
+      this.parmValue = {};
+      this.searchList();
+    },
+
+    openModal(id, isDetail, sitem) {
+      this.showModel = true;
+      this.modelId = id;
+      this.isDetail = isDetail;
+      this.sitem = sitem;
+    },
+    async deleteById(id, status) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        // this.tableData = res.data.list;
+        // this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+
+    // async statusConfirm(id, status) {
+    //   let str = status === "1" ? "禁用" : "启用";
+    //   await this.$confirm("确定要改为" + str + "?", {
+    //     confirmButtonText: "确定",
+    //     cancelButtonText: "取消",
+    //     type: "warning",
+    //   })
+    //     .then(async () => {
+    //       this.loading = true;
+    //       const model = {
+    //         id: id,
+    //         status: status === "1" ? "0" : "1",
+    //       };
+    //       const res = await asyncRequest.status(model);
+    //       if (res && res.code === 0) {
+    //         this.loading = false;
+    //         this.$notify.success({
+    //           title: "状态修改成功!",
+    //           message: "",
+    //         });
+    //         await this.searchList();
+    //       } else if (res && res.code >= 100 && res.code <= 104) {
+    //         await this.logout();
+    //       } else {
+    //         this.$message.warning(res.message);
+    //       }
+    //     })
+    //     .catch(() => {
+    //       console.log("取消");
+    //     });
+    // },
+  },
+};
+</script>
+   <style lang="scss" scoped>
+.newProcess {
+}
+</style>
+