Bläddra i källkod

客户管理-科室信息、负责人信息:新增时自动带出客户名称;新增修改完成时刷新列表;业务员名称赋值

DongZ 1 år sedan
förälder
incheckning
3b1941991a

+ 14 - 29
src/views/business/spd/cm/customers/index.vue

@@ -130,7 +130,7 @@
           <!-- <el-table-column label="负责部门" align="center" prop="responsibleDeptName" min-width="80" /> -->
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180px" fixed="right">
             <template slot-scope="scope">
-              <el-button size="mini" type="text" icon="el-icon-search" @click="handleCheck(scope.row)">查看</el-button>
+              <el-button size="mini" type="text" icon="el-icon-search" @click="handleCheck(scope.row.id)">查看</el-button>
               <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
               <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
             </template>
@@ -302,7 +302,7 @@
                 <el-row :gutter="20">
                   <el-col :span="6">
                     <el-form-item label="创建人" prop="createBy">
-                      <el-input v-model="form.createBy" :disabled="true" />
+                      <el-input v-model="form.createByName" :disabled="true" />
                     </el-form-item>
                   </el-col>
                   <el-col :span="6">
@@ -312,7 +312,7 @@
                   </el-col>
                   <el-col :span="6">
                     <el-form-item label="修改人" prop="updateBy">
-                      <el-input v-model="form.updateBy" :disabled="true" />
+                      <el-input v-model="form.updateByName" :disabled="true" />
                     </el-form-item>
                   </el-col>
                   <el-col :span="6">
@@ -470,11 +470,11 @@
       </div>
     </div>
 
-    <AddPerson v-model="isAdd1" v-if="isAdd1" :pageStu="page" :disable="disable" :row="rowDetail" :customersId="form.id"
-      @refresh="searchList" />
+    <AddPerson v-model="isAdd1" v-if="isAdd1" :pageStu="page" :disable="disable" :row="rowDetail"
+      :customersId="form.id" :customersName="form.name" />
 
     <AddDepartment v-model="isAdd2" v-if="isAdd2" :pageStu="page" :disable="disable" :row="rowDetail"
-      :customersId="form.id" @refresh="searchList" />
+      :customersId="form.id" :customersName="form.name" />
   </div>
 </template>
 
@@ -544,8 +544,6 @@
         mkCmCustomersResponsiblePersonList: [],
         // 客户科室表格数据
         mkCmCustomersDepartmentList: [],
-        // 弹出层标题
-        title: "",
         // 首次进入标签页的显示
         activeName: 'first',
         // 下拉收起配置
@@ -688,8 +686,10 @@
           detailedAddress: null,
           createBy: null,
           createTime: null,
+          createByName: null,
           updateBy: null,
           updateTime: null,
+          updateByName: null,
           delFlag: null
         };
         this.activeName = 'first';
@@ -717,20 +717,16 @@
       handleAdd() {
         this.isList = false;
         this.openState = 'add';
-        this.title = "添加客户";
       },
       /** 查看按钮操作 */
-      handleCheck(row) {
+      handleCheck(id) {
         this.isList = false;
-        this.reset();
-        const id = row.id || this.ids
-        getCustomers(id).then(response => {
+        const id1 = id || this.ids
+        getCustomers(id1).then(response => {
           this.form = response.data;
           this.mkCmCustomersResponsiblePersonList = response.data.mkCmCustomersResponsiblePersonList;
           this.mkCmCustomersDepartmentList = response.data.mkCmCustomersDepartmentList;
           this.openState = 'check';
-          this.title = "查看客户";
-          console.log(response, 'response');
         });
         getContactInfo().then(response => {
           this.mkCmCustomersContactList = response.data;
@@ -760,7 +756,6 @@
           this.mkCmCustomersResponsiblePersonList = response.data.mkCmCustomersResponsiblePersonList;
           this.mkCmCustomersDepartmentList = response.data.mkCmCustomersDepartmentList;
           this.openState = 'update';
-          this.title = "修改客户";
         });
       },
       /** Add修改按钮操作 */
@@ -780,21 +775,19 @@
       /** 提交按钮 */
       submitForm() {
         this.$refs["form"].validate(valid => {
-          console.log(this.isList, 'this.isList');
           if (valid) {
             if (this.form.id != null) {
               updateCustomers(this.form).then(response => {
                 this.$modal.msgSuccess("修改成功");
-                this.getList();
-                this.isList = true;
               });
             } else {
               addCustomers(this.form).then(response => {
                 this.$modal.msgSuccess("新增成功");
-                this.getList();
-                this.isList = true;
               });
             }
+            this.reset();
+            this.getList();
+            this.isList = true;
           }
         });
       },
@@ -921,14 +914,6 @@
           })
           .catch(_ => {});
       },
-      searchList() {
-        console.og('1111')
-        getCustomers(this.form.id).then(res => {
-          this.form = res.data;
-          this.mkCmCustomersResponsiblePersonList = res.data.mkCmCustomersResponsiblePersonList;
-          this.mkCmCustomersDepartmentList = res.data.mkCmCustomersDepartmentList;
-        })
-      },
     }
   };
 

+ 35 - 9
src/views/business/spd/cm/customersDepartment/index.vue

@@ -10,7 +10,7 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="客户名称" prop="customersName">
-            <el-input v-model="form.customersName" placeholder="请输入客户名称" :disabled="disable" clearable />
+            <el-input v-model="form.customersName" :disabled="true" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -45,8 +45,8 @@
           </el-form-item>
         </el-col>
         <el-col :span="6">
-          <el-form-item label="业务员名称" prop="salesmanName">
-            <el-input v-model="form.salesmanName" placeholder="请输入业务员名称" disabled />
+          <el-form-item label="业务员名称" prop="createByName">
+            <el-input v-model="form.createByName" disabled />
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -76,7 +76,7 @@
 
   export default {
     name: "CustomersDepartment",
-    props: ['pageStu', 'row', 'disable', 'customersId'],
+    props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
     model: {
       prop: 'isAdd2',
       event: 'jugislist'
@@ -107,15 +107,13 @@
         form: {
           id: null,
           name: null,
-          customersName: null,
+          customersName: this.customersName,
           responsiblePerson: null,
           responsiblePersonName: null,
           phone: null,
           address: null,
           conventionalTherapy: null,
           characteristic: null,
-          salesman: null,
-          salesmanName: null,
           marketingArea: null,
           marketingAreaName: null,
           memo: null,
@@ -149,8 +147,36 @@
     methods: {
       // 取消按钮
       cancel() {
+        this.reset();
         this.$emit('jugislist', false);
       },
+      reset() {
+        this.form = {
+          id: null,
+          name: null,
+          customersName: this.customersName,
+          responsiblePerson: null,
+          responsiblePersonName: null,
+          phone: null,
+          address: null,
+          conventionalTherapy: null,
+          characteristic: null,
+          marketingArea: null,
+          marketingAreaName: null,
+          memo: null,
+          state: null,
+          tenantId: null,
+          revision: null,
+          createBy: null,
+          createTime: null,
+          createByName: null,
+          updateBy: null,
+          updateTime: null,
+          updateByName: null,
+          delFlag: null
+        };
+        this.resetForm("form");
+      },
       /** 提交按钮 */
       submitForm() {
         this.$refs["form"].validate(valid => {
@@ -158,14 +184,14 @@
             if (this.form.id != null) {
               updateCustomersDepartment(this.form).then(response => {
                 this.$modal.msgSuccess("修改成功");
-                this.cancel();
               });
             } else {
               addCustomersDepartment(this.form).then(response => {
                 this.$modal.msgSuccess("新增成功");
-                this.cancel();
               });
             }
+            this.cancel();
+            this.$parent.handleCheck(this.form.customersId);
           }
         });
       },

+ 27 - 6
src/views/business/spd/cm/customersResponsiblePerson/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div id="CustomersResponsiblePerson" class="app-container">
-    <el-form :model="form" :rules="rules" ref="form" label-width="auto">
+    <el-form ref="form" :model="form" :rules="rules" label-width="auto">
       <el-divider content-position="left">负责人信息</el-divider>
       <el-row type="flex" class="row-bg" justify="space-around">
         <el-col :span="6">
@@ -12,7 +12,7 @@
         </el-col>
         <el-col :span="6">
           <el-form-item label="客户名称" prop="customersName">
-            <el-input v-model="form.customersName" placeholder="请输入客户名称" clearable :disabled="disable" />
+            <el-input v-model="form.customersName" :disabled="true" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
@@ -67,7 +67,7 @@
 
   export default {
     name: "CustomersResponsiblePerson",
-    props: ['pageStu', 'row', 'disable', 'customersId'],
+    props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
     model: {
       prop: 'isAdd1',
       event: 'jugislist'
@@ -100,7 +100,7 @@
           id: null,
           person: null,
           personName: null,
-          customersName: null,
+          customersName: this.customersName,
           relationshipType: null,
           productionLine: null,
           startDate: null,
@@ -144,8 +144,29 @@
     methods: {
       // 取消按钮
       cancel() {
+        this.reset();
         this.$emit('jugislist', false);
       },
+      reset() {
+        form = {
+          id: null,
+          person: null,
+          personName: null,
+          customersName: this.customersName,
+          relationshipType: null,
+          productionLine: null,
+          startDate: null,
+          endDate: null,
+          tenantId: null,
+          revision: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          delFlag: null
+        };
+        this.resetForm("form");
+      },
       /** 提交按钮 */
       submitForm() {
         this.$refs["form"].validate(valid => {
@@ -153,14 +174,14 @@
             if (this.form.id != null) {
               updateCustomersResponsiblePerson(this.form).then(response => {
                 this.$modal.msgSuccess("修改成功");
-                this.cancel();
               });
             } else {
               addCustomersResponsiblePerson(this.form).then(response => {
                 this.$modal.msgSuccess("新增成功");
-                this.cancel();
               });
             }
+            this.cancel();
+            this.$parent.handleCheck(this.form.customersId);
           }
         });
       },