| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <byProductSearch @search="reload" ref="searchRef"> </byProductSearch>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- row-key="id"
- cache-key="by_product_list"
- :selection.sync="selection"
- autoAmendPage
- :parse-data="parseData"
- @update:selection="handleSelectionChange"
- :height="tableHeight"
- @fullscreen-change="fullscreenChange"
- >
- <template v-slot:toolbar>
- <el-button type="primary" size="mini" @click="handByProd"
- >新建回收单</el-button
- >
- </template>
- <template v-slot:formedNum="{ row }">
- {{ row.notFormedNum || 0 }} / {{ row.formedNum || 0 }}
- </template>
- <template v-slot:weight="{ row }">
- {{ row.weight || 0 }} / {{ row.weightUnit }}
- </template>
- <template v-slot:action="{ row }">
- <!-- <el-button type="text" size="mini">详情</el-button> -->
- <el-button type="text" size="mini" @click="disopseProduct(row)"
- >处置</el-button
- >
- </template>
- </ele-pro-table>
- </el-card>
- <addByProduct v-if="addByProductShow" @close="close"></addByProduct>
- <el-dialog
- title="仓库处置"
- :visible.sync="visible"
- v-if="visible"
- :before-close="handleClose"
- :close-on-click-modal="false"
- :close-on-press-escape="false"
- append-to-body
- width="500px"
- >
- <el-form size="mini" :model="form" label-width="96px">
- <el-form-item label="仓库" prop="warehouseList">
- <el-select
- v-model="form.warehouseId"
- filterable
- placeholder="请选择仓库"
- >
- <el-option
- v-for="item in warehouseList"
- :label="item.name"
- :value="item.id"
- :key="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <template slot="footer">
- <el-button size="mini" @click="visible = false">取 消</el-button>
- <el-button size="mini" type="primary" @click="warehouseSave"
- >保 存</el-button
- >
- </template>
- </el-dialog>
- </div>
- </template>
- <script>
- import { getPage } from '@/api/byProduct/index';
- import byProductSearch from './components/byProduct-search.vue';
- import addByProduct from './components/addByProduct.vue';
- export default {
- components: {
- byProductSearch,
- addByProduct
- },
- data() {
- return {
- // 加载状态
- loading: false,
- selection: [],
- addByProductShow: false,
- visible: false,
- warehouseList: [],
- form: {
- warehouseId: ''
- },
- tableHeight: 'calc(100vh - 300px)'
- };
- },
- computed: {
- columns() {
- return [
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- fixed: 'left'
- },
- {
- prop: 'code',
- label: '回收单号',
- align: 'left',
- width: '300',
- showOverflowTooltip: true
- },
- {
- prop: 'workOrderCode',
- label: '工单编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'taskName',
- label: '工序',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'categoryCode',
- label: '物品编码',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'categoryName',
- label: '物品名称',
- align: 'center',
- showOverflowTooltip: true
- },
- {
- prop: 'formedNum',
- slot: 'formedNum',
- label: '不合格品/合格品数量',
- align: 'center',
- width: 140
- },
- {
- prop: 'weight',
- slot: 'weight',
- label: '重量',
- align: 'center',
- width: 140
- },
- {
- prop: 'executorName',
- label: '回收人',
- align: 'center',
- width: 95
- },
- {
- prop: 'createTime',
- label: '创建时间',
- align: 'center',
- width: 95,
- showOverflowTooltip: true
- },
- {
- prop: '',
- label: '操作',
- width: 80,
- align: 'center',
- resizable: false,
- fixed: 'right',
- slot: 'action'
- }
- ];
- }
- },
- created() {},
- methods: {
- /* 表格数据源 */
- async datasource({ page, limit, where }) {
- let parma = {
- ...where,
- pageNum: page,
- size: limit
- };
- let res = await getPage(parma);
- return res;
- },
- /* 数据转为树形结构 */
- parseData(data) {
- return {
- ...data,
- list: this.$util.toTreeData({
- data: data.list,
- count: data.total,
- idField: 'id',
- parentIdField: 'parentId'
- })
- };
- },
- handleSelectionChange(data) {
- console.log(data);
- },
- /* 刷新表格 */
- reload(where = {}) {
- this.$refs.table.reload({ page: 1, where });
- },
- handleClose() {
- this.visible = false;
- },
- warehouseSave() {
- this.visible = false;
- },
- disopseProduct(item) {
- this.visible = true;
- },
- handByProd() {
- this.addByProductShow = true;
- },
- close(val) {
- if (val) {
- this.reload();
- }
- this.addByProductShow = false;
- },
- fullscreenChange(fullscreen) {
- if (fullscreen) {
- this.tableHeight = 'calc(100vh - 120px)';
- } else {
- this.tableHeight = 'calc(100vh - 300px)';
- }
- }
- }
- };
- </script>
|