zhouna 4 gadi atpakaļ
vecāks
revīzija
b3c7a94808

+ 11 - 1
src/api/config.js

@@ -99,7 +99,17 @@ export default {
     'delConceptInfo':'/kl/conceptInfo/changeStatus',   //删除术语静态知识
     'login': '/sys/user/getJwt',
     'getDicList': '/sys/dictionaryInfo/getList',  //返回字典信息(界面返回)
-
+    //知识库规则维护
+    'zskRuleList':'/klRule/getKlRuleInfoPage',//规则列表
+    'zskAddRule':'/klRule/saveRuleInfo',//添加规则
+    'zskActiveRule':'/klRule/startRuleInfo',//启用规则
+    'zskDisableRule':'/klRule/disableRuleInfo',//禁用规则
+    'zskDelRule':'/klRule/clearRuleInfo',//删除规则
+    'zskRuleDetail':'/klRule/getByIdRuleInfo',//规则详情
+    'zskTypeList':'/klRulePlan/getMenu',//类型列表
+    'zskSearchConcept':'/klDisease/searchConcept',//知识库搜索术语
+    'zskUpdateAll':'/cache/clearRuleAll',//更新数据
+    'zskgetDict':'/kl/dictionary/getDictionarys',//禁止修改基础规则类型
   },
 	menuIconList: { //菜单对应图标
 		'YH-KZT': 'el-icon-menu',

+ 36 - 0
src/api/knowledgeLib.js

@@ -0,0 +1,36 @@
+import axios from 'axios';
+import config from '@api/config.js';
+
+const urls = config.urls;
+export default {
+    getRulesList(param){
+        return axios.post(urls.zskRuleList,param);
+    },
+    getTypesList(param){
+        return axios.post(urls.zskTypeList,param);
+    },
+    deleteRule(param){
+        return axios.post(urls.zskDelRule,param);
+    },
+    deleteRuleApply(param){
+        return axios.post(urls.zskDisableRule,param);
+    },
+    ruleDetail(param){
+        return axios.post(urls.zskRuleDetail,param);
+    },
+    searchConcept(param){
+        return axios.post(urls.zskSearchConcept,param);
+    },
+    saveRule(param){
+        return axios.post(urls.zskAddRule,param);
+    },
+    saveRuleApply(param){
+        return axios.post(urls.zskActiveRule,param);
+    },
+    zskUpdateAll() {    //更新数据
+        return axios.post(urls.zskUpdateAll)
+    },
+    zskgetDict(){
+        return axios.post(urls.zskgetDict)
+    }
+}

+ 435 - 0
src/components/knowledgeExtra/AddNewRule.vue

@@ -0,0 +1,435 @@
+<template>
+    <div>
+        <crumbs :title="title" :param="$route.params" linkTo="ZskRuleManager"></crumbs>
+        <div class="contents">
+            <div class="content">
+                <el-form ref="form" :label-position="labelPosition" class="add-new-form" label-width="130px" :model="form" :rules="rules">
+                    <el-form-item label="规则名称:" prop="parDescription">
+                        <el-input v-model.trim = "form.parDescription"></el-input>
+                    </el-form-item>
+                    <el-form-item label="规则类型:" prop="parRuleType">
+                        <el-select v-model="form.parRuleType"
+                                   placeholder="请选择"
+                                   size="small"
+                                   @change="ruleTypeChange"
+                        >
+                            <el-option
+                                    v-for="item in ruleTypeList"
+                                    :key="item.id"
+                                    :label="item.name"
+                                    :value="item.id">
+                            </el-option>
+                        </el-select>
+                        <span class="tip-text">注:更改术语类型,将会清空已填写的规则内容~</span>
+                    </el-form-item>
+                    <el-form-item label="规则术语类型:" prop="parLenCode">
+                        <el-select v-model="form.parLenCode"
+                                   placeholder="请选择"
+                                   size="small" @change="ruleTermChange">
+                            <el-option
+                                    v-for="item in ruleTermTypeList"
+                                    :key="item.id"
+                                    :label="item.name"
+                                    :value="item.code">
+                            </el-option>
+                        </el-select>
+                        <span class="tip-text">注:更改规则术语类型,将会清空已填写的规则内容~</span>
+                    </el-form-item>
+                    <el-form-item  class="addDepartFormItem" label="医学标准术语:" prop="parConceptId">
+                        <el-select clearable filterable remote :remote-method="searchConcept" v-model="form.parConceptId">
+                            <el-option
+                                    v-for="item in conceptList"
+                                    :key="item.conceptId"
+                                    :label="item.conceptName"
+                                    :value="item.conceptId">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>
+                    <!--<el-form-item label="有无子条件:" prop="parHasSub">
+                        <el-select v-model="form.parHasSub"
+                                   placeholder="请选择"
+                                   size="small">
+                            <el-option
+                                    v-for="item in hasSub"
+                                    :key="item.id"
+                                    :label="item.name"
+                                    :value="item.id">
+                            </el-option>
+                        </el-select>
+                    </el-form-item>-->
+                    <el-form-item label="附加信息:" prop="remind" class="parMsg">
+                        <el-input type="textarea" :rows="3" placeholder="请输入附加信息" v-model="form.parMsg" maxlength="301"></el-input>
+                    </el-form-item>
+                    <el-form-item v-if="form.parHasSub===1" label="规则内容:" prop="remind" class="discDesc">
+                        <SubRulesGroup v-for="(group,i) in subGroups"
+                                       ref="groups"
+                                       :data="group"
+                                       :baseTypes="baseTypeList"
+                                       :inx="i"
+                                       :firstPlace="firstPlace"
+                                       :isLast="subGroups.length===1"
+                                       @addGroup="addGroup"
+                                       @delGroup="delGroup"></SubRulesGroup>
+                    </el-form-item>
+                    <el-button class="disclButn" size="small" type="primary" @click="confirm">保存</el-button>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script type="text/javascript">
+    import api from '@api/knowledgeLib.js';
+    import SubRulesGroup from './SubRulesGroup'
+    export default {
+        name:'AddRule',
+        data(){
+            return{
+                labelPosition:'left',
+                isFirst:true,
+                isCopy:false,
+                dict:'',
+                title:'规则维护-添加规则',
+                ruleTermTypeList:[],
+                ruleTypeList:[],
+                conceptList:[],
+                baseTypeList:[],
+                conceptName:'',
+                firstPlace:null,
+                subGroups:[[{
+                    subDescription:'',
+                    parRuleType:'',
+                    subConceptId:'',
+                    subType:'',
+                    subMaxOperator:'',
+                    subMaxUnit:'',
+                    subMaxValue:'',
+                    subMinOperator:'',
+                    subMinUnit:'',
+                    subMinValue:'',
+                    subEqValue:'',
+                    subLenCode:'',
+                    dataType:'',
+                }]],
+                form:{
+                    parDescription:'',
+                    parRuleType:'',
+                    parConceptId:'',
+                    parlibName:'',
+                    parHasSub:undefined,
+                    parLenCode:'',
+                    parMsg:'',
+                    klRuleInfoSaveSub:[],
+                },
+                parId:null,
+                rules:{
+                    parDescription:[{ required: true, message: '请输入规则名称',trigger: ['blur'] },{
+                        validator: (rule,value,callback)=>{
+                            if(value.length>100){
+                                callback(new Error('规则名称不能超过100字'));
+                            }else{
+                                callback();
+                            }}, trigger: 'change'
+                    }],
+                    parRuleType:[{ required: true, message: '请选择规则类型',trigger: ['change'] }],
+                    parLenCode:[{ required: true, message: '请选择规则术语类型',trigger: ['change'] }],
+                    parConceptId:[{ required: true, message: '请输入医学标准术语',trigger: ['blur'] }],
+                    parHasSub:[{ required: true, message: '请选择有无子条件',trigger: ['change'] }],
+                    parMsg:[{
+                        validator: (rule,value,callback)=>{
+                            if(value.length>300){
+                                callback(new Error('附加信息不能超过300字'));
+                            }else{
+                                callback();
+                            }}, trigger: 'change'
+                    }]
+                },
+                hasSub:[{name:'有',id:1},{name:'无',id:0},
+                ]
+            }
+        },
+        created(){
+            this.getTypeList();
+            this.getDict();
+            const param = this.$route.params;
+            let info = param.data;
+            if(info){
+                this.parId = info.parId;
+                this.isCopy=param.copy;
+                this.title = "规则维护-"+(this.isCopy?'复制':'修改')+"规则";
+                this.form=Object.assign({},this.form,info);
+                this.conceptList=[{conceptName:this.form.parlibName,conceptId:this.form.parConceptId}];
+                this.subGroups=this.formatGroupDatas(info.klRuleByIdSub);
+
+            }
+        },
+        watch:{
+            'form.parRuleType':function(val){
+                const obj = this.ruleTypeList.find((it)=>it.id===val);
+                this.ruleTermTypeList = obj.subMenuList;
+            },
+            'form.parLenCode':function(val){
+                if(!val){
+                    this.baseTypeList = [];
+                    return ;
+                }
+                const obj = this.ruleTermTypeList.find((it)=>it.code===val);
+                this.baseTypeList = obj.subMenuList;
+            },
+            'form.parConceptId':function(val){
+                if(this.checkFirstPlace) {
+                    this.firstPlace = this.conceptList.find((it) => it.conceptId === val);
+                }else{
+                    this.firstPlace =null;
+                }
+            }
+        },
+        components:{
+            SubRulesGroup
+        },
+        computed:{
+            checkFirstPlace:function(){
+                const str=this.form.parRuleType+this.form.parLenCode;
+                return this.dict.indexOf(str);
+            }
+        },
+        methods:{
+            getDict(){
+                api.zskgetDict().then((res) => {
+                    if (res.data.code == '0') {
+                        const data = res.data.data;
+                        const arr =data['20'].map((it)=>it.val);
+                        this.dict = arr.join(",");
+                        localStorage.setItem("zskDicts",arr.join(","));
+                    }
+                }).catch((error) => {
+                    console.log(error);
+                });
+            },
+            showConfirmDialog(msg,resolve){
+                this.$alert(msg, '提示', {
+                    confirmButtonText: '确定',
+                    type: 'warning'
+                }).then(() => {
+                    resolve();
+                }).catch(() => {});
+            },
+            formatGroupDatas(data){
+                let arr=[];
+                data.map((it)=>{
+                    if(!arr[it.groupType]){arr[it.groupType]=[];}
+                    if(it.subMaxOperator){
+                        it.dataType='1';
+                    }else if(it.subEqValue){
+                        it.dataType='2';
+                    }
+                    arr[it.groupType].push(it);
+                })
+                return arr;
+            },
+            searchConcept(val){
+                const param = {
+                    excludedConceptIds:[this.form.parRuleType],
+                    libType:this.form.parLenCode,
+                    name:val,
+                };
+                api.searchConcept(param).then((res) => {
+                    if (res.data.code == '0') {
+                        const data = res.data.data;
+                        this.conceptList = data;
+                    }
+                }).catch((error) => {
+                    console.log(error);
+                });
+            },
+            ruleTypeChange(val){       //规则类型选中
+                this.form.parRuleType=val;
+                this.form.parLenCode='';
+                const obj = this.ruleTypeList.find((it)=>it.id===val);//console.log(val)
+                this.ruleTermTypeList = obj.subMenuList;
+                this.setInitGroupData();
+            },
+            ruleTermChange(val){        //规则术语类型选中
+                this.form.parLenCode=val;
+                const obj = this.ruleTermTypeList.find((it)=>it.code===val);
+                this.baseTypeList = obj.subMenuList;
+                this.setInitGroupData();
+                this.form.parHasSub=obj.subMenuList.length?1:0;
+            },
+            getTypeList(){
+                const typeListData = JSON.parse(localStorage.getItem("zskTypesList"));
+                this.ruleTypeList = typeListData;
+            },
+            setInitGroupData(){
+                this.subGroups = [[{
+                    subDescription:'',
+                    parRuleType:'',
+                    subConceptId:'',
+                    subType:'',
+                    subMaxOperator:'',
+                    subMaxUnit:'',
+                    subMaxValue:'',
+                    subMinOperator:'',
+                    subMinUnit:'',
+                    subMinValue:'',
+                    subEqValue:'',
+                    subLenCode:'',
+                    dataType:'',
+                }]];
+                this.form.parConceptId='';//医学标准术语清空
+                this.conceptList=[];  //下拉列表清空
+            },
+            addGroup(){
+                this.subGroups.push([{
+                    subDescription:'',
+                    parRuleType:'',
+                    subConceptId:'',
+                    subType:'',
+                    subMaxOperator:'',
+                    subMaxUnit:'',
+                    subMaxValue:'',
+                    subMinOperator:'',
+                    subMinUnit:'',
+                    subMinValue:'',
+                    subEqValue:'',
+                    subLenCode:'',
+                    dataType:'',
+                }]);
+            },
+            delGroup(i){
+                this.subGroups.splice(i,1);
+            },
+            saveRule(params){
+                api.saveRule(params).then((res)=>{
+                    if(res.data.code==0){
+                        this.$message({
+                            message:"操作成功",
+                            type:'success'
+                        });
+                        this.$router.push({name: 'ZskRuleManager'});
+                    }else{
+                        this.$message({
+                            message:res.data.msg,
+                            type:'warning'
+                        });
+                    }
+                })
+            },
+            formatGroups(){
+                let obj = [];
+                this.subGroups.map((item,i)=>{
+                    item.map((it)=>{
+                        obj.push({groupType:i,...it});
+                    })
+                });
+                return obj
+            },
+            validateForms(callBack){
+                this.$refs['form'].validate((valid) => {
+                    if (valid) {
+                        const groupsRef = this.$refs['groups'];
+                        let groupRef=null,goOn=true;
+                        for(let i=0;i<groupsRef.length;i++){
+                            groupRef=groupsRef[i].$refs['group'];
+                            for(let j=0;j<groupRef.length;j++){
+                                groupRef[j].$refs['groupData'].validate((valid)=>{
+                                    if(!valid){
+                                        goOn=false;
+                                    }
+                                })
+                            }
+                        }
+                        if(goOn){
+                            callBack();
+                        }
+                    } else {
+                        return false;
+                    }
+                });
+            },
+            confirm(){
+                const _this=this;
+                this.validateForms(function(){
+                    _this.form.klRuleByIdSub=undefined;
+                    _this.form.klRuleInfoSaveSub = _this.form.parHasSub?_this.formatGroups():undefined;
+                    let params = _this.form;
+                    if(_this.parId){//修改/复制
+                        params = Object.assign({},_this.form,{parId:_this.isCopy?undefined:_this.parId})
+                    }
+                    _this.saveRule(params);
+                });
+            },
+        }
+    }
+</script>
+<style lang="less">
+    @import "../../less/admin.less";
+    .content{
+        background: #fff;
+        // padding: 20px 20px 30px;
+        padding: 20px 20px 50px;
+        color: #545455;
+        min-width: 980px;
+        position: relative;
+        .tip-text{
+            color:#F56C6C;
+            margin-left: 10px;
+        }
+        .conceptItem{
+            padding: 0 10px;
+            cursor: pointer;
+            height: 32px;
+            line-height: 32px;
+            &:hover{
+                background: #ebedf1;
+            }
+        }
+        .discDesc{
+            margin-bottom: 20px;
+        }
+        .disclButn{
+            position: absolute;
+            right: 80px;
+            bottom: 10px;
+        }
+    }
+    .add-new-form{
+        .el-form-item__label{
+            text-align: right;
+        }
+        .addDepartFormItem {
+            position: relative;
+        }
+        .itemList {
+            position: absolute;
+            // display: none;
+            background: #fff;
+            width: 188px;
+            max-height: 160px;
+            border: 1px solid #DCDFE6;
+            left: 0;
+            top: 37px;
+            z-index: 2;
+            overflow-y: auto;
+        }
+        .indexList {
+            left: 42px;
+            top: 78px;
+        }
+        .el-input__prefix, .el-input__suffix{
+            /*top:-2px;*/
+            right: 3px;
+        }
+        .el-input--suffix .el-input__inner{
+            padding-right: 22px;
+        }
+        .el-input,.el-input__inner{
+            width: 190px;
+            line-height: 32px;
+            height: 32px;
+        }
+        .el-input__icon{
+            line-height: 32px;
+        }
+    }
+
+</style>

+ 407 - 0
src/components/knowledgeExtra/RuleManager.vue

@@ -0,0 +1,407 @@
+<template>
+    <div>
+        <crumbs title="规则维护" :minWidth="titleWidth" class="knowledgeTitle">
+            <el-form :inline="true" class="demo-form-inline">
+                <el-form-item label="规则名称:">
+                    <el-input size="mini" v-model="filter.parDescription" placeholder="输入规则名称"></el-input>
+                </el-form-item>
+                <el-form-item label="规则类型:">
+                    <el-select v-model="filter.parRuleType" clearable placeholder="请选择" size="mini">
+                        <el-option
+                                v-for="item in ruleTypeList"
+                                :key="item.id"
+                                :label="item.name"
+                                :value="item.id">
+                        </el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item label="术语名称:">
+                    <el-input size="mini" v-model="filter.parConceptName" placeholder="输入术语名称"></el-input>
+                </el-form-item>
+                <el-form-item label="状态:">
+                    <el-select v-model="filter.parStatus" clearable placeholder="请选择" size="mini">
+                        <el-option
+                                v-for="item in stateSelect"
+                                :key="item.id"
+                                :label="item.name"
+                                :value="item.id">
+                        </el-option>
+                    </el-select>
+                </el-form-item>
+                <el-form-item>
+                    <el-button size="mini" @click="filterDatas">确认</el-button>
+                </el-form-item>
+            </el-form>
+            <el-form class="secLine">
+                <el-form-item>
+                    <el-button size="mini" @click="addRule" type="warning" style="margin:0 10px">+ 新增规则</el-button>
+                    <el-button size="mini" @click="update">更新数据</el-button>
+                </el-form-item>
+            </el-form>
+        </crumbs>
+        <div class="contents knowledgeContents">
+            <el-table :data="list"
+                      border
+                      style="width: 100%">
+                <el-table-column
+                        type="index"
+                        :index="indexMethod"
+                        label="编号"
+                        width="60">
+                </el-table-column>
+                <el-table-column
+                        prop="parDescription"
+                        label="规则名称"
+                        width="160">
+                </el-table-column>
+                <el-table-column
+                        prop="parRuleType"
+                        label="规则类型"
+                        width="100">
+                    <template slot-scope="scope">
+                        {{statusTrans(scope.row.parRuleType)}}
+                    </template>
+                </el-table-column>
+                <el-table-column
+                        prop="parConceptName"
+                        label="医学标准术语"
+                        width="160">
+                </el-table-column>
+                <el-table-column
+                        prop="parLibTypeName"
+                        label="术语类型"
+                        width="130">
+                </el-table-column>
+                <el-table-column
+                        prop="parHasSub"
+                        label="有无子条件"
+                        width="100">
+                    <template slot-scope="scope">
+                        {{scope.row.parHasSub === '0'?'无':'有'}}
+                    </template>
+                </el-table-column>
+                <el-table-column
+                        prop="parMsg"
+                        label="附加信息"
+                        width="160">
+                </el-table-column>
+                <el-table-column
+                        label="状态">
+                    <template slot-scope="scope">
+                          <span>
+                            {{scope.row.parStatus === 0?'禁用':'启用'}}
+                          </span>
+                    </template>
+                </el-table-column>
+                <el-table-column
+                        prop="modifier"
+                        label="操作人">
+                </el-table-column>
+                <el-table-column
+                        prop="gmtModified"
+                        label="操作时间"
+                        width="180">
+                </el-table-column>
+                <el-table-column
+                        label="操作"
+                        width="180">
+                    <template slot-scope="scope">
+                        <el-button type="text" size="small" @click="editData(scope.row.parId)">修改</el-button>
+                        <span style="margin:0 3px;">|</span>
+                        <el-button type="text" size="small" @click="editData(scope.row.parId,true)">复制</el-button>
+                        <span style="margin:0 3px;">|</span>
+                        <el-button type="text" size="small" :class="scope.row.parStatus === 0?'':'delete'" @click="showDelDialog(scope.row)">{{scope.row.parStatus === 0?'启用':'禁用'}}</el-button>
+                        <span style="margin:0 3px;">|</span>
+                        <el-button type="text" size="small" class="delete" @click="showDelDialog(scope.row,1)">删除</el-button>
+                    </template>
+                </el-table-column>
+            </el-table>
+            <el-pagination :current-page.sync="currentPage"
+                           @current-change="currentChange"
+                           background
+                           :page-size="pageSize"
+                           :page-sizes="pageSizeArr"
+                           @size-change="handleSizeChange"
+                           :layout="pageLayout"
+                           :total="total">
+            </el-pagination>
+        </div>
+
+    </div>
+</template>
+
+<script>
+    import api from '@api/knowledgeLib.js';
+    import config from '@api/config.js';
+    import utils from '@api/utils.js';
+
+    export default {
+        name: 'ZskRuleManager',
+        data: function () {
+            return {
+                list: [],
+                stateSelect:[
+                    {id:1,name:'启用'},
+                    {id:0,name:'禁用'},
+                ],
+                ruleTypeList:[],
+                searched: false,
+                filter:{
+                    parStatus:'',
+                    parDescription:'',
+                    parConceptName:'',
+                    parRuleType:'',
+                },
+                cacheData: {},
+                currentPage: 1,
+                pageSize: config.pageSize,
+                pageSizeArr:config.pageSizeArr,
+                pageLayout:config.pageLayout,
+                total: 0,
+                titleWidth:'1070px' //头部最小宽度
+            }
+        },
+        created() {
+            this.getTypeList();
+            const that = this;
+            //返回时避免参数未赋值就获取列表
+            setTimeout(function(){
+                that.getDataList();
+            });
+        },
+        watch: {
+            'filter': {
+                handler: function () {
+                    this.searched = false;
+                },
+                deep: true
+            }
+        },
+        beforeRouteEnter(to, from, next) {
+            next(vm => {
+                //const pm = to.param;
+                Object.assign(vm, to.params);
+                vm.inCurrentPage=to.params.currentPage;
+            })
+        },
+        methods: {
+            statusTrans(type){
+                const obj = this.ruleTypeList.find((it)=>it.type===type);
+                return obj&&obj.name;
+            },
+            getTypeList(){
+                const typeListData = JSON.parse(localStorage.getItem("zskTypesList"));
+                if(typeListData){
+                    this.ruleTypeList = typeListData;
+                    return;
+                }
+                api.getTypesList({}).then((res) => {
+                    if (res.data.code == '0') {
+                        const data = res.data.data;
+                        this.ruleTypeList = data;
+                        localStorage.setItem("zskTypesList",JSON.stringify(data));
+                    }
+                }).catch((error) => {
+                    console.log(error);
+                });
+            },
+            handleSizeChange(val){
+                this.pageSize = val;
+                this.currentPage = utils.getCurrentPage(this.currentPage, this.total, this.pageSize);
+                this.getDataList();
+            },
+            addRule(){
+                const pam = this.searched ? {
+                    currentPage: this.currentPage,
+                    pageSize:this.pageSize,
+                    filter: this.filter
+                } : {currentPage: this.currentPage,
+                    pageSize:this.pageSize};
+                this.$router.push({name: 'AddZskRule', params: pam});
+            },
+            filterDatas(){
+                this.currentPage = 1;
+                this.getDataList(1);
+            },
+            getDataList(flag,isTurnPage) {
+                const params = this.getFilterItems(isTurnPage);
+                this.searched = true;
+                const loading = this.$loading({
+                    lock: true,
+                    text: 'Loading',
+                    spinner: 'el-icon-loading',
+                    background: 'rgba(0, 0, 0, 0.7)'
+                });
+                api.getRulesList(params).then((res) => {
+                    loading.close();
+                    if (res.data.code == '0') {
+                        const data = res.data.data;
+                        for(let j = 0;j < data.records.length;j++){
+                            data.records[j].condition = (data.records[j].parStatus == '1'?'启用':'禁用')
+                        }
+                        this.list = data.records;
+                        if(!flag){//搜索时不缓存
+                            this.cacheData[params.current] = data.records;
+                        }else{
+                            this.cacheData = {}
+                        }
+                        this.total = data.total;
+                        if(this.inCurrentPage!==undefined){
+                            this.currentPage=this.inCurrentPage;
+                            this.inCurrentPage = undefined;
+                        }
+                    }else{
+                        this.warning(res.data.msg||'获取列表数据失败');
+                    }
+                }).catch((error) => {
+                    loading.close();
+                    console.log(error);
+                });
+            },
+            getFilterItems(isTurnPage) {
+                //翻页时筛选条件没点确定则清空
+                if(isTurnPage&&!this.searched){
+                    this.clearFilter();
+                };
+                const param = {
+                    current: this.inCurrentPage||this.currentPage,
+                    size: this.pageSize,
+                    parRuleType: this.filter.parRuleType,
+                    parDescription: this.filter.parDescription.trim(),
+                    parConceptName: this.filter.parConceptName.trim(),
+                    parStatus:this.filter.parStatus
+                };
+                return param;
+            },
+            indexMethod(index) {
+                return ((this.currentPage - 1) * this.pageSize) + index + 1;
+            },
+            currentChange(next) {
+                this.currentPage = next;
+                /*if (this.cacheData[next]) {       //如果已请求过该页数据,则使用缓存不重复请求
+                  this.list = this.cacheData[next];
+                } else {*/
+                this.getDataList(1,true);
+                //}
+            },
+            warning(msg,type){
+                this.$message({
+                    showClose: true,
+                    message:msg,
+                    type:type||'warning'
+                })
+            },
+            showConfirmDialog(msg,resolve){
+                this.$alert(msg, '提示', {
+                    confirmButtonText: '确定',
+                    type: 'warning'
+                }).then(() => {
+                    resolve();
+                }).catch(() => {});
+            },
+            editData(id,isCopy){
+                const pam = this.searched ? {
+                    currentPage: this.currentPage,
+                    pageSize:this.pageSize,
+                    filter: this.filter
+                } : {currentPage: this.currentPage,
+                    pageSize:this.pageSize};
+                api.ruleDetail({id}).then((res) => {
+                    if (res.data.code == '0') {
+                        const data = res.data.data;
+                        this.$router.push({name:'AddZskRule',params:{...pam,data,copy:isCopy}});
+                    }
+                }).catch((error) => {
+                    this.warning('获取详情失败,请重试')
+                });
+            },
+            showDelDialog(row,isDelete){
+                const params = {
+                    id:row.parId
+                };
+                const txt=row.parStatus===0?'重新启用':'禁用';
+                const warningTxt = isDelete?'是否删除该规则?可能对现有系统造成影响':'是否'+txt+'该条数据?';
+                const handleFn = isDelete?api.deleteRule:(row.parStatus===0?api.saveRuleApply:api.deleteRuleApply);
+                this.showConfirmDialog(warningTxt,()=>{
+                    handleFn(params).then((res)=>{
+                        if(res.data.code=='0'){
+                            if(!this.searched){
+                                //未点确认时清空搜索条件
+                                this.clearFilter();
+                            }
+                            if(isDelete){       //恢复成功后跳转到筛选条件的首页
+                                this.currentPage = 1;
+                            } else {
+                                if (this.filter.parStatus!==''&&this.list.length === 1){
+                                    //有启用状态筛选条件且当前页只有最后一条数据删除时,删除成功后跳转到前一页
+                                    this.currentPage = this.currentPage===1?1:this.currentPage-1;
+                                }
+                            }
+                            this.warning(res.data.msg||'操作成功','success');
+                            this.getDataList();
+                        }else{
+                            this.warning(res.data.msg);
+                        }
+                    }).catch((error)=>{
+                        this.warning(error);
+                    })
+                });
+            },
+            clearFilter(){
+                this.filter={
+                    parStatus:'',
+                    parConceptName:'',
+                    parDescription:'',
+                    parRuleType:'',
+                };
+            },
+            update(){
+                const loading = this.$loading({
+                    lock: true,
+                    text: 'Loading',
+                    spinner: 'el-icon-loading',
+                    background: 'rgba(0, 0, 0, 0.7)'
+                });
+                api.zskUpdateAll().then((res) => {
+                    loading.close();
+                    if (res.data.code == '0') {
+                        this.warning('更新成功','success');
+                        this.getDataList();
+                    }
+                }).catch((error) => {
+                    loading.close();
+                    this.warning('更新失败,请重试')
+                });
+            },
+        }
+    }
+</script>
+
+<style lang="less" scoped>
+    @import "../../less/admin.less";
+    /deep/ .container.knowledgeTitle {
+        height: 80px;
+    }
+    /deep/ .contents.knowledgeContents {
+        padding: 104px 20px 0;
+    }
+    /deep/ .secLine.el-form {
+        float: right;
+        display: block;
+        position: relative;
+        top: -5px;
+    }
+    .delete{
+        color: red;
+    }
+    .review{
+        color: #22ccc8;
+    }
+    .el-table .cell{
+        overflow: hidden;
+        white-space: nowrap;
+    }
+    #upFile{
+        display: none !important;
+    }
+</style>

+ 376 - 0
src/components/knowledgeExtra/SubConditions.vue

@@ -0,0 +1,376 @@
+<template>
+    <div class="groups-cont">
+        <el-form ref="groupData" label-width="150px" class="sub-condition-form" :model="groupData" :rules="rules">
+            <span v-if="!disabled" class="del-btn"  @click="delRule">删除</span><!--:class="isLast?'disable del-btn':'del-btn'"-->
+            <el-form-item label="基础规则名称:" prop="subDescription">
+                <el-input v-model.trim = "groupData.subDescription" :disabled="disabled"></el-input>
+            </el-form-item>
+            <el-form-item label="基础规则类型:" prop="subType">
+                <el-select v-model="groupData.subType"
+                           :disabled="disabled"
+                           placeholder="请选择"
+                           size="small"
+                           @change="subTypeChange">
+                    <el-option
+                            v-for="item in baseTypes"
+                            :key="item.id"
+                            :label="item.name"
+                            :value="item.type">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item label="基础规则术语类型:" prop="subLenCode">
+                <el-select v-model="groupData.subLenCode"
+                           :disabled="disabled"
+                           placeholder="请选择"
+                           size="small" @change="subCodeChange">
+                    <el-option
+                            v-for="item in baseTermTypeList"
+                            :key="item.id"
+                            :label="item.name"
+                            :value="item.code">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item  class="addDepartFormItem" label="医学标准术语:" prop="subConceptId">
+                <el-select clearable remote filterable :disabled="disabled" :remote-method="searchConcept" v-model="groupData.subConceptId">
+                    <el-option
+                            v-for="item in conceptList"
+                            :key="item.conceptId"
+                            :label="item.conceptName"
+                            :value="item.conceptId">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item v-if="groupData.subType===2" label="选择类型:" prop="dataType">
+                <el-select v-model="groupData.dataType"
+                           placeholder="请选择"
+                           size="small" @change="dataTypeChange">
+                    <el-option
+                            v-for="item in dataTypes"
+                            :key="item.id"
+                            :label="item.name"
+                            :value="item.id">
+                    </el-option>
+                </el-select>
+            </el-form-item>
+            <el-form-item class="min-margin" v-if="groupData.dataType==='1'" label="最大值:" required>
+                <div class="select-item clearfix">
+                    <el-col :span="4">
+                        <el-form-item prop="subMaxOperator">
+                            <el-select v-model="groupData.subMaxOperator"
+                                       placeholder="请选择"
+                                       size="small">
+                                <el-option
+                                        v-for="item in operTypeList"
+                                        :key="item.key"
+                                        :label="item.name"
+                                        :value="item.key">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="4">
+                        <el-form-item prop="subMaxValue">
+                            <el-input-number controls-position="right" type="text" v-model="groupData.subMaxValue" placeholder="填写数值"/>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="4">
+                        <el-form-item prop="subMaxUnit">
+                            <el-input  type="text" v-model="groupData.subMaxUnit" placeholder="填写单位"/>
+                        </el-form-item>
+                    </el-col>
+                </div>
+            </el-form-item>
+            <el-form-item class="min-margin" v-if="groupData.dataType==='1'" label="最小值:" required>
+                <div class="select-item clearfix">
+                    <el-col :span="4">
+                        <el-form-item prop="subMinOperator">
+                            <el-select v-model="groupData.subMinOperator"
+                                       placeholder="请选择"
+                                       size="small">
+                                <el-option
+                                        v-for="item in operTypeList"
+                                        :key="item.name"
+                                        :label="item.name"
+                                        :value="item.name">
+                                </el-option>
+                            </el-select>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="4">
+                        <el-form-item prop="subMaxValue">
+                            <el-input-number controls-position="right" type="text" v-model="groupData.subMinValue" placeholder="填写数值"/>
+                        </el-form-item>
+                    </el-col>
+                    <el-col :span="4">
+                        <el-form-item prop="subMinUnit">
+                            <el-input  type="text" v-model="groupData.subMinUnit" placeholder="填写单位"/>
+                        </el-form-item>
+                    </el-col>
+                </div>
+            </el-form-item>
+            <el-form-item v-if="groupData.dataType==='2'" label="医学内容:" prop="subEqValue" class="discDesc">
+                <el-input type="textarea" rows="3" placeholder="请输入医学内容" v-model="groupData.subEqValue"></el-input>
+            </el-form-item>
+            <el-form-item v-if="groupData.subType===6" label="正则表达式:" prop="subEqValue" class="discDesc">
+                <el-input type="textarea" rows="3" placeholder="请输入正则表达式" v-model="groupData.subEqValue"></el-input>
+            </el-form-item>
+        </el-form>
+        <div class="inner-oper">
+            <span>新增规则:</span>
+            <span class="add-btn" @click="addRule"><img src="../../images/add.png" alt="新增规则"></span>
+        </div>
+    </div>
+</template>
+<script>
+    import api from '@api/knowledgeLib.js';
+    export default {
+        name:'subCondititons',
+        props:['groupData','ind','isLast','baseTypes','firstPlace','disabled'],
+        data(){
+            return {
+                baseTermTypeList:[],
+                typeList:[],
+                operTypeList:[{name:'>',key:'>'},
+                    {name:'>=',key:'>='},
+                    {name:'<',key:'<'},
+                    {name:'<=',key:'<='},
+                    {name:'=',key:'='},
+                ],
+                dataTypes:[{id:'1',name:'数值类型'},{id:'2',name:'文本类型'}],
+                conceptList:[],
+                rules:{
+                    subDescription:[{ required: true, message: '请选择基础规则名称',trigger: ['blur'] },{
+                        validator: (rule,value,callback)=>{
+                            if(value.length>100){
+                                callback(new Error('规则名称不能超过100字'));
+                            }else{
+                                callback();
+                            }}, trigger: 'change'
+                    }],
+                    subType:[{ required: true, message: '请选择基础规则类型',trigger: ['change'] }],
+                    subLenCode:[{ required: true, message: '请选择基础规则术语类型',trigger: ['change'] }],
+                    subConceptId:[{ required: true, message: '请输入医学标准术语',trigger: ['blur'] }],
+                    dataType:[{ required: true, message: '请选择类型',trigger: ['change'] }],
+                    subMaxOperator:[{ required: true, message: '请选择最大值操作符',trigger: ['change'] }],
+                    subMaxValue:[{ required: true, message: '请输入最大值',trigger: ['blur'] }],
+                    subMaxUnit:[{ required: true, message: '请输入最大值单位',trigger: ['blur'] }],
+                    subMinOperator:[{ required: true, message: '请选择最小值操作符',trigger: ['change'] }],
+                    subMinValue:[{ required: true, message: '请输入最小值',trigger: ['blur'] }],
+                    subMinUnit:[{ required: true, message: '请输入最小值单位',trigger: ['blur'] }],
+                    subEqValue:[{ required: true, message: '请输入医学内容',trigger: ['blur'] }],
+                },
+            }
+        },
+        watch:{
+            'groupData':{
+                handler:function(val){
+                    this.$emit("changeVal",val,this.ind);
+                },
+                deep:true
+            },
+            'baseTypes':{
+                handler:function(){
+                    if(!this.groupData.subType){
+                        this.baseTermTypeList =[];
+                        return;
+                    }
+                    const obj = this.baseTypes.find((it)=>it.type===this.groupData.subType);
+                    this.baseTermTypeList = obj.subMenuList;
+                },
+                deep:true
+            },
+            'firstPlace':function(val){
+                if(!val)return;
+                /*const str=localStorage.getItem("zskDicts");
+                const arr=str.split(",");
+                arr*/
+                const sub = this.baseTypes.find((it)=>it.firstPlace===1);
+                this.groupData.subType=sub.type;
+                this.baseTermTypeList =sub.subMenuList;
+                this.groupData.subLenCode=this.baseTermTypeList.find((it)=>it.firstPlace===1).code;
+                this.conceptList=[val];
+                this.groupData.subDescription=val.conceptName;
+                this.groupData.subConceptId = val.conceptId;
+                this.groupData.subConceptName = val.conceptName;
+            }
+        },
+        created(){
+            this.conceptList=[{conceptName:this.groupData.subLibName,conceptId:this.groupData.subConceptId}];
+        },
+        methods:{
+            dataTypeChange(val){
+                this.groupData.dataType=val;
+                this.clearNumText();
+            },
+            subTypeChange(val){         //基础规则类型修改
+                this.groupData.subLenCode='';
+                this.groupData.dataType='';
+                this.clearConcept();
+                this.clearNumText();
+                if(!val){
+                    this.baseTermTypeList =[];
+                    return;
+                }
+                const obj = this.baseTypes.find((it)=>it.type===val);
+                this.baseTermTypeList = obj.subMenuList;
+            },
+            subCodeChange(val){        //基础规则术语类型修改
+                this.groupData.subLenCode=val;
+                this.groupData.dataType='';
+                this.clearConcept();
+                this.clearNumText();
+            },
+            clearConcept(){
+                this.groupData.subConceptId='';
+                this.conceptList=[];
+            },
+            clearNumText(){
+                this.groupData.subMaxOperator='';
+                this.groupData.subMaxValue='';
+                this.groupData.subMaxUnit='';
+                this.groupData.subMinOperator='';
+                this.groupData.subMinValue='';
+                this.groupData.subMinUnit='';
+                this.groupData.subEqValue='';
+            },
+            searchConcept(val){
+                const param = {
+                    excludedConceptIds:[this.groupData.subType],
+                    libType:this.groupData.subLenCode,
+                    name:val,
+                };
+                api.searchConcept(param).then((res) => {
+                    if (res.data.code == '0') {
+                        const data = res.data.data;
+                        this.conceptList = data;
+                    }
+                }).catch((error) => {
+                    console.log(error);
+                });
+            },
+            addRule(){
+                this.$emit("addRule");
+            },
+            delRule(){
+                if(this.isLast){
+                    this.warning("初始状态规则不能删除~");
+                    return;
+                }
+                //this.showConfirmDialog("是否删除该条规则,可能对现有系统会造成影响",()=>{
+                this.$emit("delRule",this.ind);
+                //});
+
+            },
+            warning(msg,type){
+                this.$message({
+                    showClose: true,
+                    message:msg,
+                    type:type||'warning'
+                })
+            },
+            showConfirmDialog(msg,resolve){
+                this.$alert(msg, '提示', {
+                    confirmButtonText: '确定',
+                    type: 'warning'
+                }).then(() => {
+                    resolve();
+                }).catch(() => {});
+            },
+        }
+    }
+</script>
+<style lang="less">
+    .groups-cont{
+        background: #fff;
+        .conceptItem{
+            padding: 0 10px;
+            cursor: pointer;
+            height: 32px;
+            line-height: 32px;
+            &:hover{
+                background: #ebedf1;
+            }
+        }
+        .inner-oper{
+            border-top:2px solid #F5F5F5;
+            padding: 15px 0 15px 21px;
+            .add-btn {
+                cursor: pointer;
+                img {
+                    vertical-align: middle;
+                }
+            }
+        }
+        .sub-condition-form{
+            padding: 20px;
+            position: relative;
+            .del-btn{
+                color: #FF5B5B;
+                cursor: pointer;
+                position: absolute;
+                right: 20px;
+                top:20px;
+                z-index: 1;
+                &.disable{
+                    color: #B8B8B8;
+                }
+            }
+        }
+        .el-input__icon{
+            line-height: 32px;
+        }
+        .select-item{
+            &>div{
+                float: left;
+                margin-right: 10px;
+            }
+            .el-input{
+                width: auto;
+            }
+            input{
+                width: 95px;
+                line-height: 32px;
+                height: 32px;
+            }
+        }
+        .el-input,.el-input__inner{
+            width: 190px;
+            line-height: 32px;
+            height: 32px;
+        }
+        .el-button--danger.is-plain{
+            background: none;
+        }
+        .itemList {
+            position: absolute;
+            // display: none;
+            background: #fff;
+            width: 188px;
+            max-height: 160px;
+            border: 1px solid #DCDFE6;
+            left: 0;
+            top: 37px;
+            z-index: 2;
+            overflow-y: auto;
+        }
+        .el-form-item{
+            margin-bottom: 22px;
+            &.min-margin{
+                margin-bottom: 0;
+            }
+        }
+        .el-form-item__error{
+            top: auto;
+        }
+        .el-input-number{
+            width: 95px;
+        }
+        .el-input-number.is-controls-right .el-input-number__decrease, .el-input-number.is-controls-right .el-input-number__increase{
+            width: 25px;
+            height: 15px;
+            line-height: 16px;
+        }
+    }
+</style>

+ 104 - 0
src/components/knowledgeExtra/SubRulesGroup.vue

@@ -0,0 +1,104 @@
+<template>
+    <div class="sub-groups">
+        <SubConditions v-for="(rules,i) in data"
+                       ref="group"
+                       :groupData="rules"
+                       :isLast="rules.length===1"
+                       :ind="i"
+                       :baseTypes="baseTypes"
+                       :firstPlace="firstPlace"
+                       :disabled="i===0&&disable"
+                       @changeVal="handleInput"
+                       @addRule="addRule"
+                       @delRule="delRule"></SubConditions>
+        <div class="group-oper">
+            <el-button size="small" @click="addGroup">+新增分组</el-button>
+            <el-button :class="isLast?'disable':''" size="small" type="danger" plain @click="delGroup">-删除分组</el-button>
+        </div>
+    </div>
+</template>
+<script>
+    import SubConditions from './SubConditions.vue';
+    export default {
+        name:'SubRulesGroup',
+        props:['data','inx','isLast','baseTypes','firstPlace'],
+        data(){
+            return {
+            }
+        },
+        computed:{
+            'disable':function(){
+                return Object.keys(this.firstPlace||{}).length>0&&this.inx===0;
+            }
+        },
+        methods:{
+            handleInput(val,i){
+                this.data[i]=val;
+            },
+            addRule(){
+                let temp={
+                    subDescription:'',
+                    subConceptId:'',
+                    subType:'',
+                    subLenName:'',
+                    subLenCode:'',
+                    subLibName:'',
+                    subMaxOperator:'',
+                    subMaxUnit:'',
+                    subMaxValue:'',
+                    subMinOperator:'',
+                    subMinUnit:'',
+                    subMinValue:'',
+                    subEqValue:'',
+                    dataType:'',
+                };
+                this.data.push(temp);
+            },
+            delRule(i){
+                if(i===0&&this.data.length===1){
+                    this.$emit("delGroup",this.inx);
+                    return;
+                }
+                this.data.splice(i,1);
+            },
+            addGroup(){
+                this.$emit("addGroup");
+            },
+            delGroup(){
+                this.$emit("delGroup",this.inx);
+            },
+            warning(msg,type){
+                this.$message({
+                    showClose: true,
+                    message:msg,
+                    type:type||'warning'
+                })
+            },
+            showConfirmDialog(msg,resolve){
+                this.$alert(msg, '提示', {
+                    confirmButtonText: '确定',
+                    type: 'warning'
+                }).then(() => {
+                    resolve();
+                }).catch(() => {
+                    this.warning("删除失败,请重试!")
+                });
+            },
+        },
+        components:{
+            SubConditions
+        }
+    }
+</script>
+<style lang="less" scoped>
+    .sub-groups{
+        background: #F5F5F5;
+        padding: 20px;
+    }
+    .group-oper{
+        text-align: center;
+        padding: 11px 0;
+        border-top: 4px solid #F5F5F5;
+        background: #fff;
+    }
+</style>

BIN
src/images/add.png


+ 12 - 0
src/routes.js

@@ -21,6 +21,8 @@ import Plan from '@components/icss/plan/Plan.vue';  //关联维护设置
 import AddPlan from '@components/icss/plan/AddPlan.vue';  //关联维护设置
 import Bill from '@components/icss/bill/Bill.vue';  //开单
 import AddBill from '@components/icss/bill/AddBill.vue';  //开单-编辑
+import ZskRuleManager from '@components/knowledgeExtra/RuleManager.vue';  //知识库规则维护
+import AddZskRule from '@components/knowledgeExtra/AddNewRule.vue';   //知识库添加规则
 
 export default [
   {
@@ -57,6 +59,16 @@ export default [
       { path: 'LT-DZBLFAPZ-EDIT', component: AddPlan, name: 'AddPlan' }, //电子病历方案配置--新增编辑
       { path: 'GZWH-KDHLXGZWH', component: Bill, name: 'Bill' }, //开单
       { path: 'GZWH-KDHLXGZWH-EDIT', component: AddBill, name: 'AddBill' }, //开单
+      {
+          path: 'GZWH-GZWH',
+          component: ZskRuleManager,
+          name: 'ZskRuleManager',
+      },
+      {
+          path: 'GZWH-GZWH-TJGZ',
+          component: AddZskRule,
+          name: 'AddZskRule',
+      },
     ],
   },
 ];