Browse Source

新增考评预警规则页面,新增页面;

SunZehao 1 year ago
parent
commit
e4fecde45e

+ 611 - 0
src/components/evaluationknowledgePage/earlyWarningRulePage.vue

@@ -0,0 +1,611 @@
+<template>
+    <div class="earlyWarningRules" v-loading="loadingImport">
+        <div class="earlyWarningRulesBtn">
+            <div class="collectSeach">
+                <div class="exceed">
+                    <span class="exceedSpan">业务属性:</span>
+                    <el-select v-model="businessStr" placeholder="请选择业务属性" clearable >
+                        <el-option
+                        v-for="item in binSectionoptions"
+                        :key="item.id"
+                        :label="item.sectionName"
+                        :value="item.id">
+                        </el-option>
+                    </el-select>
+                </div>
+                <div class="exceed">
+                    <span class="exceedSpan" style="width:100px">规则名称:</span>
+                    <el-input v-model="indicatorStr" placeholder="请输入规则名称"></el-input>
+                </div>
+                <seachs @handleSeach="getSeachData" @handleRest="reset"></seachs>
+            </div>
+            <div class="PeriodBtn">
+                <btns
+                :showImport="false"
+                :showExport="false"
+                :showAdd="$utils.havePurview('earlyWarningRules:oneLevel:add')"
+                :showSave="$utils.havePurview('earlyWarningRules:oneLevel:save')"
+                :showDelete="$utils.havePurview('earlyWarningRules:oneLevel:delete')"
+                :disSave="changeDateSelect.length === 0 || changeDateSelect.length>1"
+                :disDelete="changeDateSelect.length === 0"
+                :disImport="true"
+                :disExport="true"
+                @handleAdd="handleAdd"
+                @handleEdit="handleEdit"
+                @handleDelete="handleDelete"
+                ></btns>
+            </div>
+            <div class="earlyWarningRulesTableData">
+                <el-table :data="earlyWarningRulesData" style="width: 100%" @select="rowClick" @select-all="allSelect" @row-dblclick="handleEdit">
+                    <el-table-column type="selection" label="操作" align="center" />
+                    <el-table-column label="规则名称" prop="scoreRuleName" />
+                    <el-table-column label="业务属性" prop="businessName"  width="200" />
+                    <el-table-column label="指标名称" width="300">
+                        <template #default="scope">
+                            <span>{{scope.row.indicatorNames.join(',')}}</span>
+                        </template>
+                    </el-table-column>
+                    <el-table-column label="描述">
+                        <template #default="scope">
+                            <el-tooltip
+                                class="box-item"
+                                effect="customized"
+                                :content="scope.row.describe"
+                                placement="top"
+                            >
+                                <span class="tooltipCC">{{scope.row.describe}}</span>
+                            </el-tooltip>
+                        </template>
+                    </el-table-column>
+                </el-table>
+                <el-pagination
+                    @size-change="handleSizeChange"
+                    @current-change="handleCurrentChange"
+                    :current-page="page.currentPage"
+                    :page-size="page.pagesize"
+                    layout="total, prev, pager, next, jumper"
+                    :total="page.total">
+                </el-pagination>
+            </div>
+            <el-dialog :title="title" v-model="dialogVisible" width="60vw" :close-on-click-modal="false">
+                <div class="periodFrom">
+                    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm" :validate-on-rule-change="false">
+                        <el-form-item label="规则名称" prop="ruleName">
+                            <el-input v-model="ruleForm.ruleName" placeholder="请输入规则名称"></el-input>
+                        </el-form-item>
+                        <el-form-item label="业务属性" prop="binSection">
+                            <el-select v-model="ruleForm.binSection" placeholder="请选择业务属性" :disabled="isSave" @change="changeBinstation">
+                                <el-option
+                                v-for="item in binSectionoptions"
+                                :key="item.id"
+                                :label="item.sectionName"
+                                :value="item.id">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="指标名称" prop="indicatorId">
+                            <!-- multiple collapse-tags -->
+                            <el-select v-model="ruleForm.indicatorId" placeholder="请选择指标名称" :disabled="isSave">
+                                <el-option
+                                v-for="item in indicItemoptions"
+                                :key="item.indicatorCode"
+                                :label="item.indicatorName"
+                                :value="item.indicatorCode">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                        <el-form-item label="规则配置">
+                            <div class="earlyWarningRight">
+                                <div class="earlyWarningFrom">
+                                    <div class="fromLeft">
+                                        <el-tabs type="border-card">
+                                            <el-tab-pane label="子指标">
+                                                <el-table
+                                                    size="mini"
+                                                    :show-header="false"
+                                                    :highlight-current-row="true"
+                                                    :stripe="false"
+                                                    :border="false"
+                                                    height="240"
+                                                    ref="multipleTable"
+                                                    :data="childerindicItemoptions"
+                                                    @select-all="onSelectAll"
+                                                    @selection-change="selectItem"
+                                                    @row-click="onSelectOp"
+                                                >
+                                                    <el-table-column type="selection" width="55" align="center" />
+                                                    <el-table-column prop="childName" />
+                                                    <el-table-column prop="childCode" />
+                                                </el-table>
+                                            </el-tab-pane>
+                                            <el-tab-pane label="指标项">
+                                                <el-table
+                                                    size="mini"
+                                                    :show-header="false"
+                                                    :highlight-current-row="true"
+                                                    :stripe="false"
+                                                    :border="false"
+                                                    height="240"
+                                                    @row-dblclick="rowDbclick"
+                                                    :data="multipleSelectionObj?multipleSelectionObj.list:[]"
+                                                >
+                                                    <el-table-column prop="optionName" />
+                                                    <el-table-column prop="optionCode" />
+                                                </el-table>
+                                            </el-tab-pane>
+                                            <el-tab-pane label="函数">
+                                                <el-table
+                                                    size="mini"
+                                                    fit
+                                                    :show-header="false"
+                                                    :highlight-current-row="true"
+                                                    :stripe="false"
+                                                    :border="false"
+                                                    height="240"
+                                                    @row-dblclick="tabFuncRowClickHandle"
+                                                    :data="funcMsg"
+                                                >
+                                                    <el-table-column min-width="40%">
+                                                        <template #default="scope">
+                                                            <el-popover trigger="hover" placement="bottom">
+                                                            <p>描述:{{ scope.row.formulaName }}</p>
+                                                            <!-- <p>参数:{{ scope.row.param }}</p> -->
+                                                            <template #reference>
+                                                                <span size="medium" transition="fade-in-linear">{{
+                                                                scope.row.formulaName
+                                                                }}</span>
+                                                            </template>
+                                                            </el-popover>
+                                                        </template>
+                                                    </el-table-column>
+                                                    <el-table-column min-width="60%">
+                                                        <template #default="scope">
+                                                            <el-popover trigger="hover" placement="bottom">
+                                                            <p>描述:{{ scope.row.description }}</p>
+                                                            <!-- <p>参数:{{ scope.row.param }}</p> -->
+                                                            <template #reference>
+                                                                <span size="medium" transition="fade-in-linear">{{
+                                                                scope.row.description
+                                                                }}</span>
+                                                            </template>
+                                                            </el-popover>
+                                                        </template>
+                                                    </el-table-column>
+                                                </el-table>
+                                            </el-tab-pane>
+                                            <el-tab-pane label="运算符">
+                                                <el-button-group>
+                                                    <el-button
+                                                    v-for="item in operator"
+                                                    :key="item"
+                                                    plain
+                                                    @click="scorRuleSplit(item)"
+                                                    style="width: 60px; margin: 7px 12px; height: 40px; border: 1px solid #409EFF;"
+                                                    >
+                                                    {{ item }}
+                                                    </el-button>
+                                                </el-button-group>
+                                            </el-tab-pane>
+                                        </el-tabs>
+                                    </div>
+                                    <div class="fromRight">
+                                        <div>
+                                            <div style="display:flex">
+                                                <!-- <el-checkbox style="margin-right: 10px" v-model="isrepresentation" @change="changeRep" /> -->
+                                                <!-- <el-tag style="margin-bottom: 5px">公式</el-tag> -->
+                                                <span style="font-size: 14px;color: #606266;font-weight:blod">公式</span>
+                                            </div>
+                                            <el-input
+                                            type="textarea"
+                                            rows="16"
+                                            v-model="itemForm.representation"
+                                            id="representation"
+                                            />
+                                        </div>
+                                        <!-- <div style="margin-top: 10px">
+                                            <div style="display:flex">
+                                                <el-checkbox style="margin-right: 10px" disabled v-model="isrange" @change="changeRank" />
+                                                <el-tag style="margin-bottom: 5px">子指标名称</el-tag>
+                                            </div>
+                                            <el-input
+                                            type="textarea"
+                                            rows="4"
+                                            v-model="itemForm.range"
+                                            disabled
+                                            id="range"
+                                            />
+                                        </div> -->
+                                    </div>
+                                </div>
+                            </div>
+                        </el-form-item>
+                        <el-form-item label="描述" prop="desc">
+                            <el-input v-model="ruleForm.desc" :rows="5" type="textarea" placeholder="请输入描述"></el-input>
+                        </el-form-item>
+                    </el-form>
+                </div>
+                <template #footer>
+                    <span class="dialog-footer">
+                        <el-button @click="dialogVisible = false">取 消</el-button>
+                        <el-button type="primary" @click="saveevaluscoringruleMsg('ruleForm')">确 定</el-button>
+                    </span>
+                </template>
+            </el-dialog>
+        </div>
+    </div>
+</template>
+
+<script>
+import btns from '../elbuttonS.vue'
+import seachs from '../seachGroup.vue'
+import {apiGetevaluationscoringruleList, apiGetindicatorListAll, apiGetfunctionList,
+apiGetbinsectionList, apiGetevaluationscoringSaveList, apiGetevaluationruleRemove} from '../../api/api'
+export default {
+  components: { btns,seachs },
+    data() {
+        return {
+            dialogVisible: false,
+            title: '',
+            indicItemoptions: [],
+            childerindicItemoptions: [],
+            binSectionoptions: [],
+            indicatorItems: [],
+            indicatorStr: '',
+            businessStr: '',
+            rowdataMsg: {},
+            changeDateSelect: [],
+            isSave: false,
+            funcMsg: [],
+            operator: [],
+            ruleForm: {
+                ruleName: '',
+                binSection: '',
+                indicatorId: '',
+                desc: ''
+            },
+            itemForm: {
+                representation: '',
+                range: '',
+                desc: ''
+            },
+            rules: {
+                ruleName: [
+                    { required: true, message: '请输入规则名称', trigger: 'blur' }
+                ],
+                binSection: [
+                    { required: true, message: '请选择业务属性', trigger: 'change' }
+                ],
+                indicatorId: [
+                    { required: true, message: '请选择指标名称', trigger: 'change' }
+                ],
+                desc: [
+                    { required: true, message: '请输入描述', trigger: 'blur' }
+                ]
+            },
+            loadingImport: false,
+            earlyWarningRulesData:[],
+            page:{
+                pagesize: 12,
+                currentPage: 1,
+                total: 0
+            }
+        }
+    },
+    created() {
+        this.getEvalscoringData()
+        this.getDataDictionary()
+        this.getEvaluationData()
+        this.getFunData()
+        this.operator = ["+", "-", "*", "/", "(", ")", ">", ">=", "<", "<=", "==", "!=",
+            "&&", "||", "!", "%", "true", "false", ".", ]
+    },
+    methods:{
+        // 查询预警规则数据
+        getEvalscoringData() {
+            let that = this
+            let params = {
+                pageNum: that.page.currentPage,
+                pageSize: that.page.pagesize,
+                scoreRuleName: that.indicatorStr,
+                businessPhase: that.businessStr
+            }
+            apiGetevaluationscoringruleList(params).then(datas =>{
+                if (datas && datas.data) {
+                    that.earlyWarningRulesData = datas.data.records
+                    that.page.total = datas.data.total
+                }
+            })
+        },
+        // 函数查询
+        getFunData() {
+            let that = this
+            apiGetfunctionList().then(datas =>{
+                if (datas && datas.data) {
+                    that.funcMsg = datas.data
+                }
+            })
+        },
+        // 查询模块
+        getDataDictionary() {
+            let that = this
+            apiGetbinsectionList().then(datas =>{
+                if (datas && datas.data) {
+                    that.binSectionoptions = datas.data
+                }
+            })
+        },
+        changeBinstation(val) {
+            this.getEvaluationData(val)
+        },
+        // 查询指标数据
+        getEvaluationData(val) {
+            let that = this
+            let params = {
+                binSection: val
+            }
+            apiGetindicatorListAll(params).then(datas =>{
+                if (datas && datas.data) {
+                    that.indicItemoptions = datas.data
+                }
+            })
+        },
+        handleAdd() {
+            this.dialogVisible = true
+            this.isSave = false
+            this.title = '新增考评预警规则'
+            this.$nextTick(() =>{
+                this.ruleForm = {
+                    ruleName: '',
+                    binSection: '',
+                    indicatorId: '',
+                    desc: ''
+                }
+            })
+        },
+        handleEdit(row) {
+            this.dialogVisible = true
+            this.isSave = true
+            this.title = '修改考评预警规则'
+            let evalradio = null
+            if (row) {
+                evalradio = row
+            } else {
+                evalradio = this.changeDateSelect[0]
+            }
+            this.ruleForm = {
+                ruleName: evalradio.scoreRuleName,
+                binSection: evalradio.businessPhase,
+                indicatorId: evalradio.indicatorId,
+                desc: evalradio.describe
+            }
+            this.getEvaluationData(evalradio.businessPhase)
+        },
+        saveevaluscoringruleMsg(formName) {
+            let that = this
+            that.$refs[formName].validate((valid) => {
+                if (valid) {
+                    that.saveAndEditIndicatorData()
+                }
+            });
+        },
+        //新增/修改指标数据
+        saveAndEditIndicatorData() {
+            let that = this
+            let params = {
+                scoreRuleName: that.ruleForm.ruleName,
+                businessPhase: that.ruleForm.binSection,
+                indicatorId: that.ruleForm.indicatorId,
+                describe: that.ruleForm.desc
+            }
+            if (that.isSave) {
+                let evalradio = this.changeDateSelect[0]
+                params.id = evalradio.id
+            }
+            apiGetevaluationscoringSaveList(params).then(datas =>{
+                if (!that.isSave) {
+                    that.$message({
+                        message: '考评预警规则新增成功',
+                        type: 'success'
+                    });
+                } else {
+                    that.$message({
+                        message: '考评预警规则修改成功',
+                        type: 'success'
+                    });
+                }
+                that.dialogVisible = false
+                that.changeDateSelect = []
+                that.getEvalscoringData()
+            })
+        },
+        //删除指标数据
+        handleDelete() {
+            this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+            }).then(() => {
+                let that = this
+                let paramsArr = []
+                that.changeDateSelect.forEach(it =>{
+                    paramsArr.push(it.id)
+                })
+                apiGetevaluationruleRemove(paramsArr.join(',')).then(datas =>{
+                    if (datas) {
+                        that.$message({
+                            type: 'success',
+                            message: '删除成功!'
+                        });
+                        that.changeDateSelect = []
+                        that.getEvalscoringData()
+                    }
+                })
+            })
+        },  
+        showCounter() {
+            this.$refs.counter.init(this.ruleForm.optionName)
+        },
+        counterStr(val) {
+            this.ruleForm.optionName = val
+        },
+        getSeachData() {
+            this.page.currentPage = 1
+            this.getEvalscoringData()
+        },
+        reset() {
+            this.page.currentPage = 1
+            this.indicatorStr = ''
+            this.businessStr = ''
+            this.getEvalscoringData()
+        },
+        handleSizeChange(val){
+            this.page.pagesize = val
+            this.getEvalscoringData()
+        },
+        handleCurrentChange(val){
+            this.page.currentPage =val
+            this.getEvalscoringData()
+        },
+        rowClick(selection, row) {
+            this.changeDateSelect = selection
+        }
+    }
+}
+</script>
+
+<style lang="less">
+.earlyWarningRules{
+    .earlyWarningRulesBtn{
+        .collectSeach{
+            display: flex;
+            padding: 24px 20px;
+            border-bottom: 1px solid#D6DBEA;
+                .exceed{
+                    display: flex;
+                    .exceedSpan{
+                        width: 75px;
+                        height: 12px;
+                        font-size: 14px;
+                        font-family: Microsoft YaHei;
+                        font-weight: 400;
+                        color: #8991B0;
+                        line-height: 12px;
+                        margin-top: 14px;
+                    }
+                    .el-input{
+                        margin-right:10px;
+                        .el-input__inner{
+                            height:40px;
+                        }
+                        .el-input__suffix{
+                            .el-select__caret{
+                                line-height:30px;
+                            }
+                        }
+                    }
+                }
+                .el-select{
+                    margin-right:10px;
+                    .el-input__inner{
+                        height:30px;
+                    }
+                    .el-input__suffix{
+                        .el-select__caret{
+                            line-height:30px;
+                        }
+                    }
+                }
+        }
+        span{
+            font-size:14px;
+        }
+        .PeriodBtn{
+            display: flex;
+            justify-content: end;
+            padding: 20px 0;
+        }
+        .el-button{
+            height: 30px;
+            // width:100px;
+            padding: 0 30px ;
+            // padding-top: 8px;
+            span{
+                margin:0;
+            }
+        }
+    }
+    .earlyWarningRulesTableData{
+        .el-table{
+            .el-table__body-wrapper{
+                height: 60vh !important;
+            }
+            .el-input__inner{
+                height: 30px !important;
+            }
+            .el-radio__label{
+                display: none;
+            }
+            .tooltipCC{
+                width: 400px;
+                display: inline-block;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
+            }
+            .indicitem{
+                color: #409EFF;
+                font-size: 12px;
+                margin-right: 20px;
+                cursor:pointer;
+                &:hover{
+                    text-decoration: underline;
+                }
+            }
+        }
+        .el-pagination{
+            margin-top: 20px;
+            text-align: end;
+            position: relative;
+        }
+    }
+    .el-overlay{
+        .el-dialog{
+            margin-top: 5vh;
+            .el-dialog__body{
+                padding: 30px 60px 30px 20px;
+                .periodFrom{
+                    .el-select, .el-input{
+                        width: 100%;
+                    }
+                    .earlyWarningRight {
+                        width: 100%;
+                        // padding-left: 30px;
+                        .earlyWarningFrom{
+                            display: flex;
+                            .fromLeft{
+                                width: 55%;
+                                margin-right: 20px;
+                                .el-tabs{
+                                    height: 100%;
+                                    .el-tabs__content{
+                                        .el-table{
+                                            .el-table__body-wrapper{
+                                                .el-checkbox__inner{
+                                                    border-radius: 10px;
+                                                }
+                                            }
+                                        }
+                                    }
+                                }
+                            }
+                            .fromRight{
+                                width: 43%;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+</style>

+ 2 - 2
src/components/gatewaynNewPage.vue

@@ -276,7 +276,7 @@
                                 <p>{{it.noticeTitle}}</p>
                                 <div style="margin-top: 5px">
                                     <span style="margin-right: 10px">{{it.createTime.substring(0, it.createTime.indexOf(' '))}}</span>
-                                    <span>{{it.releaseDept}}</span>
+                                    <span>{{it.releaseDeptName}}</span>
                                 </div>
                             </div>
                         </div>
@@ -345,7 +345,7 @@ export default {
     },
     mounted() {
         this.getGateWayData()
-        // this.getDeptNoticeData()
+        this.getDeptNoticeData()
     },
     methods: {
         getDeptNoticeData() {

+ 11 - 0
src/router/index.js

@@ -298,6 +298,17 @@ const routes = [
                             import(
                                 '../components/evaluationknowledgePage/scoringRulesPage.vue'
                             ),
+                    },
+                    {
+                        path: '/evaluationknowledge/earlyWarningRule',
+                        name: 'earlyWarningRule',
+                        meta: {
+                            title: '考评预警规则',
+                        },
+                        component: () =>
+                            import(
+                                '../components/evaluationknowledgePage/earlyWarningRulePage.vue'
+                            ),
                     }
                 ]
             },

+ 2 - 2
src/utils/index.js

@@ -28,16 +28,16 @@ const until = {
     },
     // 权限分配
     havePurview(data) {
+        let show = false
         if (window.localStorage.getItem('purview')) {
             let per = JSON.parse(window.localStorage.getItem('purview'))
-            let show = false
             per.forEach(it => {
                 if (it === data) { 
                     show = true
                 }
             })
-            return show
         }
+        return show
     },
     
     sortBy(attr,rev){