| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <return-search @search="reload" ref="searchRef"> </return-search>
- <!-- 数据表格 -->
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- row-key="id"
- cache-key="returnKey"
- :selection.sync="selection"
- >
- <template v-slot:toolbar>
- <el-button type="primary" size="mini" @click="handleReturn"
- >新建</el-button
- >
- </template>
- <template v-slot:scene="{ row }">
- {{ sceneListFn(row.scene) }}
- </template>
- <template v-slot:action="{ row }">
- <el-button type="text" size="mini" @click="handDetailed(row)"
- >详情</el-button
- >
- </template>
- </ele-pro-table>
- </el-card>
- <returnPop
- v-if="returnShow"
- :returnDetailsId="returnDetailsId"
- @close="close"
- :sceneList="sceneList"
- ></returnPop>
- </div>
- </template>
- <script>
- import { returnPage } from '@/api/materialReturn/index.js';
- import returnSearch from './components/return-search.vue';
- import returnPop from './components/returnPop.vue';
- import { getByCode } from '@/api/system/dictionary-data';
- export default {
- components: {
- returnSearch,
- returnPop
- },
- data() {
- return {
- // 加载状态
- loading: false,
- selection: [],
- returnShow: false,
- returnDetailsId: null ,
- sceneList: []
- };
- },
- computed: {
- columns() {
- return [
- {
- prop: 'code',
- label: '退料单编号',
- align: 'center'
- },
- {
- prop: 'name',
- label: '退料单名称',
- align: 'center'
- },
- {
- slot: 'scene',
- prop: 'scene',
- label: '退料场景',
- align: 'center'
- },
- {
- prop: 'executorName',
- label: '退料人',
- align: 'center'
- },
- {
- prop: 'executorTime',
- label: '退料时间',
- align: 'center'
- },
- {
- prop: 'remark',
- label: '退料描述',
- align: 'center'
- },
- {
- prop: '',
- label: '操作',
- width: 80,
- align: 'center',
- resizable: false,
- fixed: 'right',
- slot: 'action'
- }
- ];
- }
- },
- created() {
- this.getByCodeFn();
- },
- methods: {
- /* 表格数据源 */
- async datasource({ page, limit, where }) {
- let res = await returnPage({
- ...where,
- pageNum: page,
- size: limit
- });
- return res;
- },
- handleReturn() {
- this.returnDetailsId = null
- this.returnShow = true;
- },
- close(val) {
- if (val) {
- this.reload();
- }
- this.returnDetailsId = null;
- this.returnShow = false;
- },
- handDetailed(row) {
- this.returnDetailsId = row.id
- this.returnShow = true
- },
- getByCodeFn() {
- getByCode('returnScenario').then((res) => {
- let _arr = [];
- res.data.map((item) => {
- const key = Object.keys(item)[0];
- const value = item[key];
- _arr.push({ label: value, value: key });
- });
- this.sceneList = _arr;
- });
- },
- sceneListFn(val) {
- let _arr = this.sceneList;
- for (const item of _arr) {
- if (item.value == val) {
- return item.label;
- }
- }
- },
- /* 刷新表格 */
- reload(where = {}) {
- this.$refs.table.reload({ page: 1, where });
- }
- }
- };
- </script>
|