Sfoglia il codice sorgente

启用禁用接口修改

morphone1995 4 anni fa
parent
commit
9726fcee7e

+ 65 - 7
src/components/icss/AddMedicinePrompt.vue

@@ -46,7 +46,7 @@
         <InfoParagraph
           v-for="(f,i) in form.prags"
           v-if="!upload"
-          :key="i + showType"
+          :key="(i+1)*10000 + showType"
           :data="f"
           :index="i"
           :total="form.prags.length"
@@ -198,6 +198,7 @@ export default {
   created: function() {
     const { isEdit, data, isCopy } = this.$route.params;
     if (isEdit || isCopy) {
+      this.showType = data.type; // 编辑页确认显示类型
       this.isEdit = isEdit;
       this.isCopy = isCopy;
       this.title = isEdit ? '修改' : isCopy ? '复制' : '添加';
@@ -426,12 +427,69 @@ export default {
         return +it;
       });
     },
+
+    // 额外的表单检验
+    formVal(){            
+      let positiontemp = this.form.prags.map(item => {
+        return [...item.position];
+      });
+      let positionArr = positiontemp.reduce(function(a, b) {
+        return a.concat(b);
+      }); // 所有被选中的值集合
+      // console.log(positionArr, 'positionArr');
+      // console.log(this.showType, '当前页的显示类型');
+      let isVisFlag = positionArr.some(item => item === 2);
+      let isDiagFlag = positionArr.some(item => item === 3);
+      // console.log(isVisFlag, 'isVisFlag');
+      if (
+        (this.showType == 3 || this.showType == 4 || this.showType == 5) &&
+        isVisFlag
+      ) {
+        //若医学术语为检验/检查,且内容类型选择了注意事项,此时“注意事项标题”是必填项
+        this.$refs.groups.clearValidate();
+        this.rules.titleChange.push({
+          required: true,
+          message: '请输入注意事项标题',
+          trigger: 'change'
+        });
+        this.$refs.groups.validateField('titleChange');
+        this.rules.titleChange = this.rules.titleChange.slice(0, 1);
+
+        if (this.form.titleChange.trim() !== '') {
+          // console.log('内容不为空');
+          return true
+        } else {
+          return false;
+        }
+        // return;
+      } else if (isDiagFlag && this.showType == 1) {
+        // 若医学术语为诊断,且内容类型选择了临床路径,此时“临床路径标题”是必填项
+        this.$refs.groups.clearValidate();
+        this.rules.titleChange.push({
+          required: true,
+          message: '请输入临床路径标题',
+          trigger: 'change'
+        });
+        this.$refs.groups.validateField('titleChange');
+        this.rules.titleChange = this.rules.titleChange.slice(0, 1);
+
+        if (this.form.titleChange.trim() !== '') {
+          // console.log('内容不为空');
+          return true
+        } else {
+          return false;
+        }
+      }
+    },
+
     submitForm() {
       if (this.isSuccessUpload === 1) {
         this.warning('文件上传中,请稍等');
         return;
       }
-
+      let flagVal = this.formVal()   // 额外的表单校验
+      // console.log(flagVal,'flagVal======================');
+      if(flagVal === false) return
       //验证外层表单
       let goOn = true,
         it = null;
@@ -504,9 +562,9 @@ export default {
 
       if (!this.isEdit) {
         // 新增页面
-        this.saveDisable = true
-        this.sendSaveOrEdit(param)
-        return 
+        this.saveDisable = true;
+        this.sendSaveOrEdit(param);
+        return;
       }
       this.showSaveDialog(
         param,
@@ -516,7 +574,7 @@ export default {
     showSaveDialog(param, msg) {
       this.showConfirmDialog(msg, () => {
         this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
-        this.sendSaveOrEdit(param)       
+        this.sendSaveOrEdit(param);
       });
     },
 
@@ -552,7 +610,7 @@ export default {
 
     // 弹出窗
     showConfirmDialog(msg, resolve) {
-      this.$confirm(msg, '', {
+      this.$confirm(msg, '提示', {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         cancelButtonClass: 'cancel',

+ 23 - 21
src/components/icss/MedicineInfoPg.vue

@@ -15,7 +15,7 @@
         <el-checkbox v-for="it in positions" :key="it.key" :label="it.key">{{it.name}}</el-checkbox>
       </el-checkbox-group>
     </el-form-item>
-    <el-form-item label="内容" prop="content" label-width="160px">
+    <el-form-item label="内容" prop="content" label-width="160px" ref="editor">
       <quillEditor
         v-model="data.content"
         :options="editorOption"
@@ -27,7 +27,7 @@
       <a v-if="index!==0" :class="index===total-1?'order-spc':'order-up'" @click="reOrder(1)">上升</a>
       <a v-if="index!==total-1" :class="index===0?'order-spc':'order-down'" @click="reOrder(0)">下降</a>
     </div>
-    <el-form-item label-width="160px" class='btns'>
+    <el-form-item label-width="160px" class="btns">
       <el-button @click="addEmit">添加段落</el-button>
       <el-button @click="delEmit" type="info">删除本段落</el-button>
     </el-form-item>
@@ -107,20 +107,21 @@ export default {
         //   { required: true, message: '请选择是否属于诊断', trigger: 'change' }
         // ],
         position: [
-          { required: true, message: '请选择内容类型', trigger: 'change' }
+          { required: true, message: '请选择内容类型', trigger: 'blur' }
         ],
         title: [
           { required: true, message: '请输入段落标题', trigger: 'change' },
-          {
-            validator: (rule, value, callback) => {
-              if (value.length > 30) {
-                callback(new Error('标题名称不能超过30字'));
-              } else {
-                callback();
-              }
-            },
-            trigger: 'change'
-          }
+          { max: 30, message: '标题名称不能超过30字', trigger: 'change' }
+          // {
+          //   validator: (rule, value, callback) => {
+          //     if (value.length > 30) {
+          //       callback(new Error('标题名称不能超过30字'));
+          //     } else {
+          //       callback();
+          //     }
+          //   },
+          //   trigger: 'change'
+          // }
         ],
         content: [
           { required: true, message: '请输入段落内容', trigger: 'change' }
@@ -130,11 +131,15 @@ export default {
   },
   watch: {
     'data.content': function() {
+      if (this.data.content !== '') {
+        this.$refs.editor && this.$refs.editor.clearValidate(); // 清除校验
+      }
+
       this.data.text = this.$refs.quillEditor.quill.root.innerText;
     }
   },
   created() {
-    // console.log(this.showType, 'showType');
+    // console.log(this.showType, 'showType','需要显示的类型');
     this.editorOption.modules.toolbar.container = this.toolbars[
       this.toolbarMode
     ];
@@ -146,14 +151,10 @@ export default {
     if (this.showType == 1) {
       // 诊断
       this.positions = positions.filter(item => item.key !== 2);
-    } else if (
-      this.showType == 3 ||
-      this.showType == 4 ||
-      this.showType == 5
-    ) {
+    } else if (this.showType == 3 || this.showType == 4 || this.showType == 5) {
       // 检验/检查
       this.positions = positions.filter(item => {
-        return item.key <= 2
+        return item.key <= 2;
       });
     } else if (this.showType == 2 || this.showType == 6) {
       // 药品/手术
@@ -172,6 +173,7 @@ export default {
     delEmit() {
       this.$emit('del', this.index);
     }
+
     /*emitVal(){
         let data = this.form;
         let pst=this.form.position;
@@ -231,7 +233,7 @@ export default {
   vertical-align: top;
 }
 
-.btns{
+.btns {
   margin-top: 24px;
 }
 </style>

+ 11 - 11
src/components/icss/MedicinePrompt.vue

@@ -41,20 +41,20 @@
         <el-table-column
                         label="状态">
                     <template slot-scope="scope">
-                        <span v-if="scope.row.isDeleted=='N'">启用</span>
-                        <span v-if="scope.row.isDeleted=='Y'">禁用</span>
+                        <span v-if="scope.row.status===1">启用</span>
+                        <span v-if="scope.row.status===0">禁用</span>
                     </template>
         </el-table-column>
         <el-table-column label="操作" width="140">
           <template slot-scope="scope">
             <el-button
-              v-if="scope.row.isDeleted=='Y'"
+              v-if="scope.row.status===0"
               type="text"
               size="small"
               class="is-disabled"
             >修改</el-button>
             <el-button
-              v-if="scope.row.isDeleted=='N'"
+              v-if="scope.row.status===1"
               type="text"
               size="small"
               @click="toEditProduct(scope.row)"
@@ -64,13 +64,13 @@
             <el-button v-if="scope.row.isDeleted=='N'&&scope.row.typeId !== 82 && scope.row.typeId !== 83" type="text" size="small" @click="toCopyProduct(scope.row)">复制</el-button>-->
             <span style="margin:0 3px;">|</span>
             <el-button
-              v-if="scope.row.isDeleted=='Y'"
+              v-if="scope.row.status===0"
               type="text"
               size="small"
               @click="showReuseDialog(scope.row)"
             >启用</el-button>
             <el-button
-              v-if="scope.row.isDeleted=='N'"
+              v-if="scope.row.status===1"
               type="text"
               size="small"
               class="delete"
@@ -114,8 +114,8 @@ export default {
       pays: [],
       typeList: [],
       stateList: [
-        { id: 'N', name: '启用' },
-        { id: 'Y', name: '禁用' }
+        { id: 1, name: '启用' },
+        { id: 0, name: '禁用' }
       ],
       searched: false,
       filter: {
@@ -265,7 +265,7 @@ export default {
         title: this.filter.title,
         current: this.inCurrentPage || this.currentPage,
         size: this.pageSize,
-        isDeleted: this.filter.status,
+        status: this.filter.status,
         type: this.filter.libType
       };
       return param;
@@ -313,7 +313,7 @@ export default {
         '确定禁用该静态知识?',
         () => {
           api
-            .delConceptInfo({ id: row.id, isDeleted: 'Y' })
+            .delConceptInfo({ id: row.id, status: 0 })
             .then(res => {
               if (res.data.code == '0') {
                 if (!this.searched) {
@@ -341,7 +341,7 @@ export default {
         '确定启用该静态知识?',
         () => {
           api
-            .delConceptInfo({ id: row.id, isDeleted: 'N' })
+            .delConceptInfo({ id: row.id, status: 1 })
             .then(res => {
               if (res.data.code == '0') {
                 this.currentPage = 1; //恢复数据跳转到筛选条件下首页

+ 6 - 8
src/components/icss/lis/AddLis.vue

@@ -59,10 +59,10 @@
                   @change="changeWord"
                   @focus="handleFocus"
                   @visible-change="handleVisible"
+                  @clear="handleClear"
                   placeholder="搜索"
                   :remote-method="searchTerms"
                   reserve-keyword
-                  @click.native="handleclick"
                 >
                   <el-option
                     v-for="(item,idx) in uniqueNameList"
@@ -135,7 +135,7 @@ export default {
     }
     if (isEdit && data.hisName !== '' && data.hisDetailName === '') {
       this.searchType = 1;
-      console.log('改变searchType为1');
+      // console.log('改变searchType为1');
     }
   },
   methods: {
@@ -169,17 +169,15 @@ export default {
     },
     changeWord() {},
     // 获取焦点
-    handleFocus() {
-      // this.searchTerms(this.queryText);
-      // this.uniqueNameList = [];
-    },
+    handleFocus() {},
     handleVisible(flag) {
       if (!flag) {
         this.uniqueNameList = [];
       }
     },
-    handleclick() {},
-
+    handleClear() {
+      this.form.searchTextPre = '';
+    },
     handleChoose(val) {
       // console.log('点击选中option', val);
       this.form.searchTextPre = val;