yangfeng
2023-07-31 9556ecc3c377d2e8e8d3659b7c56f9e35ff0c626
增加联系人姓名、销售机会、销售线索等弹窗选择项
3个文件已添加
10个文件已修改
1010 ■■■■ 已修改文件
src/components/makepager/TableCommonView.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/getClientName.js 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/client/followupRecords/AddFollowupRecordsDialog.vue 166 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/client/followupRecords/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectChanceDialog.vue 191 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectClientDialog.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectCommonDialog.vue 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectContactDialog.vue 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/commonDialog/SelectLeadDialog.vue 158 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/quotation/AddQuotationDialog.vue 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue 109 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/subOrder/AddSubOrderDialog.vue 134 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sales/subOrder/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/makepager/TableCommonView.vue
@@ -14,7 +14,6 @@
      :header-cell-style="{ background: '#ECF4FF', color: '#666' }"
    >
      <el-table-column v-if="selectBox" type="selection" width="40"> </el-table-column>
      <el-table-column
        v-for="(item, i) in tableList.tableColumn"
        :key="i"
@@ -32,6 +31,9 @@
            dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop]) === "1900-01-01 08:00:00"
              ? "--"
              : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row[item.prop])
          }}</span>
          <span v-else-if="item.isClick" class="sel-name" @click="selNameClick(scope.row)">{{
            scope.row[item.prop]
          }}</span>
          <span v-else>{{ scope.row[item.prop] ? scope.row[item.prop] : "--" }}</span>
        </template>
@@ -52,7 +54,6 @@
      type: Boolean,
      default: true
    },
    tableList: {
      type: Object,
      default: () => {
@@ -180,6 +181,9 @@
        }
      }
      return fmt
    },
    selNameClick(row) {
      this.$emit("selCommonClick", row)
    }
  }
}
@@ -198,6 +202,10 @@
    background-color: $color-primary;
    border-radius: 4px;
  }
  .sel-name {
    color: $color-primary;
    cursor: pointer;
  }
}
::v-deep {
  .el-table__footer-wrapper tbody td.el-table__cell {
src/store/modules/getClientName.js
@@ -1,12 +1,17 @@
import { getClientList } from "@/api/client/client" // 导入接口
import { getContactList } from "@/api/client/contacts"
import { getSaleChanceList } from "@/api/sales/salesOpportunity"
import { getSalesLeadsList } from "@/api/client/salesLead"
import { getMasterOrderList } from "@/api/sales/masterOrder"
import { Message } from "element-ui"
export default {
  state: {
    clientList: [], // 客户列表
    contactNamelist: [] // 联系人
    contactNamelist: [], // 联系人
    saleChancelist: [], // 销售机会
    saleLeadlist: [], // 销售线索
    masterOrderList: [] // 销售总单
  },
  mutations: {
    clientNameList(state, payload) {
@@ -17,6 +22,12 @@
    },
    saleChancelist(state, payload) {
      state.saleChancelist = payload
    },
    saleLeadlist(state, payload) {
      state.saleLeadlist = payload
    },
    masterOrderList(state, payload) {
      state.masterOrderList = payload
    }
  },
  actions: {
@@ -46,6 +57,24 @@
          Message.error(res.msg)
        }
      })
    },
    geLead(context) {
      getSalesLeadsList().then((res) => {
        if (res.code == 200) {
          context.commit("saleLeadlist", res.data.list)
        } else {
          Message.error(res.msg)
        }
      })
    },
    geMaster(context) {
      getMasterOrderList().then((res) => {
        if (res.code == 200) {
          context.commit("masterOrderList", res.data.list)
        } else {
          Message.error(res.msg)
        }
      })
    }
  }
}
src/views/client/followupRecords/AddFollowupRecordsDialog.vue
@@ -25,7 +25,11 @@
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="querySearchAsync"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'client')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('client', $event)"
                    ></el-autocomplete>
@@ -60,11 +64,15 @@
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系人姓名" prop="contact_id">
                <el-form-item label="联系人姓名" prop="contact_name">
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.contact_name"
                      :fetch-suggestions="queryContactAsync"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'contact')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('contact', $event)"
                    ></el-autocomplete>
@@ -110,26 +118,47 @@
                </el-form-item>
              </el-col>
              <el-col v-if="isUnflod" :span="12">
                <el-form-item label="销售机会" prop="sale_chance_id">
                <el-form-item label="销售机会" prop="sale_chance_name">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.sale_chance_id"></el-input>
                    <!-- <el-autocomplete
                      v-model="editConfig.infomation.sale_chance_id"
                      :fetch-suggestions="queryChanceAsync"
                    <el-autocomplete
                      v-model="editConfig.infomation.sale_chance_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'chance')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('chance', $event)"
                    ></el-autocomplete> -->
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit-outline"></i></div>
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('chance')">
                      <i class="el-icon-circle-plus-outline"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient('chance')">
                      <i class="el-icon-edit-outline"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="销售线索" prop="sales_leads_id">
                <el-form-item label="销售线索" prop="sales_leads_name">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.sales_leads_id"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit-outline"></i></div>
                    <!-- <el-input v-model="editConfig.infomation.sales_leads_id"></el-input> -->
                    <el-autocomplete
                      v-model="editConfig.infomation.sales_leads_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'lead')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('lead', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('lead')">
                      <i class="el-icon-circle-plus-outline"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient('lead')">
                      <i class="el-icon-edit-outline"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
@@ -222,6 +251,18 @@
        :edit-common-config="editSelectContactConfig"
        @selClient="selClient"
      />
      <!-- 选择销售机会 -->
      <SelectChanceDialog
        v-if="editSelectChanceConfig.editVisible"
        :edit-common-config="editSelectChanceConfig"
        @selClient="selClient"
      />
      <!-- 选择销售线索 -->
      <SelectLeadDialog
        v-if="editSelectLeadConfig.editVisible"
        :edit-common-config="editSelectLeadConfig"
        @selClient="selClient"
      />
    </el-dialog>
  </div>
</template>
@@ -231,6 +272,8 @@
import { getAddFollowRecord, getUpdateFollowRecord } from "@/api/client/followupRecords"
import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog"
import SelectChanceDialog from "@/views/other/commonDialog/SelectChanceDialog"
import SelectLeadDialog from "@/views/other/commonDialog/SelectLeadDialog"
export default {
  name: "AddFollowupRecordsDialog",
  props: {
@@ -245,7 +288,7 @@
      }
    }
  },
  components: { SelectClientDialog, SelectContactDialog },
  components: { SelectClientDialog, SelectContactDialog, SelectChanceDialog, SelectLeadDialog },
  computed: {
    searchCommonHeight() {
      return this.$refs.searchCommonView.offsetHeight
@@ -258,6 +301,9 @@
    },
    saleChancelist() {
      return this.$store.state.getClientName.saleChancelist
    },
    saleLeadlist() {
      return this.$store.state.getClientName.saleLeadlist
    }
  },
  data() {
@@ -293,15 +339,27 @@
        title: "",
        infomation: {}
      },
      editSelectChanceConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      editSelectLeadConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      clientId: this.editContactsConfig.infomation.client_id,
      contactId: this.editContactsConfig.infomation.contact_id
      // saleChanceId: this.editContactsConfig.infomation.sale_chance_id
      contactId: this.editContactsConfig.infomation.contact_id,
      saleChanceId: this.editContactsConfig.infomation.sale_chance_id,
      saleLeadId: this.editContactsConfig.infomation.sales_leads_id
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.$store.dispatch("geContact")
    this.$store.dispatch("geChance")
    this.$store.dispatch("geLead")
    this.getCommonData()
  },
  methods: {
@@ -311,10 +369,23 @@
          console.log(res)
          this.clientStatusOptions = res.data.client_status
          this.memberOptions = res.data.member
          this.dataProcess()
        })
        .catch((err) => {
          console.log(err)
        })
    },
    dataProcess() {
      this.saleChancelist.map((item) => {
        if (this.saleChanceId === item.id) {
          this.editConfig.infomation.sale_chance_name = item.name
        }
      })
      this.saleLeadlist.map((item) => {
        if (this.saleLeadId === item.id) {
          this.editConfig.infomation.sales_leads_name = item.name
        }
      })
    },
    handleClose() {
      this.editConfig.visible = false
@@ -323,13 +394,10 @@
    saveClick(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log(this.editConfig.infomation)
          const params = this.saveParams()
          console.log(params)
          if (this.editConfig.title === "新建") {
            getAddFollowRecord(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
@@ -345,7 +413,6 @@
          } else {
            getUpdateFollowRecord(params)
              .then((res) => {
                console.log(res)
                this.editConfig.visible = false
                if (res.code === 200) {
                  this.$message({
@@ -380,8 +447,8 @@
          number: data.number || "",
          purpose: data.purpose || "",
          record: data.record || "",
          sale_chance_id: parseInt(data.sale_chance_id), //data.sale_chance_id ||
          sales_leads_id: 0, // data.sales_leads_id ||
          sale_chance_id: parseInt(this.saleChanceId), //data.sale_chance_id ||
          sales_leads_id: parseInt(this.saleLeadId), // data.sales_leads_id ||
          topic: data.topic || ""
        }
      }
@@ -394,20 +461,17 @@
      return params
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb) {
      var restaurants = this.clientList
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
    // 选择联系人姓名
    queryContactAsync(queryString, cb) {
      var restaurants = this.contactNamelist
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
    // 销售机会
    queryChanceAsync(queryString, cb) {
      var restaurants = this.saleChancelist
    querySearchAsync(queryString, cb, value) {
      var restaurants = []
      if (value === "client") {
        restaurants = this.clientList
      } else if (value === "contact") {
        restaurants = this.contactNamelist
      } else if (value === "chance") {
        restaurants = this.saleChancelist
      } else {
        restaurants = this.saleLeadlist
      }
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
@@ -417,13 +481,14 @@
      }
    },
    handleSelectClient(value, item) {
      console.log(value)
      if (value === "client") {
        this.clientId = item.id
      } else if (value === "contact") {
        this.contactId = item.id
      } else {
      } else if (value === "chance") {
        this.saleChanceId = item.id
      } else {
        this.saleLeadId = item.id
      }
    },
    selClientClick(value) {
@@ -431,16 +496,25 @@
        this.editSelectClientConfig.editVisible = true
      } else if (value === "contact") {
        this.editSelectContactConfig.editVisible = true
      } else if (value === "chance") {
        this.editSelectChanceConfig.editVisible = true
      } else {
        this.editSelectLeadConfig.editVisible = true
      }
    },
    selClient(row, value) {
      console.log(value)
      if (value === "contact") {
        this.editConfig.infomation.contact_name = row.name
        this.contactId = row.id
      } else {
      } else if (value === "client") {
        this.editConfig.infomation.client_name = row.name
        this.clientId = row.id
      } else if (value === "chance") {
        this.editConfig.infomation.sale_chance_name = row.name
        this.saleChanceId = row.id
      } else {
        this.editConfig.infomation.sales_leads_name = row.name
        this.saleLeadId = row.id
      }
    },
    // 清除已选择用户
@@ -448,9 +522,15 @@
      if (value === "client") {
        this.editConfig.infomation.client_name = ""
        this.clientId = 0
      } else {
      } else if (value === "contact") {
        this.editConfig.infomation.contact_name = ""
        this.contactId = 0
      } else if (value === "chance") {
        this.editConfig.infomation.sale_chance_name = ""
        this.saleChanceId = 0
      } else {
        this.editConfig.infomation.sales_leads_name = ""
        this.saleLeadId = 0
      }
    },
    // 添加附件
src/views/client/followupRecords/index.vue
@@ -63,7 +63,8 @@
        visible: false,
        title: "新建",
        infomation: {}
      }
      },
      saleChanceName: ""
    }
  },
  created() {
@@ -141,7 +142,7 @@
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = { ...row }
      this.editConfig.infomation = { ...row, sale_chance_name: "", sales_leads_name: "" }
    },
    // 删除
    delClick(id) {
src/views/other/commonDialog/SelectChanceDialog.vue
New file
@@ -0,0 +1,191 @@
<template>
  <div class="edit-selClient-box">
    <el-dialog
      :title="'销售机会'"
      :visible.sync="editConfig.editVisible"
      :width="dialogWidth"
      :before-close="handleClose"
      :append-to-body="true"
      :close-on-click-modal="false"
    >
      <div class="bg-view">
        <div class="query-bg">
          <el-input placeholder="请输入内容" v-model="queryInput" size="mini" class="input-with-select">
            <el-select v-model="select" slot="prepend" placeholder="请选择">
              <el-option label="全部字段" value="1"></el-option>
              <el-option label="销售机会编号" value="2"></el-option>
              <el-option label="机会名称" value="3"></el-option>
              <el-option label="销售阶段" value="4"></el-option>
              <el-option label="销售负责人" value="5"></el-option>
              <el-option label="预计成交日期" value="6"></el-option>
            </el-select>
          </el-input>
          <div class="btn">
            <el-button type="primary" size="mini" disabled>设置字段</el-button>
            <el-button type="primary" size="mini" disabled>快速创建</el-button>
          </div>
        </div>
        <el-table
          :data="tableData"
          border
          size="mini"
          v-loading="loading"
          :header-cell-style="{ background: '#f7f7f7' }"
        >
          <el-table-column label="销售机会编号" prop="number"></el-table-column>
          <el-table-column label="机会名称" prop="name" show-overflow-tooltip>
            <template slot-scope="scope">
              <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span>
            </template>
          </el-table-column>
          <el-table-column label="销售阶段" prop="sale_stage_id"></el-table-column>
          <el-table-column label="销售负责人" prop="member_id"></el-table-column>
          <el-table-column label="预计成交日期" prop="expected_time" show-overflow-tooltip>
            <template slot-scope="scope">
              <span>{{
                dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time) === "1900-01-01 08:00:00"
                  ? "--"
                  : dateFormat("YYYY-mm-dd HH:MM:SS", scope.row.expected_time)
              }}</span>
            </template>
          </el-table-column>
          <div slot="empty">
            <el-empty :image-size="100"></el-empty>
          </div>
        </el-table>
        <div slot="footer" class="dialog-footer">
          <div class="remark">说明:支持多字段模糊查询,仅显示符合条件的前5条数据</div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getSaleChanceList } from "@/api/sales/salesOpportunity"
export default {
  name: "EditSelChanceDialog",
  props: {
    editCommonConfig: {
      type: Object,
      default: () => {
        return {
          editVisible: false,
          title: "",
          infomation: {}
        }
      }
    }
  },
  components: {},
  computed: {},
  data() {
    return {
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      queryInput: "",
      select: "1",
      tableData: [],
      searchSelOptions: [],
      loading: false
    }
  },
  created() {
    this.getData()
  },
  methods: {
    handleClose() {
      this.editConfig.editVisible = false
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getSaleChanceList()
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item
                }
              })
              this.tableData = list.slice(0, 5) || []
            } else {
              this.tableData = []
            }
          } else {
            this.tableData = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableData = []
          this.loading = false
        })
    },
    selNameClick(row) {
      this.editConfig.editVisible = false
      console.log(row)
      this.$emit("selClient", row, "chance")
    },
    // 时间显示
    dateFormat(fmt, date) {
      let ret = ""
      date = new Date(date)
      const opt = {
        "Y+": date.getFullYear().toString(), // 年
        "m+": (date.getMonth() + 1).toString(), // 月
        "d+": date.getDate().toString(), // 日
        "H+": date.getHours().toString(), // 时
        "M+": date.getMinutes().toString(), // 分
        "S+": date.getSeconds().toString() // 秒
        // 有其他格式化字符需求可以继续添加,必须转化成字符串
      }
      for (let k in opt) {
        ret = new RegExp("(" + k + ")").exec(fmt)
        if (ret) {
          fmt = fmt.replace(ret[1], ret[1].length == 1 ? opt[k] : opt[k].padStart(ret[1].length, "0"))
        }
      }
      return fmt
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.bg-view {
  margin: 10px;
  .query-bg {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .el-input {
      width: 310px;
      .el-select {
        width: 100px;
      }
    }
    .btn {
      float: right;
    }
  }
}
.sel-name {
  color: $color-primary;
  cursor: pointer;
}
.dialog-footer {
  height: 40px;
  line-height: 40px;
  color: red;
}
::v-deep {
  .input-with-select .el-input-group__prepend {
    background-color: #fff;
  }
}
</style>
src/views/other/commonDialog/SelectClientDialog.vue
@@ -82,11 +82,7 @@
        return {
          editVisible: false,
          title: "",
          infomation: {
            name: "",
            color: "",
            setDefault: ""
          }
          infomation: {}
        }
      }
    }
@@ -142,7 +138,7 @@
    },
    selNameClick(row) {
      this.editConfig.editVisible = false
      this.$emit("selClient", row)
      this.$emit("selClient", row, "client")
    },
    // 时间显示
    dateFormat(fmt, date) {
src/views/other/commonDialog/SelectCommonDialog.vue
New file
@@ -0,0 +1,161 @@
<template>
  <div class="edit-selClient-box">
    <el-dialog
      :title="editCommonConfig.title"
      :visible.sync="editConfig.editVisible"
      :width="dialogWidth"
      :before-close="handleClose"
      :append-to-body="true"
      :close-on-click-modal="false"
    >
      <div class="bg-view">
        <div class="query-bg">
          <el-input placeholder="请输入内容" v-model="queryInput" size="mini" class="input-with-select">
            <el-select v-model="select" slot="prepend" placeholder="请选择">
              <el-option v-for="item in commonOptions" :key="item.id" :label="item.name" :value="item.name">
              </el-option>
            </el-select>
          </el-input>
          <div class="btn">
            <el-button type="primary" size="mini" disabled>设置字段</el-button>
            <el-button type="primary" size="mini" disabled>快速创建</el-button>
          </div>
        </div>
        <TableCommonView ref="tableListRef" :table-list="tableList" :select-box="false" @selCommonClick="selNameClick">
        </TableCommonView>
        <div slot="footer" class="dialog-footer">
          <div class="remark">说明:支持多字段模糊查询,仅显示符合条件的前5条数据</div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getMasterOrderList } from "@/api/sales/masterOrder"
export default {
  name: "EditSelChanceDialog",
  props: {
    editCommonConfig: {
      type: Object,
      default: () => {
        return {
          editVisible: false,
          title: "",
          infomation: {}
        }
      }
    }
  },
  components: {},
  computed: {},
  data() {
    return {
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      queryInput: "",
      select: "1",
      tableData: [],
      searchSelOptions: [],
      loading: false,
      tableList: {},
      commonOptions: []
    }
  },
  created() {
    this.getData()
    this.setTable()
  },
  methods: {
    setTable() {
      if (this.editConfig.title === "销售总单") {
        this.tableList = {
          tableInfomation: [],
          tableColumn: [
            { label: "单据编号", prop: "number", isClick: true }, // 单据编号
            { label: "负责人", prop: "member_id" } // 负责人
          ]
        }
      }
      this.commonOptions = [{ value: 1, name: "全部字段" }]
      for (let i = 1; i < this.tableList.tableColumn.length; i++) {
        const label = this.tableList.tableColumn[i].label
        this.commonOptions.push({ value: (i + 1).toString(), name: label })
      }
    },
    handleClose() {
      this.editConfig.editVisible = false
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getMasterOrderList()
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item
                }
              })
              this.tableList.tableInfomation = list.slice(0, 5) || []
            } else {
              this.tableList.tableInfomation = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableData = []
          this.loading = false
        })
    },
    selNameClick(row) {
      this.editConfig.editVisible = false
      if (this.editConfig.title === "销售总单") {
        this.$emit("selClient", row, "master")
      }
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.bg-view {
  margin: 10px;
  .query-bg {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .el-input {
      width: 310px;
      .el-select {
        width: 100px;
      }
    }
    .btn {
      float: right;
    }
  }
}
.sel-name {
  color: $color-primary;
  cursor: pointer;
}
.dialog-footer {
  height: 40px;
  line-height: 40px;
  color: red;
}
::v-deep {
  .input-with-select .el-input-group__prepend {
    background-color: #fff;
  }
}
</style>
src/views/other/commonDialog/SelectContactDialog.vue
@@ -62,11 +62,7 @@
        return {
          editVisible: false,
          title: "",
          infomation: {
            name: "",
            color: "",
            setDefault: ""
          }
          infomation: {}
        }
      }
    }
src/views/other/commonDialog/SelectLeadDialog.vue
New file
@@ -0,0 +1,158 @@
<template>
  <div class="edit-selClient-box">
    <el-dialog
      :title="'销售线索'"
      :visible.sync="editConfig.editVisible"
      :width="dialogWidth"
      :before-close="handleClose"
      :append-to-body="true"
      :close-on-click-modal="false"
    >
      <div class="bg-view">
        <div class="query-bg">
          <el-input placeholder="请输入内容" v-model="queryInput" size="mini" class="input-with-select">
            <el-select v-model="select" slot="prepend" placeholder="请选择">
              <el-option label="全部字段" value="1"></el-option>
              <el-option label="客户名称" value="2"></el-option>
              <el-option label="商机状态" value="3"></el-option>
              <el-option label="商机来源" value="4"></el-option>
            </el-select>
          </el-input>
          <div class="btn">
            <el-button type="primary" size="mini" disabled>设置字段</el-button>
            <el-button type="primary" size="mini" disabled>快速创建</el-button>
          </div>
        </div>
        <el-table
          :data="tableData"
          border
          size="mini"
          v-loading="loading"
          :header-cell-style="{ background: '#f7f7f7' }"
        >
          <el-table-column label="客户名称" prop="name" show-overflow-tooltip>
            <template slot-scope="scope">
              <span class="sel-name" @click="selNameClick(scope.row)">{{ scope.row.name }}</span>
            </template>
          </el-table-column>
          <el-table-column label="商机状态" prop="businessStatus"></el-table-column>
          <el-table-column label="商机来源" prop="sales_sources_id"></el-table-column>
          <div slot="empty">
            <el-empty :image-size="100"></el-empty>
          </div>
        </el-table>
        <div slot="footer" class="dialog-footer">
          <div class="remark">说明:支持多字段模糊查询,仅显示符合条件的前5条数据</div>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { getSalesLeadsList } from "@/api/client/salesLead"
export default {
  name: "EditSelChanceDialog",
  props: {
    editCommonConfig: {
      type: Object,
      default: () => {
        return {
          editVisible: false,
          title: "",
          infomation: {}
        }
      }
    }
  },
  components: {},
  computed: {},
  data() {
    return {
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      queryInput: "",
      select: "1",
      tableData: [],
      searchSelOptions: [],
      loading: false
    }
  },
  created() {
    this.getData()
  },
  methods: {
    handleClose() {
      this.editConfig.editVisible = false
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getSalesLeadsList()
        .then((res) => {
          console.log(res)
          if (res.code === 200) {
            if (res.data.list && res.data.list.length > 0) {
              const list = res.data.list.map((item) => {
                return {
                  ...item
                }
              })
              this.tableData = list.slice(0, 5) || []
            } else {
              this.tableData = []
            }
          } else {
            this.tableData = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableData = []
          this.loading = false
        })
    },
    selNameClick(row) {
      this.editConfig.editVisible = false
      console.log(row)
      this.$emit("selClient", row, "lead")
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.bg-view {
  margin: 10px;
  .query-bg {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    .el-input {
      width: 310px;
      .el-select {
        width: 100px;
      }
    }
    .btn {
      float: right;
    }
  }
}
.sel-name {
  color: $color-primary;
  cursor: pointer;
}
.dialog-footer {
  height: 40px;
  line-height: 40px;
  color: red;
}
::v-deep {
  .input-with-select .el-input-group__prepend {
    background-color: #fff;
  }
}
</style>
src/views/sales/quotation/AddQuotationDialog.vue
@@ -26,7 +26,11 @@
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="querySearchAsync"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'client')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('client', $event)"
                    ></el-autocomplete>
@@ -77,7 +81,11 @@
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.contact_name"
                      :fetch-suggestions="queryContactAsync"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'contact')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('contact', $event)"
                    ></el-autocomplete>
@@ -382,14 +390,13 @@
      this.editConfig.visible = false
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb) {
      var restaurants = this.clientList
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
    // 选择联系人姓名
    queryContactAsync(queryString, cb) {
      var restaurants = this.contactNamelist
    querySearchAsync(queryString, cb, value) {
      var restaurants = []
      if (value === "client") {
        restaurants = this.clientList
      } else if (value === "contact") {
        restaurants = this.contactNamelist
      }
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
src/views/sales/salesOpportunity/AddSalesOpportunityDialog.vue
@@ -26,14 +26,18 @@
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="querySearchAsync"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'client')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient"
                      @select="handleSelectClient('client', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick">
                    <div class="common-select-btn" @click="selClientClick('client')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient">
                    <div class="common-select-btn" @click="clearupClient('client')">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
@@ -54,8 +58,25 @@
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系人姓名" prop="contact_id">
                  <el-input v-model="editConfig.infomation.contact_id"></el-input>
                <el-form-item label="联系人姓名" prop="contact_name">
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.contact_name"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'contact')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient('contact', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('contact')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient('contact')">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
              <el-col :span="12">
@@ -122,7 +143,7 @@
                    size="mini"
                    style="width: 63%"
                  >
                    <el-option v-for="item in memberOptions" :key="item.id" :label="item.name" :value="item.id">
                    <el-option v-for="item in memberOptions" :key="item.id" :label="item.username" :value="item.id">
                    </el-option>
                  </el-select>
                </el-form-item>
@@ -482,6 +503,12 @@
        :edit-common-config="editSelectClientConfig"
        @selClient="selClient"
      />
      <!-- 选择联系人 -->
      <SelectContactDialog
        v-if="editSelectContactConfig.editVisible"
        :edit-common-config="editSelectContactConfig"
        @selClient="selClient"
      />
    </el-dialog>
  </div>
</template>
@@ -490,6 +517,7 @@
import { getAllData } from "@/api/client/client"
import { getAddSaleChance, getUpdateSaleChance } from "@/api/sales/salesOpportunity"
import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
import SelectContactDialog from "@/views/other/commonDialog/SelectContactDialog"
export default {
  name: "AddSalesOpportunityDialog",
  props: {
@@ -504,13 +532,16 @@
      }
    }
  },
  components: { SelectClientDialog },
  components: { SelectClientDialog, SelectContactDialog },
  computed: {
    searchCommonHeight() {
      return this.$refs.searchCommonView.offsetHeight
    },
    clientList() {
      return this.$store.state.getClientName.clientList
    },
    contactNamelist() {
      return this.$store.state.getClientName.contactNamelist
    }
  },
  data() {
@@ -543,11 +574,19 @@
        title: "",
        infomation: {}
      },
      restaurants: []
      editSelectContactConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      restaurants: [],
      clientId: this.editCommonConfig.infomation.client_id,
      contactId: this.editCommonConfig.infomation.contact_id
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.$store.dispatch("geContact")
    this.getCommonData()
  },
  methods: {
@@ -629,9 +668,9 @@
        budget: data.budget || 0,
        capital_budget: data.capital_budget || "",
        city_id: data.city_id || 0,
        client_id: data.client_id || 0,
        client_id: parseInt(this.clientId),
        competitors: data.competitors || "",
        contact_id: data.contact_id || 0,
        contact_id: parseInt(this.contactId),
        country_id: data.country_id || 0,
        currency: data.currency || 0,
        disadvantages: data.disadvantages || "",
@@ -663,9 +702,13 @@
      return params
    },
    // 选择用户相关方法
    querySearchAsync(queryString, cb) {
      console.log(this.clientList)
      var restaurants = this.clientList
    querySearchAsync(queryString, cb, value) {
      var restaurants = []
      if (value === "client") {
        restaurants = this.clientList
      } else if (value === "contact") {
        restaurants = this.contactNamelist
      }
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
      cb(results)
    },
@@ -674,20 +717,38 @@
        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
      }
    },
    handleSelectClient(item) {
      this.editConfig.infomation.client_id = item.id
    handleSelectClient(value, item) {
      if (value === "client") {
        this.clientId = item.id
      } else if (value === "contact") {
        this.contactId = item.id
      }
    },
    selClientClick() {
      this.editSelectClientConfig.editVisible = true
    selClientClick(value) {
      if (value === "client") {
        this.editSelectClientConfig.editVisible = true
      } else if (value === "contact") {
        this.editSelectContactConfig.editVisible = true
      }
    },
    selClient(row) {
      this.editConfig.infomation.client_name = row.name
      this.editConfig.infomation.client_id = row.id
    selClient(row, value) {
      if (value === "contact") {
        this.editConfig.infomation.contact_name = row.name
        this.contactId = row.id
      } else if (value === "client") {
        this.editConfig.infomation.client_name = row.name
        this.clientId = row.id
      }
    },
    // 清除已选择用户
    clearupClient() {
      this.editConfig.infomation.client_name = ""
      this.editConfig.infomation.client_id = 0
    clearupClient(value) {
      if (value === "client") {
        this.editConfig.infomation.client_name = ""
        this.clientId = 0
      } else if (value === "contact") {
        this.editConfig.infomation.contact_name = ""
        this.contactId = 0
      }
    },
    // 添加附件
    addAnnexClick() {},
src/views/sales/subOrder/AddSubOrderDialog.vue
@@ -25,14 +25,18 @@
                  <div class="custom-name">
                    <el-autocomplete
                      v-model="editConfig.infomation.client_name"
                      :fetch-suggestions="querySearchAsync"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'client')
                        }
                      "
                      value-key="name"
                      @select="handleSelectClient"
                      @select="handleSelectClient('client', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick">
                    <div class="common-select-btn" @click="selClientClick('client')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient">
                    <div class="common-select-btn" @click="clearupClient('client')">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
@@ -44,11 +48,24 @@
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="销售总单" prop="masterOrderId">
                <el-form-item label="销售总单" prop="masterOrderNumber">
                  <div class="custom-name">
                    <el-input v-model="editConfig.infomation.masterOrderId"></el-input>
                    <div class="common-select-btn"><i class="el-icon-circle-plus-outline" title="选择"></i></div>
                    <div class="common-select-btn"><i class="el-icon-edit" title="编辑"></i></div>
                    <el-autocomplete
                      v-model="editConfig.infomation.masterOrderNumber"
                      :fetch-suggestions="
                        (queryString, callback) => {
                          querySearchAsync(queryString, callback, 'master')
                        }
                      "
                      value-key="number"
                      @select="handleSelectClient('master', $event)"
                    ></el-autocomplete>
                    <div class="common-select-btn" @click="selClientClick('master')">
                      <i class="el-icon-circle-plus-outline" title="选择"></i>
                    </div>
                    <div class="common-select-btn" @click="clearupClient('master')">
                      <i class="el-icon-edit-outline" title="清除"></i>
                    </div>
                  </div>
                </el-form-item>
              </el-col>
@@ -184,6 +201,12 @@
        :edit-common-config="editSelectClientConfig"
        @selClient="selClient"
      />
      <!-- 选择销售总单 -->
      <SelectCommonDialog
        v-if="editSelectMasterConfig.editVisible"
        :edit-common-config="editSelectMasterConfig"
        @selClient="selClient"
      />
    </el-dialog>
  </div>
</template>
@@ -193,9 +216,11 @@
import { getAllData } from "@/api/client/client"
import { getAddSubOrder, getUpdateSubOrder } from "@/api/sales/subOrder"
import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog"
import SelectCommonDialog from "@/views/other/commonDialog/SelectCommonDialog"
export default {
  name: "SubOrderDialog",
  components: { CommonFormTableView, SelectClientDialog },
  components: { CommonFormTableView, SelectClientDialog, SelectCommonDialog },
  props: {
    editCommonConfig: {
      type: Object,
@@ -211,6 +236,9 @@
  computed: {
    clientList() {
      return this.$store.state.getClientName.clientList
    },
    masterOrderList() {
      return this.$store.state.getClientName.masterOrderList
    }
  },
  data() {
@@ -244,11 +272,19 @@
        editVisible: false,
        title: "",
        infomation: {}
      }
      },
      editSelectMasterConfig: {
        editVisible: false,
        title: "",
        infomation: {}
      },
      clientId: this.editCommonConfig.infomation.client_id,
      masterId: this.editCommonConfig.infomation.masterOrderId
    }
  },
  created() {
    this.$store.dispatch("geClient")
    this.$store.dispatch("geMaster")
    this.setTableForm()
    this.getCommonData()
  },
@@ -259,11 +295,19 @@
          console.log(res)
          if (res.code === 200) {
            this.memberOptions = res.data.member
            this.dataProcess()
          }
        })
        .catch((err) => {
          console.log(err)
        })
    },
    dataProcess() {
      this.masterOrderList.map((item) => {
        if (this.masterId === item.id) {
          this.editConfig.infomation.masterOrderNumber = item.number
        }
      })
    },
    // 保存
    saveClick(formName) {
@@ -315,8 +359,8 @@
      let data = this.editConfig.infomation
      let params = {
        id: this.editConfig.title === "新建" ? 0 : data.id,
        clientId: parseInt(data.client_id) || 0,
        masterOrderId: parseInt(data.masterOrderId) || 0,
        clientId: parseInt(this.clientId) || 0,
        masterOrderId: parseInt(this.masterId) || 0,
        memberId: data.memberId || 0,
        number: data.number || "",
        product: [
@@ -337,31 +381,67 @@
      this.editConfig.visible = false
    },
    // 选择客户相关方法
    querySearchAsync(queryString, cb) {
      var restaurants = this.clientList
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants
    querySearchAsync(queryString, cb, value) {
      var restaurants = []
      if (value === "client") {
        restaurants = this.clientList
      } else if (value === "master") {
        restaurants = this.masterOrderList
      }
      // else if (value === "chance") {
      //   restaurants = this.saleChancelist
      // } else {
      //   restaurants = this.saleLeadlist
      // }
      var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants
      cb(results)
    },
    createStateFilter(queryString) {
    createStateFilter(queryString, value) {
      return (state) => {
        return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        console.log(state)
        if (value === "client") {
          return state.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        } else if (value === "master") {
          return state.number.toLowerCase().indexOf(queryString.toLowerCase()) === 0
        }
      }
    },
    handleSelectClient(item) {
      this.editConfig.infomation.client_id = item.id
    handleSelectClient(value, item) {
      if (value === "client") {
        this.clientId = item.id
      } else if (value === "master") {
        this.masterId = item.id
      }
    },
    selClientClick() {
      this.editSelectClientConfig.editVisible = true
    selClientClick(value) {
      if (value == "client") {
        this.editSelectClientConfig.editVisible = true
      } else if (value == "master") {
        this.editSelectMasterConfig.title = "销售总单"
        this.editSelectMasterConfig.editVisible = true
      }
    },
    selClient(row) {
    selClient(row, value) {
      console.log(row)
      this.editConfig.infomation.client_name = row.name
      this.editConfig.infomation.client_id = row.id
      if (value == "client") {
        this.editConfig.infomation.client_name = row.name
        this.editConfig.infomation.client_id = row.id
        this.clientId = row.id
      } else if (value == "master") {
        this.editConfig.infomation.masterOrderNumber = row.number
        this.masterId = row.id
      }
    },
    // 清除已选择用户
    clearupClient() {
      this.editConfig.infomation.client_name = ""
      this.editConfig.infomation.client_id = 0
    clearupClient(value) {
      if (value == "client") {
        this.editConfig.infomation.client_name = ""
        this.editConfig.infomation.client_id = 0
        this.clientId = 0
      } else if (value == "master") {
        this.editConfig.infomation.masterOrderNumber = ""
        this.masterId = 0
      }
    },
    // 添加附件
    addAnnexClick() {},
src/views/sales/subOrder/index.vue
@@ -140,7 +140,7 @@
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = { ...row }
      this.editConfig.infomation = { ...row, masterOrderNumber: "" }
    },
    // 删除
    delClick(id) {