yangfeng
2023-08-11 78cf30802189becef2725af73f37b5d2cb28600f
src/views/other/commonDialog/SelectCommonDialog.vue
@@ -32,9 +32,8 @@
</template>
<script>
import { getMasterOrderList } from "@/api/sales/masterOrder"
export default {
  name: "EditSelChanceDialog",
  name: "EditSelCommonDialog",
  props: {
    editCommonConfig: {
      type: Object,
@@ -42,7 +41,7 @@
        return {
          editVisible: false,
          title: "",
          infomation: {}
          tableInfomation: []
        }
      }
    }
@@ -54,7 +53,7 @@
      dialogWidth: "50%",
      editConfig: this.editCommonConfig,
      queryInput: "",
      select: "1",
      select: "全部字段",
      tableData: [],
      searchSelOptions: [],
      loading: false,
@@ -63,62 +62,85 @@
    }
  },
  created() {
    this.getData()
    this.setTable()
  },
  methods: {
    setTable() {
      if (this.editConfig.title === "销售总单") {
        this.tableList = {
          tableInfomation: [],
          tableInfomation: this.editConfig.tableInfomation,
          tableColumn: [
            { label: "单据编号", prop: "number", isClick: true }, // 单据编号
            { label: "负责人", prop: "member_id" } // 负责人
          ]
        }
      } else if (this.editConfig.title === "服务合同") {
        this.tableList = {
          tableInfomation: this.editConfig.tableInfomation,
          tableColumn: [
            { label: "客户名称", prop: "clientId" }, // 客户名称
            { label: "服务合同编号", prop: "number", isClick: true }, // 服务合同编号
            { label: "负责人", prop: "memberId" }, // 负责人
            { label: "合计", prop: "total" }, // 合计
            { label: "签约日期", prop: "signTime", isTime: true }, // 签约日期
            { label: "合同状态", prop: "serviceContractStatusId" } // 合同状态
          ]
        }
      } else if (this.editConfig.title === "销售明细单") {
        this.tableList = {
          tableInfomation: this.editConfig.tableInfomation,
          tableColumn: [
            { label: "客户名称", prop: "clientId" }, // 客户名称
            { label: "订单编号", prop: "number", isClick: true }, // 订单编号
            { label: "签约日期", prop: "signTime" }, // 签约日期
            { label: "销售负责人", prop: "memberId" }, // 销售负责人
            { label: "合计", prop: "tptal" } // 合计
          ]
        }
      } else if (this.editConfig.title === "报价单") {
        this.tableList = {
          tableInfomation: this.editConfig.tableInfomation,
          tableColumn: [
            { label: "报价单号", prop: "number", isClick: true }, // 报价单号
            { label: "销售负责人", prop: "memberId" } // 销售负责人
          ]
        }
      } else if (this.editConfig.title === "客户服务单") {
        this.tableList = {
          tableInfomation: this.editConfig.tableInfomation,
          tableColumn: [
            { label: "服务单编号", prop: "serviceNumber", isClick: true }, // 服务单编号
            { label: "主题", prop: "subject" }, // 主题
            { label: "服务方式", prop: "serviceType_name" }, // 服务方式
            { label: "服务人员", prop: "serviceManId" }, // 服务人员
            { label: "优先级别", prop: "priorityLevelId" }, // 优先级别
            { label: "处理状态", prop: "status" }, // 处理状态
            { label: "客户签名", prop: "qianming" } // 客户签名
          ]
        }
      }
      this.commonOptions = [{ value: 1, name: "全部字段" }]
      this.commonOptions = [{ id: 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 })
        this.commonOptions.push({ id: (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")
      } else if (this.editConfig.title === "服务合同") {
        this.$emit("selClient", row, "serviceContract")
      } else if (this.editConfig.title === "销售明细单") {
        this.$emit("selClient", row, "contract")
      } else if (this.editConfig.title === "报价单") {
        this.$emit("selClient", row, "quotation")
      } else if (this.editConfig.title === "客户服务单") {
        this.$emit("selClient", row, "customService")
      }
    }
  }