editCacheCheckReport.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. <template>
  2. <view class="wrap">
  3. <page-nav :desc="desc" :title="title"></page-nav>
  4. <view>
  5. <form @submit="formSubmit" @reset="formReset">
  6. <!-- 项目信息项 -->
  7. <view class="uni-form-item">
  8. <view class="view-flex-rs line-body">
  9. <view class="view-flex-cc">
  10. <text class="required-star">*</text>
  11. </view>
  12. <view style="width: 200rpx;" class="view-flex-cc item-title">
  13. <text>当前项目:</text>
  14. </view>
  15. <view style="flex-grow: 0.9;" class="view-flex-cc">
  16. <text>{{projectInfo.title}}</text>
  17. </view>
  18. <view style="width: 200rpx;" class="view-flex-cc">
  19. <button style="height: 80rpx;font-size: medium;" type="primary"
  20. @click="goto('/pages/checkReport/checkProjectSelect?model=1')">重新选择</button>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 检查区域信息项 -->
  25. <view class="uni-form-item" style="margin-top: 10px;">
  26. <view class="line-body view-flex-rs">
  27. <text class="required-star">*</text>
  28. <text class="item-title">检查区域</text>
  29. </view>
  30. <view>
  31. <uni-list-item @click="selectCheckArea()" :clickable="true" :ellipsis="1"
  32. :show-extra-icon="true" showArrow
  33. :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
  34. v-bind:title="checkAreaDict.dictValue" />
  35. </view>
  36. <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkAreaDict.dictValue"
  37. hover-class="cell-hover-class" @click="selectCheckArea()"></u-cell-item> -->
  38. </view>
  39. <!-- 检查点位文本信息项 -->
  40. <view class="uni-form-item uni-column" style="margin-top: 10rpx;">
  41. <view class="line-body item-title">
  42. 具体位置
  43. </view>
  44. <view class="line-body">
  45. <uni-easyinput errorMessage v-model="failureCheckPointDesc" placeholder="请输入内容"></uni-easyinput>
  46. </view>
  47. </view>
  48. <!-- 安全隐患问题类型信息项,字典 -->
  49. <view class="uni-form-item" style="margin-top: 10px;">
  50. <view class="line-body view-flex-rs">
  51. <text class="required-star">*</text>
  52. <text class="item-title">安全问题隐患类型</text>
  53. </view>
  54. <view>
  55. <uni-list-item @click="selectCheckItemType()" :clickable="true" :ellipsis="1"
  56. :show-extra-icon="true" showArrow
  57. :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
  58. v-bind:title="checkItemTypeDict.dictValue" />
  59. </view>
  60. <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkItemTypeDict.dictValue"
  61. hover-class="cell-hover-class" @click="selectCheckItemType()"></u-cell-item> -->
  62. </view>
  63. <!-- 安全隐患问题标签信息项,字典 -->
  64. <view class="uni-form-item" style="margin-top: 10px;">
  65. <view class="line-body view-flex-rs">
  66. <text class="required-star">*</text>
  67. <text class="item-title">检查部位</text>
  68. </view>
  69. <view>
  70. <uni-list-item @click="selectCheckItemLabel()" :clickable="true" :ellipsis="1"
  71. :show-extra-icon="true" showArrow
  72. :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
  73. v-bind:title="checkItemLabelDict.dictValue" />
  74. </view>
  75. <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkItemLabelDict.dictValue"
  76. hover-class="cell-hover-class" @click="selectCheckItemLabel()"></u-cell-item> -->
  77. </view>
  78. <!-- 安全隐患问题排查标准信息项,字典 -->
  79. <view class="uni-form-item uni-column" style="margin-top: 10px;">
  80. <view class="line-body view-flex-rs">
  81. <text class="required-star">*</text>
  82. <text class="item-title">问题隐患标签</text>
  83. </view>
  84. <view>
  85. <uni-list-item @click="selectCheckStandard()" :clickable="true" :ellipsis="1"
  86. :show-extra-icon="true" showArrow
  87. :extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
  88. v-bind:title="checkStandardDict.dictValue" />
  89. </view>
  90. <!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkStandardDict.dictValue"
  91. hover-class="cell-hover-class" @click="selectCheckStandard()"></u-cell-item> -->
  92. </view>
  93. <view class="uni-form-item uni-column" style="margin-top: 10px;">
  94. <view class="line-body item-title">
  95. 法律法规
  96. </view>
  97. <view class="line-body">
  98. <textarea disabled v-model="checkItemStandardBasisDict.dictValue" class="mline-text" />
  99. <!-- <uni-easyinput disabled v-model="checkItemStandardBasisDict.dictValue"></uni-easyinput> -->
  100. </view>
  101. </view>
  102. <!-- 安全隐患问题描述信息项,文本 -->
  103. <view class="uni-form-item uni-column" style="margin-top: 10px;">
  104. <view class="line-body item-title">
  105. 安全问题隐患描述
  106. </view>
  107. <view class="line-body">
  108. <textarea v-model="failureHiddenDangerDesc" name="failureCorrectiveSuggest"
  109. class="mline-text" />
  110. </view>
  111. </view>
  112. <!-- 隐患等级信息项,字典 -->
  113. <view class="uni-form-item" style="margin-top: 15px;">
  114. <view class="view-flex-rs">
  115. <view class="uni-title line-body"><text class="required-star">*</text><text
  116. class="item-title">隐患等级</text></view>
  117. <view class="line-body">
  118. <radio-group @change="hiddenDangerRadioChange"
  119. style="display: flex;flex-direction: row;justify-content: flex-start;">
  120. <label style="margin-top: 2px;margin-right: 5px;" class="view-flex-rs"
  121. v-for="(item, index) in hiddenDangerRadio.items" :key="item.id">
  122. <view>
  123. <radio :value="item.id" :checked="index === hiddenDangerRadio.current" />
  124. </view>
  125. <view style="font-size: 12px;">{{item.dictValue}}</view>
  126. </label>
  127. </radio-group>
  128. </view>
  129. </view>
  130. </view>
  131. <!-- 整改建议信息项,文本 -->
  132. <view class="uni-form-item uni-column" style="margin-top: 10px;">
  133. <view class="line-body item-title">
  134. 整改建议
  135. </view>
  136. <view class="line-body">
  137. <textarea v-model="failureCorrectiveSuggest" name="failureCorrectiveSuggest"
  138. class="mline-text" />
  139. </view>
  140. </view>
  141. <!-- 整改期限信息项,字典 -->
  142. <view class="uni-form-item" style="margin-top: 15px;">
  143. <view class="view-flex-rs">
  144. <view class="uni-title line-body"><text class="required-star">*</text><text
  145. class="item-title">整改期限</text></view>
  146. <view class="line-body">
  147. <radio-group @change="planTimeRadioChange"
  148. style="display: flex;flex-direction: row;justify-content: flex-start;">
  149. <label style="margin-top: 2px; margin-right: 5px;" class="view-flex-rs"
  150. v-for="(item, index) in planTimeRadio.items" :key="item.id">
  151. <view>
  152. <radio :value="item.id" :checked="index === planTimeRadio.current" />
  153. </view>
  154. <view style="font-size: 12px;">{{item.dictValue}}</view>
  155. </label>
  156. </radio-group>
  157. </view>
  158. </view>
  159. </view>
  160. <!-- 图片信息项 -->
  161. <view class="uni-form-item" style="margin-top: 10px;">
  162. <view class="view-flex-rs line-body">
  163. <view class="view-flex-cc" style="height: 40px;">
  164. <text class="item-title">安全隐患问题图片</text>
  165. </view>
  166. </view>
  167. </view>
  168. <view class="uni-form-item" style="margin-top: 10px;">
  169. <view class="img-container">
  170. <view class="note-image-box">
  171. <view class="note-image-item" v-for="(item , index) in localImageList" :key="index">
  172. <view class="close-icon" @click="onDeleteClick(index)">
  173. <uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
  174. </view>
  175. <view class="image-box">
  176. <image :src="item" mode="widthFix"></image>
  177. </view>
  178. </view>
  179. <view v-if="localImageList.length < 9" class="note-image-item" @click="getPhoto()">
  180. <view class="image-box">
  181. <uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. </view>
  187. <u-gap height="50"></u-gap>
  188. <view class="uni-form-item uni-column">
  189. <view class="line-body">
  190. <button type="primary" form-type="submit">提交</button>
  191. </view>
  192. <view class="line-body" style="margin-top: 10px;">
  193. <button type="default" @click="onSaveClick">保存</button>
  194. </view>
  195. </view>
  196. <u-gap height="50"></u-gap>
  197. </form>
  198. </view>
  199. </view>
  200. </template>
  201. <script>
  202. import pageNav from '@/components/page-nav/page-nav.vue';
  203. import http from '@/http/api.js';
  204. import {
  205. devUrl,
  206. prodUrl,
  207. oss
  208. } from '@/common/setting';
  209. export default {
  210. components: {
  211. pageNav
  212. },
  213. onLoad(option) {
  214. console.log(option.checkNo);
  215. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  216. this.checkNo = option.checkNo;
  217. //问题详情信息
  218. var data = uni.getStorageSync('check_report_storage_' + this.checkNo);
  219. if (data != null) {
  220. console.log("detail " + data)
  221. this.recordInfo = data;
  222. this.failureCheckPointDesc = data['failureCheckPointDesc']
  223. this.failureHiddenDangerDesc = data['failureHiddenDangerDesc']
  224. this.failureCorrectiveSuggest = data['failureCorrectiveSuggest']
  225. this.initProjectInfo(data['failureProjectId']);
  226. this.initCheckArea(data['failureCheckArea']);
  227. this.initCheckItemType(data['failureCheckHiddenDangerType']);
  228. this.initCheckItemLabel(data['failureCheckHiddenDanger']);
  229. this.initCheckStandard(data['failureCheckHiddenDangerItemPoint']);
  230. this.initCheckStandardBasis(data['failureCheckHiddenDangerStandard']);
  231. this.initHiddenDangerLevelRadio(data['failureHiddenDangerLevel']);
  232. this.initPlanTimeRadio(data['failureCorrectivePlanTime']);
  233. this.initPhoto()
  234. }
  235. },
  236. data() {
  237. return {
  238. baseURL: '',
  239. checkNo: '',
  240. recordInfo: {},
  241. savedImageList: [],
  242. planTimeRadio: {
  243. items: [],
  244. current: 0,
  245. },
  246. hiddenDangerRadio: {
  247. items: [],
  248. current: 0,
  249. },
  250. localImageList: [],
  251. uploadImageList: [],
  252. checkAreaDict: {
  253. id: '',
  254. dictKey: '',
  255. dictValue: '请点击选择'
  256. },
  257. checkItemTypeDict: {
  258. id: '',
  259. dictKey: '',
  260. dictValue: '请点击选择'
  261. },
  262. checkItemLabelDict: {
  263. id: '',
  264. dictKey: '',
  265. dictValue: '请点击选择'
  266. },
  267. checkStandardDict: {
  268. id: '',
  269. dictKey: '',
  270. dictValue: '请点击选择'
  271. },
  272. checkItemStandardBasisDict: {
  273. id: '',
  274. dictKey: '',
  275. dictValue: ''
  276. },
  277. title: '问题编辑',
  278. desc: '',
  279. projectInfo: {
  280. 'projectId': '',
  281. 'title': ''
  282. },
  283. failureHiddenDangerDesc: '',
  284. failureCheckPointDesc: '',
  285. failureCorrectiveSuggest: '',
  286. }
  287. },
  288. computed: {
  289. getIcon() {
  290. return path => {
  291. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  292. }
  293. },
  294. },
  295. onShow() {
  296. uni.setNavigationBarTitle({
  297. title: "问题编辑"
  298. });
  299. //项目选择结果监听
  300. uni.$on("handClickProjectSelect", res => {
  301. console.log(res);
  302. this.projectInfo = {
  303. projectId: res.projectId,
  304. title: '重新选择的项目名'
  305. }
  306. // 清除监听
  307. uni.$off('handClickProjectSelect');
  308. })
  309. //检查区域选择结果监听
  310. uni.$on("handClickAreaSelect", res => {
  311. console.log(res);
  312. this.checkAreaDict = {
  313. dictValue: res.dictValue,
  314. dictKey: res.dictKey,
  315. id: res.id
  316. }
  317. // 清除监听
  318. uni.$off('handClickAreaSelect');
  319. })
  320. //安全隐患问题分类选择结果监听
  321. uni.$on("handClickItemSelect", res => {
  322. console.log("callback " + res);
  323. if (this.checkItemTypeDict.id == null || this.checkItemTypeDict.id.length == 0 || this
  324. .checkItemTypeDict.id !== res.id) {
  325. this.checkItemLabelDict = {
  326. id: '',
  327. dictKey: '',
  328. dictValue: '请点击选择'
  329. }
  330. this.checkStandardDict = {
  331. id: '',
  332. dictKey: '',
  333. dictValue: '请点击选择'
  334. }
  335. this.failureHiddenDangerDesc = "";
  336. this.checkItemStandardBasisDict = {
  337. id: '',
  338. dictKey: '',
  339. dictValue: ''
  340. }
  341. }
  342. this.checkItemTypeDict = {
  343. dictValue: res.dictValue,
  344. dictKey: res.dictKey,
  345. id: res.id
  346. }
  347. // 清除监听
  348. uni.$off('handClickItemSelect');
  349. })
  350. //安全隐患标签选择结果监听
  351. uni.$on("handClickItemLabelSelect", res => {
  352. console.log("handClickItemLabelSelect" + res);
  353. if (this.checkItemLabelDict.id == null || this.checkItemLabelDict.id.length == 0 || this
  354. .checkItemLabelDict.id !== res.id) {
  355. this.checkStandardDict = {
  356. id: '',
  357. dictKey: '',
  358. dictValue: '请点击选择'
  359. }
  360. this.failureHiddenDangerDesc = "";
  361. this.checkItemStandardBasisDict = {
  362. id: '',
  363. dictKey: '',
  364. dictValue: ''
  365. }
  366. }
  367. this.checkItemLabelDict = {
  368. dictValue: res.dictValue,
  369. dictKey: res.dictKey,
  370. id: res.id
  371. }
  372. // 清除监听
  373. uni.$off('handClickItemLabelSelect');
  374. })
  375. //安全隐患排查标准选择结果监听
  376. uni.$on("handClickStandardSelect", res => {
  377. console.log(res);
  378. if (this.checkStandardDict.id == null || this.checkStandardDict.id.length == 0 || this
  379. .checkStandardDict.id !== res.id) {
  380. this.failureHiddenDangerDesc = "";
  381. this.checkItemStandardBasisDict = {
  382. id: '',
  383. dictKey: '',
  384. dictValue: ''
  385. }
  386. }
  387. this.checkStandardDict = {
  388. dictValue: res.dictValue,
  389. dictKey: res.dictKey,
  390. id: res.id
  391. }
  392. this.failureHiddenDangerDesc = res.dictValue;
  393. this.checkItemStandardBasisDict = {
  394. dictValue: res.subDict.dictValue,
  395. dictKey: res.subDict.dictKey,
  396. id: res.subDict.id
  397. }
  398. // 清除监听
  399. uni.$off('handClickStandardSelect');
  400. })
  401. },
  402. created() {
  403. },
  404. methods: {
  405. initProjectInfo(failureProjectId) {
  406. const that = this;
  407. const id = failureProjectId;
  408. http.request({
  409. url: '/blade-business/report/projectInfo/detail',
  410. method: 'GET',
  411. params: {
  412. id
  413. }
  414. }).then(res => {
  415. console.log(res.data)
  416. that.projectInfo = {
  417. projectId: res.data.id,
  418. title: res.data.projectName
  419. }
  420. }).catch(err => {
  421. console.log(err)
  422. })
  423. },
  424. initCheckArea(dictId) {
  425. const that = this;
  426. const id = dictId;
  427. http.request({
  428. url: '/galaxy-system/dict-biz/detail',
  429. method: 'GET',
  430. params: {
  431. id
  432. }
  433. }).then(res => {
  434. console.log(res.data)
  435. if (res.data != null) {
  436. that.checkAreaDict = {
  437. id: res.data['id'],
  438. dictKey: res.data['dictKey'],
  439. dictValue: res.data['dictValue'],
  440. };
  441. }
  442. }).catch(err => {
  443. console.log(err)
  444. })
  445. },
  446. initCheckItemType(dictId) {
  447. const that = this;
  448. const id = dictId;
  449. http.request({
  450. url: '/galaxy-system/dict-biz/detail',
  451. method: 'GET',
  452. params: {
  453. id
  454. }
  455. }).then(res => {
  456. console.log(res.data)
  457. if (res.data != null) {
  458. that.checkItemTypeDict = {
  459. id: res.data['id'],
  460. dictKey: res.data['dictKey'],
  461. dictValue: res.data['dictValue'],
  462. };
  463. }
  464. }).catch(err => {
  465. console.log(err)
  466. })
  467. },
  468. initCheckItemLabel(dictId) {
  469. const that = this;
  470. const id = dictId;
  471. http.request({
  472. url: '/galaxy-system/dict-biz/detail',
  473. method: 'GET',
  474. params: {
  475. id
  476. }
  477. }).then(res => {
  478. console.log(res.data)
  479. if (res.data != null) {
  480. that.checkItemLabelDict = {
  481. id: res.data['id'],
  482. dictKey: res.data['dictKey'],
  483. dictValue: res.data['dictValue'],
  484. };
  485. }
  486. }).catch(err => {
  487. console.log(err)
  488. })
  489. },
  490. initCheckStandard(dictId) {
  491. const that = this;
  492. const id = dictId;
  493. http.request({
  494. url: '/galaxy-system/dict-biz/detail',
  495. method: 'GET',
  496. params: {
  497. id
  498. }
  499. }).then(res => {
  500. console.log(res.data)
  501. if (res.data != null) {
  502. that.checkStandardDict = {
  503. id: res.data['id'],
  504. dictKey: res.data['dictKey'],
  505. dictValue: res.data['dictValue'],
  506. };
  507. }
  508. }).catch(err => {
  509. console.log(err)
  510. })
  511. },
  512. initCheckStandardBasis(dictId) {
  513. if (null != dictId && undefined != dictId && dictId.length > 0) {
  514. const that = this;
  515. const id = dictId;
  516. http.request({
  517. url: '/galaxy-system/dict-biz/detail',
  518. method: 'GET',
  519. params: {
  520. id
  521. }
  522. }).then(res => {
  523. console.log(res.data)
  524. if (res.data != null) {
  525. that.checkItemStandardBasisDict = {
  526. id: res.data['id'],
  527. dictKey: res.data['dictKey'],
  528. dictValue: res.data['dictValue'],
  529. };
  530. }
  531. }).catch(err => {
  532. console.log(err)
  533. })
  534. }
  535. },
  536. initHiddenDangerLevelRadio(dictId) {
  537. const that = this;
  538. //查询隐患等级
  539. http.request({
  540. url: '/galaxy-system/dict-biz/dictionary?code=danger_level',
  541. method: 'GET'
  542. }).then(res => {
  543. console.log(res.data)
  544. if (res.data != null) {
  545. var dangerLevelList = [];
  546. var index = 0;
  547. const dictLength = res.data['length'];
  548. for (var i = 0; i < dictLength; i++) {
  549. let dict = res.data['' + i];
  550. if (dict['id'] == dictId) {
  551. index = i;
  552. }
  553. dangerLevelList.push(dict);
  554. }
  555. that.hiddenDangerRadio = {
  556. current: index,
  557. items: dangerLevelList
  558. }
  559. }
  560. }).catch(err => {
  561. console.log(err)
  562. })
  563. },
  564. initHiddenDangerLevelRadio(dictId) {
  565. const that = this;
  566. //查询隐患等级
  567. http.request({
  568. url: '/galaxy-system/dict-biz/dictionary?code=danger_level',
  569. method: 'GET'
  570. }).then(res => {
  571. console.log(res.data)
  572. if (res.data != null) {
  573. var dangerLevelList = [];
  574. var index = 0;
  575. const dictLength = res.data['length'];
  576. for (var i = 0; i < dictLength; i++) {
  577. let dict = res.data['' + i];
  578. if (dict['id'] == dictId) {
  579. index = i;
  580. }
  581. dangerLevelList.push(dict);
  582. }
  583. that.hiddenDangerRadio = {
  584. current: index,
  585. items: dangerLevelList
  586. }
  587. }
  588. }).catch(err => {
  589. console.log(err)
  590. })
  591. },
  592. initPlanTimeRadio(dictId) {
  593. const that = this;
  594. //查询整改期限
  595. http.request({
  596. url: '/galaxy-system/dict-biz/dictionary?code=plan_time',
  597. method: 'GET'
  598. }).then(res => {
  599. console.log(res.data)
  600. if (res.data != null) {
  601. var planTimeList = [];
  602. var index = 0;
  603. const dictLength = res.data['length'];
  604. for (var i = 0; i < dictLength; i++) {
  605. let dict = res.data['' + i];
  606. if (dict['id'] == dictId) {
  607. index = i;
  608. }
  609. planTimeList.push(dict);
  610. }
  611. that.planTimeRadio = {
  612. current: index,
  613. items: planTimeList,
  614. }
  615. }
  616. }).catch(err => {
  617. console.log(err)
  618. })
  619. },
  620. getOssPath(imagePath) {
  621. if (null != imagePath && imagePath.indexOf("blob") == 0) {
  622. return imagePath;
  623. } else {
  624. return oss + imagePath;
  625. }
  626. },
  627. initPhoto() {
  628. var saveFilePaths = uni.getStorageSync('check_report_storage_image_' + this.checkNo);
  629. this.localImageList = this.localImageList.concat(saveFilePaths);
  630. },
  631. onDeleteClick(index) {
  632. this.localImageList.splice(index, 1);
  633. },
  634. removeRecord() {
  635. var tempIndexList = [];
  636. var list = uni.getStorageSync('check_report_storage_index');
  637. if (list != null && list.length > 0) {
  638. list.forEach(itemKey => {
  639. if (itemKey !== this.checkNo) {
  640. tempIndexList.push(itemKey);
  641. }
  642. });
  643. }
  644. uni.setStorageSync('check_report_storage_index', tempIndexList);
  645. uni.removeStorageSync('check_report_storage_' + this.checkNo);
  646. },
  647. planTimeRadioChange: function(evt) {
  648. for (let i = 0; i < this.planTimeRadio.items.length; i++) {
  649. if (this.planTimeRadio.items[i].id === evt.detail.value) {
  650. this.planTimeRadio.current = i;
  651. break;
  652. }
  653. }
  654. },
  655. hiddenDangerRadioChange: function(evt) {
  656. for (let i = 0; i < this.hiddenDangerRadio.items.length; i++) {
  657. if (this.hiddenDangerRadio.items[i].id === evt.detail.value) {
  658. this.hiddenDangerRadio.current = i;
  659. break;
  660. }
  661. }
  662. },
  663. getPhoto() {
  664. const that = this;
  665. uni.chooseImage({
  666. sourceType: ['album', 'camera'],
  667. success: (res) => {
  668. const len = res.tempFilePaths.length;
  669. if (len > 0) {
  670. if (len + that.localImageList.length > 9) {
  671. uni.showModal({
  672. content: '一次最多上传9张图片,请检查!',
  673. showCancel: false
  674. });
  675. } else {
  676. let pathList = [];
  677. res.tempFilePaths.forEach(path => {
  678. that.localImageList.push(path);
  679. })
  680. }
  681. }
  682. }
  683. })
  684. },
  685. saveLocalFile(paths) {
  686. var returnFileList = [];
  687. var count = 0;
  688. return new Promise((resolve, reject) => {
  689. paths.forEach(imagePath => {
  690. console.log("path " + imagePath);
  691. uni.saveFile({
  692. tempFilePath: imagePath,
  693. success: (res) => {
  694. var savedFilePath = res.savedFilePath;
  695. returnFileList.push(savedFilePath);
  696. count += 1;
  697. if (count == paths.length) {
  698. resolve(returnFileList);
  699. }
  700. },
  701. fail: (e) => {
  702. reject('err')
  703. }
  704. })
  705. });
  706. })
  707. },
  708. async saveLocalFiles(tempImageList) {
  709. if (tempImageList.length > 0) {
  710. await this.saveLocalFile(tempImageList).then(files => {
  711. files.forEach(f => {
  712. this.savedImageList.push(f);
  713. })
  714. });
  715. }
  716. },
  717. onSaveClick(e) {
  718. if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
  719. (this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
  720. (this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
  721. (this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
  722. (this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {
  723. try {
  724. var data = {};
  725. data['failureHiddenDangerDesc'] = this.failureHiddenDangerDesc;
  726. data['failureCheckPointDesc'] = this.failureCheckPointDesc;
  727. data['failureCorrectiveSuggest'] = this.failureCorrectiveSuggest;
  728. data['failureCheckNo'] = this.checkNo;
  729. data['failureProjectId'] = this.projectInfo.projectId;
  730. data['failureCheckArea'] = this.checkAreaDict.id;
  731. data['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
  732. data['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
  733. data['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
  734. data['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;
  735. data['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this.hiddenDangerRadio.current]
  736. .id;
  737. data['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio.current]
  738. .id;
  739. var tempImageList = [];
  740. this.savedImageList = [];
  741. this.localImageList.forEach(path => {
  742. var text = String(path);
  743. if (text.indexOf("blob") == 0) {
  744. tempImageList.push(text);
  745. } else {
  746. this.savedImageList.push(text);
  747. }
  748. })
  749. this.saveLocalFiles(tempImageList);
  750. uni.setStorageSync('check_report_storage_image_' + this
  751. .checkNo, this.savedImageList);
  752. console.log("save " + data);
  753. uni.setStorageSync('check_report_storage_' + this.checkNo, data);
  754. uni.navigateBack();
  755. } catch (e) {
  756. console.log(e);
  757. uni.showModal({
  758. content: '保存失败!' + e.message,
  759. showCancel: false
  760. });
  761. }
  762. } else {
  763. uni.showModal({
  764. content: '请检查必填项',
  765. showCancel: false
  766. });
  767. }
  768. },
  769. uploadFile(imagePaths) {
  770. var returnImagePathList = [];
  771. var count = 0;
  772. console.log("accessToken:" + uni.getStorageSync('accessToken'));
  773. return new Promise((resolve, reject) => {
  774. imagePaths.forEach(imagePath => {
  775. console.log("path " + imagePath);
  776. uni.showLoading({
  777. title: '上传中'
  778. });
  779. uni.uploadFile({
  780. url: this.baseURL +
  781. '/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
  782. uni.getStorageSync('accessToken'),
  783. fileType: 'image',
  784. filePath: imagePath,
  785. name: 'file',
  786. success: (uploadFileRes) => {
  787. console.log(uploadFileRes);
  788. if (uploadFileRes.statusCode == 200) {
  789. let data = JSON.parse(uploadFileRes.data);
  790. if (data.success) {
  791. let name = data.data['name'];
  792. returnImagePathList.push(name);
  793. }
  794. }
  795. count += 1;
  796. if (count == imagePaths.length) {
  797. resolve(returnImagePathList);
  798. }
  799. },
  800. fail: (err) => {
  801. console.log(err);
  802. reject('err')
  803. },
  804. complete() {
  805. uni.hideLoading()
  806. }
  807. });
  808. });
  809. })
  810. },
  811. async upload(formdata) {
  812. const that = this;
  813. if (this.localImageList.length > 0) {
  814. await this.uploadFile(this.localImageList).then(names => {
  815. names.forEach(name => {
  816. console.log("image path " + name);
  817. this.uploadImageList.push(name);
  818. })
  819. var photoPaths = [];
  820. this.uploadImageList.forEach(name => {
  821. let p = {
  822. failureCheckNo: this.checkNo,
  823. photoPath: name
  824. }
  825. photoPaths.push(p);
  826. })
  827. formdata['photoPaths'] = photoPaths;
  828. http.request({
  829. url: '/blade-business/report/failure/save',
  830. method: 'POST',
  831. data: formdata
  832. }).then(res => {
  833. if (res.success) {
  834. that.removeRecord();
  835. uni.showModal({
  836. content: '上传成功',
  837. showCancel: false,
  838. success(res) {
  839. if (res.confirm) {
  840. uni.navigateBack();
  841. }
  842. }
  843. });
  844. } else {
  845. uni.showModal({
  846. content: '' + res.msg,
  847. showCancel: false
  848. });
  849. }
  850. }).catch(err => {
  851. console.log(err)
  852. })
  853. })
  854. } else {
  855. http.request({
  856. url: '/blade-business/report/failure/save',
  857. method: 'POST',
  858. data: formdata
  859. }).then(res => {
  860. if (res.success) {
  861. that.removeRecord();
  862. uni.showModal({
  863. content: '上传成功',
  864. showCancel: false,
  865. success(res) {
  866. if (res.confirm) {
  867. uni.navigateBack();
  868. }
  869. }
  870. });
  871. } else {
  872. uni.showModal({
  873. content: '' + res.msg,
  874. showCancel: false
  875. });
  876. }
  877. }).catch(err => {
  878. console.log(err)
  879. })
  880. }
  881. },
  882. formSubmit: function(e) {
  883. console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
  884. if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
  885. (this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
  886. (this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
  887. (this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
  888. (this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {
  889. this.recordInfo['failureCheckPointDesc'] = this.failureCheckPointDesc;
  890. this.recordInfo['failureHiddenDangerDesc'] = this.failureHiddenDangerDesc;
  891. this.recordInfo['failureCorrectiveSuggest'] = this.failureCorrectiveSuggest;
  892. this.recordInfo['failureProjectId'] = this.projectInfo.projectId;
  893. this.recordInfo['failureCheckArea'] = this.checkAreaDict.id;
  894. this.recordInfo['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
  895. this.recordInfo['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
  896. this.recordInfo['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
  897. this.recordInfo['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;
  898. this.recordInfo['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this
  899. .hiddenDangerRadio.current]
  900. .id;
  901. this.recordInfo['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio
  902. .current]
  903. .id;
  904. this.upload(this.recordInfo);
  905. } else {
  906. uni.showModal({
  907. content: '请检查必填项',
  908. showCancel: false
  909. });
  910. }
  911. },
  912. formReset: function(e) {
  913. console.log('清空数据')
  914. },
  915. selectCheckArea() {
  916. this.$u.route({
  917. url: '/pages/checkReport/checkAreaSelect'
  918. })
  919. },
  920. selectCheckItemType() {
  921. uni.navigateTo({
  922. url: '/pages/checkReport/checkItemSelect'
  923. })
  924. },
  925. selectCheckItemLabel() {
  926. if (this.checkItemTypeDict.id.length > 0) {
  927. uni.navigateTo({
  928. url: '/pages/checkReport/checkItemLabelSelect?id=' + this.checkItemTypeDict.id
  929. })
  930. } else {
  931. uni.showModal({
  932. content: '请先选择安全隐患问题类型',
  933. showCancel: false
  934. });
  935. }
  936. },
  937. selectCheckStandard() {
  938. if (this.checkItemLabelDict.id.length > 0) {
  939. uni.navigateTo({
  940. url: '/pages/checkReport/checkStandardSelect?id=' + this.checkItemLabelDict.id
  941. })
  942. } else {
  943. uni.showModal({
  944. content: '请先选择安全隐患问题标签',
  945. showCancel: false
  946. });
  947. }
  948. },
  949. openPage(path) {
  950. this.$u.route({
  951. url: path
  952. })
  953. },
  954. getGroupTitle(item) {
  955. return item.groupName
  956. },
  957. getFieldTitle(item) {
  958. return item.title
  959. },
  960. goto(url) {
  961. console.log(url);
  962. uni.navigateTo({
  963. url: url
  964. })
  965. }
  966. }
  967. }
  968. </script>
  969. <style>
  970. /* page {
  971. background-color: rgb(240, 242, 244);
  972. } */
  973. .cell-hover-class {
  974. background-color: rgb(235, 237, 238);
  975. }
  976. .view-flex-rs {
  977. display: flex;
  978. flex-direction: row;
  979. justify-content: flex-start;
  980. }
  981. .view-flex-rc {
  982. display: flex;
  983. flex-direction: row;
  984. justify-content: center;
  985. }
  986. .view-flex-re {
  987. display: flex;
  988. flex-direction: row;
  989. justify-content: flex-end;
  990. }
  991. .view-flex-cs {
  992. display: flex;
  993. flex-direction: column;
  994. justify-content: flex-start;
  995. }
  996. .view-flex-cc {
  997. display: flex;
  998. flex-direction: column;
  999. justify-content: center;
  1000. }
  1001. .view-flex-ce {
  1002. display: flex;
  1003. flex-direction: column;
  1004. justify-content: flex-end;
  1005. }
  1006. .line-body {
  1007. padding-left: 10px;
  1008. padding-right: 10px;
  1009. }
  1010. .required-star {
  1011. color: #FF0000;
  1012. font-size: 15px;
  1013. width: 20px;
  1014. text-align: center;
  1015. padding-left: 0px;
  1016. padding-right: 2px;
  1017. }
  1018. .item-title {
  1019. color: #909399;
  1020. font-size: 15px;
  1021. }
  1022. .mline-text {
  1023. padding-left: 2px;
  1024. width: 100%;
  1025. /* background-color:#909399; */
  1026. height: 100px;
  1027. border: 1px solid #FF5A5F;
  1028. border-radius: 5px;
  1029. }
  1030. </style>
  1031. <style lang="scss" scoped>
  1032. .u-cell-icon {
  1033. width: 36rpx;
  1034. height: 36rpx;
  1035. margin-right: 8rpx;
  1036. }
  1037. .slot-box {
  1038. /* #ifndef APP-NVUE */
  1039. display: flex;
  1040. /* #endif */
  1041. flex-direction: row;
  1042. align-items: center;
  1043. }
  1044. .slot-image {
  1045. /* #ifndef APP-NVUE */
  1046. display: block;
  1047. /* #endif */
  1048. margin-right: 10px;
  1049. width: 30px;
  1050. height: 30px;
  1051. }
  1052. .slot-text {
  1053. flex: 1;
  1054. font-size: 14px;
  1055. color: #4cd964;
  1056. margin-right: 10px;
  1057. }
  1058. .img-container {
  1059. margin-bottom: 20px;
  1060. .note-image-box {
  1061. margin-top: 5px;
  1062. display: flex;
  1063. flex-wrap: wrap;
  1064. padding: 10px;
  1065. .note-image-item {
  1066. position: relative;
  1067. width: 33.3%;
  1068. height: 0;
  1069. padding-top: 33.3%;
  1070. box-sizing: border-box;
  1071. // background-color: #18B566;
  1072. .close-icon {
  1073. display: flex;
  1074. justify-content: center;
  1075. align-items: center;
  1076. position: absolute;
  1077. right: 0px;
  1078. top: 0px;
  1079. width: 22px;
  1080. height: 22px;
  1081. border-radius: 50%;
  1082. background-color: #d5d5d5;
  1083. z-index: 2;
  1084. }
  1085. .image-box {
  1086. display: flex;
  1087. justify-content: center;
  1088. align-items: center;
  1089. position: absolute;
  1090. top: 5px;
  1091. right: 5px;
  1092. border: 5px;
  1093. left: 5px;
  1094. border: 1px #eee solid;
  1095. border-radius: 5px;
  1096. overflow: hidden;
  1097. width: 95%;
  1098. height: 95%;
  1099. }
  1100. }
  1101. }
  1102. }
  1103. </style>