Просмотр исходного кода

Merge branch 'dev' of git.echepei.com:caojunjie/Smart_platform_ui into dev

caojunjie 3 лет назад
Родитель
Сommit
9c8e8edf1d
1 измененных файлов с 180 добавлено и 141 удалено
  1. 180 141
      src/views/basicData/customerInformation/detailsPageEdit.vue

+ 180 - 141
src/views/basicData/customerInformation/detailsPageEdit.vue

@@ -12,10 +12,18 @@
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <el-button type="primary" @click="synchronization" size="small" :disabled="!form.id"
-        >同 步
+        <el-button
+          type="primary"
+          @click="synchronization"
+          size="small"
+          :disabled="!form.id"
+          >同 步
         </el-button>
-        <el-button type="primary" @click="openFlow" size="small" :disabled="!form.id"
+        <el-button
+          type="primary"
+          @click="openFlow"
+          size="small"
+          :disabled="!form.id"
           >审 核
         </el-button>
         <el-button
@@ -202,8 +210,14 @@
             @row-update="rowUpdate"
             @row-del="rowDel"
           >
-            <template slot-scope="{type,size,row}" slot="menu">
-              <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户</el-button>
+            <template slot-scope="{ type, size, row }" slot="menu">
+              <el-button
+                icon="el-icon-check"
+                :size="size"
+                :type="type"
+                @click="creatingUsers(row)"
+                >创建用户</el-button
+              >
             </template>
           </avue-crud>
         </basic-container>
@@ -246,30 +260,34 @@
       <template slot="content"> </template>
     </flow-dialog>
     <el-dialog
-        title="同 步"
-        :visible.sync="dialogVisible"
-        append-to-body
-        width="60%">
+      title="同 步"
+      :visible.sync="dialogVisible"
+      append-to-body
+      width="60%"
+    >
       <avue-form ref="formData" v-model="formData" :option="option">
-
       </avue-form>
       <span slot="footer" class="dialog-footer">
-    <el-button @click="dialogVisible = false">取 消</el-button>
-    <el-button type="primary" @click="confirmSynchronization">确 定</el-button>
-  </span>
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="confirmSynchronization"
+          >确 定</el-button
+        >
+      </span>
     </el-dialog>
     <el-dialog
-        title="创建用户"
-        :visible.sync="dialogVisibleBt"
-        append-to-body
-        width="60%">
+      title="创建用户"
+      :visible.sync="dialogVisibleBt"
+      append-to-body
+      width="60%"
+    >
       <avue-form ref="formDataTwo" v-model="formDataTwo" :option="optionData">
-
       </avue-form>
       <span slot="footer" class="dialog-footer">
-    <el-button @click="dialogVisibleBt = false">取 消</el-button>
-    <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
-  </span>
+        <el-button @click="dialogVisibleBt = false">取 消</el-button>
+        <el-button type="primary" @click="confirmSynchronizationTwo"
+          >确 定</el-button
+        >
+      </span>
     </el-dialog>
   </div>
 </template>
@@ -286,7 +304,9 @@ import {
   corpsfiles,
   corpsitem,
   areaTypeTree,
-  corpsAddrDelete, synchronizationCopy,creatingUsers
+  corpsAddrDelete,
+  synchronizationCopy,
+  creatingUsers
 } from "@/api/basicData/customerInformation";
 import customerContact from "./configuration/customerContact.json";
 import advantageProject from "./configuration/advantageProject.json";
@@ -296,53 +316,59 @@ import { customerParameter } from "@/enums/management-type";
 import { gainUser } from "@/api/basicData/customerInquiry";
 import addressOption from "./configuration/addressOption.json";
 import website from "@/config/website";
-import {getRoleTree} from "@/api/system/role";
-import {getDeptTree} from "@/api/system/dept";
-import {getPostList} from "@/api/system/post";
+import { getRoleTree } from "@/api/system/role";
+import { getDeptTree } from "@/api/system/dept";
+import { getPostList } from "@/api/system/post";
 
 export default {
   name: "detailsPage",
   data() {
     return {
       userList: [],
-      formData:{},
-      formDataTwo:{},
-      optionData:{
-        span:8,
-        menuBtn:false,
-        column:[{
-          label: "所属角色",
-          prop: "roleId",
-          multiple: true,
-          type: "tree",
-          dicData: [],
-          props: {
-            label: "title"
+      formData: {},
+      formDataTwo: {},
+      optionData: {
+        span: 8,
+        menuBtn: false,
+        column: [
+          {
+            label: "所属角色",
+            prop: "roleId",
+            multiple: true,
+            type: "tree",
+            dicData: [],
+            props: {
+              label: "title"
+            },
+            checkStrictly: true,
+            slot: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择所属角色",
+                trigger: "click"
+              }
+            ]
           },
-          checkStrictly: true,
-          slot: true,
-          rules: [{
-            required: true,
-            message: "请选择所属角色",
-            trigger: "click"
-          }]
-        },{
-          label: "所属部门",
-          prop: "deptId",
-          type: "tree",
-          multiple: true,
-          dicData: [],
-          props: {
-            label: "title"
+          {
+            label: "所属部门",
+            prop: "deptId",
+            type: "tree",
+            multiple: true,
+            dicData: [],
+            props: {
+              label: "title"
+            },
+            checkStrictly: true,
+            slot: true,
+            rules: [
+              {
+                required: true,
+                message: "请选择所属部门",
+                trigger: "click"
+              }
+            ]
           },
-          checkStrictly: true,
-          slot: true,
-          rules: [{
-            required: true,
-            message: "请选择所属部门",
-            trigger: "click"
-          }]
-        },
           {
             label: "所属岗位",
             prop: "postId",
@@ -353,52 +379,58 @@ export default {
               label: "postName",
               value: "id"
             },
-            rules: [{
-              required: true,
-              message: "请选择所属岗位",
-              trigger: "click"
-            }],
-          }]
+            rules: [
+              {
+                required: true,
+                message: "请选择所属岗位",
+                trigger: "click"
+              }
+            ]
+          }
+        ]
       },
-      dialogVisibleBt:false,
-      dialogVisible:false,
-      option:{
-        span:12,
-        menuBtn:false,
-        column: [{
-          label: '客户类型',
-          prop: 'corpType',
-          type: 'select',
-          cascader: ['corpsTypeId'],
-          dicUrl: "/api/blade-system/dict-biz/dictionary?code=corp_type",
-          props: {
-            label: "dictValue",
-            value: "dictKey"
-          },
-          rules: [
-            {
-              required: true,
-              message: "请选择客户类型",
-              trigger: "blur"
-            }
-          ]
-        },{
-          label: '类别',
-          prop: 'corpsTypeId',
-          type: 'tree',
-          dicUrl: "/api/blade-client/corpstype/tree?&corpType={{key}}",
-          props: {
-            label: "title",
-            value: "value",
+      dialogVisibleBt: false,
+      dialogVisible: false,
+      option: {
+        span: 12,
+        menuBtn: false,
+        column: [
+          {
+            label: "客户类型",
+            prop: "corpType",
+            type: "select",
+            cascader: ["corpsTypeId"],
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=corp_type",
+            props: {
+              label: "dictValue",
+              value: "dictKey"
+            },
+            rules: [
+              {
+                required: true,
+                message: "请选择客户类型",
+                trigger: "blur"
+              }
+            ]
           },
-          rules: [
-            {
-              required: true,
-              message: "请选择类型",
-              trigger: "blur"
-            }
-          ]
-        }]
+          {
+            label: "类别",
+            prop: "corpsTypeId",
+            type: "tree",
+            dicUrl: "/api/blade-client/corpstype/tree?&corpType={{key}}",
+            props: {
+              label: "title",
+              value: "value"
+            },
+            rules: [
+              {
+                required: true,
+                message: "请选择类型",
+                trigger: "blur"
+              }
+            ]
+          }
+        ]
       },
       switchDialog: false,
       form: {},
@@ -784,7 +816,7 @@ export default {
       addressOption: addressOption,
       addressForm: {},
       addressData: [],
-      formRow:{},
+      formRow: {},
       // 包装要求
       packageOptions: []
     };
@@ -798,7 +830,7 @@ export default {
     flowDialog
   },
   created() {
-    this.initData(website.tenantId)
+    this.initData(website.tenantId);
     if (this.$store.getters.userInfo.tenant_id === "096359") {
       let list = ["profitReturn", "usedProfit", "surplusProfit", "monthProfit"];
       for (let item in list) {
@@ -837,7 +869,7 @@ export default {
         delete this.form.corpsAddrList;
       });
     } else if (this.detailData.treeDeptId) {
-      this.$set(this.form, 'corpsTypeId', this.detailData.treeDeptId)
+      this.$set(this.form, "corpsTypeId", this.detailData.treeDeptId);
     }
     gainUser().then(res => {
       this.userList = res.data.data;
@@ -859,37 +891,39 @@ export default {
       });
     },
     //确认创建用户
-    confirmSynchronizationTwo(){
-      this.$refs['formDataTwo'].validate((valid, done) => {
-        done()
+    confirmSynchronizationTwo() {
+      this.$refs["formDataTwo"].validate((valid, done) => {
+        done();
         if (valid) {
-          let data = JSON.parse(JSON.stringify(this.formDataTwo))
+          let data = JSON.parse(JSON.stringify(this.formDataTwo));
           data.deptId = data.deptId.join(",");
           data.roleId = data.roleId.join(",");
           data.postId = data.postId.join(",");
           creatingUsers({
             ...data,
-            id:this.formRow.id
-          }).then(res=>{
-            this.dialogVisibleBt = false
-            this.$message.success('创建用户成功,默认帐号:联系人名称。默认密码:123456');
-          })
+            id: this.formRow.id
+          }).then(res => {
+            this.dialogVisibleBt = false;
+            this.$message.success(
+              "创建用户成功,默认帐号:联系人名称。默认密码:123456"
+            );
+          });
         } else {
           return false;
         }
       });
     },
-    creatingUsers(row){
-      if (row.id){
-        if (row.tel){
-          this.dialogVisibleBt = true
-          this.formDataTwo = {}
-          this.formRow = row
-        }else {
-          this.$message.error('请输入手机号');
+    creatingUsers(row) {
+      if (row.id) {
+        if (row.tel) {
+          this.dialogVisibleBt = true;
+          this.formDataTwo = {};
+          this.formRow = row;
+        } else {
+          this.$message.error("请输入手机号");
         }
-      }else {
-        this.$message.error('请保存数据后再点击');
+      } else {
+        this.$message.error("请保存数据后再点击");
       }
     },
     //新增客户联系人保存触发
@@ -1060,7 +1094,12 @@ export default {
                 type: "success",
                 message: this.form.id ? "修改成功!" : "新增成功!"
               });
-              this.form = res.data.data
+              if (res.data.data.adminProfiles) {
+                res.data.data.adminProfiles = res.data.data.adminProfiles.split(
+                  ","
+                );
+              }
+              this.form = res.data.data;
               this.disabled = false;
             }
           });
@@ -1069,25 +1108,25 @@ export default {
         }
       });
     },
-    synchronization(){
-      this.dialogVisible = true
+    synchronization() {
+      this.dialogVisible = true;
     },
     //确认同步
-    confirmSynchronization(){
-      this.$refs['formData'].validate((valid, done) => {
-        if (valid){
+    confirmSynchronization() {
+      this.$refs["formData"].validate((valid, done) => {
+        if (valid) {
           synchronizationCopy({
             ...this.formData,
-            id:this.form.id
-          }).then(res=>{
-            done()
-            this.$message.success('同步成功');
-            this.dialogVisible = false
-          })
-        }else {
+            id: this.form.id
+          }).then(res => {
+            done();
+            this.$message.success("同步成功");
+            this.dialogVisible = false;
+          });
+        } else {
           return done();
         }
-      })
+      });
     },
     backToList() {
       this.$emit("goBack");