|
@@ -42,11 +42,11 @@
|
|
|
<el-col v-for="(it,i) in rows" :key="i">
|
|
|
<div class="inps">
|
|
|
<el-input v-model="rows[i].name"
|
|
|
- v-bind:class="{select:focusOn==i}"
|
|
|
+ v-bind:class="{'red':noHolder.indexOf(i)!==-1, 'select':focusOn==i}"
|
|
|
@focus="selectRow(i,'name')"
|
|
|
ref = "inputName"
|
|
|
@input="HandleInputName(i, rows[i].name,true)"
|
|
|
- @blur="emitValues"></el-input>
|
|
|
+ @blur="emitValues(i)"></el-input>
|
|
|
</div>
|
|
|
<el-tag v-if="it.exclusion" type="info" size="mini">互斥项</el-tag>
|
|
|
</el-col>
|
|
@@ -57,6 +57,9 @@
|
|
|
</template>
|
|
|
<style lang="less">
|
|
|
@import "../../less/common.less";
|
|
|
+ .main-area .el-col .el-input.red .el-input__inner{
|
|
|
+ border-color: red;
|
|
|
+ }
|
|
|
.el-checkbox-button--small .el-checkbox-button__inner{
|
|
|
font-size: 14px;
|
|
|
}
|
|
@@ -149,6 +152,8 @@
|
|
|
focusOn:-1, //聚焦的行index
|
|
|
focusName:'name', //是否聚焦医生界面输入框
|
|
|
disableBtn:false, //占位符是否禁用
|
|
|
+ noHolder:'', //是否有占位符-仅多列使用
|
|
|
+ msgTimer:null, //占位符必填提示延时
|
|
|
}
|
|
|
},
|
|
|
mounted(){
|
|
@@ -203,6 +208,7 @@
|
|
|
},
|
|
|
handlePlaceholder(type){ //占位符类型,type=0文本输入框,type=1数字输入框
|
|
|
const i = this.focusOn;
|
|
|
+ clearTimeout(this.msgTimer);
|
|
|
if(i==-1){
|
|
|
this.$message({
|
|
|
message: '请先选中要操作的行',
|
|
@@ -213,6 +219,7 @@
|
|
|
}
|
|
|
const maps = {0:'${input_输入}',1:'${number_输入}'};
|
|
|
const key = this.focusName;
|
|
|
+ this.noHolder = this.noHolder.replace(','+i,'');
|
|
|
this.rows[i].name = this.rows[i].name+maps[type];
|
|
|
this.rows[i].description = this.rows[i].description+maps[type];
|
|
|
this.disableBtn = true;
|
|
@@ -235,25 +242,37 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- emitValues(i,type,flag){
|
|
|
- if(typeof i =='number'&&this.focusOn == -1){
|
|
|
- this.$message({
|
|
|
- message: '请先选择要操作的行',
|
|
|
- type: 'warning',
|
|
|
- showClose: true,
|
|
|
- });
|
|
|
- return;
|
|
|
+ emitValues(i){
|
|
|
+ if(typeof i ==='number'){
|
|
|
+ const reg = /(\$\{number_\S*?\})|(\$\{input_\S*?\})/g;
|
|
|
+ const name = this.rows[i].name;
|
|
|
+ if(name&&!reg.test(name)){
|
|
|
+ this.noHolder = this.noHolder.indexOf(i)!=-1?this.noHolder:this.noHolder+","+i;
|
|
|
+ const that = this;
|
|
|
+ this.msgTimer = setTimeout(function(){
|
|
|
+ that.$message({
|
|
|
+ message: '请添加数字输入框或者文本输入框',
|
|
|
+ type: 'warning',
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ },500);
|
|
|
+
|
|
|
+ this.$emit('pushValues',this.rows);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.noHolder = this.noHolder.replace(','+i,'');
|
|
|
}
|
|
|
const items = this.rows;
|
|
|
this.$emit('pushValues',items);
|
|
|
},
|
|
|
HandleInputName(i, name, isName) {
|
|
|
- const pureName=name.replace(/(\$\{number_\S*?\})|(\$\{input_\S*?\})/g,'');
|
|
|
- const hasPlace = /(\$\{number_\S*?\})|(\$\{input_\S*?\})/g.test(name);
|
|
|
+ const reg = /(\$\{number_\S*?\})|(\$\{input_\S*?\})/g;
|
|
|
+ const pureName=name.replace(reg,'');
|
|
|
+ const hasPlace = reg.test(name);
|
|
|
if(hasPlace&&this.disableBtn==false){
|
|
|
this.disableBtn = true;
|
|
|
}else if(!hasPlace&&this.disableBtn==true){
|
|
|
- this.rows[i][isName?'description':'name'] = this.rows[i][isName?'description':'name'].replace(/(\$\{number_\S*?\})|(\$\{input_\S*?\})/g,'');
|
|
|
+ this.rows[i][isName?'description':'name'] = this.rows[i][isName?'description':'name'].replace(reg,'');
|
|
|
this.disableBtn = false;
|
|
|
}
|
|
|
if(pureName.length > 30) {
|