zhaozp 3 gadi atpakaļ
vecāks
revīzija
1ed13c34a5
1 mainītis faili ar 99 papildinājumiem un 70 dzēšanām
  1. 99 70
      src/pages/index/index.vue

+ 99 - 70
src/pages/index/index.vue

@@ -247,7 +247,7 @@
             }"
             @click="saveFc(0)"
           >
-            {{ submitClickStatusFc ? "编辑" : "保存" }}
+            {{ fcType === 2 ? (showButton ? "保存" : "编辑") : "保存" }}
           </view>
         </view>
       </view>
@@ -317,6 +317,7 @@
               type="text"
               :disabled="fcType === 3"
               placeholder="请输入备注"
+              @focus="ifUpdate"
               v-model="item.remark"
               style="
                 background: #fff;
@@ -355,7 +356,7 @@
             }"
             @click="saveFc(1)"
           >
-            {{ pollingButtonName(fcType) }}
+            {{ pollingButtonName(fcType, showButton) }}
           </view>
         </view>
       </view>
@@ -390,8 +391,12 @@
               style="color: #fff; width: 62%; font-weight: bold"
             >
               <view class="u-m-b-6">
-                流程: {{ item.flow }} 项目: {{ item.longdyProject }} <text class="u-m-l-6" v-if="item.inspectClass">班次 : {{ item.inspectClass === 1 ? '上一班' : '当前班'  }}</text>
-              </view> 
+                流程: {{ item.flow }} 项目: {{ item.longdyProject }}
+                <text class="u-m-l-6" v-if="item.inspectClass"
+                  >班次 :
+                  {{ item.inspectClass === 1 ? "上一班" : "当前班" }}</text
+                >
+              </view>
               <view>
                 <text> 标准: {{ item.standard }}</text>
               </view>
@@ -597,44 +602,47 @@
         </view>
       </view>
       <view slot="default" class="u-m-b-10">
-        <view style="height:360rpx;overflow-y:auto;">
-           <u-card
-          :show-head="false"
-          :border="false"
-          box-shadow="0rpx 5rpx 5rpx rgba(0, 0, 0, 0.16)"
-          v-for="(item,index) in otherShowData"
-          :key="index"
-        >
-          <view slot="body" class="f-25">
-            <u-row class="u-m-t-10 u-m-b-10">
-              <u-col :span="4">
-                <text>流程: {{ item.flow }}</text>
-              </u-col>
-              <u-col :span="4">
-                <text>项目: {{ item.longdyProject }}</text>
-              </u-col>
-              <!-- <u-col :span="3">
+        <view style="height: 360rpx; overflow-y: auto">
+          <u-card
+            :show-head="false"
+            :border="false"
+            box-shadow="0rpx 5rpx 5rpx rgba(0, 0, 0, 0.16)"
+            v-for="(item, index) in otherShowData"
+            :key="index"
+          >
+            <view slot="body" class="f-25">
+              <u-row class="u-m-t-10 u-m-b-10">
+                <u-col :span="4">
+                  <text>流程: {{ item.flow }}</text>
+                </u-col>
+                <u-col :span="4">
+                  <text>项目: {{ item.longdyProject }}</text>
+                </u-col>
+                <!-- <u-col :span="3">
                 <text>频次: {{ item.flow }}</text>
               </u-col> -->
-            </u-row>
-            <u-row class="u-m-t-10 u-m-b-10">
-              <u-col :span="4">
-                <text>标准: {{ item.standard }}</text>
-              </u-col>
-              <u-col :span="4">
-                <text v-if="item.inspectContent === '√'">结果: 正常</text>
-                 <text v-else-if="item.inspectContent === 'x'">结果: 异常</text>
-                  <text v-else-if="item.inspectContent === '/'">结果: 停用</text>
-                   <text v-else>结果: 未检查</text>
-              </u-col>
-              <u-col :span="3">
-                <text>备注: {{ item.remark || '无' }}</text>
-              </u-col>
-            </u-row>
-          </view>
-        </u-card>
+              </u-row>
+              <u-row class="u-m-t-10 u-m-b-10">
+                <u-col :span="4">
+                  <text>标准: {{ item.standard }}</text>
+                </u-col>
+                <u-col :span="4">
+                  <text v-if="item.inspectContent === '√'">结果: 正常</text>
+                  <text v-else-if="item.inspectContent === 'x'"
+                    >结果: 异常</text
+                  >
+                  <text v-else-if="item.inspectContent === '/'"
+                    >结果: 停用</text
+                  >
+                  <text v-else>结果: 未检查</text>
+                </u-col>
+                <u-col :span="3">
+                  <text>备注: {{ item.remark || "无" }}</text>
+                </u-col>
+              </u-row>
+            </view>
+          </u-card>
         </view>
-       
       </view>
     </u-modal>
     <u-toast ref="uToast" />
@@ -679,9 +687,9 @@ import {
   patrolUpdate,
   patrolScan,
   dutyPatrolScan,
-  otherClazz
+  otherClazz,
 } from "@/common/api.js";
-import colorGradient from '../../uview-ui/libs/function/colorGradient';
+import colorGradient from "../../uview-ui/libs/function/colorGradient";
 export default {
   components: {
     djButton,
@@ -800,7 +808,7 @@ export default {
       // 其他责任人检查数据
       otherShowData: [],
       // 当期那名
-      nowName: ''
+      nowName: "",
     };
   },
   onLoad() {
@@ -861,11 +869,15 @@ export default {
     },
     // 巡检不同状态下按钮名
     pollingButtonName() {
-      return function (fcType) {
+      return function (fcType, showButton) {
         if (fcType === 1) {
           return "提交";
         } else if (fcType === 2) {
-          return "编辑";
+          if (showButton) {
+            return "保存";
+          } else {
+            return "编辑";
+          }
         } else {
           return "解决";
         }
@@ -1021,7 +1033,7 @@ export default {
             this.halfYearData = data.patrolHalfYearCheckresults;
           }
         } else {
-          console.log(111)
+          console.log(111);
           this.hintCase(res.message || "获取失败");
         }
       });
@@ -1029,6 +1041,7 @@ export default {
     // 返回到流程页
     returnFlowInfo() {
       this.infoStatus = 2;
+      this.showButton = false;
       dutyPlanInfo({ versionId: this.sjRecordId, type: this.fcType }).then(
         (res) => {
           this.procedureRes = res.data.procedureRes;
@@ -1122,22 +1135,36 @@ export default {
       if (index !== 1) {
         let data = [];
         if (index === 0) {
+          if (this.fcType === 2) {
+            if (!this.showButton) {
+              this.showButton = true;
+              return;
+            }
+          }
+          // 知道未提交的 this.datafc.filter((item) => item.state === 1)
           data = {
             everyId: this.everyId,
             subInsertReqs: this.datafc.filter((item) => item.state === 1),
             type: 1,
             versionId: this.sjRecordId,
           };
-        } else {
           let flag = false;
-          console.log(this.procedureRes)
-          for (let i of this.procedureRes) {
-            if (i.type === 2) {
+          for (let i of data.subInsertReqs) {
+            if (!i.inspectContent) {
               this.hintCase("检查内容未填全");
               flag = true;
+              break;
+            }
+            if (i.inspectContent !== "√") {
+              if (!i.remark) {
+                this.hintCase("检查内容未填全");
+                flag = true;
+                break;
+              }
             }
           }
           if (flag) return;
+        } else {
           data = {
             type: 2,
             versionId: this.sjRecordId,
@@ -1147,6 +1174,7 @@ export default {
         versionSubInsert(data).then((res) => {
           if (res.status === "20000") {
             if (index === 0) {
+              this.showButton = false;
               this.infoStatus = 2;
               dutyPlanInfo({
                 versionId: this.sjRecordId,
@@ -1280,17 +1308,19 @@ export default {
     },
     changeOKForFc(id, index, state) {
       // if (this.submitClickStatusFc) return;
-      if (state === 2) return;
-      for (let i of this.datafc) {
-        if (id === i.id) {
-          if (index === 1) {
-            i.inspectContent = "√";
-          } else if (index === 2) {
-            i.inspectContent = "x";
-          } else {
-            i.inspectContent = "/";
+      if (this.ifUpdate()) {
+        if (state === 2) return;
+        for (let i of this.datafc) {
+          if (id === i.id) {
+            if (index === 1) {
+              i.inspectContent = "√";
+            } else if (index === 2) {
+              i.inspectContent = "x";
+            } else {
+              i.inspectContent = "/";
+            }
+            return;
           }
-          return;
         }
       }
     },
@@ -1373,20 +1403,19 @@ export default {
       });
     },
     lookCheckResult() {
-      otherClazz({versionid:this.sjRecordId}).then(res=> {
-        if(res.status === '20000') {
-          if(res.data.length){
-            this.otherShowData = res.data
-            this.otherShow = true
-          }
-          else {
-            this.hintCase('无相关信息')
+      otherClazz({ versionid: this.sjRecordId }).then((res) => {
+        if (res.status === "20000") {
+          if (res.data.length) {
+            this.otherShowData = res.data;
+            this.otherShow = true;
+          } else {
+            this.hintCase("无相关信息");
           }
         } else {
-          this.hintCase('无相关信息')
+          this.hintCase("无相关信息");
         }
-        console.log(res)
-      })
+        console.log(res);
+      });
     },
     // 提示框
     hintCase(msg) {