|
@@ -1,4 +1,4 @@
|
|
|
-<!-- <template>
|
|
|
|
|
|
|
+<template>
|
|
|
<div class="ele-body">
|
|
<div class="ele-body">
|
|
|
<el-card shadow="never" v-loading="loading">
|
|
<el-card shadow="never" v-loading="loading">
|
|
|
<seek-page :seekList="seekList" @search="search"></seek-page>
|
|
<seek-page :seekList="seekList" @search="search"></seek-page>
|
|
@@ -11,21 +11,37 @@
|
|
|
:current.sync="current"
|
|
:current.sync="current"
|
|
|
highlight-current-row
|
|
highlight-current-row
|
|
|
row-key="id"
|
|
row-key="id"
|
|
|
- :pageSize="20"
|
|
|
|
|
:height="tableHeight"
|
|
:height="tableHeight"
|
|
|
:selection.sync="selection"
|
|
:selection.sync="selection"
|
|
|
@fullscreen-change="fullscreenChange"
|
|
@fullscreen-change="fullscreenChange"
|
|
|
>
|
|
>
|
|
|
|
|
+ <template v-slot:toolbar>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ class="ele-btn-icon"
|
|
|
|
|
+ @click="printData('add')"
|
|
|
|
|
+ >
|
|
|
|
|
+ 下载
|
|
|
|
|
+ </el-button></template
|
|
|
|
|
+ >
|
|
|
<template slot="subCountAllFirst" slot-scope="{ row }">
|
|
<template slot="subCountAllFirst" slot-scope="{ row }">
|
|
|
- <span class="clickable" @click="onClickSubCountAllFirst(row)">
|
|
|
|
|
- {{ row.subCountAllFirst != null ? row.subCountAllFirst : 0 }}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ <el-input v-model="row.subCountAllFirst" @change="changeUpate(row)" />
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<template slot="subCountSendFirst" slot-scope="{ row }">
|
|
<template slot="subCountSendFirst" slot-scope="{ row }">
|
|
|
- <span class="clickable" @click="onClickSubCountSendFirst(row)">
|
|
|
|
|
- {{ row.subCountSendFirst != null ? row.subCountSendFirst : 0 }}
|
|
|
|
|
- </span>
|
|
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="row.subCountSendFirst"
|
|
|
|
|
+ @change="changeUpate(row)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template slot="difference" slot-scope="{ row }">
|
|
|
|
|
+ <el-input v-model="row.difference" @change="changeUpate(row)" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
|
|
+ <template slot="remark" slot-scope="{ row }">
|
|
|
|
|
+ <el-input v-model="row.remark" @change="changeUpate(row)" />
|
|
|
</template>
|
|
</template>
|
|
|
</ele-pro-table>
|
|
</ele-pro-table>
|
|
|
</el-card>
|
|
</el-card>
|
|
@@ -33,7 +49,10 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import { getDailyList } from '@/api/wanLong/index';
|
|
|
|
|
|
|
+ import { getDailyList, updateDaily } from '@/api/wanLong/index';
|
|
|
|
|
+ import { getTreeByPid } from '@/api/classifyManage';
|
|
|
|
|
+ import * as XLSX from 'xlsx';
|
|
|
|
|
+ import { saveAs } from 'file-saver';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'wanLongIndex',
|
|
name: 'wanLongIndex',
|
|
@@ -45,19 +64,73 @@
|
|
|
selection: [],
|
|
selection: [],
|
|
|
tableHeight: 'calc(100vh - 320px)',
|
|
tableHeight: 'calc(100vh - 320px)',
|
|
|
dynamicColumns: [], // 保存 taskList 动态列
|
|
dynamicColumns: [], // 保存 taskList 动态列
|
|
|
- taskNames: [] // taskName 列名数组
|
|
|
|
|
|
|
+ taskNames: [], // taskName 列名数组
|
|
|
|
|
+ categoryData: [],
|
|
|
|
|
+ categoryType: [],
|
|
|
|
|
+
|
|
|
|
|
+ orderStatus: [
|
|
|
|
|
+ {
|
|
|
|
|
+ value: 4,
|
|
|
|
|
+ label: '待生产'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: 5,
|
|
|
|
|
+ label: '生产中'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: 6,
|
|
|
|
|
+ label: '已完成'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: 7,
|
|
|
|
|
+ label: '已延期'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: 9,
|
|
|
|
|
+ label: '暂停'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: 10,
|
|
|
|
|
+ label: '终止'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
|
computed: {
|
|
|
seekList() {
|
|
seekList() {
|
|
|
|
|
+ const today = new Date();
|
|
|
|
|
+ const year = today.getFullYear();
|
|
|
|
|
+ const month = String(today.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const day = String(today.getDate()).padStart(2, '0');
|
|
|
|
|
+
|
|
|
|
|
+ const dateStr = `${year}-${month}-${day}`;
|
|
|
|
|
+
|
|
|
return [
|
|
return [
|
|
|
{
|
|
{
|
|
|
- label: '开始时间:',
|
|
|
|
|
|
|
+ label: '选择日期:',
|
|
|
value: 'startTime',
|
|
value: 'startTime',
|
|
|
type: 'date',
|
|
type: 'date',
|
|
|
- dateType: 'daterange',
|
|
|
|
|
- placeholder: ''
|
|
|
|
|
|
|
+ dateType: 'date',
|
|
|
|
|
+ placeholder: '',
|
|
|
|
|
+ defaultValue: dateStr,
|
|
|
|
|
+ clearable: false,
|
|
|
|
|
+ width: 220
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '物品分类:',
|
|
|
|
|
+ value: 'categoryLevelId',
|
|
|
|
|
+ type: 'select',
|
|
|
|
|
+ placeholder: '',
|
|
|
|
|
+ planList: this.categoryType
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '工单状态:',
|
|
|
|
|
+ value: 'workOrderStatusList',
|
|
|
|
|
+ type: 'select',
|
|
|
|
|
+ placeholder: '',
|
|
|
|
|
+ multiple: true,
|
|
|
|
|
+ planList: this.orderStatus
|
|
|
}
|
|
}
|
|
|
];
|
|
];
|
|
|
},
|
|
},
|
|
@@ -175,9 +248,18 @@
|
|
|
showOverflowTooltip: true,
|
|
showOverflowTooltip: true,
|
|
|
align: 'center'
|
|
align: 'center'
|
|
|
},
|
|
},
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '固配与活配差异',
|
|
|
|
|
+ prop: 'difference',
|
|
|
|
|
+ slot: 'difference',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ showOverflowTooltip: true,
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
{
|
|
{
|
|
|
label: '备注',
|
|
label: '备注',
|
|
|
prop: 'remark',
|
|
prop: 'remark',
|
|
|
|
|
+ slot: 'remark',
|
|
|
width: 120,
|
|
width: 120,
|
|
|
showOverflowTooltip: true,
|
|
showOverflowTooltip: true,
|
|
|
align: 'center'
|
|
align: 'center'
|
|
@@ -195,11 +277,37 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ created() {
|
|
|
|
|
+ this.getTreeData();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
methods: {
|
|
methods: {
|
|
|
datasource({ page, limit, where }) {
|
|
datasource({ page, limit, where }) {
|
|
|
|
|
+ if (Object.keys(where).length == 0) {
|
|
|
|
|
+ const today = new Date();
|
|
|
|
|
+ const year = today.getFullYear();
|
|
|
|
|
+ const month = String(today.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const day = String(today.getDate()).padStart(2, '0');
|
|
|
|
|
+
|
|
|
|
|
+ const dateStr = `${year}-${month}-${day}`;
|
|
|
|
|
+ where.startTime = dateStr + ' 00:00:00';
|
|
|
|
|
+ where.endTime = dateStr + ' 23:59:59';
|
|
|
|
|
+ console.log(where.startTime, '8888');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (where.startTime) {
|
|
|
|
|
+ let times = this.formatDate(where.startTime).split(' ');
|
|
|
|
|
+
|
|
|
|
|
+ where.endTime = times[0] + ' 00:00:00';
|
|
|
|
|
+ where.startTime = times[0] + ' 23:59:59';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log(where.startTime, '9999');
|
|
|
|
|
+ where.startTime = '';
|
|
|
|
|
+ where.endTime = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return getDailyList({
|
|
return getDailyList({
|
|
|
pageNum: page,
|
|
pageNum: page,
|
|
|
- size: limit,
|
|
|
|
|
|
|
+ size: -1,
|
|
|
...where
|
|
...where
|
|
|
}).then((res) => {
|
|
}).then((res) => {
|
|
|
const data = res.data || [];
|
|
const data = res.data || [];
|
|
@@ -232,7 +340,23 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
search(e) {
|
|
search(e) {
|
|
|
- this.$refs.table.reload(e);
|
|
|
|
|
|
|
+ this.reload(e);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ reload(where) {
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ async changeUpate(item) {
|
|
|
|
|
+ const filteredData = Object.keys(item).reduce((acc, key) => {
|
|
|
|
|
+ if (!key.startsWith('task_')) {
|
|
|
|
|
+ acc[key] = item[key];
|
|
|
|
|
+ }
|
|
|
|
|
+ return acc;
|
|
|
|
|
+ }, {});
|
|
|
|
|
+ await updateDaily(filteredData);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
fullscreenChange(fullscreen) {
|
|
fullscreenChange(fullscreen) {
|
|
@@ -249,6 +373,89 @@
|
|
|
onClickSubCountSendFirst(row) {
|
|
onClickSubCountSendFirst(row) {
|
|
|
console.log('点击送货初始值', row);
|
|
console.log('点击送货初始值', row);
|
|
|
this.$message.info(`送货初始值: ${row.subCountSendFirst}`);
|
|
this.$message.info(`送货初始值: ${row.subCountSendFirst}`);
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ formatNode(node) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ id: node.id,
|
|
|
|
|
+ parentId: node.parentId,
|
|
|
|
|
+ name: node.name,
|
|
|
|
|
+ code: node.code,
|
|
|
|
|
+ value: node.value || node.id,
|
|
|
|
|
+ label: node.label || node.name,
|
|
|
|
|
+ sortNum: node.sortNum
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ formatDate(date) {
|
|
|
|
|
+ const d = new Date(date);
|
|
|
|
|
+ const yyyy = d.getFullYear();
|
|
|
|
|
+ const mm = String(d.getMonth() + 1).padStart(2, '0');
|
|
|
|
|
+ const dd = String(d.getDate()).padStart(2, '0');
|
|
|
|
|
+ const hh = String(d.getHours()).padStart(2, '0');
|
|
|
|
|
+ const mi = String(d.getMinutes()).padStart(2, '0');
|
|
|
|
|
+ const ss = String(d.getSeconds()).padStart(2, '0');
|
|
|
|
|
+ return `${yyyy}-${mm}-${dd} ${hh}:${mi}:${ss}`;
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ async getTreeData() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getTreeByPid(9);
|
|
|
|
|
+ const rootNode = res.data?.[0];
|
|
|
|
|
+
|
|
|
|
|
+ if (!rootNode || !rootNode.children) {
|
|
|
|
|
+ this.categoryType = [];
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.categoryType = rootNode.children.map((child) =>
|
|
|
|
|
+ this.formatNode(child)
|
|
|
|
|
+ );
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ this.categoryType = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async printData() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const tableData = this.$refs.table?.getData?.() || [];
|
|
|
|
|
+ if (!tableData.length) {
|
|
|
|
|
+ this.$message.warning('当前表格没有数据可导出');
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const allColumns = this.columns
|
|
|
|
|
+ .concat(this.dynamicColumns)
|
|
|
|
|
+ .filter(
|
|
|
|
|
+ (col) =>
|
|
|
|
|
+ col.columnKey !== 'selection' && col.columnKey !== 'index'
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ const exportData = tableData.map((row) => {
|
|
|
|
|
+ const obj = {};
|
|
|
|
|
+ allColumns.forEach((col) => {
|
|
|
|
|
+ const key = col.prop || col.columnKey;
|
|
|
|
|
+ if (key) {
|
|
|
|
|
+ obj[col.label] = row[key] ?? '';
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ return obj;
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const ws = XLSX.utils.json_to_sheet(exportData);
|
|
|
|
|
+
|
|
|
|
|
+ const wb = XLSX.utils.book_new();
|
|
|
|
|
+ XLSX.utils.book_append_sheet(wb, ws, '表格数据');
|
|
|
|
|
+ const wbout = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
|
|
|
|
|
+ saveAs(
|
|
|
|
|
+ new Blob([wbout], { type: 'application/octet-stream' }),
|
|
|
|
|
+ '生产日报.xlsx'
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ this.$message.success('导出成功');
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ console.error(err);
|
|
|
|
|
+ this.$message.error('导出 Excel 失败,请检查控制台');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -259,12 +466,4 @@
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
color: #409eff;
|
|
color: #409eff;
|
|
|
}
|
|
}
|
|
|
-</style> -->
|
|
|
|
|
-
|
|
|
|
|
-<template> </template>
|
|
|
|
|
-
|
|
|
|
|
-<script>
|
|
|
|
|
- export default {};
|
|
|
|
|
-</script>
|
|
|
|
|
-
|
|
|
|
|
-<style></style>
|
|
|
|
|
|
|
+</style>
|