rectifyInfo.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. <!-- 整改信息 -->
  2. <template>
  3. <view id="rectifyInfo">
  4. <view class="list-page-box" v-if="pageType == 1">
  5. <view class="for-max-box" v-for="(item,index) in newData.detailsList" :key="index">
  6. <view class="for-position-index">{{index+1}}</view>
  7. <view class="for-name-box">
  8. <view>{{item.jcxName}}</view>
  9. <view v-if="item.isZg==0||item.isZg==1">{{item.isZg == 0?'完成整改':(item.isZg == 1?'暂无法整改':'未确认')}}</view>
  10. </view>
  11. <view class="for-title-box" v-if="item.isLingshi == 1">临时检查项</view>
  12. <view class="for-title-box" v-if="item.isLingshi == 0">{{item.jcxSstkMs}}</view>
  13. <view class="for-button" @click="itemClick(item,index)">{{item.isZg == 0 || item.isZg == 1 ?'修改内容':'完成整改'}}</view>
  14. </view>
  15. <view class="list-button-box" @click="allUpDataClick">提交审核</view>
  16. </view>
  17. <view class="info-page-box" v-if="pageType == 2">
  18. <view class="info-data-box">
  19. <view class="info-name">{{form.jcxName}}</view>
  20. <view class="info-title" v-if="form.isLingshi == 1">临时检查项</view>
  21. <view class="info-title" v-if="form.isLingshi == 0">{{form.jcxSstkMs}}</view>
  22. <view class="info-text-box">
  23. <view>隐患描述:</view>
  24. <view>{{form.yhMs}}</view>
  25. </view>
  26. <view class="info-img-box" v-if="form.yhImg[0]">
  27. <view class="info-text">隐患图片:</view>
  28. <view class="img-max-box">
  29. <img v-for="(url,index) in form.yhImg" :key="index" :src="url" @click="lockImg(url)"
  30. :class="form.yhImg.length == 1?'imgOne':(form.yhImg.length > 1 && form.yhImg.length < 5 ?'imgTwo':(form.yhImg.length > 4?'imgTree':''))">
  31. </view>
  32. </view>
  33. </view>
  34. <view class="text-input-max-box" v-if="formType == 0">
  35. <view class="input-box" v-if="newData.zgType == 0">
  36. <view class="text-p">整改描述</view>
  37. <view class="bj-p">*</view>
  38. <textarea class="textarea-p" maxlength="50" v-model="form.zgMs" placeholder="请输入整改描述"></textarea>
  39. </view>
  40. <view class="input-box" v-if="newData.zgType == 1">
  41. <view class="text-p">原因分析</view>
  42. <view class="bj-p">*</view>
  43. <textarea class="textarea-p" maxlength="50" v-model="form.zgYyfx" placeholder="请输入原因分析"></textarea>
  44. </view>
  45. <view class="input-box" v-if="newData.zgType == 1">
  46. <view class="text-p">整改措施</view>
  47. <view class="bj-p">*</view>
  48. <textarea class="textarea-p" maxlength="50" v-model="form.zgCs" placeholder="请输入整改措施"></textarea>
  49. </view>
  50. <view class="img-up-box">
  51. <view class="text-p">整改照片</view>
  52. <view class="bj-p"></view>
  53. <view class="img-box">
  54. <view class="min-for-img-box" v-for="(url,index) in form.yhZghImg" :key="index">
  55. <img class="min-for-img" @click.stop="lockImg(url)"
  56. :src="url">
  57. <img class="del-img" @click.stop="delZgImg(index)" src="@/images/icon_jlfgz_gb.png">
  58. </view>
  59. <view class="up-img" @click="selectImage">
  60. <view>上传</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="text-info-max-box" v-if="formType == 1">
  66. <view class="text-info-name">提交不能立整立改的隐患请在下方上传或填写整改计划及措施等相关材料。</view>
  67. <textarea class="text-info-textarea-p" maxlength="50" v-model="form.zmClMs" placeholder="请输入证明材料描述"></textarea>
  68. <view class="text-info-for-up-img-box" v-for="(url,index) in form.zmClImg" :key="index">
  69. <img class="text-info-for-up-img" @click.stop="lockImg(url)"
  70. :src="url">
  71. <img class="del-img" @click.stop="delZmImg(index)" src="@/images/icon_jlfgz_gb.png">
  72. </view>
  73. <view class="text-info-up-img-box" @click="proveImgUp">
  74. <view>+</view>
  75. <view>添加</view>
  76. </view>
  77. </view>
  78. <view class="check-button-box">
  79. <view @click="outItmeClick">取消</view>
  80. <view @click="itemOkClick">确认</view>
  81. </view>
  82. </view>
  83. </view>
  84. </template>
  85. <script>
  86. import { checkRecordUpdate } from '@/api/index.js'
  87. import { config } from '@/api/request/config.js'
  88. export default {
  89. name: "rectifyInfo",
  90. data() {
  91. return {
  92. pageType:1,
  93. newData:[],
  94. form:{},
  95. formType:"",
  96. formIndex:"",
  97. }
  98. },
  99. onLoad(option) {
  100. let obj = JSON.parse(decodeURIComponent(option.newData));
  101. this.newData = JSON.parse(JSON.stringify(obj));
  102. },
  103. onShow() {
  104. },
  105. methods: {
  106. //提交数据
  107. async allUpDataClick(){
  108. let self = this;
  109. for(let i=0;i<self.newData.detailsList.length;i++){
  110. if(self.newData.detailsList[i].isZg != 0 && self.newData.detailsList[i].isZg != 1){
  111. uni.showToast({
  112. title: '请完成所有整改后再提交',
  113. icon:"none",
  114. mask:true,
  115. duration: 2000
  116. });
  117. return
  118. }
  119. }
  120. let obj = {
  121. id: self.newData.id,
  122. fzrId:this.newData.fzrId,
  123. detailsList: [],
  124. }
  125. let age = 0;
  126. for(let i=0;i<self.newData.detailsList.length;i++){
  127. let minObk = {}
  128. if(self.newData.detailsList[i].isZg == 0){
  129. if(self.newData.zgType == 0){
  130. minObk.zgMs = self.newData.detailsList[i].zgMs;
  131. }else if(self.newData.zgType == 1){
  132. minObk.zgYyfx = self.newData.detailsList[i].zgYyfx;
  133. minObk.zgCs = self.newData.detailsList[i].zgCs;
  134. }
  135. minObk.yhZghImg = self.newData.detailsList[i].yhZghImg + '';
  136. }else if(self.newData.detailsList[i].isZg == 1){
  137. age++;
  138. minObk.zmClMs = self.newData.detailsList[i].zmClMs;
  139. minObk.zmClImg = self.newData.detailsList[i].zmClImg + '';
  140. }
  141. minObk.isZg = self.newData.detailsList[i].isZg
  142. minObk.id = self.newData.detailsList[i].id;
  143. obj.detailsList.push(minObk);
  144. }
  145. if(age == 0){
  146. obj.zgStatus = 1;
  147. }else{
  148. obj.zgStatus = 3;
  149. }
  150. const {data} = await checkRecordUpdate(obj);
  151. if(data.code == 200){
  152. uni.showToast({
  153. title: '提交成功',
  154. icon:"none",
  155. mask:true,
  156. duration: 2000
  157. });
  158. setTimeout(function(){
  159. uni.navigateBack();
  160. },2000);
  161. }
  162. },
  163. //确定整改数据
  164. itemOkClick(){
  165. if(this.formType == 0){
  166. //整改
  167. if(this.newData.zgType == 0){
  168. // 一般整改
  169. if(!this.form.zgMs){
  170. uni.showToast({
  171. title: '请输入整改描述',
  172. icon:"none",
  173. mask:true,
  174. duration: 2000
  175. });
  176. return
  177. }
  178. }else if(this.newData.zgType == 1){
  179. // 重大整改
  180. if(!this.form.zgYyfx){
  181. uni.showToast({
  182. title: '请输入原因分析',
  183. icon:"none",
  184. mask:true,
  185. duration: 2000
  186. });
  187. return
  188. }
  189. if(!this.form.zgCs){
  190. uni.showToast({
  191. title: '请输入整改措施',
  192. icon:"none",
  193. mask:true,
  194. duration: 2000
  195. });
  196. return
  197. }
  198. }
  199. if(!this.form.yhZghImg[0]){
  200. uni.showToast({
  201. title: '请上传整改照片',
  202. icon:"none",
  203. mask:true,
  204. duration: 2000
  205. });
  206. return
  207. }
  208. this.form.isZg = 0;
  209. }else if(this.formType == 1){
  210. //暂无法整改
  211. if(!this.form.zmClMs){
  212. uni.showToast({
  213. title: '请输入证明材料描述',
  214. icon:"none",
  215. mask:true,
  216. duration: 2000
  217. });
  218. return
  219. }
  220. if(!this.form.zmClImg[0]){
  221. uni.showToast({
  222. title: '请上传证明材料',
  223. icon:"none",
  224. mask:true,
  225. duration: 2000
  226. });
  227. return
  228. }
  229. this.form.isZg = 1;
  230. }
  231. this.newData.detailsList[this.formIndex] = JSON.parse(JSON.stringify(this.form));
  232. this.pageType = 1;
  233. this.$forceUpdate();
  234. },
  235. //取消当前整改操作
  236. outItmeClick(){
  237. this.pageType = 1;
  238. },
  239. //选择整改隐患与类型
  240. itemClick(item,index){
  241. let self = this;
  242. uni.showActionSheet({
  243. itemList: ['完成整改', '暂时无法整改'],
  244. success: function (res) {
  245. self.form = JSON.parse(JSON.stringify(item));
  246. if(!self.form.yhImg || self.form.yhImg == 'undefined' || self.form.yhImg == null || self.form.yhImg == 'null'){
  247. self.form.yhImg = [];
  248. }
  249. if(!self.form.yhZghImg || self.form.yhZghImg == 'undefined' || self.form.yhZghImg == null || self.form.yhZghImg == 'null'){
  250. self.form.yhZghImg = [];
  251. }
  252. if(!self.form.zmClImg || self.form.zmClImg == 'undefined' || self.form.zmClImg == null || self.form.zmClImg == 'null'){
  253. self.form.zmClImg = [];
  254. }
  255. self.formIndex = index;
  256. if(res.tapIndex == 0){
  257. // 完成整改
  258. self.formType = 0;
  259. }else if(res.tapIndex == 1){
  260. // 暂时无法整改
  261. self.formType = 1;
  262. }
  263. self.pageType=2;
  264. self.$forceUpdate();
  265. },
  266. fail: function (res) {
  267. console.log(res.errMsg);
  268. }
  269. });
  270. },
  271. //删除证明图片
  272. delZmImg(index){
  273. console.log("index",index)
  274. this.form.zmClImg.splice(index,1);
  275. },
  276. //证明上传
  277. proveImgUp(){
  278. let self = this;
  279. if(this.form.zmClImg.length>8){
  280. uni.showToast({
  281. title: '最多上传9张图片',
  282. icon:"none",
  283. mask:true,
  284. duration: 2000
  285. });
  286. return
  287. }
  288. wx.chooseImage({
  289. count: 1,
  290. sizeType: ["original", "compressed"],
  291. sourceType: ["album", "camera"],
  292. success: function(res) {
  293. let tempFilePaths = res.tempFilePaths[0];
  294. self.zmUploadImg(tempFilePaths);
  295. }
  296. });
  297. },
  298. async zmUploadImg(tempFilePaths){
  299. var self = this;
  300. uni.showLoading({
  301. title: '上传中',
  302. mask: true
  303. });
  304. uni.uploadFile({
  305. url: config.base_url+'/file/upload', //仅为示例,非真实的接口地址
  306. header:{'Authorization':uni.getStorageSync('token')},
  307. filePath: tempFilePaths,
  308. name: 'file',
  309. formData: {
  310. 'user': 'test'
  311. },
  312. success: (uploadFileRes) => {
  313. let res = JSON.parse(uploadFileRes.data);
  314. if(res.code == 200){
  315. self.form.zmClImg.push(res.data.url);
  316. }else{
  317. uni.showToast({
  318. title: res.msg,
  319. icon:"none",
  320. mask:true,
  321. duration: 2000
  322. });
  323. }
  324. },
  325. fail: err => {},
  326. complete: () => {
  327. uni.hideLoading()
  328. }
  329. });
  330. },
  331. //删除整改图片
  332. delZgImg(index){
  333. console.log("index",index)
  334. this.form.yhZghImg.splice(index,1);
  335. },
  336. // 整改上传
  337. selectImage() {
  338. let self = this;
  339. if(this.form.yhZghImg.length>8){
  340. uni.showToast({
  341. title: '最多上传9张图片',
  342. icon:"none",
  343. mask:true,
  344. duration: 2000
  345. });
  346. return
  347. }
  348. wx.chooseImage({
  349. count: 1,
  350. sizeType: ["original", "compressed"],
  351. sourceType: ["album", "camera"],
  352. success: function(res) {
  353. let tempFilePaths = res.tempFilePaths[0];
  354. self.zgUploadImg(tempFilePaths);
  355. }
  356. });
  357. },
  358. async zgUploadImg(tempFilePaths){
  359. var self = this;
  360. uni.showLoading({
  361. title: '上传中',
  362. mask: true
  363. });
  364. uni.uploadFile({
  365. url: config.base_url+'/file/upload', //仅为示例,非真实的接口地址
  366. header:{'Authorization':uni.getStorageSync('token')},
  367. filePath: tempFilePaths,
  368. name: 'file',
  369. formData: {
  370. 'user': 'test'
  371. },
  372. success: (uploadFileRes) => {
  373. let res = JSON.parse(uploadFileRes.data);
  374. if(res.code == 200){
  375. self.form.yhZghImg.push(res.data.url);
  376. }else{
  377. uni.showToast({
  378. title: res.msg,
  379. icon:"none",
  380. mask:true,
  381. duration: 2000
  382. });
  383. }
  384. },
  385. fail: err => {},
  386. complete: () => {
  387. uni.hideLoading()
  388. }
  389. });
  390. },
  391. //查看图片
  392. lockImg(url){
  393. wx.previewImage({
  394. urls: [url], //需要预览的图片http链接列表,多张的时候,url直接写在后面就行了
  395. current: '', // 当前显示图片的http链接,默认是第一个
  396. success: function(res) {},
  397. fail: function(res) {},
  398. complete: function(res) {},
  399. })
  400. },
  401. }
  402. }
  403. </script>
  404. <style lang="stylus" scoped>
  405. #rectifyInfo{
  406. height: 100%;
  407. width: 100%;
  408. display flex
  409. .list-page-box{
  410. flex:1;
  411. .for-max-box{
  412. background #fff
  413. margin:20rpx;
  414. border-radius:20rpx;
  415. position relative
  416. overflow hidden
  417. .for-position-index{
  418. position absolute
  419. top:0;
  420. left:0;
  421. background #B4DBFF;
  422. width:50rpx;
  423. height:50rpx;
  424. text-align center;
  425. line-height:50rpx;
  426. color:#0183FA;
  427. font-size:34rpx;
  428. }
  429. .for-name-box{
  430. display flex;
  431. margin:75rpx 26rpx 0;
  432. view:nth-child(1){
  433. font-size:30rpx;
  434. line-height:30rpx;
  435. flex:1;
  436. }
  437. view:nth-child(2){
  438. font-size:28rpx;
  439. color:#999;
  440. line-height:30rpx;
  441. }
  442. }
  443. .for-title-box{
  444. margin:40rpx 26rpx 0;
  445. font-size:28rpx;
  446. color:#666;
  447. line-height:40rpx;
  448. padding-bottom:40rpx;
  449. border-bottom:1rpx solid #e0e0e0;
  450. }
  451. .for-button{
  452. width:180rpx;
  453. height:60rpx;
  454. line-height:60rpx;
  455. color:#fff;
  456. margin:30rpx 30rpx 30rpx 500rpx;
  457. background:#0183FA ;
  458. border-radius:50rpx;
  459. text-align:center;
  460. font-size:28rpx;
  461. }
  462. }
  463. .list-button-box{
  464. width: 700rpx;
  465. height: 100rpx;
  466. color:#fff;
  467. background: #0183FA;
  468. border-radius: 20rpx;
  469. text-align center
  470. line-height:100rpx;
  471. margin:30rpx auto;
  472. }
  473. }
  474. .info-page-box{
  475. flex:1;
  476. .info-data-box{
  477. background #fff
  478. border-radius:20rpx;
  479. margin:20rpx;
  480. overflow hidden
  481. .info-name{
  482. color:#333;
  483. margin:36rpx 28rpx;
  484. }
  485. .info-title{
  486. margin:0 28rpx;
  487. color:#666;
  488. line-height:40rpx;
  489. font-size:28rpx;
  490. padding-bottom:40rpx;
  491. border-bottom:1rpx solid #e0e0e0;
  492. }
  493. .info-text-box{
  494. display:flex;
  495. margin:37rpx 28rpx;
  496. view:nth-child(1){
  497. width:140rpx;
  498. font-size:28rpx;
  499. color:#999;
  500. }
  501. view:nth-child(2){
  502. flex:1;
  503. font-size:28rpx;
  504. color:#666;
  505. }
  506. }
  507. .info-img-box{
  508. .info-text{
  509. font-size:28rpx;
  510. color:#999;
  511. margin:40rpx 28rpx 35rpx;
  512. }
  513. .img-max-box{
  514. margin-left:27rpx;
  515. img{
  516. display:inline-block;
  517. margin-bottom:20rpx;
  518. }
  519. .imgOne{
  520. width:400rpx;
  521. height:400rpx;
  522. }
  523. .imgTwo{
  524. width:320rpx;
  525. height:320rpx;
  526. margin:0 20rpx 16rpx 0;
  527. }
  528. .imgTree{
  529. width:210rpx;
  530. height:210rpx;
  531. margin:0 18rpx 12rpx 0;
  532. }
  533. }
  534. }
  535. }
  536. .text-input-max-box{
  537. background #fff
  538. border-radius:20rpx;
  539. margin:20rpx;
  540. overflow hidden
  541. padding-bottom:32rpx;
  542. .input-box{
  543. display flex
  544. margin:32rpx 25rpx 0;
  545. .text-p{
  546. font-size:30rpx;
  547. line-height:74rpx;
  548. }
  549. .bj-p{
  550. font-size:30rpx;
  551. line-height:74rpx;
  552. color:#FF0000;
  553. width:30rpx;
  554. }
  555. .textarea-p{
  556. width:470rpx;
  557. height:212rpx;
  558. padding:20rpx;
  559. font-size:28rpx;
  560. border:1rpx solid #dedede;
  561. border-radius:20rpx;
  562. }
  563. }
  564. .img-up-box{
  565. display flex
  566. margin:32rpx 25rpx 0;
  567. .text-p{
  568. font-size:30rpx;
  569. line-height:74rpx;
  570. }
  571. .bj-p{
  572. font-size:30rpx;
  573. line-height:74rpx;
  574. color:#FF0000;
  575. width:30rpx;
  576. }
  577. .img-box{
  578. flex:1;
  579. .up-img{
  580. display: inline-block;
  581. background url(@/images/icon_07.png) no-repeat
  582. background-size 100%
  583. width:160rpx;
  584. height:160rpx;
  585. overflow: hidden;
  586. margin:0 10rpx 10rpx 0;
  587. view{
  588. font-size:28rpx;
  589. text-align center;
  590. color:#999;
  591. line-height:30rpx;
  592. margin-top:100rpx;
  593. }
  594. }
  595. .min-for-img-box{
  596. position relative
  597. display: inline-block;
  598. width:160rpx;
  599. height:160rpx;
  600. margin:0 10rpx 10rpx 0;
  601. overflow hidden;
  602. .min-for-img{
  603. width:160rpx;
  604. height:160rpx;
  605. }
  606. .del-img{
  607. position absolute;
  608. top:10rpx;
  609. right:10rpx;
  610. width:40rpx;
  611. height:40rpx;
  612. }
  613. }
  614. }
  615. }
  616. }
  617. .text-info-max-box{
  618. background #fff
  619. border-radius:20rpx;
  620. margin:20rpx;
  621. overflow hidden
  622. padding:36rpx 40rpx;
  623. .text-info-name{
  624. font-size:30rpx;
  625. color:#333;
  626. }
  627. .text-info-textarea-p{
  628. width:602rpx;
  629. height:187rpx;
  630. border:1rpx solid #E0E0E0;
  631. padding:20rpx;
  632. margin:30rpx auto;
  633. border-radius:20rpx;
  634. font-size:28rpx;
  635. }
  636. .text-info-for-up-img-box{
  637. position relative
  638. width:640rpx;
  639. height:250rpx;
  640. margin:0 auto 30rpx;
  641. border-radius:20rpx;
  642. overflow:hidden;
  643. .text-info-for-up-img{
  644. width:640rpx;
  645. height:250rpx;
  646. }
  647. .del-img{
  648. width:40rpx;
  649. height:40rpx;
  650. position absolute
  651. top:20rpx;
  652. right:20rpx;
  653. }
  654. }
  655. .text-info-up-img-box{
  656. width:640rpx;
  657. height:250rpx;
  658. margin:0 auto 30rpx;
  659. border:4rpx dashed #E0E0E0;
  660. background #F8F8F8
  661. border-radius:20rpx;
  662. view{
  663. text-align center
  664. }
  665. view:nth-child(1){
  666. margin-top:90rpx;
  667. color: #E0E0E0;
  668. font-size:70rpx;
  669. line-height: 30rpx;
  670. }
  671. view:nth-child(2){
  672. margin-top:27rpx;
  673. font-size:28rpx;
  674. color:#999;
  675. line-height: 30rpx;
  676. }
  677. }
  678. }
  679. .check-button-box{
  680. display flex
  681. width:650rpx;
  682. margin:40rpx auto 40rpx;
  683. view{
  684. text-align center
  685. line-height:100rpx;
  686. font-size:30rpx;
  687. color:#fff;
  688. }
  689. view:nth-child(1){
  690. width:325rpx;
  691. line-height:100rpx;
  692. background: linear-gradient(-45deg, #999, #999);
  693. border-bottom-left-radius 50rpx
  694. border-top-left-radius 50rpx
  695. }
  696. view:nth-child(2){
  697. width:325rpx;
  698. line-height:100rpx;
  699. background: linear-gradient(-35deg, #309CFF, #0183FA);
  700. border-bottom-right-radius 50rpx
  701. border-top-right-radius 50rpx
  702. }
  703. }
  704. }
  705. }
  706. </style>