root 1 year ago
parent
commit
01e8a3c95d

+ 4 - 4
src/main/index.js

@@ -63,11 +63,11 @@ let jar_time = null;
 //设置访问路径
 //打包访问的路径
 
-let serveUrl = "./resources/exe"
-let serveUrlJar = '\\resources\\exe'
+// let serveUrl = "./resources/exe"
+// let serveUrlJar = '\\resources\\exe'
 //本地访问的路径
-// let serveUrl = "./exe"
-// let serveUrlJar = '\\exe'
+let serveUrl = "./exe"
+let serveUrlJar = '\\exe'
 /**
  * Set `__static` path to static files in production
  * https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-static-assets.html

+ 0 - 1
src/renderer/components/ManageEquipment.vue

@@ -291,7 +291,6 @@ export default {
     openData() {
       let that = this;
       that.$http.getTmp(`/v1/device/open/notify`, {}, (res) => {
-        debugger;
         if (res.code == 200) {
           // that.tableData = res.data;
           // that.totolSize = res.data.totalElements;

+ 0 - 1
src/renderer/components/ScaleResult.vue

@@ -369,7 +369,6 @@ export default {
     },
 
     inits() {
-      debugger;
       console.log(this.$route.params.tableData);
       let _this = this;
       this.tableData = this.$route.params.tableData;

+ 0 - 1
src/renderer/components/TestResults.vue

@@ -375,7 +375,6 @@ export default {
     },
 
     inits() {
-      debugger
       let _this = this;
       let version = JSON.parse(this.tableData.userRecordEntity.testResult)[0].version;
       this.testResultData = this.tableData;

+ 97 - 16
src/renderer/components/treatDepression.vue

@@ -95,7 +95,22 @@
                   <div class="main_answer_left" style="float: right">
                     <div class="message-wrapper message-wrapper-right">
                       <el-radio-group
-                        v-if="content.isType == 0"
+                        v-if="content.isScale"
+                        v-model="answerList[content.index].checkItems"
+                        @input="nextHandle(content.index)"
+                      >
+                        <el-radio
+                          style="width: 100%"
+                          v-for="(item, index) in content.question"
+                          :key="index"
+                          size="small"
+                          :label="item"
+                          border
+                          >{{ item }}</el-radio
+                        >
+                      </el-radio-group>
+                      <el-radio-group
+                        v-if="!content.isScale && content.isType == 0"
                         v-model="content.radio"
                         :disabled="!(chatContents.length - 1 == index)"
                         @input="chooseAnswer(content)"
@@ -110,11 +125,15 @@
                           >{{ item.answer }}</el-radio
                         >
                       </el-radio-group>
-                      <div class="send_class" v-if="content.isType == 1">
+                      <div
+                        class="send_class"
+                        v-if="content.isType == 1 || content.isType == 3"
+                      >
                         <el-input
                           :disabled="!(chatContents.length - 1 == index)"
-                          v-if="content.isType == 1"
+                          v-if="content.isType == 1 || content.isType == 3"
                           v-model="content.text"
+                          @keyup.native.enter="sendMessageFun(content)"
                         /><i
                           v-show="chatContents.length - 1 == index"
                           style="
@@ -123,7 +142,7 @@
                             color: #57c02c;
                             margin-left: 10px;
                           "
-                          v-if="content.isType == 1"
+                          v-if="content.isType == 1 || content.isType == 3"
                           @click="sendMessageFun(content)"
                           class="el-icon-s-promotion"
                         ></i>
@@ -599,10 +618,32 @@ export default {
       });
     },
     sendMessageFun(val) {
+      // 若问题类型为3,校验输入值是否为0~100的整数
+      if (val.isType == 3) {
+        var a = val.text;
+        var reg = new RegExp("^(\\d|[1-9]\\d|100)$");
+        if (!reg.test(a)) {
+          this.$message.warning("请输入0~100之间的整数");
+          return;
+        }
+      }
       let id = val.question[0].nextQuestionNo;
       let questionNo = val.question[0].questionNo;
+      this.chatContents[this.chatContents.length - 1] = {
+        //是问题还是答案
+        from: 2,
+        //是否是量表的信息
+        isScale: false,
+        //是单选还是文字  0单选  1填空  -1描述
+        isType: -1,
+        //可点击可不点击 0单选   1填空
+        disabled: false,
+        //问题
+        question: val.text,
+        //头像
+        from1: HeadImg1,
+      };
       //发送填空题
-
       if (!id == "") {
         let paramsSave = {
           label: 1,
@@ -621,7 +662,6 @@ export default {
             this.updateName(val.text, id);
           }
         }
-        console.log(1234);
       } else {
         this.chatContents.push({
           //是问题还是答案
@@ -693,8 +733,10 @@ export default {
               that.getQuestion("", true);
             }
             let result = res.data;
+            // 若无下一题,oNum加1进入下一部分
             if (result == null) {
               this.oNum = this.oNum < 5 ? ++this.oNum : 1;
+              this.endHandle();
               this.getQuestion(1, true);
               return;
             }
@@ -730,6 +772,23 @@ export default {
         }
       );
     },
+
+    // 本轮对话结束
+    endHandle() {
+      this.$alert("本段对话结束", "提示", {
+        showCancelButton: true,
+        cancelButtonText: "结束对话",
+        confirmButtonText: "继续对话",
+        callback: (action) => {
+          if ("confirm" == action) {
+            this.getQuestion(1, true);
+          } else if ("cancel" == action) {
+            this.$router.go(-1);
+          }
+        },
+      });
+    },
+
     //修改文本打印效果
     pFun(val, flag, result, saveFlag, isShow) {
       let that = this;
@@ -910,8 +969,7 @@ export default {
               });
             } else {
               this.oNum = this.oNum < 5 ? ++this.oNum : 1;
-              this.getQuestion(1, true);
-              // this.saveChat();
+              this.endHandle();
             }
           }
         }
@@ -959,7 +1017,7 @@ export default {
         if (data[0].questionType == 0) {
           this.chatContents.push({
             index: 0,
-            from: 1,
+            from: 2,
             disabled: false,
             isScale: true,
             isType: 0,
@@ -977,7 +1035,7 @@ export default {
           // }
           this.chatContents.push({
             index: 0,
-            from: 1,
+            from: 2,
             disabled: false,
             isScale: true,
             isType: 5,
@@ -994,10 +1052,25 @@ export default {
 
       if (id == "-200") {
         //上一次的id
+        this.chatContents[this.chatContents.length - 1] = {
+          from: 2,
+          isScale: false,
+          isType: -1,
+          question: "继续上次",
+          from1: HeadImg,
+        };
         this.getQuestion(this.preQuestion, false);
         return;
       }
       if (id == "-201") {
+        this.chatContents[this.chatContents.length - 1] = {
+          from: 2,
+          isScale: false,
+          isType: -1,
+          question: "重新开始",
+          from1: HeadImg,
+        };
+        this.oNum = 1;
         this.getQuestion(1, false);
         return;
       }
@@ -1044,6 +1117,14 @@ export default {
           contant1.scrollTop = contant1.scrollHeight;
         });
       } else {
+        //上一次的id
+        this.chatContents[this.chatContents.length - 1] = {
+          from: 2,
+          isScale: false,
+          isType: -1,
+          question: content.radio,
+          from1: HeadImg,
+        };
         this.getQuestion(id, true);
       }
     },
@@ -1054,13 +1135,13 @@ export default {
 
       if (i < this.questionList.length - 1) {
         let ttmp = this.answerList[i].checkItems;
-        this.chatContents.push({
+        this.chatContents[this.chatContents.length - 1] = {
           from: 2,
           isScale: false,
           isType: -1,
           question: ttmp,
           from1: HeadImg,
-        });
+        };
 
         i = i + 1;
         let checkItems = this.questionList[i].checkItems;
@@ -1075,7 +1156,7 @@ export default {
         if (this.questionList[i].questionType == 0) {
           this.chatContents.push({
             index: i,
-            from: 1,
+            from: 2,
             isScale: true,
             isType: 0,
             question: checkItems.split(";"),
@@ -1092,7 +1173,7 @@ export default {
           // }
           this.chatContents.push({
             index: i,
-            from: 1,
+            from: 2,
             isScale: true,
             isType: 5,
             question: dataTmp,
@@ -1106,13 +1187,13 @@ export default {
         });
       } else {
         let ttmp = this.answerList[i].checkItems;
-        this.chatContents.push({
+        this.chatContents[this.chatContents.length - 1] = {
           from: 2,
           isScale: false,
           isType: -1,
           question: ttmp,
           from1: HeadImg,
-        });
+        };
         this.getScaleResult(this.flag);
       }
     },