check_inspection.vue 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. <template>
  2. <view class="uni-container uni-container-bg">
  3. <!-- 下拉框 -->
  4. <view class="u-page__tag-item" style="margin-bottom: 26upx;width: 700upx;border-bottom: 2px solid #55cbbf;">
  5. <u-form>
  6. <u-form-item prop="orgName" @click="
  7. showOrg = true;
  8. hideKeyboard();
  9. " label="单位选择:" labelWidth="80px">
  10. <u--input border="none" disabled v-model="formData.orgName" placeholder="请选择所属单位"></u--input>
  11. <u-icon slot="right" name="arrow-down" class="danwei"></u-icon>
  12. </u-form-item>
  13. </u-form>
  14. </view>
  15. <view class="tops" v-if="!getqrcode">
  16. <view style="display: flex;flex-direction: column;">
  17. <image :src="scan" class="tupian" @click="erWeiMa"></image>
  18. <view style="margin-top: 20rpx;">设施扫码</view>
  19. </view>
  20. <!-- #ifdef H5 -->
  21. <u-popup :show="qrScanShow" mode="center" @close="qrScanClose" @open="qrScanOpen" closeable
  22. :safeAreaInsetTop="true" zoom>
  23. <view class="qr-scan-containner">
  24. <view class="qr-scan-middle">
  25. <view class="qr-scan-title">
  26. 扫码
  27. </view>
  28. <qrcode-stream class="qr-scan-view" @decode="onDecode" />
  29. </view>
  30. </view>
  31. </u-popup>
  32. <!-- <view class="qrcode" v-if="qrcodeShow">
  33. <qrcode-stream @decode="onDecode" />
  34. </view> -->
  35. <!-- #endif -->
  36. <view>
  37. <image :src="Group" @click="
  38. showMCheck = true;
  39. hideKeyboard();
  40. " class="tiantupian"></image>
  41. <view style="margin-top: 20rpx;">手动添加</view>
  42. </view>
  43. </view>
  44. <view class="cont" v-if="!getqrcode">
  45. 主动检查记录
  46. </view>
  47. <div v-if="!getqrcode">
  48. <uni-card v-for="(item, index) in tableData" :key="index">
  49. <view class="titles"><text class="name-align-task">检查项:</text>{{item.inspName}}
  50. <u-icon v-if="item.isdenger==1" name="warning-fill" color="#ff5647" size="28"
  51. :customStyle="{marginTop:'20px',backgroundColor:'#fff'}"></u-icon>
  52. </view>
  53. <view><text class="name-align-task">检查结果:</text>{{item.handleResult}}</view>
  54. <view class="an-niu">
  55. <text><text class="name-align-task">检查时间:</text>{{item.inspectTime}}</text>
  56. <text @click="addClickDetail(item.id)" class="detail">查看详情</text>
  57. </view>
  58. </uni-card>
  59. </div>
  60. <!-- 扫码弹出层 -->
  61. <u-popup :show="maShow" :round="10" @close="maShow=false">
  62. <view v-if="insTypeData!=''">
  63. <view class="springFarm" v-for="(item,index) in insTypeData" :key="index">
  64. <view class="show-title">设备名称:{{item.fpdName}}</view>
  65. <view class="show-title">设备序列号:{{item.fpdCode}}</view>
  66. <view>
  67. <view class="show-title">设备检查项:</view>
  68. </view>
  69. <view style="display: flex;flex-direction: column;">
  70. <view class="" v-if="item.inspectResultList!=''">
  71. <uni-grid :column="3" :showBorder="false">
  72. <uni-grid-item v-for="(items,indexs) in item.inspectResultList" :key="indexs">
  73. <view class="grid-item-box">
  74. <image :src="items.subValue==1?zhengchang:moren" class="tupians"
  75. @click="normalPopup(items,indexs,index)">
  76. </image>
  77. <text class="text">{{items.subLable}}</text>
  78. </view>
  79. </uni-grid-item>
  80. </uni-grid>
  81. </view>
  82. <view class="slot-contents" v-if="show2" @click="descript(index)">
  83. <textarea v-model="dangerDescribe" placeholder="请输入隐患描述内容"></textarea>
  84. </view>
  85. <!-- <view class="slot-contents" @click="descript(index)">
  86. <textarea v-model="remark" placeholder="请输入描述内容"></textarea>
  87. </view> -->
  88. </view>
  89. <view class="show-title">
  90. <view class="">巡检拍照:<text style="color:#822e2e;"></text></view>
  91. <view class="">
  92. <image :src="photograph" @click="photoUpload(item)" class="tiantupian"></image>
  93. <isLodingModel></isLodingModel>
  94. </view>
  95. </view>
  96. <view class="uni-grid-wraps">
  97. <view style="position: relative;width: 180rpx;float: left;margin: 10rpx 15rpx 0 0rpx;"
  98. v-for="(items,indexs) in item.attUrl" :key="indexs">
  99. <image :src="items" style="width: 160rpx;height: 160rpx;border-radius: 30rpx;float: left;">
  100. <u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)">
  101. </u-icon>
  102. </view>
  103. </view>
  104. <view style="width: 60%;position: absolute;left:150rpx;;bottom:60rpx;z-index: 9999;">
  105. <div class="btnList" v-if="show2">
  106. <u-button shape="circle" type="primary" color="#4CB2B6" text="立即处理"
  107. customStyle="margin-right:20%" @click="checkPopupConfirmNow">
  108. </u-button>
  109. <u-button v-if="show2" shape="circle" type="primary" color="#4CB2B6" text="生成隐患"
  110. @click="checkPopupYinHuan">
  111. </u-button>
  112. </div>
  113. <div class="btnList" v-if="!show2">
  114. <u-button shape="circle" type="primary" color="#4CB2B6" text="保存"
  115. customStyle="margin-right:20%" @click="checkPopupConfirm()">
  116. </u-button>
  117. <u-button shape="circle" type="primary" color="#4CB2B6" text="取消" @click="checkPopupCancel">
  118. </u-button>
  119. </div>
  120. </view>
  121. </view>
  122. </view>
  123. <view v-else>
  124. 暂无数据
  125. </view>
  126. </u-popup>
  127. <!-- 手动添加弹出层-->
  128. <u-popup :show="manualPopup" :round="10" @close="manualPopup=false">
  129. <view v-if="checkManualData!=[]">
  130. <view class="springFarm" v-for="(item,index) in checkManualData" :key="index">
  131. <view class="show-title">检查项名称:{{item.inspName}}</view>
  132. <view>
  133. <view class="show-title">设备检查项:</view>
  134. </view>
  135. <view style="display: flex;flex-direction: column;">
  136. <view class="" v-if="item.inspectSubDOList!=''">
  137. <uni-grid :column="3" :showBorder="false">
  138. <uni-grid-item v-for="(items,indexs) in item.inspectSubDOList" :key="indexs">
  139. <view class="grid-item-box">
  140. <image :src="items.isdenger==1?zhengchang:moren" class="tupians"
  141. @click="checkPopupManual(items,indexs,index)">
  142. </image>
  143. <text class="text">{{items.subLable}}</text>
  144. </view>
  145. </uni-grid-item>
  146. </uni-grid>
  147. </view>
  148. <view class="slot-contents" v-if="showManual" @click="descript(index)">
  149. <textarea v-model="dangerDescribe" placeholder="请输入隐患描述内容"></textarea>
  150. </view>
  151. <!-- <view class="slot-contents" @click="descript(index)">
  152. <textarea class="slot-contents" v-model="remark" placeholder="请输入描述内容"></textarea>
  153. </view> -->
  154. </view>
  155. <view class="show-title">
  156. <view class="">巡检拍照:<text style="color:#822e2e;"></text></view>
  157. <view class="">
  158. <image :src="photograph" @click="photoUpload(item)" class="tiantupian"></image> <!-- 加载中 -->
  159. <isLodingModel></isLodingModel>
  160. </view>
  161. </view>
  162. <view class="uni-grid-wraps">
  163. <view style="position: relative;width: 180rpx;float: left;margin: 10rpx 15rpx 0 0rpx;"
  164. v-for="(items,indexs) in item.attUrl" :key="indexs">
  165. <image :src="items" style="width: 160rpx;height: 160rpx;border-radius: 30rpx;float: left;">
  166. <u-icon name="close" color="#4CB2B6" size="19" @click="closeImage(item,indexs,index)">
  167. </u-icon>
  168. </view>
  169. </view>
  170. <view style="width: 60%;position: absolute;left:150rpx;;bottom:60rpx;z-index: 9999;">
  171. <div class="btnList" v-if="showManual">
  172. <u-button shape="circle" type="primary" color="#4CB2B6" text="立即处理"
  173. customStyle="margin-right:20%" @click="checkPopupConfirmNow">
  174. </u-button>
  175. <u-button v-if="showManual" shape="circle" type="primary" color="#4CB2B6" text="生成隐患"
  176. @click="checkPopupYinHuan">
  177. </u-button>
  178. </div>
  179. <div class="btnList" v-if="!showManual">
  180. <u-button shape="circle" type="primary" color="#4CB2B6" text="保存"
  181. customStyle="margin-right:20%" @click="checkPopupConfirm()">
  182. </u-button>
  183. <u-button shape="circle" type="primary" color="#4CB2B6" text="取消" @click="checkPopupCancel">
  184. </u-button>
  185. </div>
  186. </view>
  187. </view>
  188. </view>
  189. <view v-else>
  190. 暂无数据
  191. </view>
  192. </u-popup>
  193. <u-modal :show="show5" title="请输入处理结果" @confirm="descriptFpd" @cancel="show5 = false">
  194. <view class="slot-content jieguo">
  195. <textarea v-model="handleResult" placeholder="请输入" />
  196. </view>
  197. </u-modal>
  198. <u-action-sheet :show="showOrg" :actions="actions" title="请选择单位" @close="showOrg = false" @select="sexSelect">
  199. </u-action-sheet>
  200. <u-action-sheet :show="showMCheck" :actions="actionsManual" title="请选择检查项" @close="showMCheck = false">
  201. <view style="margin-bottom: 20rpx;">
  202. <view class="manual-hand">
  203. 手动输入设施编码:
  204. </view>
  205. <view class="manual-hand-item">
  206. <u--input placeholder="请输入设施编号" v-model="manualValue" class="manual-hand-input"></u--input>
  207. <u-button shape="circle" type="primary" color="#4CB2B6" text="确认"
  208. customStyle="width:120rpx;margin-left:2%" @click="manualHandConfirm()">
  209. </u-button>
  210. </view>
  211. </view>
  212. <hr>
  213. <view class="manual-hand">
  214. 选择检查项大类:
  215. </view>
  216. <view v-for="(item,index) in actionsManual" :key="index" @click="SelectMCheck(item)" class="manual">
  217. {{item.name}}
  218. </view>
  219. </u-action-sheet>
  220. </view>
  221. </template>
  222. <script>
  223. // #ifdef H5
  224. import {
  225. QrcodeStream
  226. } from 'vue-qrcode-reader'
  227. // #endif
  228. import {
  229. getInspect, //获取主动检查列表
  230. inspTypeList,
  231. createInspect, //创建主动检查
  232. getInspectInfo, //手动添加的检查项列表
  233. getFpd //根据编码获取设施信息
  234. } from "@/api/check_active";
  235. import loadImage from 'blueimp-load-image';
  236. import {
  237. getAccessToken
  238. } from '@/utils/auth'
  239. import config from '@/config'
  240. import store from "@/store"
  241. const baseUrl = config.baseUrl
  242. const baseUrlImg = config.baseUrlImg
  243. import {
  244. getOrgId //获取orgId
  245. } from '@/api/fire_device';
  246. import {
  247. shijianc
  248. } from '@/utils/common.js'
  249. let that = '';
  250. export default {
  251. components: {
  252. // #ifdef H5
  253. QrcodeStream
  254. // #endif
  255. },
  256. data() {
  257. return {
  258. manualValue: '', //手动输入的设施编号
  259. manualPopup: false,
  260. scan: `${baseUrlImg}/checkActive/scan.png`,
  261. // 是否开启扫描
  262. qrScanShow: false,
  263. Group: `${baseUrlImg}/checkActive/Group2.png`,
  264. erWeiMaShu: '', //二维码内容对象
  265. tableData: [],
  266. loading: false,
  267. saveImplement: {
  268. attUrl: [],
  269. dangerDescribe: "", //隐患描述
  270. fpdId: "",
  271. fpdResultCreateReqVOList: [], //传的当前事件
  272. hisResultCreateReqVOList: [], //手动检查
  273. handleMethod: "", //处理方式
  274. handleResult: "", //处理结果描述
  275. handleTime: '',
  276. inspectTime: '',
  277. imgUrl1: "",
  278. imgUrl2: "",
  279. imgUrl3: "",
  280. orgId: 0,
  281. taskId: 0,
  282. broadId: 0,
  283. remark: "", //附加描述
  284. isdenger: 0,
  285. },
  286. maShow: false, //扫码后弹框是否展示
  287. manualCheck: false, //手动检查弹框是否显示
  288. actionsManual: [], //手动检查弹框数据
  289. ManualData: [], //手动检查弹框完整数据
  290. checkManualData: [], //手动检查选中的一条检查项数据
  291. showManual: false, //手动检查是否显示描述
  292. showMCheck: false,
  293. insTypeData: '', //扫二维码后出现的消防列表数据内容
  294. moren: `${baseUrlImg}/checkActive/moren.png`, //默认图片
  295. zhengchang: `${baseUrlImg}/checkActive/zhengchang.png`,
  296. show5: false,
  297. remark: '',
  298. photograph: `${baseUrlImg}/checkActive/photograph.png`,
  299. show2: false,
  300. handleResult: '',
  301. dangerDescribe: '',
  302. showOrg: false,
  303. actions: [],
  304. // 每页数据量
  305. pageSize: 10,
  306. // 当前页
  307. pageNo: 1,
  308. // 数据总量
  309. total: 0,
  310. formData: {
  311. orgName: '',
  312. orgId: ''
  313. },
  314. getqrcode: false,
  315. qrcodeShow: false, //h5端扫码是否显示
  316. }
  317. },
  318. watch: {
  319. loading: {
  320. handler(newLength, oldLength) {
  321. this.$modal.isLoadingModel(this.loading)
  322. },
  323. immediate: true
  324. }
  325. },
  326. onShow() {
  327. this.tableData = []
  328. this.actions = []
  329. that = this;
  330. getOrgId({
  331. pageNo: this.pageNo,
  332. pageSize: this.pageSize,
  333. userId: this.$store.state.user.id
  334. }).then(response => {
  335. // 取到用户对应的单位名称与id
  336. response.data.map(v => {
  337. this.actions.push({
  338. id: v.dwid,
  339. name: v.orgName
  340. });
  341. });
  342. this.formData.orgName = response.data.length > 0 ? response.data[0].orgName : '' //默认
  343. this.formData.orgId = response.data.length > 0 ? response.data[0].dwid : ''
  344. });
  345. this.getData(1)
  346. this.getInspect()
  347. },
  348. methods: {
  349. qrScanOpen() {},
  350. async getInspect() {
  351. const res = await getInspectInfo(1, 999)
  352. this.ManualData = res.data.list
  353. this.actionsManual = res.data.list.filter(obj => obj.inspType !== 'fpd').map(obj => {
  354. return {
  355. id: obj.id,
  356. name: obj.inspName
  357. };
  358. })
  359. },
  360. closeImage(item, val, k) { //删除图片---5.25新加--未验证
  361. if (this.manualPopup) { //手动检查
  362. this.checkManualData[0].attUrl.splice(val, 1)
  363. } else { //扫码添加
  364. console.log(item, 'iii');
  365. if (item.fpdType) {
  366. this.insTypeData[k].attUrl.splice(val, 1)
  367. }
  368. // this.tableData[k].attUrl.splice(val, 1)
  369. }
  370. that.$forceUpdate();
  371. },
  372. sexSelect(e) { //单位
  373. this.formData.orgId = e.id;
  374. this.formData.orgName = e.name;
  375. this.tableData = []
  376. this.getData(1)
  377. },
  378. manualHandConfirm() { //手动输入编号确认
  379. console.log(this.manualValue, 'manualValue');
  380. var that = this
  381. getFpd({
  382. fpdCode: this.manualValue
  383. }).then(res => {
  384. if (res.data.list.length > 0) {
  385. inspTypeList({
  386. id: res.data.list[0].id,
  387. fpdCode: this.manualValue
  388. }).then(reponse => {
  389. that.showMCheck = false
  390. that.maShow = true
  391. that.show2 = false
  392. this.manualValue = ''
  393. that.insTypeData = reponse.data.records
  394. that.insTypeData.map(i => i.attUrl = [])
  395. })
  396. } else {
  397. this.$modal.msg('不存在该设备编码,请确认是否输入正确')
  398. }
  399. })
  400. },
  401. SelectMCheck(e) { //手动选择
  402. this.reselt()
  403. this.checkManualData = this.ManualData.filter(ManualDataItem => {
  404. return ManualDataItem.id == e.id
  405. })
  406. this.showMCheck = false
  407. this.manualPopup = true
  408. this.checkManualData.map(i => {
  409. i.inspectSubDOList.map(v => {
  410. v.isdenger = 0
  411. })
  412. i.isdenger = i.isdenger
  413. i.remark = ''
  414. i.attUrl = []
  415. i.handleMethod = ''
  416. i.handleResult = ''
  417. i.handleTime = ''
  418. i.inspectTime = ''
  419. })
  420. this.remark = ''
  421. console.log(this.checkManualData, 'checkManualData=========', this.ManualData);
  422. },
  423. checkPopupManual(items, indexs, index) { //手动选择
  424. this.checkManualData[0].inspectSubDOList.map(i => {
  425. console.log(i, 'itemtiiejteioti', items);
  426. if (i.id == items.id) {
  427. i.isdenger = i.isdenger === 1 ? 0 : 1;
  428. this.showManual = i.isdenger === 1 ? true : false;
  429. } else {
  430. i.isdenger = 0
  431. this.showManual = false
  432. }
  433. })
  434. this.$forceUpdate()
  435. console.log(this.checkManualData, '1111111111', this.showManual);
  436. },
  437. descript(index) { //隐患描述点击确认
  438. // this.show2 = false
  439. },
  440. getData(pageNo) {
  441. this.loading = true
  442. const id = this.$store.state.user.id
  443. getInspect({
  444. pageNo: pageNo,
  445. pageSize: this.pageSize,
  446. userId: id,
  447. orgId: this.formData.orgId
  448. }).then(response => {
  449. this.loading = false
  450. this.tableData = [...this.tableData, ...response.data.list]
  451. // this.tableData = response.data.list
  452. this.total = response.data.total
  453. })
  454. },
  455. //小程序端扫码
  456. erWeiMa() {
  457. // #ifdef H5
  458. this.qrScanShow = true
  459. // #endif
  460. // #ifdef MP-WEIXIN
  461. var that = this
  462. this.remark = ''
  463. // 只允许从相机扫码
  464. uni.scanCode({
  465. onlyFromCamera: true, //只允许从相机扫码
  466. success: function(res) {
  467. if (res.errMsg == "scanCode:ok") {
  468. console.log('条码内容:' + res.result, JSON.parse(res.result));
  469. let result = JSON.parse(res.result)
  470. console.log('条码内容:', JSON.parse(res.result));
  471. inspTypeList(JSON.parse(res.result)).then(reponse => {
  472. console.log(reponse, 'reponsesssssssssssssss');
  473. if (reponse.code == 0) {
  474. that.maShow = true
  475. that.show2 = false
  476. that.insTypeData = reponse.data.records
  477. that.insTypeData.map(i => {
  478. i.remark = ''
  479. i.attUrl = []
  480. i.handleMethod = ''
  481. i.handleResult = ''
  482. i.handleTime = ''
  483. i.inspectTime = ''
  484. })
  485. }
  486. })
  487. setTimeout(() => {
  488. that.$modal.msgSuccess('扫码成功')
  489. }, 200)
  490. }
  491. },
  492. fail: () => {
  493. that.$modal.msgError('未识别到二维码,请重新尝试!')
  494. }
  495. })
  496. // #endif
  497. },
  498. // #ifdef H5
  499. // 扫码成功后执行函数
  500. onDecode(qrcodeVal) {
  501. this.$modal.msgSuccess('扫码成功', qrcodeVal)
  502. this.qrcodeResault = qrcodeVal
  503. this.qrScanShow = false
  504. let result = JSON.parse(qrcodeVal)
  505. var that = this
  506. inspTypeList(JSON.parse(qrcodeVal)).then(reponse => {
  507. console.log(reponse, 'qrcodeVal');
  508. if (reponse.code == 0) {
  509. that.maShow = true
  510. that.show2 = false
  511. that.insTypeData = reponse.data.records
  512. that.insTypeData.map(i => i.attUrl = [])
  513. }
  514. })
  515. setTimeout(() => {
  516. that.$modal.msgSuccess('扫码成功')
  517. }, 200)
  518. },
  519. // 点击关闭按钮
  520. qrScanClose() {
  521. this.qrScanShow = false
  522. },
  523. onInit(promise) { //未使用
  524. promise
  525. .then(console.log)
  526. .catch(console.error)
  527. },
  528. // #endif
  529. descriptFpd() { //隐患描述点击确认
  530. this.show5 = false
  531. this.handleResult = this.handleResult
  532. if (this.manualPopup) {
  533. this.checkManualData[0].handleResult = this.handleResult
  534. }
  535. this.checkPopupConfirm()
  536. // this.maShow=false
  537. },
  538. checkPopupConfirmNow() {
  539. this.show5 = true
  540. this.handleMethod = "立即处理" //立即整改
  541. console.log(this.checkManualData, 'this.checkManualData');
  542. if (this.manualPopup) {
  543. this.checkManualData[0].handleMethod = "立即处理"
  544. }
  545. },
  546. checkPopupYinHuan() {
  547. this.handleMethod = "生成隐患" //生成隐患
  548. this.handleResult = "不正常"
  549. console.log(this.checkManualData, 'this.checkManualData[this.checkManualData[');
  550. if (this.manualPopup) { //手动检查
  551. this.checkManualData[0].handleMethod = "生成隐患"
  552. this.checkManualData[0].handleResult = "不正常"
  553. }
  554. this.checkPopupConfirm()
  555. },
  556. photoUpload(val) {
  557. let pictures = [];
  558. let that = this;
  559. uni.chooseImage({
  560. sourceType: ['camera'], //实现拍照
  561. count: 3,
  562. sizeType: ['original', 'compressed'],
  563. // sourceType: ['album','camera'], //打开系统相册
  564. success(res) {
  565. that.loading = true
  566. if (Array.isArray(res.tempFilePaths)) { //从相册选择有三张的情况
  567. res.tempFilePaths.forEach(item => {
  568. loadImage(
  569. item,
  570. function(canvas) {
  571. canvas.toBlob(function(blob) {
  572. // 压缩后的 Blob 对象
  573. const compressedFile = blob;
  574. // 将压缩后的文件 `compressedFile` 转换为临时URL
  575. const fileUrl = URL.createObjectURL(
  576. compressedFile);
  577. uni.uploadFile({
  578. url: baseUrl +
  579. '/admin-api/infra/file/upload', //后端用于处理图片并返回图片地址的接口
  580. filePath: item,
  581. name: 'file',
  582. header: {
  583. "Authorization": 'Bearer ' +
  584. getAccessToken(),
  585. }, //请求token
  586. success: (res) => {
  587. let imgUrl = JSON.parse(res
  588. .data)
  589. that.loading = false
  590. //消防设备外(扫一扫下方)展示的图片
  591. //弹出层的消防设备展示的图片
  592. if (that.manualPopup) { //手动检查
  593. that.checkManualData.map(
  594. i => {
  595. i.attUrl.push(
  596. imgUrl
  597. .data)
  598. })
  599. } else { //扫码添加
  600. that.insTypeData.map((i,
  601. index) => {
  602. if (val.id == i
  603. .id) {
  604. i.attUrl
  605. .push(
  606. imgUrl
  607. .data
  608. )
  609. }
  610. })
  611. }
  612. that.$forceUpdate();
  613. // // 返回的url
  614. },
  615. fail: () => {
  616. that.loading = false
  617. console.log("err");
  618. }
  619. })
  620. // 上传完毕后,释放临时URL
  621. URL.revokeObjectURL(fileUrl);
  622. }, 'image/jpeg', 0.6); // 设置压缩后的图片格式为 JPEG,压缩质量为 0.6
  623. }, {
  624. canvas: true,
  625. maxWidth: 800
  626. } // 设置最大宽度为 800px
  627. );
  628. })
  629. }
  630. }
  631. })
  632. },
  633. // 消防设备扫码
  634. normalPopup(items, indexs, index) {
  635. // this.insTypeData.map(k => {
  636. // k.attUrl = []
  637. // })
  638. this.insTypeData[index].inspectResultList.map(k => {
  639. if (k.isNormal == 1) this.nnorNormalValue = k.id
  640. if (this.insTypeData[index].inspectResultList[indexs].isNormal != 1 && this
  641. .insTypeData[index]
  642. .inspectResultList[indexs].subValue != 1) {
  643. // this.show5 = true
  644. this.show2 = true
  645. }
  646. })
  647. let tableItem = this.insTypeData[index].inspectResultList[indexs]
  648. let ALLinspectResultList = this.insTypeData[index].inspectResultList
  649. let YesinspectResultList = []
  650. let NorinspectResultList = []
  651. var Y = ALLinspectResultList.filter(i => i.id == this.nnorNormalValue)
  652. var N = ALLinspectResultList.filter(i => i.id != this.nnorNormalValue)
  653. N.map(n => {
  654. NorinspectResultList.push(n.subValue)
  655. })
  656. Y.map(y => {
  657. YesinspectResultList.push(y.subValue)
  658. })
  659. // items.isdenger = 0 ? 1 : 0
  660. if (NorinspectResultList.includes(1)) { //如果互斥的数组存在true normal!=1的数组
  661. if (tableItem.id == this.nnorNormalValue) {
  662. this.insTypeData[index].inspectResultList.map((i, kindex) => {
  663. if (i.id != this.nnorNormalValue) {
  664. i.subValue = 0
  665. this.show2 = false
  666. } else {
  667. i.subValue = 1
  668. }
  669. })
  670. } else {
  671. items.subValue = items.subValue == 0 ? 1 : 0
  672. this.show2 = false
  673. }
  674. } else {
  675. if (tableItem.id == this.nnorNormalValue) {
  676. items.subValue = items.subValue == 0 ? 1 : 0
  677. } else {
  678. // if (YesinspectResultList.includes(true)) { //是否存在第一份
  679. this.insTypeData[index].inspectResultList.map((i, kindex) => {
  680. if (i.id == this.nnorNormalValue) {
  681. i.subValue = 0
  682. }
  683. })
  684. // }
  685. items.subValue = items.subValue == 0 ? 1 : 0
  686. }
  687. }
  688. },
  689. checkPopupConfirm() { //弹出得到的那一条数据insTypeData的id 弹出保存
  690. if (this.manualPopup) { //手动检查
  691. this.saveImplement = this.checkManualData[0]
  692. this.saveImplement.hisResultCreateReqVOList = this.checkManualData[0].inspectSubDOList
  693. this.saveImplement.dangerDescribe = this.dangerDescribe
  694. this.saveImplement.handleTime = shijianc(new Date().getTime())
  695. this.saveImplement.inspectTime = shijianc(new Date().getTime())
  696. this.saveImplement.remark = this.remark
  697. this.saveImplement.imgUrl1 = this.checkManualData[0].attUrl[0] ? this.checkManualData[0].attUrl[0] :
  698. "";
  699. this.saveImplement.imgUrl2 = this.checkManualData[0].attUrl[1] ? this.checkManualData[0].attUrl[1] :
  700. "";
  701. this.saveImplement.imgUrl3 = this.checkManualData[0].attUrl[2] ? this.checkManualData[0].attUrl[2] :
  702. "";
  703. console.log(this.saveImplement, this.checkManualData, 'this.saveImplement===');
  704. this.saveImplement.hisResultCreateReqVOList.map(z => {
  705. z.resLable = z.subLable
  706. z.resValue = z.isdenger
  707. })
  708. this.saveImplement.inspId = this.saveImplement.id
  709. this.saveImplement.inspectSubDOList.map(i => {
  710. if (i.isdenger == 1 && i.isNormal == 0) { //必传参数,只有该检查项正常为0,那么isdenger==1
  711. this.saveImplement.isdenger = 1
  712. } else {
  713. this.saveImplement.isdenger = 0
  714. }
  715. })
  716. this.saveImplement.orgId = this.formData.orgId
  717. if (!this.saveImplement.dangerDescribe && this.saveImplement.isdenger == 1) return that.$modal
  718. .msgError('请填写隐患描述');
  719. console.log(this.saveImplement, 'this.saveImplement===');
  720. this.baocun(this.saveImplement)
  721. } else { //设施扫码
  722. //this.insTypeData[0]扫二维码后点击出现的一条消防列表数据内容 this.newInsTypeData的多条数据列表
  723. let arr = []
  724. console.log('aaaaaaaaaaaaaa', this.insTypeData);
  725. let normalArr = 0
  726. this.insTypeData[0].inspectResultList.map((i, index) => {
  727. arr.push(i.subValue)
  728. if (i.isNormal == 1) {
  729. normalArr = index //找到正常的所在的index
  730. }
  731. })
  732. if (arr.includes(1)) { //包含了证明勾选了
  733. this.insTypeData.map(i => {
  734. })
  735. this.saveImplement = this.insTypeData
  736. this.saveImplement.map(i => {
  737. i.handleTime = shijianc(new Date().getTime())
  738. i.inspectTime = shijianc(new Date().getTime())
  739. i.orgId = this.formData.orgId
  740. i.dangerDescribe = this.dangerDescribe
  741. i.handleMethod = this.handleMethod
  742. i.remark = this.remark
  743. i.handleResult = this.handleResult
  744. i.fpdId = i.id
  745. i.inspType = "fpd"
  746. i.imgUrl1 = i.attUrl[0] ? i.attUrl[0] : ""
  747. i.imgUrl2 = i.attUrl[1] ? i.attUrl[1] : ""
  748. i.imgUrl3 = i.attUrl[2] ? i.attUrl[2] : ""
  749. i.inspName = i.fpdName
  750. i.inspCode = i.fpdCode
  751. i.inspId = i.id
  752. i.fpdResultCreateReqVOList = i.inspectResultList
  753. i.fpdResultCreateReqVOList.map(z => {
  754. z.broadId = 0
  755. z.fpdId = z.id
  756. z.resLable = z.subLable
  757. z.resValue = z.subValue
  758. z.status = 0
  759. if (z.subValue == 1 && z.isNormal ==
  760. 0) { //必传参数,只有该检查项正常为0,那么isdenger==1
  761. i.isdenger = 1
  762. } else {
  763. i.isdenger = 0
  764. }
  765. })
  766. })
  767. console.log(this.saveImplement, 'this.saveImplement[0]this.saveImplement[0]');
  768. if (!this.saveImplement[0].dangerDescribe && this.saveImplement[0].isdenger == 1) return that
  769. .$modal.msgError('请填写隐患描述');
  770. this.baocun(this.saveImplement[0])
  771. } else {
  772. that.$modal.alert('请勾选检查结果')
  773. }
  774. }
  775. },
  776. baocun(val) {
  777. createInspect(JSON.stringify(val)).then(response => {
  778. if (response.data) {
  779. uni.showToast({
  780. title: '提交成功',
  781. icon: 'none',
  782. duration: 2000
  783. })
  784. this.tableData = []
  785. this.getData(1)
  786. this.reselt()
  787. console.log(this.checkManualData, '===================');
  788. this.$forceUpdate()
  789. } else {
  790. this.$modal.msgError('提交失败')
  791. }
  792. })
  793. this.maShow = false
  794. this.manualPopup = false
  795. },
  796. reselt() {
  797. this.dangerDescribe = ''
  798. this.handleResult = ''
  799. this.saveImplement = { //重置
  800. attUrl: [],
  801. dangerDescribe: "", //隐患描述
  802. fpdId: "",
  803. fpdResultCreateReqVOList: [], //传的当前事件
  804. hisResultCreateReqVOList: [],
  805. handleMethod: "", //处理方式
  806. handleResult: "", //处理结果描述
  807. handleTime: "",
  808. inspectTime: "",
  809. imgUrl1: "",
  810. imgUrl2: "",
  811. imgUrl3: "",
  812. orgId: 0,
  813. taskId: 0,
  814. broadId: 0,
  815. remark: "", //附加描述
  816. isdenger: 0,
  817. }
  818. this.checkManualData = [{ //重置
  819. attUrl: [],
  820. dangerDescribe: "", //隐患描述
  821. fpdId: "",
  822. fpdResultCreateReqVOList: [], //传的当前事件
  823. hisResultCreateReqVOList: [],
  824. handleMethod: "", //处理方式
  825. handleResult: "", //处理结果描述
  826. handleTime: "",
  827. inspectTime: "",
  828. imgUrl1: "",
  829. imgUrl2: "",
  830. imgUrl3: "",
  831. orgId: 0,
  832. taskId: 0,
  833. broadId: 0,
  834. remark: "", //附加描述
  835. isdenger: 0,
  836. }]
  837. },
  838. checkPopupCancel() {
  839. this.maShow = false
  840. this.showManual = false
  841. this.manualPopup = false
  842. },
  843. // 隐藏键盘
  844. hideKeyboard() {
  845. uni.hideKeyboard();
  846. },
  847. addClick() {
  848. this.manualCheck = true
  849. },
  850. addClickDetail(val) {
  851. uni.navigateTo({
  852. url: `/pagesA/fire/check_inspection/inspect_detail/inspect_detail?id=${val}`,
  853. success: function(res) {
  854. res.eventChannel.emit('acceptDataFromOpenerPage', val);
  855. }
  856. })
  857. },
  858. },
  859. // 触底的事件
  860. onReachBottom() {
  861. // 判断是否还有下一页数据
  862. if (this.pageNo * this.pageSize >= this.total) return uni.showToast({
  863. title: `数据加载完毕`
  864. })
  865. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  866. if (this.loading) return
  867. this.pageNo += 1
  868. this.getData(this.pageNo)
  869. },
  870. }
  871. </script>
  872. <style>
  873. page {
  874. background-color: #F5F7F9;
  875. }
  876. </style>
  877. <style lang="scss" scoped>
  878. page {
  879. background-color: #F5F7F9 !important;
  880. }
  881. .tops {
  882. display: flex;
  883. justify-content: space-between;
  884. width: 80%;
  885. margin: 50rpx 10%;
  886. // 二维码扫描相关样式
  887. .qr-scan-containner {
  888. max-width: 600rpx;
  889. display: flex;
  890. flex-direction: column;
  891. justify-content: center;
  892. align-items: center;
  893. align-content: center;
  894. background-color: transparent;
  895. .qr-scan-middle {
  896. .qr-scan-title {
  897. font-size: 30rpx;
  898. text-align: center;
  899. padding: 20rpx 0;
  900. }
  901. max-width: 100%;
  902. }
  903. }
  904. }
  905. .tupian {
  906. width: 95rpx;
  907. height: 95rpx;
  908. }
  909. .tupians {
  910. width: 45rpx;
  911. height: 45rpx;
  912. }
  913. .tiantupian {
  914. width: 95rpx;
  915. height: 95rpx;
  916. }
  917. .cont {
  918. font-size: 16px;
  919. color: #4CB2B6;
  920. margin-bottom: 30rpx;
  921. }
  922. .text {
  923. text-align: center;
  924. color: #000;
  925. font-size: 26rpx;
  926. margin-left: 20rpx;
  927. }
  928. .text2 {
  929. text-align: center;
  930. color: #000;
  931. font-size: 22rpx;
  932. margin-top: 10rpx;
  933. }
  934. ::v-deep .u-icon__icon {
  935. margin-right: 0px !important;
  936. }
  937. .child {
  938. margin: 20rpx 0 0 20rpx;
  939. border-radius: 10rpx;
  940. .child-new {
  941. display: flex;
  942. .child-new-item {
  943. width: 30%;
  944. margin-top: 25%;
  945. transform: translateY(-50px);
  946. }
  947. .child-result {
  948. /deep/.data-v-525ecd67 {
  949. // width: 130rpx;
  950. height: 100rpx;
  951. }
  952. }
  953. }
  954. }
  955. .titles {
  956. padding: 20rpx 0;
  957. color: #383838;
  958. }
  959. .grid-item-box {
  960. display: flex;
  961. align-items: center;
  962. justify-content: center;
  963. padding: 15px 0;
  964. }
  965. /deep/ .uni-grid-item {
  966. height: 140rpx !important;
  967. }
  968. /deep/.uni-textarea-textarea {
  969. border: 1px solid #4CB2B6;
  970. border-radius: 16rpx;
  971. }
  972. .btnList {
  973. display: flex
  974. }
  975. /deep/.u-icon--right[data-v-172979f2],
  976. /deep/.u-icon--right.data-v-172979f2,
  977. .u-icon--right {
  978. // background-color: #f8f8f8;
  979. border-radius: 5rpx;
  980. position: absolute;
  981. top: -14rpx;
  982. right: 14rpx;
  983. }
  984. /deep/.danwei.u-icon--right[data-v-172979f2],
  985. /deep/.danwei.u-icon--right.data-v-172979f2,
  986. .danwei.u-icon--right {
  987. top: 58rpx !important;
  988. right: 58rpx !important;
  989. }
  990. .uni-grid-wraps {
  991. margin-left: 60rpx;
  992. margin-bottom: 200rpx;
  993. }
  994. /deep/.u-slide-up-enter-active[data-v-39e33bf2],
  995. /deep/.u-slide-up-enter-active.data-v-39e33bf2,
  996. .u-slide-up-enter-active {
  997. height: 90% !important;
  998. overflow-y: auto;
  999. }
  1000. .springFarm {
  1001. margin-left: 40rpx;
  1002. }
  1003. .show-title {
  1004. font-size: 32rpx;
  1005. color: #383838;
  1006. margin: 40rpx 0;
  1007. }
  1008. /deep/.u-modal {
  1009. border: 1px solid #4CB2B6 !important;
  1010. }
  1011. .slot-contents {
  1012. // margin-left: 40rpx;
  1013. margin-bottom: 20rpx;
  1014. border-radius: 1px solid #E5E5E5 !important;
  1015. // background-color: #F0F2F3 !important;
  1016. }
  1017. /deep/ .slot-contents .uni-textarea-textarea {
  1018. border: 1px solid #4CB2B6 !important;
  1019. // background-color: #F0F2F3 !important;
  1020. }
  1021. .jieguo {
  1022. /deep/.uni-textarea-textarea {
  1023. border: none !important
  1024. }
  1025. }
  1026. /deep/ .uni-textarea-placeholder {
  1027. color: #a4a8ab;
  1028. margin-top: 20rpx;
  1029. margin-left: 30rpx;
  1030. }
  1031. .detail {
  1032. // width: 72px;
  1033. // height: 60rpx;
  1034. float: right;
  1035. border-radius: 30px;
  1036. background-color: #F7C41E;
  1037. margin-right: 20rpx;
  1038. text-align: center;
  1039. // line-height: 60rpx;
  1040. padding: 3rpx 15rpx;
  1041. }
  1042. .an-niu {
  1043. display: flex;
  1044. justify-content: space-between;
  1045. }
  1046. /deep/.u-input {
  1047. padding: 4px !important;
  1048. }
  1049. /deep/.canvasBox {
  1050. .box {
  1051. width: 600rpx;
  1052. /* 设置扫码容器宽度 */
  1053. height: 600rpx;
  1054. /* 设置扫码容器高度 */
  1055. }
  1056. }
  1057. .manual {
  1058. font-size: 16px;
  1059. padding: 25rpx 0;
  1060. }
  1061. .manual-hand {
  1062. margin-left: 30rpx;
  1063. display: flex;
  1064. font-size: 18px;
  1065. color: #30746b;
  1066. margin: 20rpx;
  1067. }
  1068. .manual-hand-item {
  1069. display: flex;
  1070. width: 90%;
  1071. justify-content: space-between;
  1072. margin-left: 3%;
  1073. /deep/.u-input {
  1074. border: 1px solid #726f74 !important;
  1075. }
  1076. }
  1077. </style>