yangfeng
2023-08-01 ebddc02611b0373c1d5bfa342bd781fb5eb82009
src/views/service/orderManage/index.vue
@@ -12,13 +12,14 @@
    <SearchCommonView ref="searchCommonView" :query-class-options="queryClassOptions" :search-options="searchOptions" />
    <div class="btn-pager">
      <PublicFunctionBtnView :receive="true" :submit-approval="true" :operates-list="operatesList" />
      <PagerView class="page" />
      <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
    </div>
    <TableCommonView ref="tableListRef" :table-list="tableList">
      <template slot="tableButton">
        <el-table-column label="操作" width="120">
        <el-table-column label="操作" width="90">
          <template slot-scope="scope">
            <el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
            <el-button @click="delClick(scope.row.id)" type="text" size="small">删除</el-button>
          </template>
        </el-table-column>
      </template>
@@ -30,10 +31,13 @@
<script>
import AddOrderManageDialog from "@/views/service/orderManage/AddOrderManageDialog"
import { getOrderManageList, getDelOrderManage } from "@/api/serviceManage/orderManage"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
export default {
  name: "SalesLead",
  props: {},
  mixins: [pageMixin],
  components: {
    AddOrderManageDialog
  },
@@ -73,28 +77,19 @@
  },
  created() {
    this.setTable()
    this.getData()
  },
  methods: {
    setTable() {
      this.tableList = {
        tableInfomation: [
          {
            orderNumber: "LEA110",
            customName: "上海通用机械有限公司",
            contactName: "董奇伟",
            servicePerson: "系统管理员",
            orderStatus: "已结单",
            repairSource: "电话报修",
            orderType: "保内收费"
          }
        ],
        tableInfomation: [],
        tableColumn: [
          { label: "工单编号", prop: "orderNumber", min: 100 }, // 工单编号
          { label: "客户名称", prop: "customName", min: 130 }, // 客户名称
          { label: "工单编号", prop: "number", min: 100 }, // 工单编号
          { label: "客户名称", prop: "clientId", min: 130 }, // 客户名称
          { label: "联系人姓名", prop: "contactName" }, // 联系人姓名
          { label: "服务人员", prop: "servicePerson" }, // 服务人员
          { label: "工单状态", prop: "orderStatus" }, // 工单状态
          { label: "报修来源", prop: "repairSource" }, // 报修来源
          { label: "服务人员", prop: "name" }, // 服务人员
          { label: "工单状态", prop: "orderType" }, // 工单状态
          { label: "报修来源", prop: "reportSourceId" }, // 报修来源
          { label: "工单类型", prop: "orderType" } // 工单类型
        ]
      }
@@ -104,6 +99,39 @@
        this.searchOptions.push({ value: (i + 1).toString(), label: label })
      }
    },
    // 请求数据
    async getData() {
      this.loading = true
      await getOrderManageList({
        keyword: "",
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      })
        .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 || []
              this.pagerOptions.totalCount = res.data.count
            } else {
              this.tableList.tableInfomation = []
            }
          } else {
            this.tableList.tableInfomation = []
          }
          this.loading = false
        })
        .catch((err) => {
          console.log(err)
          this.tableList.tableInfomation = []
          this.loading = false
        })
    },
    // tab切换
    tabsClick(tab, event) {
      console.log(tab, event)
@@ -112,39 +140,37 @@
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = {
        customName: "",
        orderNumber: "CS21",
        orderName: "",
        orderType: "",
        contactName: "",
        repairSource: "",
        selSourceOrder: "",
        problemDesc: "",
        approvalWorkflow: "",
        approvalSteps: "",
        approvalPerson: "",
        approvalOpinion: ""
      }
      this.editConfig.infomation = {}
    },
    // 编辑
    handleClick(row) {
      console.log(row)
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = {
        orderNumber: row.orderNumber,
        orderName: row.orderName,
        orderType: row.orderType,
        contactName: row.contactName,
        repairSource: row.repairSource,
        selSourceOrder: row.selSourceOrder,
        problemDesc: row.problemDesc,
        approvalWorkflow: "",
        approvalSteps: "",
        approvalPerson: "",
        approvalOpinion: ""
      }
      this.editConfig.infomation = { ...row }
    },
    // 删除
    delClick(id) {
      this.$confirm("是否确认删除?", "警告", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(function () {
          return getDelOrderManage({ id: id })
        })
        .then((response) => {
          if (response.code === 200) {
            this.$message.success("删除成功")
            this.getData()
          } else {
            this.$message.warning("删除失败")
          }
        })
        .catch(function () {})
    },
    getSelectArray(val) {
      console.log(val)
    }
  }
}