1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
| <template>
| <div class="app-container">
| <div class="search_form">
| <div>
| <el-button type="primary"
| @click="isShowNewModal = true">新增</el-button>
| <el-button type="danger"
| @click="handleDelete">删除</el-button>
| <el-button @click="handleOut">导出</el-button>
| </div>
| </div>
| <div class="table_list">
| <PIMTable rowKey="id"
| :column="tableColumn"
| :tableData="tableData"
| :page="page"
| :tableLoading="tableLoading"
| :isSelection="true"
| @selection-change="handleSelectionChange"
| @pagination="pagination">
| </PIMTable>
| </div>
| </div>
| </template>
|
| <script setup>
| import { onMounted, ref } from "vue";
| import { ElMessageBox } from "element-plus";
| import dayjs from "dayjs";
| import { delProductOrder } from "@/api/productionManagement/productionOrder.js";
| import PIMTable from "@/components/PIMTable/PIMTable.vue";
|
| const { proxy } = getCurrentInstance();
|
| const isShowNewModal = ref(false);
|
| const tableColumn = ref([
| {
| label: "序号",
| type: "index",
| width: "60px",
| align: "center",
| },
| {
| label: "来源",
| prop: "source",
| width: "100px",
| },
| {
| label: "状态",
| prop: "status",
| width: "80px",
| },
| {
| label: "审核状态",
| prop: "auditStatus",
| width: "100px",
| },
| {
| label: "订单号",
| prop: "orderNo",
| width: "120px",
| },
| {
| label: "生产计划号",
| prop: "productionPlanNo",
| width: "140px",
| },
| {
| label: "零件号",
| prop: "partNo",
| width: "120px",
| },
| {
| label: "零件",
| prop: "partName",
| width: "120px",
| },
| {
| label: "工艺文件号",
| prop: "processFileNo",
| width: "140px",
| },
| {
| label: "销售数量",
| prop: "salesQuantity",
| width: "100px",
| align: "right",
| },
| {
| label: "制造数量",
| prop: "manufactureQuantity",
| width: "100px",
| align: "right",
| },
| {
| label: "零件单位",
| prop: "partUnit",
| width: "80px",
| },
| {
| label: "主计划需求日期",
| prop: "mainPlanDemandDate",
| formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
| width: "140px",
| },
| {
| label: "承诺日期",
| prop: "commitmentDate",
| formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
| width: "120px",
| },
| {
| label: "制造属性",
| prop: "manufactureProperty",
| width: "100px",
| },
| {
| label: "备注",
| prop: "remark",
| width: "150px",
| },
| {
| label: "更新时间",
| prop: "updateTime",
| formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
| width: "120px",
| },
| {
| label: "更新人",
| prop: "updateBy",
| width: "100px",
| },
| {
| label: "创建时间",
| prop: "createTime",
| formatData: val => (val ? dayjs(val).format("YYYY-MM-DD") : ""),
| width: "120px",
| },
| {
| label: "创建人",
| prop: "createBy",
| width: "100px",
| },
| {
| dataType: "action",
| label: "操作",
| align: "center",
| fixed: "right",
| width: 200,
| operation: [
| {
| name: "下发",
| type: "text",
| clickFun: row => {
| // 下发操作
| },
| },
| {
| name: "追踪进度",
| type: "text",
| clickFun: row => {
| // 追踪进度操作
| },
| },
| ],
| },
| ]);
| const tableData = ref([]);
| const tableLoading = ref(false);
| const page = reactive({
| current: 1,
| size: 100,
| total: 0,
| });
| const selectedRows = ref([]);
|
| // 模拟数据
| const mockData = [
| {
| id: 1,
| source: "销售订单",
| status: "执行中",
| auditStatus: "已审核",
| orderNo: "SO20260301",
| productionPlanNo: "PP20260301001",
| partNo: "P001",
| partName: "齿轮",
| processFileNo: "PF20260301",
| salesQuantity: 100,
| manufactureQuantity: 105,
| partUnit: "个",
| mainPlanDemandDate: "2026-03-15",
| commitmentDate: "2026-03-10",
| manufactureProperty: "常规",
| remark: "无",
| updateTime: "2026-03-05",
| updateBy: "张三",
| createTime: "2026-03-01",
| createBy: "李四",
| },
| {
| id: 2,
| source: "库存补充",
| status: "已完成",
| auditStatus: "已审核",
| orderNo: "SO20260302",
| productionPlanNo: "PP20260301002",
| partNo: "P002",
| partName: "轴承",
| processFileNo: "PF20260302",
| salesQuantity: 200,
| manufactureQuantity: 200,
| partUnit: "套",
| mainPlanDemandDate: "2026-03-20",
| commitmentDate: "2026-03-15",
| manufactureProperty: "常规",
| remark: "紧急订单",
| updateTime: "2026-03-06",
| updateBy: "王五",
| createTime: "2026-03-02",
| createBy: "赵六",
| },
| {
| id: 3,
| source: "销售订单",
| status: "待执行",
| auditStatus: "待审核",
| orderNo: "SO20260303",
| productionPlanNo: "PP20260301003",
| partNo: "P003",
| partName: "轴",
| processFileNo: "PF20260303",
| salesQuantity: 150,
| manufactureQuantity: 155,
| partUnit: "根",
| mainPlanDemandDate: "2026-03-25",
| commitmentDate: "2026-03-20",
| manufactureProperty: "定制",
| remark: "特殊规格",
| updateTime: "2026-03-07",
| updateBy: "孙七",
| createTime: "2026-03-03",
| createBy: "周八",
| },
| ];
|
| // 查询列表
| const getList = () => {
| tableLoading.value = true;
| // 使用模拟数据
| setTimeout(() => {
| tableData.value = mockData;
| page.total = mockData.length;
| tableLoading.value = false;
| }, 500);
| };
|
| const pagination = obj => {
| page.current = obj.page;
| page.size = obj.limit;
| getList();
| };
|
| // 表格选择数据
| const handleSelectionChange = selection => {
| selectedRows.value = selection;
| };
|
| const handleDelete = () => {
| let ids = [];
| if (selectedRows.value.length > 0) {
| ids = selectedRows.value.map(item => item.id);
| } else {
| proxy.$modal.msgWarning("请选择数据");
| return;
| }
| ElMessageBox.confirm("选中的内容将被删除,是否确认删除?", "删除确认", {
| confirmButtonText: "确认",
| cancelButtonText: "取消",
| type: "warning",
| })
| .then(() => {
| // 模拟删除操作
| tableData.value = tableData.value.filter(item => !ids.includes(item.id));
| page.total = tableData.value.length;
| proxy.$modal.msgSuccess("删除成功");
| })
| .catch(() => {
| proxy.$modal.msg("已取消");
| });
| };
|
| // 导出
| const handleOut = () => {
| ElMessageBox.confirm("选中的内容将被导出,是否确认导出?", "导出", {
| confirmButtonText: "确认",
| cancelButtonText: "取消",
| type: "warning",
| })
| .then(() => {
| proxy.$modal.msgSuccess("导出成功");
| })
| .catch(() => {
| proxy.$modal.msg("已取消");
| });
| };
|
| onMounted(() => {
| getList();
| });
| </script>
|
| <style scoped lang="scss">
| .search_form {
| margin-bottom: 20px;
| }
| </style>
|
|