src/views/client/followupRecords/AddFollowupRecordsDialog.vue
@@ -24,12 +24,23 @@
            <el-row>
              <el-col :span="12" v-if="isUnflod">
                <el-form-item label="跟进记录编号" prop="number">
                  <WordInput
                  <el-input
                    v-if="
                      codenumer &&
                      (explain != '' || isIdDisabled) &&
                      method == 0
                      editConfig.title == '编辑' ||
                      (editConfig.title == '新建' &&
                        codenumer &&
                        (explain != '' || isIdDisabled))
                    "
                    :disabled="editConfig.title == '编辑'"
                    v-model="editConfig.infomation.number"
                    placeholder="请输入编码"
                  >
                  </el-input>
                  <span  v-else-if="editConfig.title == '新建'" style="color: #f56c6c"
                    >请优先配置编码规范 <el-button type="text" @click="numberClick"> 配置规范 </el-button></span
                  >
                  <!-- <WordInput
                    v-if="codenumer && (explain != '' || isIdDisabled) && method == 0"
                    :codenumer="codenumer"
                    :sum="sum"
                    :disabled="this.editConfig.title !== '新建' || isIdDisabled"
@@ -37,12 +48,9 @@
                    @codeList="codeList"
                  />
                  <span v-else-if="method == 0" style="color: #f56c6c"
                    >请优先配置编码规范
                    <el-button type="text" @click="numberClick">
                      配置规范
                    </el-button></span
                    >请优先配置编码规范 <el-button type="text" @click="numberClick"> 配置规范 </el-button></span
                  >
                  <span v-else>自动生成</span>
                  <span v-else>自动生成</span> -->
                </el-form-item>
              </el-col>
              <el-col :span="12">
@@ -397,12 +405,11 @@
import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog";
import SelectChanceDialog from "@/views/other/commonDialog/SelectChanceDialog";
import SelectLeadDialog from "@/views/other/commonDialog/SelectLeadDialog";
import codeMixin from "./mixin/codeMixin";
import { getContactList } from "@/api/client/contacts"
import codeMixin from "@/components/makepager/mixin/codeMixin";
import { getContactList } from "@/api/client/contacts";
import { mapActions } from "vuex";
import { getSaleChanceList } from "@/api/sales/salesOpportunity";
import { getSalesLeadsList } from "@/api/client/salesLead"
import { getSalesLeadsList } from "@/api/client/salesLead";
export default {
  name: "AddFollowupRecordsDialog",
@@ -420,8 +427,8 @@
    },
    isDetail: {
      type: Boolean,
      default: false
    }
      default: false,
    },
  },
  components: {
    SelectClientDialog,
@@ -436,15 +443,15 @@
    clientList() {
      return this.$store.state.getClientName.clientList;
    },
    contactNamelist() {
      return this.$store.state.getClientName.contactNamelist;
    },
    // contactNamelist() {
    //   return this.$store.state.getClientName.contactNamelist
    // },
    // saleChancelist() {
    //   return this.$store.state.getClientName.saleChancelist
    // },
    saleLeadlist() {
      return this.$store.state.getClientName.saleLeadlist;
    },
    // saleLeadlist() {
    //   return this.$store.state.getClientName.saleLeadlist
    // }
  },
  data() {
    return {
@@ -452,7 +459,7 @@
      editConfig: this.editContactsConfig,
      rules: {
        number: [
          { required: true, message: "请输入跟进记录编号", trigger: "blur" },
          { required: true, validator: this.validateCheckCode, trigger: ["blur",'change'] },
        ],
        member_id: [
          { required: true, message: "请选择负责人", trigger: "change" },
@@ -461,7 +468,7 @@
          { required: true, message: "请输入跟进记录", trigger: "blur" },
        ],
        client_name: [
          { required: true, message: "请选择客户名称", trigger: "change" },
          { required: true, validator: this.checkClient, trigger: "change" },
        ],
        contact_name: [
          { required: true, message: "请选择联系人姓名", trigger: "change" },
@@ -498,19 +505,19 @@
        editVisible: false,
        title: "",
        infomation: {},
        search_map:{}
        search_map: {},
      },
      editSelectChanceConfig: {
        editVisible: false,
        title: "",
        infomation: {},
        search_map:{},
        search_map: {},
      },
      editSelectLeadConfig: {
        editVisible: false,
        title: "",
        infomation: {},
        search_map:{},
        search_map: {},
      },
      clientId: this.editContactsConfig.infomation.client_id,
      contactId: this.editContactsConfig.infomation.contact_id,
@@ -522,9 +529,9 @@
  },
  created() {
    this.$store.dispatch("geClient");
    this.$store.dispatch("geContact");
    // this.$store.dispatch("geContact")
    // this.$store.dispatch("geChance")
    this.$store.dispatch("geLead");
    // this.$store.dispatch("geLead")
    this.getCommonData();
    this.getContactInfoList();
    this.formInfo();
@@ -535,12 +542,9 @@
        this.formInfo();
      }
    },
    "editContactsConfig.infomation.codeStandID"() {
      this.formInfo();
    },
  },
  methods: {
    ...mapActions(["getContactFilter","getLeadFilter"]),
    ...mapActions(["getContactFilter", "getLeadFilter"]),
    formInfo() {
      this.objCode.type = "跟进记录编码";
      this.objCode.codeStandID = "";
@@ -554,7 +558,7 @@
        console.log(res);
        this.clientStatusOptions = res.data.client_status;
        this.memberOptions = res.data.member;
        this.dataProcess();
        // this.dataProcess()
      });
    },
    async getContactInfoList() {
@@ -626,7 +630,6 @@
          sales_leads_id: this.saleLeadId || 0,
          topic: data.topic || "",
          codeStandID: data.ID,
          codeRule: this.codeRule,
        },
      };
      let params = {};
@@ -675,32 +678,42 @@
        );
      };
    },
    async handleSelectClient(value, item) {
      if (value === "client") {
        console.log(item,"item")
        this.editSelectContactConfig.search_map.client_id=item.id
        this.editSelectChanceConfig.search_map.client_id=item.id
        this.editSelectLeadConfig.search_map.name=item.name
        await getContactList({
        search_map:{
          client_id:item.id
    // 联系人列表
    async getContactList(item) {
      await getContactList({
        search_map: {
          client_id: item.id,
        },
        page: 1,
        pageSize: 15
        }).then((res) => {
          if (res.code === 200) {
            this.getContactFilter(res.data.list);
          }
        });
        await getSalesLeadsList({
          search_map:{
            name:item.name
          },
        }).then((res) => {
          if (res.code === 200) {
            this.getLeadFilter(res.data.list);
          }
        });
        pageSize: 15,
      }).then((res) => {
        if (res.code === 200) {
          this.contactNamelist = res.data.list;
        }
      });
    },
    // 销售线索
    async getSalesLeadsList(item) {
      await getSalesLeadsList({
        search_map: {
          name: item.name,
        },
      }).then((res) => {
        if (res.code === 200) {
          this.saleLeadlist = res.data.list;
        }
      });
    },
    async handleSelectClient(value, item) {
      if (value === "client") {
        this.editConfig.infomation.contact_name = "";
        this.editConfig.infomation.sales_leads_name = "";
        this.editConfig.infomation.sale_chance_name = "";
        this.editSelectContactConfig.search_map.client_id = item.id;
        this.editSelectChanceConfig.search_map.client_id = item.id;
        this.editSelectLeadConfig.search_map.name = item.name;
        this.getContactList(item);
        this.getSalesLeadsList(item);
        this.clientId = item.id;
        this.editConfig.infomation.client_name = item.name;
        this.isChance = false;
@@ -732,8 +745,16 @@
        this.editConfig.infomation.contact_name = row.name;
        this.contactId = row.id;
      } else if (value === "client") {
        this.editConfig.infomation.client_name = row.name;
        this.editConfig.infomation.contact_name = "";
        this.editConfig.infomation.sales_leads_name = "";
        this.editConfig.infomation.sale_chance_name = "";
        this.editSelectContactConfig.search_map.client_id = row.id;
        this.editSelectChanceConfig.search_map.client_id = row.id;
        this.editSelectLeadConfig.search_map.name = row.name;
        this.getContactList(row);
        this.getSalesLeadsList(row);
        this.clientId = row.id;
        this.editConfig.infomation.client_name = row.name;
        this.isChance = false;
        this.getChanceList(row.id);
      } else if (value === "chance") {
@@ -747,6 +768,9 @@
    // 清除已选择用户
    clearupClient(value) {
      if (value === "client") {
        this.editConfig.infomation.contact_name = "";
        this.editConfig.infomation.sales_leads_name = "";
        this.editConfig.infomation.sale_chance_name = "";
        this.editConfig.infomation.client_name = "";
        this.clientId = 0;
        this.isChance = true;
@@ -777,6 +801,17 @@
        this.isUnflod = true;
      }
    },
    // 客户名称单独校验
    checkClient(rule, value, callback) {
      if (
        this.editConfig.infomation.client_name &&
        this.editConfig.infomation.client_name.length > 0
      ) {
        callback();
      } else {
        callback(new Error("请选择客户名称"));
      }
    },
  },
};
</script>