|
@@ -7,14 +7,34 @@
|
|
|
padding-top: 50px;
|
|
|
padding-bottom: 0;
|
|
|
box-sizing: border-box;
|
|
|
- .form{
|
|
|
+ .form {
|
|
|
width: 100%;
|
|
|
}
|
|
|
- .remark{
|
|
|
+ .remark {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #606266;
|
|
|
position: relative;
|
|
|
left: 40px;
|
|
|
top: -10px;
|
|
|
}
|
|
|
+
|
|
|
+ .left_header {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ .tips {
|
|
|
+ font-size: 14px;
|
|
|
+ margin-top: 15px;
|
|
|
+ }
|
|
|
+ .inp {
|
|
|
+ width: 280px;
|
|
|
+
|
|
|
+ /deep/.el-input__inner {
|
|
|
+ height: 30px;
|
|
|
+ margin-top: 10px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
.table_form {
|
|
|
width: 100%;
|
|
|
box-sizing: border-box;
|
|
@@ -40,7 +60,7 @@
|
|
|
margin: 30px 0;
|
|
|
overflow: hidden;
|
|
|
overflow-y: auto;
|
|
|
- height: calc(100vh - 364px);
|
|
|
+ height: calc(100vh - 410px);
|
|
|
}
|
|
|
.tabs {
|
|
|
float: left;
|
|
@@ -57,6 +77,14 @@
|
|
|
background: #ffffff;
|
|
|
}
|
|
|
}
|
|
|
+ /deep/.el-select-dropdown__item.hover,
|
|
|
+ .el-select-dropdown__item:hover {
|
|
|
+ color: #48c5d7;
|
|
|
+ }
|
|
|
+ /deep/ .el-form--inline .el-form-item__label {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #606266;
|
|
|
+ }
|
|
|
/deep/ .el-input--mini .el-input__inner,
|
|
|
.el-select {
|
|
|
width: 100%;
|
|
@@ -128,12 +156,19 @@
|
|
|
<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
|
|
|
+ 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"
|
|
|
+ :disabled="sign==2?true:false"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in ruleTypeList"
|
|
@@ -153,6 +188,8 @@
|
|
|
placeholder="请输入"
|
|
|
:remote-method="searchLibName"
|
|
|
@change="getCollectionLib"
|
|
|
+ :disabled="sign==2?true:false"
|
|
|
+ value-key="conceptId"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in ruleTermTypeList"
|
|
@@ -167,6 +204,11 @@
|
|
|
</div>
|
|
|
<div class="table_content" v-if="onshow">
|
|
|
<div class="table_left">
|
|
|
+ <div class="left_header">
|
|
|
+ <p class="tips">关联的术语({{form.concepts.length}})</p>
|
|
|
+ <el-input v-model="searchtext" @input="searchList" placeholder="请搜索" class="inp"></el-input>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="left_box">
|
|
|
<el-table
|
|
|
v-if="firstList.length>0"
|
|
@@ -260,16 +302,20 @@ export default {
|
|
|
type: [],
|
|
|
firstList: [],
|
|
|
lastList: [],
|
|
|
- sign:1,
|
|
|
+ sign: 1,
|
|
|
+ searchtext: '',
|
|
|
form: {
|
|
|
collectionLibType: '',
|
|
|
collectionLibName: '',
|
|
|
concepts: [],
|
|
|
conceptLibType: '',
|
|
|
- collectionRemark:'',
|
|
|
+ collectionRemark: '',
|
|
|
collectionId: ''
|
|
|
},
|
|
|
- whether:false,
|
|
|
+ whether: false,
|
|
|
+ editCount: -1, // 页面会否被编辑 >0被编辑 =0 未编辑
|
|
|
+ startCount: -1,
|
|
|
+ isSaveSuccess: false, // 是否保存成功
|
|
|
rules: {
|
|
|
collectionLibType: [
|
|
|
{ required: true, message: '请选择术语集合类型', trigger: 'change' }
|
|
@@ -291,13 +337,16 @@ export default {
|
|
|
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.form.collectionRemark = info.collectionRemark;
|
|
|
+ this.sign = 2;
|
|
|
this.$nextTick(() => {
|
|
|
- this.getList();
|
|
|
+ this.getList(this.form.concepts);
|
|
|
this.getIds(this.form.concepts);
|
|
|
});
|
|
|
}
|
|
|
+ setTimeout(() => {
|
|
|
+ this.startCount = this.editCount;
|
|
|
+ }, 500);
|
|
|
},
|
|
|
methods: {
|
|
|
getDict() {
|
|
@@ -327,7 +376,7 @@ export default {
|
|
|
excludedConceptIds: [0],
|
|
|
libType: this.form.collectionLibType,
|
|
|
name: val,
|
|
|
- sign:this.sign
|
|
|
+ sign: this.sign
|
|
|
})
|
|
|
.then(res => {
|
|
|
if (res.data.code == '0') {
|
|
@@ -339,6 +388,19 @@ export default {
|
|
|
console.log(error);
|
|
|
});
|
|
|
},
|
|
|
+ searchList(val) {
|
|
|
+ let concepts = JSON.parse(JSON.stringify(this.form.concepts));
|
|
|
+ let str = ".*" + val + ".*"
|
|
|
+ let reg = new RegExp(str)
|
|
|
+ let arr=[]
|
|
|
+ //通过附加信息查询
|
|
|
+ for(var i=0;i<concepts.length;i++){
|
|
|
+ if(reg.test(concepts[i].conceptLibName)){
|
|
|
+ arr.push(concepts[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.getList(arr)
|
|
|
+ },
|
|
|
getCollectionLib(newValue) {
|
|
|
this.form.collectionLibName = newValue.conceptName;
|
|
|
this.form.collectionId = newValue.conceptId;
|
|
@@ -346,7 +408,7 @@ export default {
|
|
|
},
|
|
|
// 基础术语
|
|
|
searchConcept() {
|
|
|
- this.whether = true
|
|
|
+ this.whether = true;
|
|
|
const params = {
|
|
|
typeId: this.form.conceptLibType,
|
|
|
name: this.conceptText,
|
|
@@ -356,14 +418,14 @@ export default {
|
|
|
const { data } = res;
|
|
|
if (data.code == '0') {
|
|
|
this.conceptList = data.data;
|
|
|
- this.whether = false
|
|
|
+ this.whether = false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
// 选择基础术语
|
|
|
selectConcept(item) {
|
|
|
- if(this.whether){
|
|
|
- return
|
|
|
+ if (this.whether) {
|
|
|
+ return;
|
|
|
}
|
|
|
let concepts = {
|
|
|
conceptId: item.conceptId,
|
|
@@ -372,12 +434,15 @@ export default {
|
|
|
};
|
|
|
this.excludedConceptIds.push(item.conceptId);
|
|
|
this.form.concepts.push(concepts);
|
|
|
- this.getList();
|
|
|
+ this.getList(this.form.concepts);
|
|
|
this.$nextTick(() => {
|
|
|
this.searchConcept();
|
|
|
});
|
|
|
},
|
|
|
+ // 切换术语类型
|
|
|
getConceptLibType() {
|
|
|
+ this.form.collectionLibName = '';
|
|
|
+ this.ruleTermTypeList = [];
|
|
|
this.type.forEach(it => {
|
|
|
let id = it.val.split('-');
|
|
|
if (this.form.collectionLibType == id[0]) {
|
|
@@ -394,16 +459,15 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
this.searchConcept();
|
|
|
- this.getList();
|
|
|
+ this.getList(this.form.concepts);
|
|
|
},
|
|
|
getchk(num) {
|
|
|
return num % 2 == 0 ? '偶数' : '奇数'; //判断是否能整除2
|
|
|
},
|
|
|
- getList() {
|
|
|
- let concepts = JSON.parse(JSON.stringify(this.form.concepts));
|
|
|
+ getList(arr) {
|
|
|
this.firstList = [];
|
|
|
this.lastList = [];
|
|
|
- concepts.forEach((item, index) => {
|
|
|
+ arr.forEach((item, index) => {
|
|
|
if (this.getchk(index) == '偶数') {
|
|
|
this.firstList.push(item);
|
|
|
} else {
|
|
@@ -422,6 +486,7 @@ export default {
|
|
|
message: '操作成功',
|
|
|
type: 'success'
|
|
|
});
|
|
|
+ this.isSaveSuccess = true;
|
|
|
this.$router.push({
|
|
|
name: 'TermSet',
|
|
|
params: Object.assign({}, this.$route.params, { currentPage: 1 })
|
|
@@ -435,6 +500,32 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ form: {
|
|
|
+ handler(newName, oldName) {
|
|
|
+ this.editCount++;
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ beforeRouteLeave(to, from, next) {
|
|
|
+ if (this.startCount !== this.editCount && this.form.concepts.length > 0 && !this.isSaveSuccess) {
|
|
|
+ this.$alert('还有未保存的内容,确定要退出当前页面吗?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ // cancelButtonText: '取消',
|
|
|
+ // cancelButtonClass: 'leaveBtn',
|
|
|
+ // customClass: 'leaveBox',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ next();
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ } else {
|
|
|
+ next();
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
onshow() {
|
|
|
return (
|