1
lzhe
2024-05-02 5237d75a9c44b033c72120d41382a3906fd5cd1c
1
已修改3个文件
273 ■■■■ 文件已修改
src/views/console/system/add-scope-manager.vue 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/system/data-scope-manager.vue 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/time-analysis.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/console/system/add-scope-manager.vue
@@ -3,43 +3,35 @@
        <el-form :model="addDictForm" :rules="addDictRules" :disabled="mode=='show'" ref="dialogForm" label-width="120px" label-position="center">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="权限名称" prop="scopeName">
                        <el-input v-model="addDictForm.scopeName" placeholder="权限名称" clearable></el-input>
                    <el-form-item label="权限名称" prop="deptName">
                        <el-input v-model="addDictForm.deptName" placeholder="权限名称" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="权限编号" prop="resourceCode">
                        <el-input v-model="addDictForm.resourceCode" placeholder="权限编号" clearable></el-input>
                    <el-form-item label="权限描述" prop="fullName">
                        <el-input v-model="addDictForm.fullName" placeholder="权限描述" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="权限字段" prop="scopeColumn">
                        <el-input v-model="addDictForm.scopeColumn" placeholder="权限字段" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="规则分类" prop="scopeType">
                        <el-select v-model="addDictForm.scopeType" style="width: 100%" @change="scopeTypeNameChange" placeholder="规则分类">
                            <el-option v-for="item in scopeTypeNameList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                    <el-form-item label="上级权限">
                        <el-select v-model="addDictForm.parentId" placeholder="请选择上级权限" style="width: 100%" @change="parentIdChange" :disabled="mode=='add'">
                            <el-option v-for="item in parentIdList" :key="item.parentId" :label="item.title" :value="item.parentId"/>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="可见字段" prop="scopeField">
                        <el-input v-model="addDictForm.scopeField" placeholder="可见字段" clearable></el-input>
                <el-col :span="12">
                    <el-form-item label="权限类型" pros="deptCategory">
                        <el-select v-model="addDictForm.deptCategory" placeholder="请选择权限类型" style="width: 100%" @change="deptCategoryChange">
                            <el-option v-for="item in deptCategoryList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/>
                        </el-select>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="权限类名" prop="scopeClass">
                        <el-input v-model="addDictForm.scopeClass" placeholder="权限类名" clearable></el-input>
                <el-col :span="12">
                    <el-form-item label="排序" prop="sort">
                        <el-input v-model="addDictForm.sort" placeholder="排序" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                    <el-form-item label="规则值" v-if="addDictForm.scopeType == '5'">
                        <el-input type="textarea" v-model="addDictForm.scopeValue" placeholder="规则值" clearable></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="24">
                <el-col :span="12">
                    <el-form-item label="备注">
                        <el-input v-model="addDictForm.remark" placeholder="备注" clearable></el-input>
                    </el-form-item>
@@ -47,8 +39,8 @@
            </el-row>
        </el-form>
        <template #footer>
            <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="dictSubmit">保 存</el-button>
            <el-button @click="visible=false" >取 消</el-button>
            <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="dictSubmit()">保 存</el-button>
        </template>
    </el-dialog>
</template>
@@ -56,8 +48,11 @@
<script>
    export default {
        emits: ['success', 'closed'],
        props: ["deptCategoryList","parentIdList"],
        data() {
            return {
                deptCategoryList: [],
                parentIdList: [],
                value1: true,
                mode: "add",
                titleMap: {
@@ -69,24 +64,21 @@
                isSaveing: false,
                //表单数据
                addDictForm: {
                    $scopeType: "",
                    scopeName: "工作台[暂无]",
                    resourceCode: "",
                    scopeColumn: "",
                    scopeType: "",
                    scopeField: "",
                    scopeClass: "",
                    $deptCategory: "",
                    $parentId: "",
                    deptCategory: "",
                    deptName: "",
                    fullName: "",
                    parentId: "",
                    remark: "",
                    scopeValue: ""
                    sort: ""
                },
                //验证规则
                addDictRules: {
                    scopeName:[{required: true, message: '请输入权限名称'}],
                    resourceCode:[{required: true, message: '请输入权限编号'}],
                    scopeColumn:[{required: true, message: '请输入权限字段'}],
                    scopeType:[{required: true, message: '请输入规则分类',trigger: 'change'}],
                    scopeField:[{required: true, message: '请输入可见字段'}],
                    scopeClass:[{required: true, message: '请输入权限类名'}],
                    deptName:[{required: true, message: '请输入权限名称'}],
                    fullName:[{required: true, message: '请输入权限描述'}],
                    deptCategory:[{required: true, message: '请输入权限类型',trigger: 'change'}],
                    sort:[{required: true, message: '请输入排序'}]
                },
                //所需数据选项
                groups: [],
@@ -103,30 +95,28 @@
            }
        },
        mounted() {
            // this.getDept()
            // this.getParentIdList();  //上级权限list
            // this.getDictionary();  //权限类型list
        },
        props: ['scopeTypeNameList','tableRow'],
        methods: {
            scopeTypeNameChange(value) {
                this.scopeTypeNameList.forEach(item=> {
                    if(item.dictKey == value) {
                        this.addDictForm.scopeName = `工作台[${item.dictValue}]`;
                        this.addDictForm.$scopeType = item.dictValue;
            parentIdChange(value) {
                this.parentIdList.forEach(item=> {
                    if(item.parentId == value) {
                        this.addDictForm.$parentId = item.title;
                    }
                })
                if(value == "2") {
                    this.addDictForm.scopeColumn = 'create_user';
                }else if(value == "3" || value == "4") {
                    this.addDictForm.scopeColumn = 'create_dept';
                }else {
                    this.addDictForm.scopeColumn = "";
                }
            },
            deptCategoryChange(value) {
                this.deptCategoryList.forEach(item=> {
                    if(item.dictKey == value) {
                        this.addDictForm.$deptCategory = item.dictValue;
                    }
                })
            },
            //显示
            open(mode='add'){
                this.mode = mode;
                this.visible = true;
                this.addDictForm.resourceCode = this.tableRow.alias;
                return this
            },
            //加载树数据
@@ -138,14 +128,22 @@
                var res = await this.$API.system.dept.list.get();
                this.depts = res.data;
            },
            getDetail(id) {
                console.log(this.deptCategoryList)
                this.$HTTP.get(`/api/blade-system/data-scope-manager/detail?id=${id}`).then(res=> {
                    if(res.code == 200) {
                        //可以和上面一样单个注入,也可以像下面一样直接合并进去
                        Object.assign(this.addDictForm, res.data);
                    }
                })
            },
            //表单提交方法
            dictSubmit(){
                this.addDictForm.menuId = this.tableRow.id;
                var obj = Object.assign({},this.addDictForm);
                var obj = Object.assign({},this.addDictForm);;
                this.$refs.dialogForm.validate(async (valid) => {
                    if (valid) {
                        this.isSaveing = true;
                        this.$HTTP.post("/api/blade-system/data-scope/submit",obj).then(res=> {
                        this.$HTTP.post("/api/blade-system/data-scope-manager/submit",obj).then(res=> {
                            this.isSaveing = false;
                            if(res.code == 200) {
                                this.$emit('success', this.addDictForm, this.mode);
@@ -162,9 +160,7 @@
            },
            //表单注入数据
            setData(data){
                data.scopeType = String(data.scopeType);
                //可以和上面一样单个注入,也可以像下面一样直接合并进去
                Object.assign(this.addDictForm, data);
                this.getDetail(data.id);
            }
        }
    }
src/views/console/system/data-scope-manager.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-04-17 18:02:12
 * @LastEditTime: 2024-05-02 22:20:47
 * @FilePath: /smart-web/src/views/master/person/main/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -10,10 +10,10 @@
    <div class="dict-main">
        <el-form :inline="true" :model="searchData" abel-width="120px">
            <el-form-item label="权限名称">
                <el-input v-model="searchData.name" placeholder="权限名称" clearable />
                <el-input v-model="searchData.deptName" placeholder="权限名称" clearable />
            </el-form-item>
            <el-form-item label="权限描述">
                <el-input v-model="searchData.code" placeholder="权限描述" clearable></el-input>
                <el-input v-model="searchData.deptName" placeholder="权限描述" clearable></el-input>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="searchclick">搜索</el-button>
@@ -22,26 +22,29 @@
        </el-form>
        <div>
            <div style="margin-bottom: 12px;">
                <el-button type="primary">添加</el-button>
                <el-button type="primary" @click="addData">添加</el-button>
                <el-button type="danger" @click="delData">删除</el-button>
                <el-button type="primary" @click="addAuthority">权限设置</el-button>
            </div>
            <div class="dict-table">
                <el-table ref="multipleTableRef" :data="tableData" border row-key="id" style="width: 100%" class="multipleTableRef" @selection-change="handleSelectionChange" :tree-props="{ children: 'children', hasChildren: 'has' }">
                    <el-table-column type="selection" width="55" />
                    <el-table-column prop="test" label="权限名称"></el-table-column>
                    <el-table-column prop="test" label="权限描述"></el-table-column>
                    <el-table-column prop="test" label="权限类型"></el-table-column>
                    <el-table-column prop="test" label="排序"></el-table-column>
                    <el-table-column fixed="right" label="操作">
                    <el-table-column prop="deptName" label="权限名称"></el-table-column>
                    <el-table-column prop="fullName" label="权限描述"></el-table-column>
                    <el-table-column prop="deptCategoryName" label="权限类型"></el-table-column>
                    <el-table-column prop="sort" label="排序"></el-table-column>
                    <el-table-column fixed="right" label="操作" width="280">
                        <template #default="scope">
                            <el-button text type="primary" size="small" @click="showDrawer(scope.row, scope.$index)">权限配置</el-button>
                            <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
                            <el-button text type="primary" size="small" @click="showDrawer(scope.row, scope.$index)">编辑</el-button>
                            <el-button text type="primary" size="small" @click="showDrawer(scope.row, scope.$index)">删除</el-button>
                            <el-button text type="primary" size="small" @click="showDrawer(scope.row, scope.$index)">新增子项</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
        </div>
        <save-dialog v-if="dialog.save" ref="saveDialog" :scopeTypeNameList="scopeTypeNameList" :tableRow="tableRow" @success="addDatascopeSuccess" @closed="dialog.save=false"></save-dialog>
        <save-dialog v-if="dialog.save" ref="saveDialog" :deptCategoryList="deptCategoryList" :parentIdList ="parentIdList" @success="addDatascopeSuccess" @closed="dialog.save=false"></save-dialog>
    </div>
</template>
<script>
@@ -77,46 +80,55 @@
                    size: 10
                },
                searchData: {
                    name: "",
                    code: "",
                    belongApplication: "",
                    parentId: ""
                    deptName: "",
                    fullName: "",
                    parentId: "0"
                },
                dialog: {
                    save: false,
                    allocation: false
                },
                tableData: [],
                drawerTableData: [],
                rowId: "",
                tableRow: {}
                tableRow: {},
                parentIdList: [],
                deptCategoryList: []
            }
        },
        created(){
            
        },
        mounted(){
            this.getscopeTypeNameList();//规则分类枚举
            this.searchBtn();
            this.getDictionary();
            this.getParentIdList();
        },
        components: {
            ...ElementPlusIconsVue,saveDialog
        },
        methods: {
            getscopeTypeNameList() {  //规则分类枚举
                this.$HTTP.get("/api/blade-system/dict/dictionary?code=data_scope_type").then(res=> {
            getParentIdList() {
                this.$HTTP.get("/api/blade-system/data-scope-manager/tree").then(res=> {
                    if(res.code == 200) {
                        this.scopeTypeNameList = res.data;
                        this.parentIdList = res.data;
                    }
                })
            },
            getDictionary() {
                this.$HTTP.get("/api/blade-system/dict/dictionary?code=data_scope_category").then(res=> {
                    if(res.code == 200) {
                        this.deptCategoryList = res.data;
                    }
                })
            },
            addDatascopeSuccess() {
                this.drawerSearchclick();
                this.searchclick();
            },
            //添加
            addData(){
                this.dialog.save = true
                this.dialog.save = true;
                this.$nextTick(() => {
                    this.$refs.saveDialog.open()
                    this.$refs.saveDialog.open();
                })
            },
            addAuthority() {
@@ -143,7 +155,6 @@
                this.$HTTP.post("/api/blade-system/data-scope/remove?ids="+selStr).then(res=> {
                    if(res.code == 200) {
                        that.$message.success("操作成功");
                        that.drawerSearchclick();
                    }
                })
            },
@@ -173,17 +184,12 @@
                    this.$HTTP.post("/api/blade-system/data-scope/remove?ids="+row.id).then(res=> {
                        if(res.code == 200) {
                            that.$message.success("操作成功");
                            that.drawerSearchclick();
                        }
                    })
                }).catch(() => {
                })
            },
            handleClose(done) {
                this.drawerTableData = [];
                done();
            },
            exportFile(row,index){
                window.open(row.link);
            },
@@ -192,9 +198,8 @@
            },
            searchClearBtn() {
                this.searchData = {
                    name: "",
                    code: "",
                    belongApplication: "",
                    deptName: "",
                    fullName: "",
                    parentId: ""
                }
                this.searchBtn();
@@ -202,33 +207,7 @@
            showDrawer(row){
                this.rowId = row.id;
                this.tableRow = row;  //后面组件会用到
                this.drawerSearchclick();
                this.drawer = true;
            },
            drawerSearchclick() {
                var obj = {};
                for(var key in this.drawerSearchData) {
                    if(this.drawerSearchData[key]) {
                        obj[key] = this.drawerSearchData[key];
                    }
                }
                obj.menuId = this.rowId;
                this.$HTTP.get("/api/blade-system/data-scope/list?"+this.$TOOL.qsStringify(obj)).then(res=> {
                    if(res.code == 200) {
                        this.drawerTableData = res.data.records;
                        this.drawerTotal = res.data.total;
                    }
                })
            },
            drawerSearchClearBtn() {
                this.drawerSearchData = {
                    scopeName: "",
                    resourceCode: "",
                    menuId: this.rowId,
                    current: 1,
                    size: 10
                }
                this.drawerSearchclick();
            },
            searchclick() {
                this.searchBtn();
@@ -240,11 +219,11 @@
                        obj[key] = this.searchData[key];
                    }
                }
                // this.$HTTP.get("/api/blade-system/menu/lazy-menu-list",obj).then(res=> {
                //     if(res.code == 200) {
                //         this.tableData = res.data;
                //     }
                // })
                this.$HTTP.get("/api/blade-system/data-scope-manager/lazy-list?" + this.$TOOL.qsStringify(obj)).then(res=> {
                    if(res.code == 200) {
                        this.tableData = res.data;
                    }
                })
            },
            handleSelectionChange(selection) {
                this.selection = selection;
@@ -259,12 +238,10 @@
                console.log(`每页 ${val} 条`);
                this.drawerSearchData.current = "1";
                this.drawerSearchData.size = val;
                this.drawerSearchclick();
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
                this.drawerSearchData.current = val;
                this.drawerSearchclick();
            }
        }
    }
src/views/mdc/time-analysis.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-04-26 09:36:18
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-05-01 22:44:46
 * @LastEditTime: 2024-05-02 20:46:36
 * @FilePath: /smart-web/src/views/mdc/status-record.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -198,7 +198,7 @@
                    show: true,
                    axisLabel: {
                        formatter: function (value) {
                            return value + "%";
                            return value * 100 + "%";
                        }
                    },
                    data: [2,20,40,60,80,100]
@@ -234,7 +234,7 @@
                    show: true,
                    axisLabel: {
                        formatter: function (value) {
                            return value + "%";
                            return value * 100 + "%";
                        }
                    },
                    data: [2,20,40,60,80,100]
@@ -270,7 +270,7 @@
                    show: true,
                    axisLabel: {
                        formatter: function (value) {
                            return value + "%";
                            return value * 100 + "%";
                        }
                    },
                    data: [2,20,40,60,80,100]
@@ -306,7 +306,7 @@
                    show: true,
                    axisLabel: {
                        formatter: function (value) {
                            return value + "%";
                            return value * 100 + "%";
                        }
                    },
                    data: [2,20,40,60,80,100]
@@ -325,21 +325,17 @@
    },
    methods: {
        getDataA() {
            var ids = [];
            this.treeChecked.forEach(item=> {
                ids.push(item.id);
            })
            if(this.btnLeftctive == 1) {  //按工位统计
                var obj = {
                    ids: ids,
                    ids: this.ids,
                    localDate: this.date,
                    type: 0
                }
            }else if(this.btnLeftctive == 1) { //按工位组统计
            }else if(this.btnLeftctive == 2) { //按工位组统计
                var obj = {
                    groupCategory: 1,
                    groupType: "group_workstation",
                    ids: ids,
                    ids: this.ids,
                    localDate: this.date,
                    type: 1
                }
@@ -414,7 +410,7 @@
            }
            if(this.btnLeftctive == 1) {  //按工位统计
                obj.type = 0;
            }else if(this.btnLeftctive == 1) { //按工位组统计
            }else if(this.btnLeftctive == 2) { //按工位组统计
                obj.type = 1;
            }
            this.$HTTP.post(`/api/blade-mdc/time-used-analysis/work-stations?current=${this.current}&size=${this.size}`,obj).then(res=> {
@@ -426,7 +422,6 @@
                    this.chartOptionA.xAxis.data = xAxis;
                    var recordDom = document.getElementById('recordwork' + index);
                    this.chartOptionA.series = this.formatChartData(res.data.countStatus);
                    console.log(this.chartOptionA.series)
                    var myChart = echarts.init(recordDom);
                    myChart.setOption(this.chartOptionA);
                }
@@ -449,12 +444,14 @@
            }
            if(this.btnLeftctive == 1) {  //按工位统计
                obj.type = 0;
            }else if(this.btnLeftctive == 1) { //按工位组统计
            }else if(this.btnLeftctive == 2) { //按工位组统计
                obj.type = 1;
            }
            this.$HTTP.post(`/api/blade-mdc/time-used-analysis/work-stations?current=${this.current}&size=${this.size}`,obj).then(res=> {
                if(res.code == 200) {
                    var xAxis = [];
                    res.data.workStationDetails == null ? res.data.workStationDetails = [] : res.data.workStationDetails;
                    res.data.countStatus == null ? res.data.countStatus = [] : res.data.countStatus;
                    res.data.workStationDetails.forEach(item=> {
                        xAxis.push(item.name);
                    })
@@ -560,9 +557,7 @@
            this.getDataA();
        },
        changeTabB(item,index,index1) {
            if(index == 0) {
                this.setTitle1[0].btnListActive = item.id;
            }
            this.setTitle1[index].btnListActive = item.id;
            this.date = this.setTitle1[0].btnListActive;
            if(index == 0) {
                this.getDataChartsB("DAY");
@@ -600,21 +595,26 @@
            this.date = this.time[1];
        },
        query() {
            console.log(this.activeName)
            this.getTime({endDate: this.time[1],startDate: this.time[0],statisticalMethod: 'SHIFT'});
            this.date = this.time[1];
            this.ids = [];
            console.log(this.btnLeftctive)
            if(this.btnLeftctive == 1) {  //按工位统计
                this.treeChecked.forEach(item=> {
                    this.ids.push(item.id);
                })
            }else if(this.btnLeftctive == 1) { //按工位组统计
            }else if(this.btnLeftctive == 2) { //按工位组统计
                this.treeListNodeList.forEach(item=> {
                    this.ids.push(item.id);
                })
            }
            console.log(this.ids,2)
            this.getTime({endDate: this.time[1],startDate: this.time[0],statisticalMethod: 'SHIFT'});
            this.date = this.time[1];
            this.getDataA();
            if(this.activeName == "shift") {  //按班次统计
                this.getDataA();
            }else if(this.activeName == "time") { //按周期统计
                this.getDataChartsB("DAY");
                this.getDataChartsB("WEEK");
                this.getDataChartsB("MONTH",this.setTitle1[2].btnListActive.split("月")[0]);
            }
        }
    }
}