| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <!-- <template>
- <div class="ele-body">
- <el-card shadow="never" v-loading="loading">
- <seek-page :seekList="seekList" @search="search"></seek-page>
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- cache-key="wanLongDailyList"
- :current.sync="current"
- highlight-current-row
- row-key="id"
- :pageSize="20"
- :height="tableHeight"
- :selection.sync="selection"
- @fullscreen-change="fullscreenChange"
- >
- <template slot="subCountAllFirst" slot-scope="{ row }">
- <span class="clickable" @click="onClickSubCountAllFirst(row)">
- {{ row.subCountAllFirst != null ? row.subCountAllFirst : 0 }}
- </span>
- </template>
- <template slot="subCountSendFirst" slot-scope="{ row }">
- <span class="clickable" @click="onClickSubCountSendFirst(row)">
- {{ row.subCountSendFirst != null ? row.subCountSendFirst : 0 }}
- </span>
- </template>
- </ele-pro-table>
- </el-card>
- </div>
- </template>
- <script>
- import { getDailyList } from '@/api/wanLong/index';
- export default {
- name: 'wanLongIndex',
- data() {
- return {
- loading: false,
- current: null,
- selection: [],
- tableHeight: 'calc(100vh - 320px)',
- dynamicColumns: [], // 保存 taskList 动态列
- taskNames: [] // taskName 列名数组
- };
- },
- computed: {
- seekList() {
- return [
- {
- label: '开始时间:',
- value: 'startTime',
- type: 'date',
- dateType: 'daterange',
- placeholder: ''
- }
- ];
- },
- columns() {
- const baseColumns = [
- {
- columnKey: 'selection',
- type: 'selection',
- width: 45,
- align: 'center'
- },
- {
- columnKey: 'index',
- label: '序号',
- type: 'index',
- width: 55,
- align: 'center',
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '物品名称',
- prop: 'categoryName',
- width: 150,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '物品编码',
- prop: 'categoryCode',
- width: 160,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '图号',
- prop: 'imgCode',
- width: 160,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '图纸版本',
- prop: 'version',
- width: 160,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '重量',
- prop: 'productUnitWeight',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '型号',
- prop: 'modelType',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '规格',
- prop: 'specification',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '中间状态数量',
- prop: 'middleNum',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '库存数量',
- prop: 'availableCountBase',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '下料初始值',
- prop: 'subCountAllFirst',
- width: 120,
- slot: 'subCountAllFirst',
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '下料总数量',
- prop: 'subCountAll',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '送货初始值',
- prop: 'subCountSendFirst',
- width: 120,
- slot: 'subCountSendFirst',
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '送货数量',
- prop: 'subCountSend',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '备注',
- prop: 'remark',
- width: 120,
- showOverflowTooltip: true,
- align: 'center'
- },
- {
- label: '日期',
- prop: 'date',
- width: 100,
- showOverflowTooltip: true,
- align: 'center'
- }
- ];
- return baseColumns.concat(this.dynamicColumns);
- }
- },
- methods: {
- datasource({ page, limit, where }) {
- return getDailyList({
- pageNum: page,
- size: limit,
- ...where
- }).then((res) => {
- const data = res.data || [];
- if (data.length) {
- const firstItem = data[0];
- if (firstItem.taskList && firstItem.taskList.length) {
- this.taskNames = firstItem.taskList.map((t) => t.taskName);
- this.dynamicColumns = firstItem.taskList.map((t) => ({
- label: t.taskName,
- prop: `task_${t.taskName}`,
- width: 100,
- align: 'center'
- }));
- }
- }
- const tableData = data.map((item) => {
- const taskFields = {};
- if (item.taskList && item.taskList.length) {
- item.taskList.forEach((t) => {
- taskFields[`task_${t.taskName}`] = t.quantity;
- });
- }
- return Object.assign({}, item, taskFields);
- });
- return tableData;
- });
- },
- search(e) {
- this.$refs.table.reload(e);
- },
- fullscreenChange(fullscreen) {
- this.tableHeight = fullscreen
- ? 'calc(100vh - 120px)'
- : 'calc(100vh - 320px)';
- },
- onClickSubCountAllFirst(row) {
- console.log('点击下料初始值', row);
- this.$message.info(`下料初始值: ${row.subCountAllFirst}`);
- },
- onClickSubCountSendFirst(row) {
- console.log('点击送货初始值', row);
- this.$message.info(`送货初始值: ${row.subCountSendFirst}`);
- }
- }
- };
- </script>
- <style scoped>
- .clickable {
- cursor: pointer;
- color: #409eff;
- }
- </style> -->
- <template> </template>
- <script>
- export default {};
- </script>
- <style></style>
|