yangfeng
2023-08-09 acdff03246ce648082192dfb069c3a006a7fbee6
src/views/sales/masterOrder/index.vue
@@ -1,11 +1,28 @@
<template>
  <div class="master-order">
    <SearchCommonView ref="searchCommonView" :query-class-options="queryClassOptions" :search-options="searchOptions" />
    <div class="btn-pager">
      <PublicFunctionBtnView :operates-list="operatesList" />
      <PagerView class="page" />
    <div v-if="isDetail" class="detail-top">
      <DetailListCommonBtn :query-class-options="queryClassOptions" />
      <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
    </div>
    <TableCommonView ref="tableListRef" :show-summary="showSummary" :table-list="tableList">
    <div v-else class="top">
      <SearchCommonView
        ref="searchCommonView"
        :query-class-options="queryClassOptions"
        :search-options="searchOptions"
      />
      <div class="btn-pager">
        <PublicFunctionBtnView :operates-list="operatesList" />
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
      </div>
    </div>
    <TableCommonView
      ref="tableListRef"
      :show-summary="showSummary"
      :table-list="tableList"
      :select-box="!isDetail"
      @selClientClick="selClientClick"
      @selCommonClick="selCommonClick"
    >
      <template slot="tableButton">
        <el-table-column label="操作" width="90">
          <template slot-scope="scope">
@@ -17,18 +34,32 @@
    </TableCommonView>
    <!-- 新建/编辑 -->
    <AddMasterOrderDialog v-if="editConfig.visible" :edit-common-config="editConfig" />
    <!-- 销售子单详情 -->
    <DetailMasterOrder v-if="masterOrderDeail.visible" :master-order-detail="masterOrderDeail" />
    <!-- 客户详情 -->
    <DetailClientManage v-if="clientDeail.visible" :client-manage-detail="clientDeail" />
  </div>
</template>
<script>
import AddMasterOrderDialog from "@/views/sales/masterOrder/AddMasterOrderDialog"
import { getMasterOrderList, getDelMasterOrder } from "@/api/sales/masterOrder"
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import DetailMasterOrder from "@/views/sales/masterOrder/DetailMasterOrder"
export default {
  name: "MasterOrder",
  props: {},
  props: {
    isDetail: {
      type: Boolean,
      default: false
    }
  },
  mixins: [pageMixin],
  components: {
    AddMasterOrderDialog
    AddMasterOrderDialog,
    DetailMasterOrder,
    DetailClientManage: () => import("@/views/client/client/DetailClientManage")
  },
  computed: {},
  data() {
@@ -62,6 +93,14 @@
        show: true,
        sumProp: ["money"],
        mergeNumber: 5
      },
      masterOrderDeail: {
        visible: false,
        infomation: {}
      },
      clientDeail: {
        visible: false,
        infomation: {}
      }
    }
  },
@@ -74,8 +113,8 @@
      this.tableList = {
        tableInfomation: [],
        tableColumn: [
          { label: "单据编号", prop: "number", min: 100 }, // 单据编号
          { label: "客户名称", prop: "client_id", min: 120 }, // 客户名称
          { label: "单据编号", prop: "number", min: 100, isCommonClick: true }, // 单据编号
          { label: "客户名称", prop: "client_name", min: 120, isClientClick: true }, // 客户名称
          { label: "服务开始时间", prop: "start_time", isTime: true }, // 服务开始时间
          { label: "服务截止时间", prop: "end_time", isTime: true }, // 服务截止时间
          { label: "合同金额", prop: "money" }, // 合同金额
@@ -92,17 +131,23 @@
    // 请求数据
    async getData() {
      this.loading = true
      await getMasterOrderList()
      await getMasterOrderList({
        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
                  ...item,
                  client_name: item.client.name
                }
              })
              this.tableList.tableInfomation = list || []
              this.pagerOptions.totalCount = res.data.count
            } else {
              this.tableList.tableInfomation = []
            }
@@ -143,7 +188,7 @@
        .then((response) => {
          if (response.code === 200) {
            this.$message.success("删除成功")
            this.getUserList()
            this.getData()
          } else {
            this.$message.warning("删除失败")
          }
@@ -152,6 +197,18 @@
    },
    getSelectArray(val) {
      console.log(val)
    },
    // 客户名称详情
    selClientClick(row) {
      console.log(row)
      this.clientDeail.visible = true
      this.clientDeail.infomation = { ...row }
    },
    // 机会名称详情
    selCommonClick(row) {
      console.log(row)
      this.masterOrderDeail.visible = true
      this.masterOrderDeail.infomation = { ...row }
    }
  }
}
@@ -160,7 +217,16 @@
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.master-order {
  .btn-pager {
  .top {
    margin-bottom: 20px;
    .btn-pager {
      display: flex;
      .page {
        margin-left: auto;
      }
    }
  }
  .detail-top {
    display: flex;
    .page {
      margin-left: auto;