|
@@ -0,0 +1,440 @@
|
|
|
+<style lang="less" scoped>
|
|
|
+// @import "../../less/admin.less";
|
|
|
+#AddRuleContent {
|
|
|
+ width: 100%;
|
|
|
+ min-width: 1000px;
|
|
|
+ padding: 20px;
|
|
|
+ padding-top: 50px;
|
|
|
+ padding-bottom: 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+ .form{
|
|
|
+ width: 100%;
|
|
|
+ }
|
|
|
+ .remark{
|
|
|
+ position: relative;
|
|
|
+ left: 40px;
|
|
|
+ top: -10px;
|
|
|
+ }
|
|
|
+ .table_form {
|
|
|
+ width: 100%;
|
|
|
+ box-sizing: border-box;
|
|
|
+ background: #fff;
|
|
|
+ padding: 20px;
|
|
|
+ padding-bottom: 0;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ .table_content {
|
|
|
+ min-height: 200px;
|
|
|
+ height: calc(100vh - 264px);
|
|
|
+ margin-top: 10px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .table_left {
|
|
|
+ flex: 1;
|
|
|
+ margin-right: 10px;
|
|
|
+ background: #ffffff;
|
|
|
+ padding: 0 50px;
|
|
|
+
|
|
|
+ .left_box {
|
|
|
+ margin: 30px 0;
|
|
|
+ overflow: hidden;
|
|
|
+ overflow-y: auto;
|
|
|
+ height: calc(100vh - 364px);
|
|
|
+ }
|
|
|
+ .tabs {
|
|
|
+ float: left;
|
|
|
+ max-width: 49%;
|
|
|
+ min-width: 49%;
|
|
|
+ }
|
|
|
+ .form_btn {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .table_right {
|
|
|
+ width: 300px;
|
|
|
+ background: #ffffff;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /deep/ .el-input--mini .el-input__inner,
|
|
|
+ .el-select {
|
|
|
+ width: 100%;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
+ /deep/ .el-form-item.is-success .el-input__inner,
|
|
|
+ .el-form-item.is-success .el-textarea__inner {
|
|
|
+ border-color: #c9c9c9 !important;
|
|
|
+ }
|
|
|
+ /deep/ .el-form-item.is-success .el-textarea__inner {
|
|
|
+ border-color: #c9c9c9 !important;
|
|
|
+ }
|
|
|
+ /deep/ .el-form-item.is-success .el-textarea__inner {
|
|
|
+ border-color: #c9c9c9 !important;
|
|
|
+ }
|
|
|
+ .conceptSearch {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ z-index: 2;
|
|
|
+ padding: 30px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ .conceptTitle {
|
|
|
+ width: 100%;
|
|
|
+ text-align: center;
|
|
|
+ padding: 20px 0;
|
|
|
+ }
|
|
|
+ .searchText {
|
|
|
+ padding: 0 35px 0 15px;
|
|
|
+ width: 100%;
|
|
|
+ height: 34px;
|
|
|
+ border: 1px solid #c9c9c9;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .conceptList {
|
|
|
+ min-height: 200px;
|
|
|
+ max-height: 300px;
|
|
|
+ margin: -2px auto 0;
|
|
|
+ border: 1px solid #e1dfdf;
|
|
|
+ overflow: hidden;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .conceptItem {
|
|
|
+ height: 34px;
|
|
|
+ line-height: 34px;
|
|
|
+ text-align: left;
|
|
|
+ padding: 0 15px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ .conceptItem:hover {
|
|
|
+ background: #f5f7fa;
|
|
|
+ }
|
|
|
+ .searchWrap {
|
|
|
+ position: relative;
|
|
|
+ .search {
|
|
|
+ position: absolute;
|
|
|
+ right: 7px;
|
|
|
+ top: 8px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .noresult {
|
|
|
+ padding: 20px 0;
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <crumbs :title="title" :param="$route.params" linkTo="TermSet"></crumbs>
|
|
|
+ <div id="AddRuleContent">
|
|
|
+ <div class="table_form">
|
|
|
+ <el-form size="mini" :inline="true" class="demo-form-inline form" :model="form" :rules="rules">
|
|
|
+ <el-form-item label-width="130px" label="术语集合类型:" prop="collectionLibType">
|
|
|
+ <el-select
|
|
|
+ v-model="form.collectionLibType"
|
|
|
+ placeholder="请选择"
|
|
|
+ @change="getConceptLibType"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in ruleTypeList"
|
|
|
+ :key="item.val"
|
|
|
+ :label="item.name"
|
|
|
+ :value="item.val"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- 规则术语类型: -->
|
|
|
+ <el-form-item label-width="130px" label="术语集合名称:" prop="collectionLibName">
|
|
|
+ <el-select
|
|
|
+ clearable
|
|
|
+ remote
|
|
|
+ filterable
|
|
|
+ v-model.trim="form.collectionLibName"
|
|
|
+ placeholder="请输入"
|
|
|
+ :remote-method="searchLibName"
|
|
|
+ @change="getCollectionLib"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in ruleTermTypeList"
|
|
|
+ :key="item.conceptId"
|
|
|
+ :label="item.conceptName"
|
|
|
+ :value="item"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div class="remark">说明:{{form.collectionRemark}}</div>
|
|
|
+ </div>
|
|
|
+ <div class="table_content" v-if="onshow">
|
|
|
+ <div class="table_left">
|
|
|
+ <div class="left_box">
|
|
|
+ <el-table
|
|
|
+ v-if="firstList.length>0"
|
|
|
+ :data="firstList"
|
|
|
+ border
|
|
|
+ class="tabs"
|
|
|
+ :header-row-style="{height:'40px'}"
|
|
|
+ :header-cell-style="{height:'40px',padding:'0',background:'#f7f7f7'}"
|
|
|
+ >
|
|
|
+ <el-table-column prop="conceptLibName" :show-overflow-tooltip="true" label="术语名称"></el-table-column>
|
|
|
+ <el-table-column label="操作" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ class="delete"
|
|
|
+ @click="showDelDialog(scope.row)"
|
|
|
+ >移除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-table
|
|
|
+ v-if="lastList.length>0"
|
|
|
+ :data="lastList"
|
|
|
+ border
|
|
|
+ class="tabs"
|
|
|
+ :header-row-style="{height:'40px'}"
|
|
|
+ :header-cell-style="{height:'40px',padding:'0',background:'#f7f7f7'}"
|
|
|
+ >
|
|
|
+ <el-table-column prop="conceptLibName" :show-overflow-tooltip="true" label="术语名称"></el-table-column>
|
|
|
+ <el-table-column label="操作" fixed="right">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ class="delete"
|
|
|
+ @click="showDelDialog(scope.row)"
|
|
|
+ >移除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="form_btn">
|
|
|
+ <el-button type="primary" size="medium " @click="saveSet">确定</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="table_right">
|
|
|
+ <div class="conceptSearch" ref="conceptSearch">
|
|
|
+ <h4 class="conceptTitle">添加关联术语</h4>
|
|
|
+ <p class="searchWrap">
|
|
|
+ <img class="search" src="../../images/search.png" alt="搜索" />
|
|
|
+ <input
|
|
|
+ v-model.trim="conceptText"
|
|
|
+ @input="searchConcept"
|
|
|
+ type="text"
|
|
|
+ ref="conceptInput"
|
|
|
+ class="searchText"
|
|
|
+ placeholder="请输入关键词搜索"
|
|
|
+ />
|
|
|
+ </p>
|
|
|
+ <ul class="conceptList" ref="conceptList">
|
|
|
+ <li
|
|
|
+ v-for="item in conceptList"
|
|
|
+ class="conceptItem ellipsis"
|
|
|
+ :title="item.conceptName"
|
|
|
+ @click="selectConcept(item)"
|
|
|
+ :key="item.conceptId"
|
|
|
+ >{{item.conceptName}}</li>
|
|
|
+ <li class="noresult" v-if="conceptList.length==0">暂无结果~</li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script type="text/javascript">
|
|
|
+import api from '@api/knowledgeLib.js';
|
|
|
+import AddNewRuleTable from './AddNewRuleTable';
|
|
|
+export default {
|
|
|
+ name: 'AddRule',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ title: '术语集合内容维护-添加',
|
|
|
+ ruleTypeList: [],
|
|
|
+ ruleTermTypeList: [],
|
|
|
+ conceptList: [],
|
|
|
+ conceptText: [],
|
|
|
+ excludedConceptIds: [],
|
|
|
+ type: [],
|
|
|
+ firstList: [],
|
|
|
+ lastList: [],
|
|
|
+ sign:1,
|
|
|
+ form: {
|
|
|
+ collectionLibType: '',
|
|
|
+ collectionLibName: '',
|
|
|
+ concepts: [],
|
|
|
+ conceptLibType: '',
|
|
|
+ collectionRemark:'',
|
|
|
+ collectionId: ''
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ collectionLibType: [
|
|
|
+ { required: true, message: '请选择术语集合类型', trigger: 'change' }
|
|
|
+ ],
|
|
|
+ collectionLibName: [
|
|
|
+ { required: true, message: '请选择术语集合名称', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.getDict();
|
|
|
+ const param = this.$route.params;
|
|
|
+ let info = param.data;
|
|
|
+ if (info) {
|
|
|
+ this.title = '术语集合内容维护-' + '修改';
|
|
|
+ this.form.collectionLibType = JSON.stringify(info.collectionLibType);
|
|
|
+ this.form.collectionLibName = info.collectionLibName;
|
|
|
+ this.form.concepts = info.concepts;
|
|
|
+ this.form.conceptLibType = info.concepts[0].conceptLibType;
|
|
|
+ this.form.collectionId = info.collectionId;
|
|
|
+ this.form.collectionRemark = info.collectionRemark
|
|
|
+ this.sign = 2
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.getList();
|
|
|
+ this.getIds(this.form.concepts);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getDict() {
|
|
|
+ api
|
|
|
+ .zskgetDict()
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code == '0') {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.ruleTypeList = data[63];
|
|
|
+ this.type = data[61];
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //过滤集合id
|
|
|
+ getIds(arr) {
|
|
|
+ arr.forEach((item, index) => {
|
|
|
+ this.excludedConceptIds.push(item.conceptId);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //获取术语集合名称
|
|
|
+ searchLibName(val) {
|
|
|
+ api
|
|
|
+ .getSearchConcept({
|
|
|
+ excludedConceptIds: [0],
|
|
|
+ libType: this.form.collectionLibType,
|
|
|
+ name: val,
|
|
|
+ sign:this.sign
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code == '0') {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.ruleTermTypeList = data;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getCollectionLib(newValue) {
|
|
|
+ this.form.collectionLibName = newValue.conceptName;
|
|
|
+ this.form.collectionId = newValue.conceptId;
|
|
|
+ this.form.collectionRemark = newValue.remark;
|
|
|
+ },
|
|
|
+ // 基础术语
|
|
|
+ searchConcept() {
|
|
|
+ const params = {
|
|
|
+ typeId: this.form.conceptLibType,
|
|
|
+ name: this.conceptText,
|
|
|
+ excludedConceptIds: this.excludedConceptIds
|
|
|
+ };
|
|
|
+ api.getTreeSearchList(params).then(res => {
|
|
|
+ const { data } = res;
|
|
|
+ if (data.code == '0') {
|
|
|
+ this.conceptList = data.data;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 选择基础术语
|
|
|
+ selectConcept(item) {
|
|
|
+ let concepts = {
|
|
|
+ conceptId: item.conceptId,
|
|
|
+ conceptLibType: item.conceptNameType,
|
|
|
+ conceptLibName: item.conceptName
|
|
|
+ };
|
|
|
+ this.excludedConceptIds.push(item.conceptId);
|
|
|
+ this.form.concepts.push(concepts);
|
|
|
+ this.getList();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.searchConcept();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getConceptLibType() {
|
|
|
+ this.type.forEach(it => {
|
|
|
+ let id = it.val.split('-');
|
|
|
+ if (this.form.collectionLibType == id[0]) {
|
|
|
+ this.form.conceptLibType = id[2];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 移除术语
|
|
|
+ showDelDialog(row) {
|
|
|
+ this.form.concepts.forEach((item, index) => {
|
|
|
+ if (item.conceptId == row.conceptId) {
|
|
|
+ this.form.concepts.splice(index, 1);
|
|
|
+ this.excludedConceptIds.splice(index, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.searchConcept();
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ getchk(num) {
|
|
|
+ return num % 2 == 0 ? '偶数' : '奇数'; //判断是否能整除2
|
|
|
+ },
|
|
|
+ getList() {
|
|
|
+ let concepts = JSON.parse(JSON.stringify(this.form.concepts));
|
|
|
+ this.firstList = [];
|
|
|
+ this.lastList = [];
|
|
|
+ concepts.forEach((item, index) => {
|
|
|
+ if (this.getchk(index) == '偶数') {
|
|
|
+ this.firstList.push(item);
|
|
|
+ } else {
|
|
|
+ this.lastList.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ saveSet() {
|
|
|
+ let params = {
|
|
|
+ ...this.form,
|
|
|
+ relationId: 0
|
|
|
+ };
|
|
|
+ api.saveOrUpdateRecord(params).then(res => {
|
|
|
+ if (res.data.code == 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ this.$router.push({
|
|
|
+ name: 'TermSet',
|
|
|
+ params: Object.assign({}, this.$route.params, { currentPage: 1 })
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: res.data.msg,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ onshow() {
|
|
|
+ return (
|
|
|
+ this.form.collectionLibType != '' && this.form.collectionLibName != ''
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|