editCheckReport.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137
  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="getOssPath(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>
  193. <u-gap height="50"></u-gap>
  194. </form>
  195. </view>
  196. </view>
  197. </template>
  198. <script>
  199. import pageNav from '@/components/page-nav/page-nav.vue';
  200. import http from '@/http/api.js'
  201. import {
  202. oss,
  203. devUrl,
  204. prodUrl,
  205. } from '@/common/setting'
  206. export default {
  207. components: {
  208. pageNav
  209. },
  210. onLoad(option) {
  211. console.log(option.id);
  212. this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
  213. //记录ID
  214. this.recordId = option.id;
  215. const id = option.id;
  216. const that = this;
  217. //查询问题详情信息
  218. http.request({
  219. url: '/blade-business/report/failure/detail',
  220. method: 'GET',
  221. params: {
  222. id
  223. }
  224. }).then(res => {
  225. console.log("detail " + res)
  226. if (res.code == 200) {
  227. that.checkNo = res.data['failureCheckNo'];
  228. that.recordInfo = res.data;
  229. that.failureCheckPointDesc = res.data['failureCheckPointDesc'];
  230. that.failureHiddenDangerDesc = res.data['failureHiddenDangerDesc'];
  231. that.failureCorrectiveSuggest = res.data['failureCorrectiveSuggest'];
  232. that.initProjectInfo(res.data['failureProjectId']);
  233. that.initCheckArea(res.data['failureCheckArea']);
  234. that.initCheckItemType(res.data['failureCheckHiddenDangerType']);
  235. that.initCheckItemLabel(res.data['failureCheckHiddenDanger']);
  236. this.initCheckStandard(res.data['failureCheckHiddenDangerItemPoint']);
  237. this.initCheckStandardBasis(res.data['failureCheckHiddenDangerStandard']);
  238. that.initHiddenDangerLevelRadio(res.data['failureHiddenDangerLevel']);
  239. that.initPlanTimeRadio(res.data['failureCorrectivePlanTime']);
  240. that.initPhoto(res.data['failureCheckNo']);
  241. }
  242. }).catch(err => {
  243. console.log(err)
  244. })
  245. },
  246. data() {
  247. return {
  248. baseURL: '',
  249. checkNo: '',
  250. recordInfo: {},
  251. planTimeRadio: {
  252. items: [],
  253. current: 0,
  254. },
  255. hiddenDangerRadio: {
  256. items: [],
  257. current: 0,
  258. },
  259. localImageList: [],
  260. uploadImageList: [],
  261. checkAreaDict: {
  262. id: '',
  263. dictKey: '',
  264. dictValue: '请点击选择'
  265. },
  266. checkItemTypeDict: {
  267. id: '',
  268. dictKey: '',
  269. dictValue: '请点击选择'
  270. },
  271. checkItemLabelDict: {
  272. id: '',
  273. dictKey: '',
  274. dictValue: '请点击选择'
  275. },
  276. checkStandardDict: {
  277. id: '',
  278. dictKey: '',
  279. dictValue: '请点击选择'
  280. },
  281. checkItemStandardBasisDict: {
  282. id: '',
  283. dictKey: '',
  284. dictValue: ''
  285. },
  286. title: '问题编辑',
  287. desc: '',
  288. projectInfo: {
  289. 'projectId': '',
  290. 'title': ''
  291. },
  292. failureHiddenDangerDesc: '',
  293. failureCheckPointDesc: '',
  294. failureCorrectiveSuggest: '',
  295. }
  296. },
  297. computed: {
  298. getIcon() {
  299. return path => {
  300. return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
  301. }
  302. },
  303. },
  304. onShow() {
  305. uni.setNavigationBarTitle({
  306. title: ""
  307. });
  308. //项目选择结果监听
  309. uni.$on("handClickProjectSelect", res => {
  310. console.log(res);
  311. this.projectInfo = {
  312. projectId: res.projectId,
  313. title: '重新选择的项目名'
  314. }
  315. // 清除监听
  316. uni.$off('handClickProjectSelect');
  317. })
  318. //检查区域选择结果监听
  319. uni.$on("handClickAreaSelect", res => {
  320. console.log(res);
  321. this.checkAreaDict = {
  322. dictValue: res.dictValue,
  323. dictKey: res.dictKey,
  324. id: res.id
  325. }
  326. // 清除监听
  327. uni.$off('handClickAreaSelect');
  328. })
  329. //安全隐患问题分类选择结果监听
  330. uni.$on("handClickItemSelect", res => {
  331. console.log("callback " + res);
  332. if (this.checkItemTypeDict.id == null || this.checkItemTypeDict.id.length == 0 || this
  333. .checkItemTypeDict.id !== res.id) {
  334. this.checkItemLabelDict = {
  335. id: '',
  336. dictKey: '',
  337. dictValue: '请点击选择'
  338. }
  339. this.checkStandardDict = {
  340. id: '',
  341. dictKey: '',
  342. dictValue: '请点击选择'
  343. }
  344. this.failureHiddenDangerDesc = "";
  345. this.checkItemStandardBasisDict = {
  346. id: '',
  347. dictKey: '',
  348. dictValue: ''
  349. }
  350. }
  351. this.checkItemTypeDict = {
  352. dictValue: res.dictValue,
  353. dictKey: res.dictKey,
  354. id: res.id
  355. }
  356. // 清除监听
  357. uni.$off('handClickItemSelect');
  358. })
  359. //安全隐患标签选择结果监听
  360. uni.$on("handClickItemLabelSelect", res => {
  361. console.log("handClickItemLabelSelect" + res);
  362. if (this.checkItemLabelDict.id == null || this.checkItemLabelDict.id.length == 0 || this
  363. .checkItemLabelDict.id !== res.id) {
  364. this.checkStandardDict = {
  365. id: '',
  366. dictKey: '',
  367. dictValue: '请点击选择'
  368. }
  369. this.failureHiddenDangerDesc = "";
  370. this.checkItemStandardBasisDict = {
  371. id: '',
  372. dictKey: '',
  373. dictValue: ''
  374. }
  375. }
  376. this.checkItemLabelDict = {
  377. dictValue: res.dictValue,
  378. dictKey: res.dictKey,
  379. id: res.id
  380. }
  381. // 清除监听
  382. uni.$off('handClickItemLabelSelect');
  383. })
  384. //安全隐患排查标准选择结果监听
  385. uni.$on("handClickStandardSelect", res => {
  386. console.log(res);
  387. if (this.checkStandardDict.id == null || this.checkStandardDict.id.length == 0 || this
  388. .checkStandardDict.id !== res.id) {
  389. this.failureHiddenDangerDesc = "";
  390. this.checkItemStandardBasisDict = {
  391. id: '',
  392. dictKey: '',
  393. dictValue: ''
  394. }
  395. }
  396. this.checkStandardDict = {
  397. dictValue: res.dictValue,
  398. dictKey: res.dictKey,
  399. id: res.id
  400. }
  401. this.failureHiddenDangerDesc = res.dictValue;
  402. this.checkItemStandardBasisDict = {
  403. dictValue: res.subDict.dictValue,
  404. dictKey: res.subDict.dictKey,
  405. id: res.subDict.id
  406. }
  407. // 清除监听
  408. uni.$off('handClickStandardSelect');
  409. })
  410. },
  411. created() {
  412. },
  413. methods: {
  414. getOssPath(imageInfo) {
  415. if (null != imageInfo && undefined != imageInfo && imageInfo.local) {
  416. return imageInfo.photoPath;
  417. } else {
  418. return oss + imageInfo.photoPath;
  419. }
  420. },
  421. initProjectInfo(failureProjectId) {
  422. const that = this;
  423. const id = failureProjectId;
  424. http.request({
  425. url: '/blade-business/report/projectInfo/detail',
  426. method: 'GET',
  427. params: {
  428. id
  429. }
  430. }).then(res => {
  431. console.log(res.data)
  432. that.projectInfo = {
  433. projectId: res.data.id,
  434. title: res.data.projectName
  435. }
  436. }).catch(err => {
  437. console.log(err)
  438. })
  439. },
  440. initCheckArea(dictId) {
  441. const that = this;
  442. const id = dictId;
  443. http.request({
  444. url: '/galaxy-system/dict-biz/detail',
  445. method: 'GET',
  446. params: {
  447. id
  448. }
  449. }).then(res => {
  450. console.log(res.data)
  451. if (res.data != null) {
  452. that.checkAreaDict = {
  453. id: res.data['id'],
  454. dictKey: res.data['dictKey'],
  455. dictValue: res.data['dictValue'],
  456. };
  457. }
  458. }).catch(err => {
  459. console.log(err)
  460. })
  461. },
  462. initCheckItemType(dictId) {
  463. const that = this;
  464. const id = dictId;
  465. http.request({
  466. url: '/galaxy-system/dict-biz/detail',
  467. method: 'GET',
  468. params: {
  469. id
  470. }
  471. }).then(res => {
  472. console.log(res.data)
  473. if (res.data != null) {
  474. that.checkItemTypeDict = {
  475. id: res.data['id'],
  476. dictKey: res.data['dictKey'],
  477. dictValue: res.data['dictValue'],
  478. };
  479. }
  480. }).catch(err => {
  481. console.log(err)
  482. })
  483. },
  484. initCheckItemLabel(dictId) {
  485. const that = this;
  486. const id = dictId;
  487. http.request({
  488. url: '/galaxy-system/dict-biz/detail',
  489. method: 'GET',
  490. params: {
  491. id
  492. }
  493. }).then(res => {
  494. console.log(res.data)
  495. if (res.data != null) {
  496. that.checkItemLabelDict = {
  497. id: res.data['id'],
  498. dictKey: res.data['dictKey'],
  499. dictValue: res.data['dictValue'],
  500. };
  501. }
  502. }).catch(err => {
  503. console.log(err)
  504. })
  505. },
  506. initCheckStandard(dictId) {
  507. const that = this;
  508. const id = dictId;
  509. http.request({
  510. url: '/galaxy-system/dict-biz/detail',
  511. method: 'GET',
  512. params: {
  513. id
  514. }
  515. }).then(res => {
  516. console.log(res.data)
  517. if (res.data != null) {
  518. that.checkStandardDict = {
  519. id: res.data['id'],
  520. dictKey: res.data['dictKey'],
  521. dictValue: res.data['dictValue'],
  522. };
  523. }
  524. }).catch(err => {
  525. console.log(err)
  526. })
  527. },
  528. initCheckStandardBasis(dictId) {
  529. if (null != dictId && undefined != dictId && dictId.length > 0) {
  530. const that = this;
  531. const id = dictId;
  532. http.request({
  533. url: '/galaxy-system/dict-biz/detail',
  534. method: 'GET',
  535. params: {
  536. id
  537. }
  538. }).then(res => {
  539. console.log(res.data)
  540. if (res.data != null) {
  541. that.checkItemStandardBasisDict = {
  542. id: res.data['id'],
  543. dictKey: res.data['dictKey'],
  544. dictValue: res.data['dictValue'],
  545. };
  546. }
  547. }).catch(err => {
  548. console.log(err)
  549. })
  550. }
  551. },
  552. initHiddenDangerLevelRadio(dictId) {
  553. const that = this;
  554. //查询隐患等级
  555. http.request({
  556. url: '/galaxy-system/dict-biz/dictionary?code=danger_level',
  557. method: 'GET'
  558. }).then(res => {
  559. console.log(res.data)
  560. if (res.data != null) {
  561. var dangerLevelList = [];
  562. var index = 0;
  563. const dictLength = res.data['length'];
  564. for (var i = 0; i < dictLength; i++) {
  565. let dict = res.data['' + i];
  566. if (dict['id'] == dictId) {
  567. index = i;
  568. }
  569. dangerLevelList.push(dict);
  570. }
  571. that.hiddenDangerRadio = {
  572. current: index,
  573. items: dangerLevelList
  574. }
  575. }
  576. }).catch(err => {
  577. console.log(err)
  578. })
  579. },
  580. initPlanTimeRadio(dictId) {
  581. const that = this;
  582. //查询整改期限
  583. http.request({
  584. url: '/galaxy-system/dict-biz/dictionary?code=plan_time',
  585. method: 'GET'
  586. }).then(res => {
  587. console.log(res.data)
  588. if (res.data != null) {
  589. var planTimeList = [];
  590. var index = 0;
  591. const dictLength = res.data['length'];
  592. for (var i = 0; i < dictLength; i++) {
  593. let dict = res.data['' + i];
  594. if (dict['id'] == dictId) {
  595. index = i;
  596. }
  597. planTimeList.push(dict);
  598. }
  599. that.planTimeRadio = {
  600. current: index,
  601. items: planTimeList,
  602. }
  603. }
  604. }).catch(err => {
  605. console.log(err)
  606. })
  607. },
  608. initPhoto(failureCheckNo) {
  609. const that = this;
  610. http.request({
  611. url: '/blade-business/report/failure/photo/list',
  612. method: 'GET',
  613. params: {
  614. failureCheckNo
  615. }
  616. }).then(res => {
  617. console.log("detail " + res)
  618. if (res.success) {
  619. if (res.data != null && res.data.length > 0) {
  620. res.data.forEach(d => {
  621. let imageInfo = {
  622. id: d.id,
  623. photoPath: d.photoPath,
  624. failureCheckNo: d.failureCheckNo,
  625. local: false,
  626. }
  627. that.localImageList.push(imageInfo);
  628. })
  629. }
  630. }
  631. }).catch(err => {
  632. console.log(err)
  633. })
  634. },
  635. onDeleteClick(index) {
  636. this.localImageList.splice(index, 1);
  637. },
  638. planTimeRadioChange: function(evt) {
  639. for (let i = 0; i < this.planTimeRadio.items.length; i++) {
  640. if (this.planTimeRadio.items[i].id === evt.detail.value) {
  641. this.planTimeRadio.current = i;
  642. break;
  643. }
  644. }
  645. },
  646. hiddenDangerRadioChange: function(evt) {
  647. for (let i = 0; i < this.hiddenDangerRadio.items.length; i++) {
  648. if (this.hiddenDangerRadio.items[i].id === evt.detail.value) {
  649. this.hiddenDangerRadio.current = i;
  650. break;
  651. }
  652. }
  653. },
  654. getPhoto() {
  655. const that = this;
  656. if (this.localImageList.length > 9) {
  657. uni.showModal({
  658. content: '一次最多上传9张图片,请检查!',
  659. showCancel: false
  660. });
  661. } else {
  662. uni.chooseImage({
  663. sourceType: ['album', 'camera'],
  664. success: async (res) => {
  665. const len = res.tempFilePaths.length;
  666. if (len > 0) {
  667. if (len + that.localImageList.length > 9) {
  668. uni.showModal({
  669. content: '一次最多上传9张图片,请检查!',
  670. showCancel: false
  671. });
  672. } else {
  673. let text = "";
  674. let pathList = [];
  675. res.tempFilePaths.forEach(async path => {
  676. let imageInfo = {
  677. id: '',
  678. photoPath: path,
  679. failureCheckNo: that.checkNo,
  680. local: true,
  681. }
  682. pathList.push(imageInfo);
  683. text += path + " ";
  684. })
  685. that.localImageList = that.localImageList.concat(pathList);
  686. }
  687. }
  688. }
  689. })
  690. }
  691. },
  692. async upload(formdata) {
  693. if (this.localImageList.length > 0) {
  694. var tempImageList = [];
  695. this.localImageList.forEach(image => {
  696. if (image.local) {
  697. tempImageList.push(image.photoPath);
  698. } else {
  699. this.uploadImageList.push(image);
  700. }
  701. })
  702. if (tempImageList.length > 0) {
  703. await this.uploadFile(tempImageList).then(names => {
  704. names.forEach(name => {
  705. console.log("image path " + name);
  706. let p = {
  707. failureCheckNo: this.checkNo,
  708. photoPath: name,
  709. id: ''
  710. }
  711. this.uploadImageList.push(p);
  712. })
  713. formdata['photoPaths'] = this.uploadImageList;
  714. http.request({
  715. url: '/blade-business/report/failure/update',
  716. method: 'POST',
  717. data: formdata
  718. }).then(res => {
  719. if (res.success) {
  720. uni.showModal({
  721. content: '上传成功',
  722. showCancel: false,
  723. success(res) {
  724. if (res.confirm) {
  725. uni.navigateBack();
  726. }
  727. }
  728. });
  729. } else {
  730. uni.showModal({
  731. content: '' + res.msg,
  732. showCancel: false
  733. });
  734. }
  735. }).catch(err => {
  736. console.log(err)
  737. })
  738. })
  739. } else {
  740. formdata['photoPaths'] = this.uploadImageList;
  741. http.request({
  742. url: '/blade-business/report/failure/update',
  743. method: 'POST',
  744. data: formdata
  745. }).then(res => {
  746. if (res.success) {
  747. uni.showModal({
  748. content: '上传成功',
  749. showCancel: false,
  750. success(res) {
  751. if (res.confirm) {
  752. uni.navigateBack();
  753. }
  754. }
  755. });
  756. } else {
  757. uni.showModal({
  758. content: '' + res.msg,
  759. showCancel: false
  760. });
  761. }
  762. }).catch(err => {
  763. console.log(err)
  764. })
  765. }
  766. } else {
  767. http.request({
  768. url: '/blade-business/report/failure/update',
  769. method: 'POST',
  770. data: formdata
  771. }).then(res => {
  772. if (res.success) {
  773. uni.showModal({
  774. content: '上传成功',
  775. showCancel: false,
  776. success(res) {
  777. if (res.confirm) {
  778. uni.navigateBack();
  779. }
  780. }
  781. });
  782. } else {
  783. uni.showModal({
  784. content: '' + res.msg,
  785. showCancel: false
  786. });
  787. }
  788. }).catch(err => {
  789. console.log(err)
  790. })
  791. }
  792. },
  793. uploadFile(imagePaths) {
  794. var returnImagePathList = [];
  795. var count = 0;
  796. console.log("accessToken:" + uni.getStorageSync('accessToken'));
  797. return new Promise((resolve, reject) => {
  798. imagePaths.forEach(imagePath => {
  799. console.log("path " + imagePath);
  800. uni.showLoading({
  801. title: '上传中'
  802. });
  803. uni.uploadFile({
  804. url: this.baseURL +
  805. '/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
  806. uni.getStorageSync('accessToken'),
  807. fileType: 'image',
  808. filePath: imagePath,
  809. name: 'file',
  810. success: (uploadFileRes) => {
  811. console.log(uploadFileRes);
  812. if (uploadFileRes.statusCode == 200) {
  813. let data = JSON.parse(uploadFileRes.data);
  814. if (data.success) {
  815. let name = data.data['name'];
  816. returnImagePathList.push(name);
  817. }
  818. }
  819. count += 1;
  820. if (count == imagePaths.length) {
  821. resolve(returnImagePathList);
  822. }
  823. },
  824. fail: (err) => {
  825. console.log(err);
  826. reject('err')
  827. },
  828. complete() {
  829. uni.hideLoading()
  830. }
  831. });
  832. });
  833. })
  834. },
  835. formSubmit: function(e) {
  836. console.log('form发生了submit事件,携带数据为:' + JSON.stringify(e.detail.value))
  837. var formdata = e.detail.value
  838. if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
  839. (this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
  840. (this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
  841. (this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
  842. (this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {
  843. this.recordInfo['failureCheckPointDesc'] = formdata['failureCheckPointDesc'];
  844. this.recordInfo['failureHiddenDangerDesc'] = formdata['failureHiddenDangerDesc'];
  845. this.recordInfo['failureCorrectiveSuggest'] = formdata['failureCorrectiveSuggest'];
  846. this.recordInfo['failureProjectId'] = this.projectInfo.projectId;
  847. this.recordInfo['failureCheckArea'] = this.checkAreaDict.id;
  848. this.recordInfo['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
  849. this.recordInfo['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
  850. this.recordInfo['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
  851. this.recordInfo['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;
  852. this.recordInfo['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this
  853. .hiddenDangerRadio.current]
  854. .id;
  855. this.recordInfo['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio
  856. .current]
  857. .id;
  858. this.upload(this.recordInfo);
  859. } else {
  860. uni.showModal({
  861. content: '请检查必填项',
  862. showCancel: false
  863. });
  864. }
  865. },
  866. formReset: function(e) {
  867. console.log('清空数据')
  868. },
  869. selectCheckArea() {
  870. this.$u.route({
  871. url: '/pages/checkReport/checkAreaSelect'
  872. })
  873. },
  874. selectCheckItemType() {
  875. uni.navigateTo({
  876. url: '/pages/checkReport/checkItemSelect'
  877. })
  878. },
  879. selectCheckItemLabel() {
  880. if (this.checkItemTypeDict.id.length > 0) {
  881. uni.navigateTo({
  882. url: '/pages/checkReport/checkItemLabelSelect?id=' + this.checkItemTypeDict.id
  883. })
  884. } else {
  885. uni.showModal({
  886. content: '请先选择安全隐患问题类型',
  887. showCancel: false
  888. });
  889. }
  890. },
  891. selectCheckStandard() {
  892. if (this.checkItemLabelDict.id.length > 0) {
  893. uni.navigateTo({
  894. url: '/pages/checkReport/checkStandardSelect?id=' + this.checkItemLabelDict.id
  895. })
  896. } else {
  897. uni.showModal({
  898. content: '请先选择安全隐患问题标签',
  899. showCancel: false
  900. });
  901. }
  902. },
  903. openPage(path) {
  904. this.$u.route({
  905. url: path
  906. })
  907. },
  908. getGroupTitle(item) {
  909. return item.groupName
  910. },
  911. getFieldTitle(item) {
  912. return item.title
  913. },
  914. goto(url) {
  915. console.log(url);
  916. uni.navigateTo({
  917. url: url
  918. })
  919. }
  920. }
  921. }
  922. </script>
  923. <style>
  924. /* page {
  925. background-color: rgb(240, 242, 244);
  926. } */
  927. .cell-hover-class {
  928. background-color: rgb(235, 237, 238);
  929. }
  930. .view-flex-rs {
  931. display: flex;
  932. flex-direction: row;
  933. justify-content: flex-start;
  934. }
  935. .view-flex-rc {
  936. display: flex;
  937. flex-direction: row;
  938. justify-content: center;
  939. }
  940. .view-flex-re {
  941. display: flex;
  942. flex-direction: row;
  943. justify-content: flex-end;
  944. }
  945. .view-flex-cs {
  946. display: flex;
  947. flex-direction: column;
  948. justify-content: flex-start;
  949. }
  950. .view-flex-cc {
  951. display: flex;
  952. flex-direction: column;
  953. justify-content: center;
  954. }
  955. .view-flex-ce {
  956. display: flex;
  957. flex-direction: column;
  958. justify-content: flex-end;
  959. }
  960. .line-body {
  961. padding-left: 10px;
  962. padding-right: 10px;
  963. }
  964. .required-star {
  965. color: #FF0000;
  966. font-size: 15px;
  967. width: 20px;
  968. text-align: center;
  969. padding-left: 0px;
  970. padding-right: 2px;
  971. }
  972. .item-title {
  973. color: #909399;
  974. font-size: 15px;
  975. }
  976. .mline-text {
  977. padding-left: 2px;
  978. width: 100%;
  979. /* background-color:#909399; */
  980. height: 100px;
  981. border: 1px solid #FF5A5F;
  982. border-radius: 5px;
  983. }
  984. </style>
  985. <style lang="scss" scoped>
  986. .u-cell-icon {
  987. width: 36rpx;
  988. height: 36rpx;
  989. margin-right: 8rpx;
  990. }
  991. .slot-box {
  992. /* #ifndef APP-NVUE */
  993. display: flex;
  994. /* #endif */
  995. flex-direction: row;
  996. align-items: center;
  997. }
  998. .slot-image {
  999. /* #ifndef APP-NVUE */
  1000. display: block;
  1001. /* #endif */
  1002. margin-right: 10px;
  1003. width: 30px;
  1004. height: 30px;
  1005. }
  1006. .slot-text {
  1007. flex: 1;
  1008. font-size: 14px;
  1009. color: #4cd964;
  1010. margin-right: 10px;
  1011. }
  1012. .img-container {
  1013. margin-bottom: 20px;
  1014. .note-image-box {
  1015. margin-top: 5px;
  1016. display: flex;
  1017. flex-wrap: wrap;
  1018. padding: 10px;
  1019. .note-image-item {
  1020. position: relative;
  1021. width: 33.3%;
  1022. height: 0;
  1023. padding-top: 33.3%;
  1024. box-sizing: border-box;
  1025. // background-color: #18B566;
  1026. .close-icon {
  1027. display: flex;
  1028. justify-content: center;
  1029. align-items: center;
  1030. position: absolute;
  1031. right: 0px;
  1032. top: 0px;
  1033. width: 22px;
  1034. height: 22px;
  1035. border-radius: 50%;
  1036. background-color: #d5d5d5;
  1037. z-index: 2;
  1038. }
  1039. .image-box {
  1040. display: flex;
  1041. justify-content: center;
  1042. align-items: center;
  1043. position: absolute;
  1044. top: 5px;
  1045. right: 5px;
  1046. border: 5px;
  1047. left: 5px;
  1048. border: 1px #eee solid;
  1049. border-radius: 5px;
  1050. overflow: hidden;
  1051. width: 95%;
  1052. height: 95%;
  1053. }
  1054. }
  1055. }
  1056. }
  1057. </style>