Browse Source

【客户管理】客户、客户负责人、客户科室数据结构及页面优化

002390 1 year ago
parent
commit
3ecdc91b57

+ 7 - 4
src/utils/init.js

@@ -27,11 +27,14 @@ export const initRules = (prop) => {
   const rules = {};
   prop
     .filter(({ item }) => item.required)
-    .forEach(({ item }) => {
+    .forEach(({ item, attr }) => {
       const message = `${item.title}不能为空`;
-      rules[item.key] = [
-        { required: true, message: message, trigger: "change" },
-      ];
+      rules[item.key] = attr.rules ?
+        [
+          { required: true, message: message, trigger: "change" },
+          ...attr.rules
+        ]
+        : [{ required: true, message: message, trigger: "change" },];
     });
   return rules;
 };

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

@@ -489,7 +489,6 @@
                 ref="mkCmCustomersContact"
                 :row-class-name="rowMkCmCustomersContactIndex"
                 @selection-change="handleMkCmCustomersContactSelectionChange"
-                @pagination="getList({ ...page, ...params })"
                 style="margin: 16px 0 0"
               >
                 <ux-table-column
@@ -563,7 +562,6 @@
                 @selection-change="
                   handleMkCmCustomersResponsiblePersonSelectionChange
                 "
-                @pagination="getList({ ...page, ...params })"
                 style="margin: 16px 0 0"
               >
                 <ux-table-column
@@ -634,7 +632,6 @@
                 ref="mkCmCustomersDepartment"
                 :row-class-name="rowMkCmCustomersDepartmentIndex"
                 @selection-change="handleMkCmCustomersDepartmentSelectionChange"
-                @pagination="getList({ ...page, ...params })"
                 style="margin: 16px 0 0"
               >
                 <ux-table-column
@@ -779,7 +776,7 @@ export default {
       // 非多个禁用
       multiple: true,
       // 显示搜索条件
-      showSearch: true,
+      // showSearch: true,
       // 总条数
       total: 0,
       // 客户表格数据
@@ -1263,7 +1260,7 @@ export default {
     },
     /** 标签页切换 */
     handleClick(tab, event) {
-      console.log(tab, event);
+      // console.log(tab, event);
     },
     /** 必填项校验 */
     checkout() {

+ 355 - 246
src/views/business/spd/cm/customersContact/index.vue

@@ -1,15 +1,25 @@
 <template>
   <!-- <el-dialog :title="title" :visible.sync="open" width="1100px" append-to-body> -->
   <div id="CustomersContact" class="app-container">
-    <el-form ref="form" :model="form" :rules="rules" label-width="auto"
-      :disabled="this.operatingState == 'Browse'">
+    <el-form
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="auto"
+      :size="size"
+      :disabled="this.operatingState == 'Browse'"
+    >
       <el-divider content-position="left">
         <dev style="width: 50px; height: 40px; font-size: 18px">基本信息</dev>
       </el-divider>
       <el-row>
         <el-col :span="8">
           <el-form-item label="编码" prop="code">
-            <el-input v-model="form.code" placeholder="系统自动生成编码" readonly />
+            <el-input
+              v-model="form.code"
+              placeholder="系统自动生成编码"
+              readonly
+            />
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -20,8 +30,12 @@
         <el-col :span="8">
           <el-form-item label="性别" prop="gander">
             <el-select v-model="form.gander" placeholder="">
-              <el-option v-for="dict in dict.type.sys_user_sex" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.sys_user_sex"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -29,24 +43,40 @@
       <el-row>
         <el-col :span="8">
           <el-form-item label="所属客户" prop="customerName">
-            <dr-popover-select v-model="form.customerName" title="客户" type="CUSTOMER_PARAM_ZT" :dataMapping="{
-                  customer: 'id',
-                  customerName: 'name',
-                }" :source.sync="form" :disabled="true">
+            <dr-popover-select
+              v-model="form.customerName"
+              title="客户"
+              type="CUSTOMER_PARAM_ZT"
+              :dataMapping="{
+                customer: 'id',
+                customerName: 'name',
+              }"
+              :source.sync="form"
+              :disabled="true"
+            >
             </dr-popover-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="联系人分类" prop="contactClassification">
             <el-select v-model="form.contactClassification" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_contact_type" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_contact_type"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="生日" prop="birthday">
-            <el-date-picker clearable v-model="form.birthday" type="date" value-format="yyyy-MM-dd">
+            <el-date-picker
+              clearable
+              v-model="form.birthday"
+              type="date"
+              value-format="yyyy-MM-dd"
+            >
             </el-date-picker>
           </el-form-item>
         </el-col>
@@ -65,8 +95,12 @@
         <el-col :span="8">
           <el-form-item label="状态" prop="state">
             <el-select v-model="form.state" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_contact_state" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_contact_state"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -77,26 +111,41 @@
       <el-row>
         <el-col :span="8">
           <el-form-item label="上级联系人" prop="superiorContactName">
-            <dr-popover-select v-model="form.superiorContactName" title="上级联系人" type="LINKMAN_PARAM" :dataMapping="{
-                  superiorContact: 'id',
-                  superiorContactName: 'name',
-                }" :source.sync="form" :queryParams="additionalCondition">
+            <dr-popover-select
+              v-model="form.superiorContactName"
+              title="上级联系人"
+              type="LINKMAN_PARAM"
+              :dataMapping="{
+                superiorContact: 'id',
+                superiorContactName: 'name',
+              }"
+              :source.sync="form"
+              :queryParams="additionalCondition"
+            >
             </dr-popover-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="任职科室" prop="section">
             <el-select v-model.trim="form.section" placeholder="" filterable>
-              <el-option v-for="dict in dict.type.mk_bo_section" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_section"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="职务" prop="position">
             <el-select v-model="form.position" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_position" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_position"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -105,24 +154,36 @@
         <el-col :span="8">
           <el-form-item label="职称" prop="jobTitle">
             <el-select v-model="form.jobTitle" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_job_title" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_job_title"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="决策力" prop="power">
             <el-select v-model="form.power" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_power" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_power"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="支持度" prop="support">
             <el-select v-model="form.support" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_support" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_support"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
@@ -131,21 +192,29 @@
         <el-col :span="8">
           <el-form-item label="擅长领域" prop="fieldExpertise">
             <el-select v-model="form.fieldExpertise" placeholder="">
-              <el-option v-for="dict in dict.type.mk_bo_field_expertise" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
+              <el-option
+                v-for="dict in dict.type.mk_bo_field_expertise"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              ></el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
           <el-form-item label="关键决策人" prop="decisionMaker">
             <el-select v-model="form.decisionMaker" placeholder="">
-              <el-option v-for="dict in dict.type.sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value">
+              <el-option
+                v-for="dict in dict.type.sys_yes_no"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+              >
               </el-option>
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col :span="8">
-        </el-col>
+        <el-col :span="8"> </el-col>
       </el-row>
       <el-divider content-position="left">
         <dev style="width: 50px; height: 40px; font-size: 18px">联系信息</dev>
@@ -178,8 +247,7 @@
             <el-input v-model="form.visitPlace" />
           </el-form-item>
         </el-col>
-        <el-col :span="8">
-        </el-col>
+        <el-col :span="8"> </el-col>
       </el-row>
       <el-tabs v-model="activeName" v-if="this.operatingState != 'Insert'">
         <el-tab-pane label="学历信息" name="first">
@@ -218,246 +286,287 @@
       </div>
     </el-form>
     <div slot="footer" class="dialog-footer">
-      <el-button size="mini" type="primary" @click="submitForm" v-if="this.operatingState != 'Browse'"
-        :disabled="submitButtonEditStatus">确 定</el-button>
-      <el-button size="mini" @click="cancel">取 消</el-button>
+      <el-button
+        :size="size"
+        type="primary"
+        @click="submitForm"
+        v-if="this.operatingState != 'Browse'"
+        :disabled="submitButtonEditStatus"
+        >确 定</el-button
+      >
+      <el-button :size="size" @click="cancel">取 消</el-button>
     </div>
   </div>
   <!-- </el-dialog> -->
 </template>
 
 <script>
-  import {
-    listContact,
-    getContact,
-    delContact,
-    addContact,
-    updateContact
-  } from "@/api/business/spd/bo/contact";
-  // import EducationList from '../education/educationList.vue';
-  // import RelationshipList from '../relationship/relationshipList.vue';
+import {
+  listContact,
+  getContact,
+  delContact,
+  addContact,
+  updateContact,
+} from "@/api/business/spd/bo/contact";
+// import EducationList from '../education/educationList.vue';
+// import RelationshipList from '../relationship/relationshipList.vue';
 
-  export default {
-    name: "CustomersContact",
-    props: ['operatingState', 'row', 'disable', 'state', 'customersId', 'customersName', 'customersCode'],
-    model: {
-      prop: 'isAdd0',
-      event: 'jugislist'
-    },
-    dicts: ['sys_user_sex', 'mk_bo_contact_state', 'mk_bo_section', 'mk_bo_position', 'mk_bo_job_title', 'mk_bo_power',
-      'mk_bo_support', 'mk_bo_field_expertise', 'sys_yes_no', 'mk_bo_contact_type'
-    ],
-    components: {
-      EducationList: () => import('../education/educationList.vue'),
-      RelationshipList: () => import('../relationship/relationshipList.vue')
-    },
-    data() {
-      return {
-        // 遮罩层
-        loading: true,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: true,
-        // 总条数
-        total: 0,
-        // 联系人管理表格数据
-        contactList: [],
-        // 查询参数
-        queryParams: {
-          pageNum: 1,
-          pageSize: 10,
-          name: null,
-          telephone: null,
-          customerName: null,
-        },
-        // 表单参数
-        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: [{
+export default {
+  name: "CustomersContact",
+  props: [
+    "operatingState",
+    "row",
+    "disable",
+    "state",
+    "customersId",
+    "customersName",
+    "customersCode",
+  ],
+  model: {
+    prop: "isAdd0",
+    event: "jugislist",
+  },
+  dicts: [
+    "sys_user_sex",
+    "mk_bo_contact_state",
+    "mk_bo_section",
+    "mk_bo_position",
+    "mk_bo_job_title",
+    "mk_bo_power",
+    "mk_bo_support",
+    "mk_bo_field_expertise",
+    "sys_yes_no",
+    "mk_bo_contact_type",
+  ],
+  components: {
+    EducationList: () => import("../education/educationList.vue"),
+    RelationshipList: () => import("../relationship/relationshipList.vue"),
+  },
+  data() {
+    return {
+      size: "mini",
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 联系人管理表格数据
+      contactList: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        name: null,
+        telephone: null,
+        customerName: null,
+      },
+      // 表单参数
+      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: [
+          {
             required: true,
             message: "姓名不能为空",
-            trigger: "blur"
-          }],
-          gander: [{
+            trigger: "blur",
+          },
+        ],
+        gander: [
+          {
             required: true,
             message: "性别不能为空",
-            trigger: "blur"
-          }],
-          customerName: [{
+            trigger: "blur",
+          },
+        ],
+        customerName: [
+          {
             required: true,
             message: "所属客户名称不能为空",
-            trigger: "blur"
-          }],
-          state: [{
+            trigger: "blur",
+          },
+        ],
+        state: [
+          {
             required: true,
             message: "状态不能为空",
-            trigger: "blur"
-          }],
-          section: [{
+            trigger: "blur",
+          },
+        ],
+        section: [
+          {
             required: true,
             message: "任职科室不能为空",
-            trigger: "blur"
-          }],
-          position: [{
+            trigger: "blur",
+          },
+        ],
+        position: [
+          {
             required: true,
             message: "职务不能为空",
-            trigger: "blur"
-          }],
-          jobTitle: [{
+            trigger: "blur",
+          },
+        ],
+        jobTitle: [
+          {
             required: true,
             message: "职称不能为空",
-            trigger: "blur"
-          }],
-          power: [{
+            trigger: "blur",
+          },
+        ],
+        power: [
+          {
             required: true,
             message: "决策力不能为空",
-            trigger: "blur"
-          }],
-          decisionMaker: [{
+            trigger: "blur",
+          },
+        ],
+        decisionMaker: [
+          {
             required: true,
             message: "关键决策人不能为空",
-            trigger: "blur"
-          }],
-          telephone: [{
-              required: true,
-              message: "联系电话不能为空",
-              trigger: "blur"
+            trigger: "blur",
+          },
+        ],
+        telephone: [
+          {
+            required: true,
+            message: "联系电话不能为空",
+            trigger: "blur",
+          },
+          {
+            validator: function (rule, value, callback) {
+              if (/^1[34578]\d{9}$/.test(value) == false) {
+                callback(new Error("手机号格式错误"));
+              } else {
+                callback();
+              }
             },
-            {
-              validator: function (rule, value, callback) {
-                if (/^1[34578]\d{9}$/.test(value) == false) {
-                  callback(new Error("手机号格式错误"));
-                } else {
-                  callback();
-                }
-              },
-              trigger: "blur"
-            }
-          ],
-        },
-        //重新加载子组件参数
-        timer: '',
-        activeName: 'first',
-        //确定按钮是否可点
-        submitButtonEditStatus: false,
-      };
+            trigger: "blur",
+          },
+        ],
+      },
+      //重新加载子组件参数
+      timer: "",
+      activeName: "first",
+      //确定按钮是否可点
+      submitButtonEditStatus: false,
+    };
+  },
+  created() {
+    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);
+      }
     },
-    created() {
-      this.initialization();
+    // 取消按钮
+    cancel() {
+      this.$emit("jugislist", false);
     },
-    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);
-      },
-      /** 修改按钮操作 */
-      handleUpdate(row) {
-        this.operatingState = "Update";
-        const id = row.id || this.ids
-        getContact(id).then(response => {
-          this.form = response.data;
-          this.timer = new Date().getTime();
-        });
-      },
-      /** 查看按钮操作 */
-      handleBrowse(row) {
-        const id = row.id || this.ids
-        getContact(id).then(response => {
-          this.form = response.data;
-          this.operatingState = "Browse";
-        });
-      },
-      /** 提交按钮 */
-      submitForm() {
-        this.submitButtonEditStatus = true;
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.id != null) {
-              updateContact(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.submitButtonEditStatus = false;
-                this.cancel();
-                this.$parent.handleCheck(this.customersId);
-              });
-            } else {
-              addContact(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.submitButtonEditStatus = false;
-                this.cancel();
-                this.$parent.handleCheck(this.customersId);
-              });
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.operatingState = "Update";
+      const id = row.id || this.ids;
+      getContact(id).then((response) => {
+        this.form = response.data;
+        this.timer = new Date().getTime();
+      });
+    },
+    /** 查看按钮操作 */
+    handleBrowse(row) {
+      const id = row.id || this.ids;
+      getContact(id).then((response) => {
+        this.form = response.data;
+        this.operatingState = "Browse";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.submitButtonEditStatus = true;
+      this.$refs["form"].validate(async (valid) => {
+        if (valid) {
+          try {
+            let { code, msg } =
+              this.form.id != null
+                ? await updateContact(this.form)
+                : await addContact(this.form);
+            if (code == 200) {
+              this.$notify.success(msg);
+              this.cancel();
+              this.$parent.handleCheck(this.customersId);
             }
-          } else {
+          } catch (error) {
+          } finally {
             this.submitButtonEditStatus = false;
           }
-        });
-      },
-      additionalCondition() {
-        return {
-          parame: {
-            customer: this.form.customer ? this.form.customer : 'xxx'
-          }
+        } else {
+          this.submitButtonEditStatus = false;
         }
-      },
-    }
-  };
-
-</script>
+      });
+    },
+    additionalCondition() {
+      return {
+        parame: {
+          customer: this.form.customer ? this.form.customer : "xxx",
+        },
+      };
+    },
+  },
+};
+</script>

+ 99 - 0
src/views/business/spd/cm/customersDepartment/columns.js

@@ -0,0 +1,99 @@
+export default function useColumns() {
+
+  // 科室信息
+  const FormColumns = [
+    {
+      item: { key: "name", title: "科室名称", required: true, },
+      attr: {
+        is: "el-select",
+        dictName: "mk_bo_section",
+        placeholder: "请输入科室名称",
+        clearable: true,
+        filterable: true,
+      },
+    },
+    {
+      item: { key: "customersName", title: "客户名称" },
+      attr: {
+        is: "el-input",
+        disabled: true,
+      },
+    },
+    {
+      item: { key: "responsiblePersonName", title: "负责人姓名" },
+      attr: {
+        is: "el-popover-select-v2",
+        referName: "MKCMCONTACTS_PARAM",
+        valueKey: "name",
+        dataMapping: {
+          responsiblePerson: 'id',
+          responsiblePersonName: 'name',
+          phone: 'cell'
+        },
+        placeholder: "请选择负责人",
+      },
+    },
+    {
+      item: { key: "phone", title: "联系人手机", required: true, },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        placeholder: "请输入联系人手机",
+        rules: [
+          {
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入正确的手机号码",
+            trigger: "blur",
+          },
+        ]
+      },
+    },
+    {
+      item: { key: "address", title: "科室位置" },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        placeholder: "请输入科室位置",
+      },
+    },
+    {
+      item: { key: "conventionalTherapy", title: "常规治疗" },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        placeholder: "请输入常规治疗",
+      },
+    },
+    {
+      item: { key: "characteristic", title: "科室特色" },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        placeholder: "请输入科室特色",
+      },
+    },
+    {
+      item: { key: "createByName", title: "业务员名称" },
+      attr: {
+        is: "el-input",
+        disabled: true,
+      },
+    },
+    {
+      item: { key: "memo", title: "备注" },
+      attr: {
+        is: "el-input",
+        clearable: true,
+        placeholder: "请输入备注",
+      },
+    },
+  ].map(({ item, attr }) => ({
+    attr,
+    item: {
+      ...item,
+      span: item.span || 6
+    }
+  }));
+
+  return { FormColumns }
+}

+ 212 - 0
src/views/business/spd/cm/customersDepartment/index copy.vue

@@ -0,0 +1,212 @@
+<template>
+  <div id="CustomersDepartment" class="app-container">
+    <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">
+          <el-form-item label="科室名称" prop="name">
+            <el-select v-model.trim="form.name" placeholder="请输入科室名称" :disabled="disable" clearable filterable>
+              <el-option v-for="dict in dict.type.mk_bo_section" :key="dict.value" :label="dict.label"
+                :value="dict.value"></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="客户名称" prop="customersName">
+            <el-input v-model="form.customersName" :disabled="true" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="负责人姓名" prop="responsiblePersonName">
+            <el-popover-select-v2 v-model="form.responsiblePersonName" title="负责人" valueKey="name"
+              referName="MKCMCONTACTS_PARAM" :dataMapping="{responsiblePerson: 'id', responsiblePersonName: 'name', phone: 'cell'}"
+              :source.sync="form" :queryParams="referQuery" placeholder="请选择负责人" :disabled="disable" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row type="flex" class="row-bg" justify="space-around">
+        <el-col :span="6">
+          <el-form-item label="联系人手机" prop="phone">
+            <el-input v-model="form.phone" placeholder="请输入联系人手机" :disabled="disable" clearable />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="科室位置" prop="address">
+            <el-input v-model="form.address" placeholder="请输入科室位置" :disabled="disable" clearable />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="常规治疗" prop="conventionalTherapy">
+            <el-input v-model="form.conventionalTherapy" placeholder="请输入常规治疗" :disabled="disable" clearable />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row type="flex" class="row-bg" justify="space-around">
+        <el-col :span="6">
+          <el-form-item label="科室特色" prop="characteristic">
+            <el-input v-model="form.characteristic" placeholder="请输入科室特色" :disabled="disable" clearable />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="业务员名称" prop="createByName">
+            <el-input v-model="form.createByName" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="备注" prop="memo">
+            <el-input v-model="form.memo" placeholder="请输入备注" :disabled="disable" clearable />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <div slot="footer" style="margin-left: 88%; margin-top: 1%">
+      <el-button type="primary" @click="submitForm" :disabled="disable">确 定</el-button>
+      <el-button @click="cancel">取 消</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+  import {
+    listCustomersDepartment,
+    getCustomersDepartment,
+    delCustomersDepartment,
+    addCustomersDepartment,
+    updateCustomersDepartment
+  } from "@/api/business/spd/cm/customersDepartment";
+  // 参照弹出框
+  import ElPopoverSelectV2 from "@/components/popover-select-v2";
+
+  export default {
+    name: "CustomersDepartment",
+    props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
+    dicts: ['mk_bo_section'],
+    model: {
+      prop: 'isAdd2',
+      event: 'jugislist'
+    },
+    components: {
+      ElPopoverSelectV2,
+    },
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 总条数
+        total: 0,
+        // 客户科室表格数据
+        customersDepartmentList: [],
+        // 当前操作人
+        operator: null,
+        // 表单参数
+        form: {
+          id: null,
+          name: null,
+          customersName: null,
+          responsiblePerson: null,
+          responsiblePersonName: null,
+          phone: null,
+          address: null,
+          conventionalTherapy: null,
+          characteristic: null,
+          marketingArea: null,
+          marketingAreaName: null,
+          memo: null,
+          state: null,
+          customersId: null,
+          tenantId: null,
+          revision: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          delFlag: null
+        },
+        // 表单校验
+        rules: {
+          name: [{
+            required: true,
+            message: '科室名称不能为空',
+            trigger: 'blur'
+          }],
+          phone: [{
+            required: true,
+            message: "手机号不能为空",
+            trigger: "blur"
+          }, {
+            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
+            message: "请输入正确的手机号码",
+            trigger: "blur"
+          }],
+        },
+      };
+    },
+    created() {
+      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);
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.id != null) {
+              updateCustomersDepartment(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.cancel();
+                this.$parent.handleCheck(this.form.customersId);
+              });
+            } else {
+              addCustomersDepartment(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.cancel();
+                this.$parent.handleCheck(this.form.customersId);
+              });
+            }
+          }
+        });
+      },
+      /** 获取详情 */
+      getDetails(row) {
+        getCustomersDepartment(row.id).then(res => {
+          if (res.code == 200) {
+            this.form = res.data;
+          }
+        })
+      },
+      // 参照查询条件
+      referQuery() {
+        const parameter = {
+          parame: {
+            customersName: this.form.customersName,
+            operator: this.operator
+          }
+        };
+        return parameter;
+      }
+    }
+  };
+
+</script>

+ 139 - 200
src/views/business/spd/cm/customersDepartment/index.vue

@@ -1,212 +1,151 @@
 <template>
   <div id="CustomersDepartment" class="app-container">
-    <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">
-          <el-form-item label="科室名称" prop="name">
-            <el-select v-model.trim="form.name" placeholder="请输入科室名称" :disabled="disable" clearable filterable>
-              <el-option v-for="dict in dict.type.mk_bo_section" :key="dict.value" :label="dict.label"
-                :value="dict.value"></el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="客户名称" prop="customersName">
-            <el-input v-model="form.customersName" :disabled="true" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="负责人姓名" prop="responsiblePersonName">
-            <el-popover-select-v2 v-model="form.responsiblePersonName" title="负责人" valueKey="name"
-              referName="MKCMCONTACTS_PARAM" :dataMapping="{responsiblePerson: 'id', responsiblePersonName: 'name', phone: 'cell'}"
-              :source.sync="form" :queryParams="referQuery" placeholder="请选择负责人" :disabled="disable" />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row type="flex" class="row-bg" justify="space-around">
-        <el-col :span="6">
-          <el-form-item label="联系人手机" prop="phone">
-            <el-input v-model="form.phone" placeholder="请输入联系人手机" :disabled="disable" clearable />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="科室位置" prop="address">
-            <el-input v-model="form.address" placeholder="请输入科室位置" :disabled="disable" clearable />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="常规治疗" prop="conventionalTherapy">
-            <el-input v-model="form.conventionalTherapy" placeholder="请输入常规治疗" :disabled="disable" clearable />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row type="flex" class="row-bg" justify="space-around">
-        <el-col :span="6">
-          <el-form-item label="科室特色" prop="characteristic">
-            <el-input v-model="form.characteristic" placeholder="请输入科室特色" :disabled="disable" clearable />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="业务员名称" prop="createByName">
-            <el-input v-model="form.createByName" disabled />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="备注" prop="memo">
-            <el-input v-model="form.memo" placeholder="请输入备注" :disabled="disable" clearable />
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-    <div slot="footer" style="margin-left: 88%; margin-top: 1%">
-      <el-button type="primary" @click="submitForm" :disabled="disable">确 定</el-button>
-      <el-button @click="cancel">取 消</el-button>
+    <el-divider content-position="left">科室信息</el-divider>
+    <el-super-form
+      v-model="params"
+      :dict="dict"
+      :rules="rules"
+      :size="size"
+      :columns="FormColumns"
+      ref="superForm"
+      label-width="auto"
+      label-position="right"
+      style="padding: 20px"
+      :disabled="disable"
+    >
+      <template slot="responsiblePersonName" slot-scope="scope">
+        <component
+          v-bind="scope.attr"
+          v-model="scope.row[scope.item.key]"
+          :size="$attrs.size"
+          :source.sync="scope.row"
+          :queryParams="
+            () => ({
+              parame: {
+                customersName: params.customersName,
+                operator: operator,
+              },
+            })
+          "
+          :disabled="disable"
+        >
+        </component
+      ></template>
+    </el-super-form>
+    <div slot="footer" style="text-align: right">
+      <el-button
+        type="primary"
+        :size="size"
+        @click="submitForm('superForm')"
+        :disabled="disable"
+        >确 定</el-button
+      >
+      <el-button :size="size" @click="cancel">取 消</el-button>
     </div>
   </div>
 </template>
 
 <script>
-  import {
-    listCustomersDepartment,
-    getCustomersDepartment,
-    delCustomersDepartment,
-    addCustomersDepartment,
-    updateCustomersDepartment
-  } from "@/api/business/spd/cm/customersDepartment";
-  // 参照弹出框
-  import ElPopoverSelectV2 from "@/components/popover-select-v2";
-
-  export default {
-    name: "CustomersDepartment",
-    props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
-    dicts: ['mk_bo_section'],
-    model: {
-      prop: 'isAdd2',
-      event: 'jugislist'
-    },
-    components: {
-      ElPopoverSelectV2,
+import { dicts } from "../dicts";
+import useColumns from "./columns";
+import {
+  listCustomersDepartment,
+  getCustomersDepartment,
+  delCustomersDepartment,
+  addCustomersDepartment,
+  updateCustomersDepartment,
+} from "@/api/business/spd/cm/customersDepartment";
+export default {
+  name: "CustomersDepartment",
+  props: ["pageStu", "row", "disable", "customersId", "customersName"],
+  dicts: [...dicts],
+  model: {
+    prop: "isAdd2",
+    event: "jugislist",
+  },
+  components: {
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2"),
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+  },
+  data() {
+    const { FormColumns } = useColumns();
+    const params = this.$init.params(FormColumns);
+    const rules = this.$init.rules(FormColumns);
+    return {
+      rules,
+      params: {
+        ...params,
+        id: null,
+        responsiblePerson: null,
+        marketingArea: null,
+        marketingAreaName: null,
+        state: null,
+        customersId: null,
+        tenantId: null,
+        revision: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        delFlag: null,
+      },
+      FormColumns,
+      size: "mini",
+      // 遮罩层
+      loading: true,
+      // 客户科室表格数据
+      customersDepartmentList: [],
+      // 当前操作人
+      operator: null,
+    };
+  },
+  created() {
+    this.initialization();
+  },
+  methods: {
+    // 初始化
+    initialization() {
+      // 客户数据赋值
+      this.params.customersId = this.customersId;
+      this.params.customersName = this.customersName;
+      if (this.pageStu == "check" || this.pageStu == "update") {
+        this.getDetails(this.row);
+      }
+      // 获取当前登录用户的编码
+      this.operator = this.$store.state.user.name;
     },
-    data() {
-      return {
-        // 遮罩层
-        loading: true,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: true,
-        // 总条数
-        total: 0,
-        // 客户科室表格数据
-        customersDepartmentList: [],
-        // 当前操作人
-        operator: null,
-        // 表单参数
-        form: {
-          id: null,
-          name: null,
-          customersName: null,
-          responsiblePerson: null,
-          responsiblePersonName: null,
-          phone: null,
-          address: null,
-          conventionalTherapy: null,
-          characteristic: null,
-          marketingArea: null,
-          marketingAreaName: null,
-          memo: null,
-          state: null,
-          customersId: null,
-          tenantId: null,
-          revision: null,
-          createBy: null,
-          createTime: null,
-          updateBy: null,
-          updateTime: null,
-          delFlag: null
-        },
-        // 表单校验
-        rules: {
-          name: [{
-            required: true,
-            message: '科室名称不能为空',
-            trigger: 'blur'
-          }],
-          phone: [{
-            required: true,
-            message: "手机号不能为空",
-            trigger: "blur"
-          }, {
-            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-            message: "请输入正确的手机号码",
-            trigger: "blur"
-          }],
-        },
-      };
+    // 取消按钮
+    cancel() {
+      this.$emit("jugislist", false);
     },
-    created() {
-      this.initialization();
+    /** 提交按钮 */
+    submitForm(prop) {
+      this.$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            let { params } = this;
+            let { code, msg } =
+              params.id != null
+                ? await updateCustomersDepartment(params)
+                : await addCustomersDepartment(params);
+
+            if (code == 200) {
+              this.$notify.success(msg);
+              this.cancel();
+              this.$parent.handleCheck(params.customersId);
+            }
+          } catch (error) {}
+        }
+      });
     },
-    methods: {
-      // 初始化
-      initialization() {
-        // 客户数据赋值
-        this.form.customersId = this.customersId;
-        this.form.customersName = this.customersName;
-        if (this.pageStu == 'check' || this.pageStu == 'update') {
-          this.getDetails(this.row);
+    /** 获取详情 */
+    getDetails(row) {
+      getCustomersDepartment(row.id).then((res) => {
+        if (res.code == 200) {
+          this.params = res.data;
         }
-        // 获取当前登录用户的编码
-        this.operator = this.$store.state.user.name;
-      },
-      // 取消按钮
-      cancel() {
-        this.$emit('jugislist', false);
-      },
-      /** 提交按钮 */
-      submitForm() {
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.id != null) {
-              updateCustomersDepartment(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.cancel();
-                this.$parent.handleCheck(this.form.customersId);
-              });
-            } else {
-              addCustomersDepartment(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.cancel();
-                this.$parent.handleCheck(this.form.customersId);
-              });
-            }
-          }
-        });
-      },
-      /** 获取详情 */
-      getDetails(row) {
-        getCustomersDepartment(row.id).then(res => {
-          if (res.code == 200) {
-            this.form = res.data;
-          }
-        })
-      },
-      // 参照查询条件
-      referQuery() {
-        const parameter = {
-          parame: {
-            customersName: this.form.customersName,
-            operator: this.operator
-          }
-        };
-        return parameter;
-      }
-    }
-  };
-
+      });
+    },
+  },
+};
 </script>

+ 12 - 6
src/views/business/spd/cm/customersResponsiblePerson/columns.js

@@ -2,7 +2,7 @@ export default function useColumns() {
   // 负责人信息
   const PrincipalCloumns = [
     {
-      item: { key: "personName", title: "人员姓名" },
+      item: { key: "personName", title: "人员姓名", required: true, },
       attr: {
         is: "el-popover-select-v2",
         referName: "CONTACTS_PARAM",
@@ -20,21 +20,21 @@ export default function useColumns() {
       },
     },
     {
-      item: { key: "relationshipType", title: "关系类型" },
+      item: { key: "relationshipType", title: "关系类型", required: true, },
       attr: {
         is: "el-select",
         dictName: "mk_cm_relationship_type",
       },
     },
     {
-      item: { key: "productionLine", title: "产线" },
+      item: { key: "productionLine", title: "产线", required: true, },
       attr: {
         is: "el-select",
         dictName: "mk_cm_production_line",
       },
     },
     {
-      item: { key: "startDate", title: "开始日期" },
+      item: { key: "startDate", title: "开始日期", required: true, },
       attr: {
         is: "el-date-picker",
         type: "date",
@@ -49,8 +49,14 @@ export default function useColumns() {
         placeholder: "请选择结束日期",
       },
     },
-   
-  ];
+
+  ].map(({ item, attr }) => ({
+    attr,
+    item: {
+      ...item,
+      span: item.span || 6
+    }
+  }))
 
   return { PrincipalCloumns }
 }

+ 187 - 0
src/views/business/spd/cm/customersResponsiblePerson/index copy.vue

@@ -0,0 +1,187 @@
+<template>
+  <div id="CustomersResponsiblePerson" class="app-container">
+    <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">
+          <el-form-item label="人员姓名" prop="personName">
+            <el-popover-select-v2 v-model="form.personName" title="负责人" valueKey="name" referName="CONTACTS_PARAM"
+              :dataMapping="{person: 'id', personName: 'name'}" :source.sync="form" placeholder="请选择负责人"
+              :disabled="disable" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="客户名称" prop="customersName">
+            <el-input v-model="form.customersName" :disabled="true" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="关系类型" prop="relationshipType">
+            <el-select clearable v-model="form.relationshipType" :disabled="disable">
+              <el-option v-for="dict in dict.type.mk_cm_relationship_type" :key="dict.value" :label="dict.label"
+                :value="dict.value" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row type="flex" class="row-bg" justify="space-around">
+        <el-col :span="6">
+          <el-form-item label="产线" prop="productionLine">
+            <el-select clearable v-model="form.productionLine" :disabled="disable">
+              <el-option v-for="dict in dict.type.mk_cm_production_line" :key="dict.value" :label="dict.label"
+                :value="dict.value" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="开始日期" prop="startDate">
+            <el-date-picker v-model="form.startDate" align="right" type="date" placeholder="请选择开始日期"
+              :disabled="disable" />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="结束日期" prop="endDate">
+            <el-date-picker v-model="form.endDate" align="right" type="date" placeholder="请选择结束日期"
+              :disabled="disable" />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <div slot="footer" style="margin-left: 88%; margin-top: 1%">
+      <el-button type="primary" @click="submitForm" :disabled="disable">确 定</el-button>
+      <el-button @click="cancel">取 消</el-button>
+    </div>
+  </div>
+</template>
+
+<script>
+  import {
+    listCustomersResponsiblePerson,
+    getCustomersResponsiblePerson,
+    delCustomersResponsiblePerson,
+    addCustomersResponsiblePerson,
+    updateCustomersResponsiblePerson
+  } from "@/api/business/spd/cm/customersResponsiblePerson";
+  // 参照弹出框
+  import ElPopoverSelectV2 from "@/components/popover-select-v2";
+
+  export default {
+    name: "CustomersResponsiblePerson",
+    props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
+    model: {
+      prop: 'isAdd1',
+      event: 'jugislist'
+    },
+    dicts: ['mk_cm_relationship_type', 'mk_cm_production_line'],
+    components: {
+      ElPopoverSelectV2,
+    },
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 选中数组
+        ids: [],
+        // 非单个禁用
+        single: true,
+        // 非多个禁用
+        multiple: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 总条数
+        total: 0,
+        // 客户负责人表格数据
+        customersResponsiblePersonList: [],
+        // 表单参数
+        form: {
+          id: null,
+          person: null,
+          personName: null,
+          customersName: null,
+          relationshipType: null,
+          productionLine: null,
+          startDate: null,
+          endDate: null,
+          customersId: null,
+          tenantId: null,
+          revision: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          delFlag: null
+        },
+        // 表单校验
+        rules: {
+          personName: [{
+            required: true,
+            message: '人员名称不能为空',
+            trigger: 'blur'
+          }],
+          relationshipType: [{
+            required: true,
+            message: '关系类型不能为空',
+            trigger: 'blur'
+          }],
+          startDate: [{
+            required: true,
+            message: '开始日期不能为空',
+            trigger: 'blur'
+          }],
+          productionLine: [{
+            required: true,
+            message: '产线不能为空',
+            trigger: 'blur'
+          }],
+        },
+      };
+    },
+    created() {
+      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);
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.id != null) {
+              updateCustomersResponsiblePerson(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.cancel();
+                this.$parent.handleCheck(this.form.customersId);
+              });
+            } else {
+              addCustomersResponsiblePerson(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.cancel();
+                this.$parent.handleCheck(this.form.customersId);
+              });
+            }
+          }
+        });
+      },
+      /** 获取详情 */
+      getDetails(row) {
+        getCustomersResponsiblePerson(row.id).then(res => {
+          if (res.code == 200) {
+            this.form = res.data;
+          }
+        })
+      },
+    }
+  }
+
+</script>

+ 125 - 174
src/views/business/spd/cm/customersResponsiblePerson/index.vue

@@ -1,187 +1,138 @@
 <template>
   <div id="CustomersResponsiblePerson" class="app-container">
-    <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">
-          <el-form-item label="人员姓名" prop="personName">
-            <el-popover-select-v2 v-model="form.personName" title="负责人" valueKey="name" referName="CONTACTS_PARAM"
-              :dataMapping="{person: 'id', personName: 'name'}" :source.sync="form" placeholder="请选择负责人"
-              :disabled="disable" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="客户名称" prop="customersName">
-            <el-input v-model="form.customersName" :disabled="true" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="关系类型" prop="relationshipType">
-            <el-select clearable v-model="form.relationshipType" :disabled="disable">
-              <el-option v-for="dict in dict.type.mk_cm_relationship_type" :key="dict.value" :label="dict.label"
-                :value="dict.value" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row type="flex" class="row-bg" justify="space-around">
-        <el-col :span="6">
-          <el-form-item label="产线" prop="productionLine">
-            <el-select clearable v-model="form.productionLine" :disabled="disable">
-              <el-option v-for="dict in dict.type.mk_cm_production_line" :key="dict.value" :label="dict.label"
-                :value="dict.value" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="开始日期" prop="startDate">
-            <el-date-picker v-model="form.startDate" align="right" type="date" placeholder="请选择开始日期"
-              :disabled="disable" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="6">
-          <el-form-item label="结束日期" prop="endDate">
-            <el-date-picker v-model="form.endDate" align="right" type="date" placeholder="请选择结束日期"
-              :disabled="disable" />
-          </el-form-item>
-        </el-col>
-      </el-row>
-    </el-form>
-    <div slot="footer" style="margin-left: 88%; margin-top: 1%">
-      <el-button type="primary" @click="submitForm" :disabled="disable">确 定</el-button>
-      <el-button @click="cancel">取 消</el-button>
+    <el-divider content-position="left">负责人信息</el-divider>
+    <el-super-form
+      v-model="params"
+      :dict="dict"
+      :rules="rules"
+      :size="size"
+      :columns="PrincipalCloumns"
+      ref="superForm"
+      label-width="auto"
+      label-position="right"
+      style="padding: 20px"
+      :disabled="disable"
+    >
+    </el-super-form>
+    <div slot="footer" style="text-align: right">
+      <el-button
+        type="primary"
+        :size="size"
+        @click="submitForm('superForm')"
+        :disabled="disable"
+        >确 定</el-button
+      >
+      <el-button :size="size" @click="cancel">取 消</el-button>
     </div>
   </div>
 </template>
 
 <script>
-  import {
-    listCustomersResponsiblePerson,
-    getCustomersResponsiblePerson,
-    delCustomersResponsiblePerson,
-    addCustomersResponsiblePerson,
-    updateCustomersResponsiblePerson
-  } from "@/api/business/spd/cm/customersResponsiblePerson";
-  // 参照弹出框
-  import ElPopoverSelectV2 from "@/components/popover-select-v2";
+import { dicts } from "../dicts";
+import useColumns from "./columns";
+import {
+  listCustomersResponsiblePerson,
+  getCustomersResponsiblePerson,
+  delCustomersResponsiblePerson,
+  addCustomersResponsiblePerson,
+  updateCustomersResponsiblePerson,
+} from "@/api/business/spd/cm/customersResponsiblePerson";
+// // 参照弹出框
+import ElPopoverSelectV2 from "@/components/popover-select-v2";
 
-  export default {
-    name: "CustomersResponsiblePerson",
-    props: ['pageStu', 'row', 'disable', 'customersId', 'customersName'],
-    model: {
-      prop: 'isAdd1',
-      event: 'jugislist'
-    },
-    dicts: ['mk_cm_relationship_type', 'mk_cm_production_line'],
-    components: {
-      ElPopoverSelectV2,
+export default {
+  name: "CustomersResponsiblePerson",
+  props: ["pageStu", "row", "disable", "customersId", "customersName"],
+  model: {
+    prop: "isAdd1",
+    event: "jugislist",
+  },
+  dicts: [...dicts],
+  components: {
+    ElPopoverSelectV2,
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+  },
+  data() {
+    const { PrincipalCloumns } = useColumns();
+    const params = this.$init.params(PrincipalCloumns);
+    const rules = this.$init.rules(PrincipalCloumns);
+    return {
+      rules,
+      PrincipalCloumns,
+      size: "mini",
+      params: {
+        ...params,
+        id: null,
+        person: null,
+        customersId: null,
+        tenantId: null,
+        revision: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        delFlag: null,
+      },
+      // 遮罩层
+      loading: true,
+      // // 选中数组
+      // ids: [],
+      // // 非单个禁用
+      // single: true,
+      // // 非多个禁用
+      // multiple: true,
+      // // 显示搜索条件
+      // showSearch: true,
+      // // 总条数
+      // total: 0,
+      // 客户负责人表格数据
+      customersResponsiblePersonList: [],
+    };
+  },
+  created() {
+    this.initialization();
+  },
+  methods: {
+    // 初始化
+    initialization() {
+      // 客户主键赋值
+      this.params.customersId = this.customersId;
+      this.params.customersName = this.customersName;
+      if (this.pageStu == "check" || this.pageStu == "update") {
+        this.getDetails(this.row);
+      }
     },
-    data() {
-      return {
-        // 遮罩层
-        loading: true,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: true,
-        // 总条数
-        total: 0,
-        // 客户负责人表格数据
-        customersResponsiblePersonList: [],
-        // 表单参数
-        form: {
-          id: null,
-          person: null,
-          personName: null,
-          customersName: null,
-          relationshipType: null,
-          productionLine: null,
-          startDate: null,
-          endDate: null,
-          customersId: null,
-          tenantId: null,
-          revision: null,
-          createBy: null,
-          createTime: null,
-          updateBy: null,
-          updateTime: null,
-          delFlag: null
-        },
-        // 表单校验
-        rules: {
-          personName: [{
-            required: true,
-            message: '人员名称不能为空',
-            trigger: 'blur'
-          }],
-          relationshipType: [{
-            required: true,
-            message: '关系类型不能为空',
-            trigger: 'blur'
-          }],
-          startDate: [{
-            required: true,
-            message: '开始日期不能为空',
-            trigger: 'blur'
-          }],
-          productionLine: [{
-            required: true,
-            message: '产线不能为空',
-            trigger: 'blur'
-          }],
-        },
-      };
+    // 取消按钮
+    cancel() {
+      this.$emit("jugislist", false);
     },
-    created() {
-      this.initialization();
+    /** 提交按钮 */
+    submitForm(prop) {
+      this.$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            let { params } = this;
+            let { code, msg } =
+              params.id != null
+                ? await updateCustomersResponsiblePerson(params)
+                : await addCustomersResponsiblePerson(params);
+            if (code == 200) {
+              this.$notify.success(msg);
+              this.cancel();
+              this.$parent.handleCheck(params.customersId);
+            }
+          } catch (error) {}
+        }
+      });
     },
-    methods: {
-      // 初始化
-      initialization() {
-        // 客户主键赋值
-        this.form.customersId = this.customersId;
-        this.form.customersName = this.customersName;
-        if (this.pageStu == 'check' || this.pageStu == 'update') {
-          this.getDetails(this.row);
+    /** 获取详情 */
+    getDetails(row) {
+      getCustomersResponsiblePerson(row.id).then((res) => {
+        if (res.code == 200) {
+          this.params = res.data;
         }
-      },
-      // 取消按钮
-      cancel() {
-        this.$emit('jugislist', false);
-      },
-      /** 提交按钮 */
-      submitForm() {
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.id != null) {
-              updateCustomersResponsiblePerson(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.cancel();
-                this.$parent.handleCheck(this.form.customersId);
-              });
-            } else {
-              addCustomersResponsiblePerson(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.cancel();
-                this.$parent.handleCheck(this.form.customersId);
-              });
-            }
-          }
-        });
-      },
-      /** 获取详情 */
-      getDetails(row) {
-        getCustomersResponsiblePerson(row.id).then(res => {
-          if (res.code == 200) {
-            this.form = res.data;
-          }
-        })
-      },
-    }
-  }
-
+      });
+    },
+  },
+};
 </script>