songshankun
2023-11-03 cf6a4b874aed82592eea78294715c7c688f9b248
src/views/warehouseManage/bussinessType/index.vue
@@ -3,7 +3,7 @@
    <div class="top">
      <SearchCommonView
        :add-title="'新建'"
        :placeholder="'请输入单号'"
        :placeholder="'请输入业务类型'"
        :amount-view="false"
        @addCommonClick="addBtnClick"
        @searchClick="getList"
@@ -11,25 +11,29 @@
    </div>
    <div class="list-view">
      <div class="table">
        <TableCommonView
          ref="tableListRef"
          :table-list="tableList"
          :show-checkcol="false"
          @tableRowClick="tableRowClick"
        ></TableCommonView>
        <TableCommonView ref="tableListRef" :table-list="tableList" :show-checkcol="false">
          <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 @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" />
      </div>
    </div>
    <!-- 新建/编辑 -->
    <AddBussinessType v-if="editConfig.visible" :edit-common-config="editConfig" />
    <AddBussinessType v-if="editConfig.visible" @refresh="refresh" :edit-common-config="editConfig" />
  </div>
</template>
<script>
import pageMixin from "@/components/makepager/pager/mixin/pageMixin"
import { getProductList } from "@/api/product/product"
import { getOperationTypeList } from "@/api/warehouseManage/warehouse"
// import DetailProduct from "@/views/productManage/product/DetailProduct"
import AddBussinessType from "@/views/warehouseManage/bussinessType/AddBussinessType"
@@ -42,7 +46,7 @@
  data() {
    return {
      tableList: {},
      searchOptions: [],
      keyword: "",
      editConfig: {
        visible: false,
        title: "新建",
@@ -58,7 +62,8 @@
    setTable() {
      this.tableList = {
        tableInfomation: [],
        selectBox: true,
        selectBox: false,
        selectIndex: true,
        showcol: this.showcol,
        allcol: [],
        tableColumn: this.setTableColumn(this.showcol)
@@ -76,14 +81,16 @@
      console.log(showcol)
      let tableColumn = [
        {
          label: "入库类型",
          prop: "id",
          label: "业务类型",
          prop: "name",
          isShowColumn: true,
          default: true
        },
        {
          label: "仓库",
          prop: "deviceName",
          propType: "mulitple",
          propTwo: "name",
          prop: "warehouse",
          isShowColumn: true,
          default: true
        }
@@ -95,41 +102,68 @@
      this.tableList.tableColumn = this.setTableColumn(val)
    },
    // 请求数据
    async getData(val, content) {
      await getProductList({
        [val]: content,
    async getData() {
      await getOperationTypeList({
        keyword: this.keyword,
        page: this.pagerOptions.currPage,
        pageSize: this.pagerOptions.pageSize
      }).then((res) => {
        if (res.data.code === 200) {
          const list = res.data.data.list.map((item) => {
            return {
              ...item,
              supplierNumber: item.supplier.number,
              status: "草稿",
              preTime: "2023-09-04 11:20:00"
            }
          })
        if (res.code === 200) {
          const list = res.data
          this.tableList.tableInfomation = list || []
          this.pagerOptions.totalCount = res.data.data.total
          this.pagerOptions.totalCount = res.total
        }
      })
    },
    refresh() {
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 搜索
    getList(val) {
      console.log(val)
      this.keyword = val
      this.pagerOptions.currPage = 1
      this.getData()
    },
    // 行点击
    tableRowClick(row) {
      console.log(row)
    tableRowClick(row, val) {
      this.editConfig.title = val
      let obj = JSON.parse(JSON.stringify(row))
      for (let i in obj) {
        if (i == "name" || i == "prefix") {
          obj[i] = obj[i] ? obj[i] : ""
        } else {
          obj[i] = obj[i] ? obj[i] : null
        }
      }
      this.editConfig.infomation = { ...obj }
      this.editConfig.visible = true
      this.editConfig.title = "编辑"
      this.editConfig.infomation = { ...row }
    },
    // 新建
    addBtnClick() {
      this.editConfig.visible = true
      this.editConfig.title = "新建"
      this.editConfig.infomation = {
        name: "",
        prefix: "",
        // 作业类型
        baseOperationType: null,
        // 退货类型
        returnOperationTypeID: null,
        // 创建欠单
        createBackorder: null,
        // 仓库
        warehouseId: null,
        // 显示作业详情
        showOperations: false,
        earlyOperations: null,
        // 保留方式
        reservationMethod: 1,
        // 默认原位置
        defaultLocationSrcId: null,
        // 默认目标位置
        defaultLocationDestId: null
      }
      this.editConfig.visible = true
    }
  }
}