Prechádzať zdrojové kódy

客户管理-在联系人页签添加时自动带出所属客户为当前客户;增加页面的初始化方法。

DongZ 1 rok pred
rodič
commit
d12cdaeb39

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

@@ -529,7 +529,7 @@
       </div>
     </div>
     <AddContact v-model="isAdd0" v-if="isAdd0" :operatingState="operatingSta" :state="state" :row="rowDetail" :customersId="form.id"
-      :customersName="form.name" />
+      :customersName="form.name" :customersCode="form.code" />
 
     <AddPerson v-model="isAdd1" v-if="isAdd1" :pageStu="page" :disable="disable" :row="rowDetail" :customersId="form.id"
       :customersName="form.name" />

+ 56 - 50
src/views/business/spd/cm/customersContact/index.vue

@@ -32,7 +32,7 @@
             <dr-popover-select v-model="form.customerName" title="客户" type="CUSTOMER_PARAM_ZT" :dataMapping="{
                   customer: 'id',
                   customerName: 'name',
-                }" :source.sync="form">
+                }" :source.sync="form" :disabled="true">
             </dr-popover-select>
           </el-form-item>
         </el-col>
@@ -239,7 +239,7 @@
 
   export default {
     name: "CustomersContact",
-    props: ['operatingState', 'row', 'disable', 'state', 'customersId', 'customersName'],
+    props: ['operatingState', 'row', 'disable', 'state', 'customersId', 'customersName', 'customersCode'],
     model: {
       prop: 'isAdd0',
       event: 'jugislist'
@@ -276,7 +276,47 @@
           customerName: null,
         },
         // 表单参数
-        form: {},
+        form: {
+          id: null,
+          code: null,
+          name: null,
+          gander: null,
+          customer: null,
+          customer_name: null,
+          customer_code: null,
+          contact_classification: null,
+          birthday: null,
+          birthplace: null,
+          hobby: null,
+          state: null,
+          superior_contact_name: null,
+          superior_contact: null,
+          section: null,
+          position: null,
+          job_title: null,
+          power: null,
+          support: null,
+          field_expertise: null,
+          decision_maker: null,
+          telephone: null,
+          mail: null,
+          address: null,
+          visit_time: null,
+          visit_place: null,
+          organization: null,
+          organization_name: null,
+          area: null,
+          department: null,
+          department_name: null,
+          department_code: null,
+          create_by: null,
+          create_time: null,
+          update_by: null,
+          update_time: null,
+          del_flag: null,
+          bo_id: null,
+          zt_id: null
+        },
         // 表单校验
         rules: {
           name: [{
@@ -349,61 +389,28 @@
       };
     },
     created() {
-      if (this.operatingState == 'Browse') {
-        this.handleBrowse(this.row);
-      } else if (this.operatingState == 'Update') {
-        this.handleUpdate(this.row);
-      }
+      this.initialization();
     },
     methods: {
+      // 初始化
+      initialization() {
+        // 客户数据赋值
+        this.form.customer = this.customersId;
+        this.form.customerCode = this.customersCode;
+        this.form.customerName = this.customersName;
+        if (this.operatingState == 'Browse') {
+          this.handleBrowse(this.row);
+        } else if (this.operatingState == 'Update') {
+          this.handleUpdate(this.row);
+        }
+      },
       // 取消按钮
       cancel() {
         this.$emit('jugislist', false);
       },
-      // 表单重置
-      reset() {
-        this.form = {
-          boId: null,
-          delFlag: null,
-          updateTime: null,
-          updateBy: null,
-          createDate: null,
-          createBy: null,
-          departmentName: null,
-          departmentCode: null,
-          area: null,
-          organization: null,
-          visitPlace: null,
-          visitTime: null,
-          address: null,
-          mail: null,
-          telephone: null,
-          decisionMaker: null,
-          fieldExpertise: null,
-          support: null,
-          power: null,
-          jobTitle: null,
-          position: null,
-          section: null,
-          superiorContact: null,
-          state: null,
-          hobby: null,
-          birthplace: null,
-          birthday: null,
-          contactClassification: null,
-          customerName: null,
-          customerCode: null,
-          gander: null,
-          name: null,
-          code: null,
-          id: null
-        };
-        this.resetForm("form");
-      },
       /** 修改按钮操作 */
       handleUpdate(row) {
         this.operatingState = "Update";
-        this.reset();
         const id = row.id || this.ids
         getContact(id).then(response => {
           this.form = response.data;
@@ -412,7 +419,6 @@
       },
       /** 查看按钮操作 */
       handleBrowse(row) {
-        this.reset();
         const id = row.id || this.ids
         getContact(id).then(response => {
           this.form = response.data;

+ 13 - 8
src/views/business/spd/cm/customersDepartment/index.vue

@@ -110,7 +110,7 @@
         form: {
           id: null,
           name: null,
-          customersName: this.customersName,
+          customersName: null,
           responsiblePerson: null,
           responsiblePersonName: null,
           phone: null,
@@ -150,15 +150,20 @@
       };
     },
     created() {
-      // 客户主键赋值
-      this.form.customersId = this.customersId;
-      if (this.pageStu == 'check' || this.pageStu == 'update') {
-        this.getDetails(this.row);
-      }
-      // 获取当前登录用户的编码
-      this.operator = this.$store.state.user.name;
+      this.initialization();
     },
     methods: {
+      // 初始化
+      initialization() {
+        // 客户数据赋值
+        this.form.customersId = this.customersId;
+        this.form.customersName = this.customersName;
+        if (this.pageStu == 'check' || this.pageStu == 'update') {
+          this.getDetails(this.row);
+        }
+        // 获取当前登录用户的编码
+        this.operator = this.$store.state.user.name;
+      },
       // 取消按钮
       cancel() {
         this.$emit('jugislist', false);

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

@@ -97,7 +97,7 @@
           id: null,
           person: null,
           personName: null,
-          customersName: this.customersName,
+          customersName: null,
           relationshipType: null,
           productionLine: null,
           startDate: null,
@@ -137,13 +137,18 @@
       };
     },
     created() {
-      // 客户主键赋值
-      this.form.customersId = this.customersId;
-      if (this.pageStu == 'check' || this.pageStu == 'update') {
-        this.getDetails(this.row);
-      }
+      this.initialization();
     },
     methods: {
+      // 初始化
+      initialization() {
+        // 客户主键赋值
+        this.form.customersId = this.customersId;
+        this.form.customersName = this.customersName;
+        if (this.pageStu == 'check' || this.pageStu == 'update') {
+          this.getDetails(this.row);
+        }
+      },
       // 取消按钮
       cancel() {
         this.$emit('jugislist', false);