Houjie
昨天 c98c05b996c0bed40cc13d19dd84e90bc49ffd12
src/views/base/WarehouseList.vue
@@ -1,7 +1,6 @@
<template>
  <a-card
    :bordered="false"
    title="供应商"
  >
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
@@ -11,28 +10,29 @@
      >
        <a-row :gutter="30">
          <a-col
            :md="6"
            :sm="24"
          >
            <a-form-item label="仓库编号">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="线边库编号">
              <j-input
                placeholder="请输入仓库编号检索"
                placeholder="请输入线边库编号检索"
                v-model="queryParam.warehouseCode"
              ></j-input>
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="24"
          >
            <a-form-item label="仓库名称">
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="线边库名称">
              <j-input
                placeholder="请输入仓库名称检索"
                placeholder="请输入线边库名称检索"
                v-model="queryParam.warehouseName"
              ></j-input>
            </a-form-item>
          </a-col>
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
@@ -41,20 +41,11 @@
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button
        type="primary"
        @click="searchQuery"
        icon="search"
      >查询</a-button>
      <a-button
        type="primary"
        @click="searchReset"
        icon="reload"
      >重置</a-button>
      <a-button
        @click="handleAdd"
        type="primary"
        icon="plus"
      >新增</a-button>
      >新增
      </a-button>
    </div>
    <!-- table区域-begin -->
@@ -70,17 +61,8 @@
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}"
        @change="handleTableChange"
        :customRow="clickThenCheck"
      >
        <span
          slot="partCount"
          slot-scope="text,record"
          class="fontweight"
        >
          {{record.partCount}}
        </span>
        <!--状态栏个性展示-->
        <span
          slot="status"
@@ -109,8 +91,8 @@
        >
          <a
            href="javascript:;"
            @click="handleDetail(record)"
          >详情</a>
            @click="handleEdit(record)"
          >编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
@@ -119,18 +101,9 @@
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleEdit(record)">编辑</a>
                <a @click="handleDetail(record)">详情</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item v-if="record.warehouseStatus == 0">
               <a-menu-item v-if="record.warehouseStatus == 0">
                <a-popconfirm
                  title="确定启用吗?"
                  @confirm="() => handleActive(record.id)"
@@ -146,6 +119,16 @@
                  <a>禁用</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
@@ -166,7 +149,7 @@
//按需引入 组件
import WarehouseModel from './modules/warehouse/WarehouseModel'
import { deleteAction, requestPut, getAction } from '@/api/manage'
import { getAction, requestPut } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import JInput from '@/components/jeecg/JInput'
@@ -177,22 +160,27 @@
  components: {
    WarehouseModel,
    JEllipsis,
    JInput,
    JInput
  },
  data() {
    return {
      selectedRowRecord: {},
      dataSource: [],
      partCount: "",
      /* 分页参数 */
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '20'],
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
          return range[0] + '-' + range[1] + ' 共' + total + '条'
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      /* 排序参数 */
      isorter:{
        column: 'warehouseCode',
        order: 'asc',
      },
      // 表头
      columns: [
@@ -201,19 +189,19 @@
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '线边库编号',
          align: "center",
          align: 'center',
          dataIndex: 'warehouseCode'
        },
        {
          title: '线边库名称',
          align: "center",
          align: 'center',
          dataIndex: 'warehouseName'
        },
        {
@@ -226,7 +214,7 @@
          title: '状态',
          align: 'center',
          scopedSlots: {
            customRender: 'status',
            customRender: 'status'
          },
          dataIndex: 'warehouseStatus'
        },
@@ -235,94 +223,83 @@
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
          scopedSlots: { customRender: 'action' }
        }
      ],
      type: "radio",
      url: {
        list: '/base/lineSideWarehouse/list',
        delete: '/base/lineSideWarehouse/delete',
        active: '/base/lineSideWarehouse/active',
      },
        active: '/base/lineSideWarehouse/active'
      }
    }
  },
  mounted() {
    this.$bus.$on('refreshParentPage', (data) => {
      this.loadData();
    })
  },
  methods: {
    loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1;
        this.ipagination.current = 1
      }
      var params = this.getQueryParams();//查询条件
      this.loading = true;
      var params = this.getQueryParams()//查询条件
      this.loading = true
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
          this.dataSource = res.result.records
          this.ipagination.total = res.result.total
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
        this.loading = false
      })
    },
    //禁用状态样式
    tableRowClass(record, index) {
      if (record.warehouseStatus != "1") {
        return "frozenRowClass";
      if (record.warehouseStatus != '1') {
        return 'frozenRowClass'
      }
      return "";
      return ''
    },
    //启用禁用
    handleActive(id) {
      if (!this.url.active) {
        this.$message.error("请设置url.active!")
        this.$message.error('请设置url.active!')
        return
      }
      let that = this;
      let that = this
      requestPut(that.url.active, {}, { id: id }).then((res) => {
        if (res.success) {
          that.$message.success(res.message);
          that.loadData();
          that.$message.success(res.message)
          that.loadData()
        } else {
          that.$message.warning(res.message);
          that.$message.warning(res.message)
        }
      });
    },
    clickThenCheck(record) {
      return {
        on: {
          click: (e) => {
            this.selectedRowRecord = record;
            this.onSelectChange(record.id.split(","), [record]);
          }
        }
      };
    },
    onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys;
    },
  },
      })
    }
  }
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
.fontweight {
  font-weight: bold;
}
.ant-card-body .table-operator {
  margin-bottom: 18px;
}
@@ -336,7 +313,7 @@
  margin: 0 5px;
}
/deep/.ant-btn-danger {
/deep/ .ant-btn-danger {
  background-color: #ffffff;
}