yangys
2025-08-30 498df4ec49c9469d535c494039586ff30c3b23a6
src/views/basesetting/produceplan.vue
@@ -7,7 +7,7 @@
<template>
    <basic-container>
        <el-tabs v-model="activeName" type="card" class="demo-tabs" @tab-click="tabsClick">
            <el-tab-pane label="主制分工表" name="zhuzhi">
            <el-tab-pane label="人员职责表" name="zhuzhi">
                <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"
@@ -28,9 +28,17 @@
                </avue-crud>
            </el-tab-pane>
            <el-tab-pane label="勤哲分工表" name="qinzhe">
                <avue-crud :option="optionQz" :table-loading="loadingQz" :data="dataQz" v-model:page="pageQz"
                    @search-change="searchChangeQz" @search-reset="searchResetQz" @current-change="currentChangeQz"
                    @size-change="sizeChangeQz" @refresh-change="refreshChangeQz" @on-load="onLoadQz">
                    @size-change="sizeChangeQz" @refresh-change="refreshChangeQz" @on-load="onLoadQz" @row-del="rowDelQz" @row-update="rowUpdateQz">
                    <template #menu-left>
                        <el-button type="primary" plain @click="importActionQz">导入
                        </el-button>
                        <el-button type="primary" plain @click="downTemplateActionQz">下载导入模板
                        </el-button>
                    </template>
                </avue-crud>
            </el-tab-pane>
        </el-tabs>
@@ -45,12 +53,17 @@
                -->
            </avue-form>
        </el-dialog>
        <el-dialog title="" append-to-body v-model="excelBoxQz" width="555px">
            <avue-form :option="excelOptionQz" v-model="excelForm" :upload-after="uploadAfterQz">
            </avue-form>
        </el-dialog>
    </basic-container>
</template>
<script>
import { getList, remove,save,update } from '@/api/basesetting/produceplan';
import { getListQz } from '@/api/basesetting/qinzhefgb';
import { getListQz, removeQz,saveQz,updateQz } from '@/api/basesetting/qinzhefgb';
import { mapGetters } from 'vuex';
import { exportBlob } from '@/api/common';
import { getToken } from '@/utils/auth';
@@ -83,11 +96,33 @@
                    },
                ],
            },
            excelOptionQz: {
                submitBtn: false,
                emptyBtn: false,
                column: [
                    {
                        label: '文件导入',
                        prop: 'file',
                        type: 'upload',
                        drag: true,
                        loadText: '导入中,请稍后',
                        span: 24,
                        propsHttp: {
                            res: 'data',
                        },
                        data: {
                        },
                        tip: '',
                        action: '/blade-mdm/producedivision/import-qinzhe',
                    },
                ],
            },
            excelForm: {
                fileType: 'program',
                excelFile: [],
            },
            excelBox: false,
            excelBoxQz: false,
            option: {
                // Define your Avue CRUD options here
                addBtn: true,
@@ -95,29 +130,15 @@
                delBtn: true,
                columnBtn: false,
                tip: false,
                // simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                // tree: true,
                searchEnter: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',
@@ -213,23 +234,29 @@
            },
            queryQz: {},
            optionQz: {
                // Define your Avue CRUD options here
                addBtn: false,
                editBtn: false,
                delBtn: false,
                editBtn: true,
                delBtn: true,
                columnBtn: false,
                tip: false,
                // simplePage: true,
                searchShow: true,
                searchMenuSpan: 6,
                // tree: true,
                searchEnter:true,
                border: true,
                index: true,
                menu: false,
                menuWidth: 320,
                dialogWidth: 500,
                dialogClickModal: false,
                column: [
                    {
                        label: '零组件号',
                        prop: 'ljh',
                        type: 'input',
                        search: true,
                        display: true,
                        disabled:true,
                        span: 24,
                    },
                    {
                        label: '产品号',
                        prop: 'cph',
@@ -237,21 +264,30 @@
                        display: true,
                        span: 24,
                    },
               {
                        label: '零组件号',
                        prop: 'ljh',
                        type: 'input',
                        search: true,
                        display: true,
                        span: 24,
                    },
                    {
                        label: '主管工艺',
                        prop: 'zggy',
                        type: 'input',
                        search: true,
                        display: true,
                        span: 24
                    },
                    {
                        label: '数据来源',
                        prop: 'source',
                        type: 'input',
                        search: false,
                        display: false,
                        span: 24,
                  render: ({ row}) => {
                            console.log('val',row)
                            if(row.source == 'MDM'){
                                return "MDM"
                            }else{
                                return "勤哲"
                            }
                        }
                    }
                ],
            },
@@ -303,6 +339,11 @@
            // this.$message.success('导入功能尚未实现');
            this.excelBox = true;
        },
        importActionQz() {
            // Logic for importing data
            // this.$message.success('导入功能尚未实现');
            this.excelBoxQz = true;
        },
        uploadAfter(res, done, loading, column) {
            //window.console.log(column);
            //console.log('res',res)
@@ -318,12 +359,29 @@
            }
            
        },
        uploadAfterQz(res, done, loading, column) {
            //window.console.log(column);
           this.$message.success('导入完成');
           this.excelBoxQz = false;
            this.onLoadQz(this.pageQz);
        },
      downTemplateAction() {
            NProgress.start();
            exportBlob(
                `/blade-mdm/producedivision/download-template`
            ).then(res => {
                downloadXls(res.data, `主制分工表导入模版.xlsx`);
                NProgress.done();
            });
        },
        downTemplateActionQz() {
            NProgress.start();
            exportBlob(
                `/blade-mdm/producedivision/download-template-qz`
            ).then(res => {
                downloadXls(res.data, `勤哲分工表导入模版.xlsx`);
                NProgress.done();
            });
        },
@@ -344,6 +402,23 @@
                    });
                });
        },
        rowDelQz(row) {
            this.$confirm('确定将选择数据删除?', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning',
            })
                .then(() => {
                    return removeQz({ljhs: [row.ljh].toString()});
                })
                .then(() => {
                    this.onLoadQz(this.pageQz);
                    this.$message({
                        type: 'success',
                        message: '操作成功!',
                    });
                });
        },
        rowUpdate (row, index, done, loading) {
            console.log('rowUpdate', row);
            
@@ -358,7 +433,27 @@
                    },
                    error => {
                      window.console.log(error);
                      loading();
                      //loading();
                      loadingZq();
                    }
                  );
        },
        rowUpdateQz (row, index, done, loading) {
            console.log('rowUpdateQz', row);
            updateQz(row).then(
                    () => {
                      this.onLoadQz(this.pageQz);
                      this.$message({
                        type: 'success',
                        message: '操作成功!',
                      });
                      done();
                    },
                    error => {
                      window.console.log(error);
                      //loading();
                      loadingZq();
                    }
                  );
        },