zuozhengqing
2023-11-24 6208d26b43f7a87027e42651c4e4d8836f9f9b8b
src/views/overview/OverviewListView.vue
@@ -1,22 +1,37 @@
<template>
  <div class="rightContent">
    <!-- <div class="label-fixed-element">
      <span>{{ params.name }}</span>
    </div> -->
    <div class="top">
      <SearchCommonView
        :add-title="'新建'"
        :placeholder="'请输入单号'"
        :placeholder="'请输入单号/来源单据'"
        :amount-view="false"
        :search-task-map="searchTaskMap"
        @addCommonClick="addBtnClick"
        @searchClick="getList"
        @delSelectClick="delSelectClick"
      />
    </div>
    <div class="list-view">
      <div class="table">
        <TableCommonView
          ref="tableListRef"
          :table-list="tableList"
          @selTableCol="selTableCol"
          @tableRowClick="tableRowClick"
        ></TableCommonView>
        <TableCommonView ref="tableListRef" :table-list="tableList" @selTableCol="selTableCol">
          <template slot="tableButton">
            <el-table-column label="操作" width="100">
              <template slot-scope="scope">
                <el-button @click="tableRowClick(scope.row, '查看')" type="text" size="small">查看</el-button>
                <el-button
                  v-if="scope.row.status !== 4&&scope.row.status !== 5"
                  @click="tableRowClick(scope.row, '编辑')"
                  type="text"
                  size="small"
                  >编辑</el-button
                >
              </template>
            </el-table-column>
          </template>
        </TableCommonView>
      </div>
      <div class="btn-pager">
        <PagerView class="page" :pager-options="pagerOptions" v-on="pagerEvents" />
@@ -25,9 +40,10 @@
    <!-- 新建/编辑 -->
    <AddOverviewDialog
      v-if="editConfig.visible"
      :work-type="workType"
      :workType="workType"
      :edit-common-config="editConfig"
      :add-name="this.$route.params.name"
      :add-name="addName"
      :display-edit="displayEdit"
    />
  </div>
</template>
@@ -47,11 +63,12 @@
  data() {
    return {
      tableList: {},
      showcol: ["从", "至", "联系人", "日期", "来源单据", "状态"],
      showcol: ["仓库位置", "调出位置", "调入位置", "联系人", "日期", "来源单据", "状态"],
      searchOptions: [],
      commonDetail: {
        visible: false,
        title: "新建",
        title: "新建"
        ,
        infomation: {}
      },
      editConfig: {
@@ -59,19 +76,55 @@
        title: "新建",
        infomation: {}
      },
      workType: this.$route.params.workType
      workType: this.$route.params.workType,
      keyword: "",
      params: {},
      displayEdit: false,
      formLabel: "",
      toLabel: "",
      addName: "",
      searchTaskMap: []
    }
  },
  created() {
    this.setFormToLabel()
    this.setTable()
    var paramsData = sessionStorage.getItem("paramsData")
    let params = {}
    if (paramsData) {
      params = JSON.parse(sessionStorage.getItem("paramsData"))
    } else {
      params = this.$route.params
      sessionStorage.setItem("paramsData", JSON.stringify(params))
    }
    this.params = params
    this.searchTaskMap =
      this.params.status > 0 ? [{ id: this.params.id, title: this.getStatus(this.params.status) }] : []
    this.getData()
    console.log(this.$route.params.workType)
    // console.log(this.$route.params.workType)
  },
  // 页面销毁之前
  beforeDestroy() {
    sessionStorage.removeItem("paramsData")
  },
  methods: {
    setFormToLabel() {
      if (this.workType === 1) {
        this.formLabel = "供应商位置"
        this.toLabel = "仓库位置"
      } else if (this.workType === 2) {
        this.formLabel = "仓库位置"
        this.toLabel = "客户位置"
      } else {
        this.formLabel = "调出位置"
        this.toLabel = "调入位置"
      }
    },
    setTable() {
      this.tableList = {
        tableInfomation: [],
        selectBox: true,
        selectBox: false,
        selectIndex: true,
        showcol: this.showcol,
        allcol: [],
        tableColumn: this.setTableColumn(this.showcol)
@@ -89,74 +142,74 @@
      let tableColumn = [
        {
          label: "单号",
          prop: "id",
          prop: "number",
          isShowColumn: true,
          default: true
        },
        {
          label: "从",
          prop: "deviceName",
          isShowColumn: showcol.includes("从"),
          label: this.formLabel,
          prop: "from",
          isShowColumn: showcol.includes(this.formLabel),
          default: false
        },
        {
          label: "至",
          prop: "id",
          isShowColumn: showcol.includes("至"),
          label: this.toLabel,
          prop: "to",
          isShowColumn: showcol.includes(this.toLabel),
          default: false
        },
        {
          label: "联系人",
          prop: "deviceId",
          prop: "companyName",
          isShowColumn: showcol.includes("联系人"),
          default: false
        },
        {
          label: "负责人",
          prop: "shopName",
          prop: "contacterName",
          isShowColumn: showcol.includes("负责人"),
          default: false
        },
        {
          label: "日期",
          prop: "preTime",
          prop: "operationDate",
          isShowColumn: showcol.includes("日期"),
          default: false,
          date: true
        },
        {
          label: "产品可用性",
          prop: "status",
          isShowColumn: showcol.includes("产品可用性"),
          default: false
        },
        {
          label: "截止日期",
          prop: "faultTime",
          isShowColumn: showcol.includes("截止日期"),
          default: false
        },
        {
          label: "实际日期",
          prop: "shopName",
          isShowColumn: showcol.includes("实际日期"),
          default: false
        },
        // {
        //   label: "产品可用性",
        //   prop: "status",
        //   isShowColumn: showcol.includes("产品可用性"),
        //   default: false
        // },
        // {
        //   label: "截止日期",
        //   prop: "faultTime",
        //   isShowColumn: showcol.includes("截止日期"),
        //   default: false
        // },
        // {
        //   label: "实际日期",
        //   prop: "shopName",
        //   isShowColumn: showcol.includes("实际日期"),
        //   default: false
        // },
        {
          label: "来源单据",
          prop: "faultLevel",
          prop: "sourceNumber",
          isShowColumn: showcol.includes("来源单据"),
          default: false
        },
        {
          label: "欠单",
          prop: "status",
          isShowColumn: showcol.includes("欠单"),
          default: false
        },
        // {
        //   label: "欠单",
        //   prop: "status",
        //   isShowColumn: showcol.includes("欠单"),
        //   default: false
        // },
        {
          label: "入库类型",
          prop: "faultTime",
          prop: "operationTypeName",
          isShowColumn: showcol.includes("入库类型"),
          default: false
        },
@@ -166,7 +219,9 @@
          width: 120,
          isShowColumn: showcol.includes("状态"),
          default: false,
          status: true
          status: true,
          isCallMethod: true,
          getCallMethod: this.getStatus
        }
      ]
      return tableColumn
@@ -178,41 +233,75 @@
    // 请求数据
    async getData() {
      await getOperation({
        operationTypeId: this.$route.params.id,
        number: this.keyword,
        operationTypeId: this.params.id,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
        pageSize: this.pagerOptions.pageSize,
        status: this.params.status
      }).then((res) => {
        console.log(res.data.data)
        if (res.data.code === 200) {
          const list = res.data.data.map((item) => {
        console.log(res.data)
        if (res.code === 200) {
          const list = res.data.map((item) => {
            return {
              ...item
              ...item,
              from: item.fromLocation.name,
              to: item.toLocation.name
            }
          })
          this.tableList.tableInfomation = list || []
          this.pagerOptions.totalCount = res.data.total
          this.pagerOptions.totalCount = res.total
        }
      })
    },
    // 搜索
    getList(val) {
      console.log(val)
      this.keyword = val
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 行点击
    tableRowClick(row) {
      console.log(row)
    // 查看 编辑
    tableRowClick(row, val) {
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.title = val
      this.editConfig.operationTypeId = this.params.id
      this.editConfig.infomation = { ...row }
    },
    // 新建
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.addName = this.params.name
      this.editConfig.operationTypeId = this.params.id
      this.editConfig.code = this.params.code
      this.editConfig.infomation = {}
      this.editConfig.visible = true
    },
    // 状态
    getStatus(val) {
      return val === 1 ? "草稿" : val === 3 ? "就绪" : val === 4 ? "完成" :val === 5 ? "取消" : ""
    },
    // 删除搜索状态
    delSelectClick() {
      this.params.status = 0
      this.getData()
    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.label-fixed-element {
  background: #e6ecf2;
  position: fixed;
  font-size: 14px;
  width: calc(100% - 530px);
  height: 45px;
  line-height: 45px;
  font-size: 18px;
  font-weight: 700;
  color: #171718;
  margin-top: -60px;
  margin-left: -5px;
}
</style>