Browse Source

独立互斥必填等验证

zhouna 6 năm trước cách đây
mục cha
commit
f66260ddda

+ 5 - 3
src/api/utils.js

@@ -259,8 +259,8 @@ export default {
    * 预问诊-字段转换
    *
    * **/
-  transPretreatKeys(org){
-    const maps = {
+  transPretreatKeys(org,isDpt){
+    let maps = {
       name:'region4',
       description:'region5',
       itemType:'region12',
@@ -268,10 +268,12 @@ export default {
       ageBegin:'region8',
       ageEnd:'region9',
       tagName:'region3',
-      tagType:'region2',
+      //tagType:isDpt?'':'region2',
+      //controlType:isDpt?'region2':'',
       type:'region1',
       url:'region13',
     };
+    isDpt?maps.controlType = 'region2':maps.tagType = 'region2';
     let obj = {};
     for(let i in org){
       if(maps[i]){

+ 5 - 5
src/components/preTreat/AddQuestionModules.vue

@@ -3,7 +3,7 @@
         <crumbs
                 :title="txt"
                 class="topBack"
-                linkTo="/admin/LT-YWZSJWH-TJMBWH"
+                linkTo="/admin/LT-YWZSJWH-MBWH"
         ></crumbs>
         <PubIndeptQa
                 @changeVal="changeVal"
@@ -41,7 +41,7 @@
     name: 'addCombinQuestion',
     data() {
       return {
-        txt:'组合填写单维护-添加组合填写单',
+        txt:'模板维护-添加模板',
         imgList:[],
         dataPub: {},      //公用组件传的值都在这
         itemsTypes:[1,2],            //有明细的类型
@@ -52,7 +52,7 @@
     beforeMount:function(){
       const {isEdit,data} = this.$route.params;
       if(isEdit){
-        this.txt = '组合填写单维护-修改组合填写单';
+        this.txt = '模板维护-修改模板';
         this.editData = data;console.log(data)
       }
     },
@@ -98,7 +98,7 @@
             //"controlType": this.dataPub.region2,                            //控件类型(0:默认值 1:下拉单选 2:下拉多选 6:文本框 7:数字键盘文本框 99:联合推送)
             "id": isEdit?data.id:'',                                    //新增id置空
             "type": this.dataPub.region1,                //填写单归属
-            "tagType": this.dataPub.region2,             //组合填写单类型
+            "tagType": this.dataPub.region2,             //模板类型
             "tagName": this.dataPub.region3,             //系统名称
             "name": this.dataPub.region4,                //医生界面名称
             "description":this.dataPub.region5,
@@ -114,7 +114,7 @@
         this.showSaveDialog(param);
       },
       showSaveDialog(param) {
-        this.showConfirmDialog('是否保存该填写单?', () => {
+        this.showConfirmDialog('是否保存该模板?', () => {
           api.questionAdd(param).then((res) => {
             if (res.data.code === '0') {
               this.warning(res.data.msg || '保存成功', 'success');

+ 6 - 6
src/components/preTreat/AddSimpleQuestion.vue

@@ -17,9 +17,8 @@
         <div class="main">
             <p class="title" v-if="dataPub.region2==1||dataPub.region2==2|| dataPub.region2==11">
                 填写单明细:
-                <i v-if='dataPub.region2==2' style="margin-left:70px;color: #22ccc8; font-size: 12px;">所有选项必须都有或者都没有同“伴”/“无”标记</i>
             </p>
-            <PubSelect v-if="dataPub.region2==1 || dataPub.region2==2 || dataPub.region2==11" :ascription="dataPub.region1" :sexType="dataPub.region7" :type="dataPub.region2" @pushValues="pushValues" :options="editData.questionDetailList"></PubSelect>
+            <PubSelect v-if="dataPub.region2==1 || dataPub.region2==2 || dataPub.region2==3 || dataPub.region2==11" :ascription="dataPub.region1" :sexType="dataPub.region7" :type="dataPub.region2" @pushValues="pushValues" :options="editData.questionDetailList"></PubSelect>
             <div class="btn">
                 <el-button
                         type="primary"
@@ -78,18 +77,19 @@
       },
       validatePass() {      //验证成功回调,调取接口
         //仍需验证填写单明细是否选择
-        let isNull = true;
+        let isNull = false;
         let options2 = [];
         const opts = this.options;
         for (let i = 0; i < this.options.length; i++) {
           if(this.options[i].name.trim() != '') {
-            isNull = false;
             options2.push(this.options[i])
+          }else if(this.options[i].description.trim() != ''){           //患者填了,医生没填,提示医生必填
+            isNull = true;
           }
         }
         this.options = options2;
         if(this.itemsTypes.includes(+this.dataPub.region2)&&isNull) {
-          this.warning('至少填一个选项')
+          this.warning('医生界面展示标准内容必填');
           return;
         }
         let flag=true;
@@ -103,7 +103,7 @@
           })==-1;
         }
         if(!flag){
-          this.warning('所有选项必须都有或者都没有同“伴”/“无”标记')
+          this.warning('所有选项必须都有或者都没有同“伴”/“无”标记');
           return;
         }
         if(parseFloat(this.dataPub.region8) >= parseFloat(this.dataPub.region9)) {

+ 1 - 1
src/components/preTreat/PubIndeptQa.vue

@@ -322,7 +322,7 @@
       //编辑时赋值
       const editData = this.$props.editData;
       if(editData.id){
-        const trans = utils.transPretreatKeys(editData);
+        const trans = utils.transPretreatKeys(editData,this.qaType==1);
         this.form = Object.assign({},this.form,trans);
         const imgUrl = trans.region13;
         if(imgUrl){

+ 62 - 13
src/components/preTreat/PubSelect.vue

@@ -2,23 +2,22 @@
     <div class="single-container">
         <el-form>
             <div class="operation-row">
-                <el-checkbox-group size="small"  v-if="type==2">
-                    <el-checkbox-button :label="0">文字输入框占位符</el-checkbox-button>
+                <el-checkbox-group size="small">
+                    <el-checkbox-button :label="0" @change="handlePlaceholder(0)">文字输入框占位符</el-checkbox-button>
                 </el-checkbox-group>
-                <el-checkbox-group size="small"  v-if="type==2">
-                    <el-checkbox-button :label="0">数字输入框占位符</el-checkbox-button>
+                <el-checkbox-group size="small">
+                    <el-checkbox-button :label="0" @change="handlePlaceholder(1)">数字输入框占位符</el-checkbox-button>
                 </el-checkbox-group>
-                <el-checkbox-group size="small" v-if="type==1&&ascription!=1">
-                    <el-checkbox-button :label="0">互斥项</el-checkbox-button>
+                <el-checkbox-group size="small" v-if="type==2">
+                    <el-checkbox-button :label="0" @change="handleExclu">互斥项</el-checkbox-button>
                 </el-checkbox-group>
-                <span v-if="type == 11" class="tip">可输入中文全角括号"()", 当作可输入内容的占位符</span>
                 <el-button type="danger" size="small" class="del" @click="delRow">删除</el-button>
 
             </div>
-            <div class="main-area">
+            <div class="main-area" v-if="type!=3">
                 <el-col class="col-title">
                     <span><i>*</i>填写单医生界面展示标准内容</span>
-                    <span>填写单医生界面展示通俗内容</span>
+                    <span>填写单患者界面展示通俗内容</span>
                 </el-col>
                 <el-col v-for="(it,i) in rows" :key="i">
                     <div class="inps">
@@ -35,10 +34,24 @@
                                   @input="HandleInputName(i, rows[i].description)"
                                   @blur="emitValues"></el-input>
                      </div>
-                    <el-tag v-if="it.isExclu" type="info" size="mini" @click="">互斥项</el-tag>
+                    <el-tag v-if="it.exclusion" type="info" size="mini">互斥项</el-tag>
                 </el-col>
                 <el-button @click="addRow">+</el-button>
             </div>
+            <div class="main-area" v-if="type==3">
+                <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}"
+                                  @focus="selectRow(i)"
+                                  ref = "inputName"
+                                  @input="HandleInputName(i, rows[i].name,true)"
+                                  @blur="emitValues"></el-input>
+                    </div>
+                    <el-tag v-if="it.exclusion" type="info" size="mini">互斥项</el-tag>
+                </el-col>
+                <el-button @click="addRow" class="little">+</el-button>
+            </div>
         </el-form>
     </div>
 </template>
@@ -68,7 +81,7 @@
     }
     .operation-row{
         margin-left:150px;
-        text-align: right;
+        /*text-align: right;*/
     .del{
         margin-left: 150px;
     }
@@ -77,7 +90,8 @@
     }
     }
     .main-area{
-        width: 420px;
+        width: 80%;
+        min-width: 400px;
         margin:20px 150px;
     .inps{
         display: inline-block;
@@ -90,7 +104,7 @@
         margin-bottom:10px;
         span{
             display: inline-block;
-            width: 210px;
+            width: calc(50% - 30px);
             font-size:12px;
             i{
                 color: #f56c6c;
@@ -114,6 +128,9 @@
     .el-button{
         width: calc(100% - 60px);
         border-radius: 0;
+    &.little{
+         width: calc(50% - 30px);
+     }
     }
     }
 </style>
@@ -191,6 +208,38 @@
         this.focusOn = index;
 
       },
+      handlePlaceholder(type){          //占位符类型,type=0文本输入框,type=1数字输入框
+        const i = this.focusOn;
+        if(i==-1){
+          this.$message({
+            message: '请先选中要操作的行',
+            type: 'warning',
+            showClose: true,
+          });
+          return ;
+        }
+        const maps = {0:'${input_输入}',1:'${number_输入}'};
+        this.rows[i].name = this.rows[i].name+maps[type];
+        this.rows[i].description = this.rows[i].description+maps[type];
+      },
+      handleExclu(){
+        const i = this.focusOn;
+        if(i==-1){
+          this.$message({
+            message: '请先选中要操作的行',
+            type: 'warning',
+            showClose: true,
+          });
+          return ;
+        }
+        this.rows.map((it,x)=>{
+          if(x===i){
+            it.exclusion = 1;
+          }else{
+            it.exclusion = 0;
+          }
+        });
+      },
       emitValues(i,type,flag){
         if(typeof i =='number'&&this.focusOn == -1){
           this.$message({

+ 7 - 7
src/components/preTreat/QuestionModules.vue

@@ -22,7 +22,7 @@
                 </el-form-item>
                 <el-form-item>
                     <el-button size="mini" @click="filterDatas">确认</el-button>
-                    <el-button size="mini" type="warning" @click="addIndeptTag">添加模板</el-button>
+                    <el-button size="mini" type="warning" @click="addModule">添加模板</el-button>
                 </el-form-item>
             </el-form>
         </crumbs>
@@ -77,7 +77,7 @@
                         label="操作"
                         width="120">
                     <template slot-scope="scope">
-                        <el-button  @click="modifyIndeptTag(scope.row)" type="text" size="small">修改</el-button>
+                        <el-button  @click="modifyModule(scope.row)" type="text" size="small">修改</el-button>
                         <span style="margin:0 3px;">|</span>
                         <el-button @click="showDelDialog(scope.row)" class="delete" type="text" size="small">删除</el-button>
                     </template>
@@ -161,11 +161,11 @@
         this.currentPage = 1;
         this.getDataList();
       },
-      addIndeptTag() {
+      addModule() {
         this.$router.push({path:'LT-YWZSJWH-TJMBWH'});
       },
-      modifyIndeptTag(row) {
-        api.questionDetail({id:row.id}).then((res)=>{
+      modifyModule(row) {
+        api.getModuleDetail({moduleId:row.id}).then((res)=>{
           const {code,data,msg} = res.data;
           if(code=='0'){
             const item = Object.assign({},row,data);
@@ -219,8 +219,8 @@
           "ids": row.id,
           "type": row.type
         };
-        this.showConfirmDialog('是否删除该填写单?',()=>{
-          api.questionDel(param).then((res)=>{
+        this.showConfirmDialog('是否删除该模板?',()=>{
+          api.addModule(param).then((res)=>{
             if(res.data.code=='0'){
               this.getDataList();
               this.warning(res.data.msg || '操作成功','success');