1
lzhe
2025-07-08 561224d0c6ea8767766a8114ce15c98e31b6a0d9
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
<!--
 * @Date: 2025-06-17 11:44:52
 * @LastEditors: gaoshp
 * @LastEditTime: 2025-07-08 20:06:11
 * @FilePath: /mdmweb/src/views/basesetting/produceplan.vue
-->
<template>
    <basic-container>
        <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud"
            @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
            @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad" @row-del="rowDel"
            @row-save="save"
            @row-update="rowUpdate">
            <template #menu-left>
                <el-button type="primary" plain @click="importAction">导入
                </el-button>
            </template>
            <!-- <template #menu="scope">
                <el-button type="primary" text size="default" v-if="permission.flow_model_update"
                    @click.stop="handleAction(scope.row, scope.index)">审批
                </el-button>
            </template> -->
        </avue-crud>
    </basic-container>
</template>
 
<script>
import { getList, remove,save,update } from '@/api/basesetting/produceplan';
import { mapGetters } from 'vuex';
export default {
    name: 'ProducePlan',
    data() {
        return {
            // Define your data properties here
            option: {
                // Define your Avue CRUD options here
                addBtn: true,
                editBtn: true,
                delBtn: true,
                columnBtn: false,
                tip: false,
                // simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                // tree: true,
                border: true,
                index: true,
                // selection: true,
                // viewBtn: true,
                menuWidth: 320,
                dialogWidth: 500,
                dialogClickModal: false,
                column: [
                    // {
                    //     label: '程序名称',
                    //     prop: 'programName',
                    //     type: 'input',
                    //     search: false,
                    //     searchRange: true,
                    //     searchSpan: 8,
                    //     hide: true,
                    //     span: 24,
                    //     rules: [{ required: true, message: '请输入程序名称', trigger: 'blur' }],
                    // },
                    {
                        label: '人员名称',
                        prop: 'name',
                        type: 'input',
                        search: true,
                        searchRange: true,
                        searchSpan: 8,
                        hide: true,
                        display: false,
                    },
                    // {
                    //     label: '序号',
                    //     prop: 'index',
                    //     type: 'index',
                    // },
                    {
                        label: '专业组长',
                        prop: 'teamLeaderId',
                        type: 'select',
                        span: 24,
                        display: true,
                        dicUrl: `/blade-mdm/flow/flow-user-list?deptId=0`,
                        props: {
                            label: 'name',
                            value: 'id',
                        },
                        rules: [{ required: true, message: '请输入专业组长', trigger: 'blur' }],
                    },
                    {
                        label: '编制(工艺员)',
                        label: '编制',
                        prop: 'programmerId',
                        type: 'select',
                        display: true,
                        span: 24,
                        dicUrl: `/blade-mdm/flow/flow-user-list?deptId=0`,
                        props: {
                            label: 'name',
                            value: 'id',
                        },
                        rules: [{ required: true, message: '请输入编制(工艺员)', trigger: 'blur' }],
                    },
                    {
                        label: '校对(工艺员)',
                        label: '校对',
                        prop: 'checkerId',
                        type: 'select',
                        display: true,
                        span: 24,
                        dicUrl: `/blade-mdm/flow/flow-user-list?deptId=0`,
                        props: {
                            label: 'name',
                            value: 'id',
                        },
                        rules: [{ required: true, message: '请输入校对(工艺员)', trigger: 'blur' }],
                    },
                    {
                        label: '审核(高师)',
                        label: '审核',
                        prop: 'seniorId',
                        type: 'select',
                        display: true,
                        span: 24,
                        dicUrl: `/blade-mdm/flow/flow-user-list?deptId=0`,
                        props: {
                            label: 'name',
                            value: 'id',
                        },
                        rules: [{ required: true, message: '请输入审核(高师)', trigger: 'blur' }],
                    },
                    {
                        label: '图号',
                        prop: 'drawingNo',
                        type: 'input',
                        display: true,
                        span: 24,
                        rules: [{ required: true, message: '请输入审核图号', trigger: 'blur' }],
                    },
 
                    // Add more columns as needed
                ],
            },
            loading: false,
            data: [], // This will hold the data for the tables
            page: {
                pageSize: 10,
                currentPage: 1,
                total: 0,
            },
            form: {}, // This will hold the form data
            query: {}, // This will hold the search query
        };
    },
    methods: {
        // Define your methods here
        searchChange(params, done) {
            this.query = params;
            this.page.currentPage = 1;
            console.log('searchChange', params);
            console.log(params);
            this.onLoad(this.page, params);
            done();
        },
        searchReset() {
            this.query = {};
            this.onLoad(this.page);
        },
        currentChange() {
            this.page.currentPage = currentPage;
        },
        sizeChange() {
            this.page.pageSize = pageSize;
        },
        refreshChange() {
            this.onLoad(this.page, this.query);
        },
        onLoad(page, params = {}) {
            const query = {
                ...this.query,
                // category: params.category ? flowCategory(params.category) : null,
                mode: this.mode,
            };
            this.loading = true;
            getList(page.currentPage, page.pageSize, Object.assign(params, query)).then(res => {
                const data = res.data.data;
                this.page.total = data.total;
                this.data = data.records;
                this.loading = false;
            });
        },
        importAction() {
            // Logic for importing data
            this.$message.success('导入功能尚未实现');
        },
        rowDel(row) {
            this.$confirm('确定将选择数据删除?', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(() => {
                    return remove({ids: [row.id].toString()});
                })
                .then(() => {
                    this.onLoad(this.page);
                    this.$message({
                        type: 'success',
                        message: '操作成功!',
                    });
                });
        },
        rowUpdate (row, index, done, loading) {
            console.log('rowUpdate', row);
            
            update(row).then(
                    () => {
                      this.onLoad(this.page);
                      this.$message({
                        type: 'success',
                        message: '操作成功!',
                      });
                      done();
                    },
                    error => {
                      window.console.log(error);
                      loading();
                    }
                  );
        },
        save (row, done, loading) {
            console.log('save', row);
            save(row).then(
                () => {
                this.onLoad(this.page);
                this.$message({
                    type: 'success',
                    message: '操作成功!',
                });
                done();
                },
                error => {
                loading();
                window.console.log(error);
                }
            );
        }
    },
    mounted() {
        // Code to run when the component is mounted
    },
}
</script>
 
<style lang="scss" scoped></style>