tearOldPipe.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. <template>
  2. <view>
  3. <view class="background">
  4. <view class="uni-list">
  5. <view class="container">
  6. <view>
  7. 工程周期
  8. </view>
  9. <view v-if="this.isEmpty(this.projectValue.dictValue)" style="margin-top: 10;"
  10. @click="pickerShow('gczq')">
  11. <span style="color: darkgray;">请选择工程周期</span>
  12. </view>
  13. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gczq')">
  14. <span style="color: black;">{{projectValue.dictLabel}}</span>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="uni-list">
  19. <view class="container">
  20. <view>
  21. 行政区
  22. </view>
  23. <view v-if="this.isEmpty(this.XZQValue.dictValue)" style="margin-top: 10;"
  24. @click="pickerShow('xzq')">
  25. <span style="color: darkgray;">请选择行政区</span>
  26. </view>
  27. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xzq')">
  28. <span style="color: black;">{{XZQValue.dictLabel}}</span>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="uni-list">
  33. <view class="container">
  34. <view>
  35. 小区
  36. </view>
  37. <view v-if="this.isEmpty(this.XQValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  38. @click="pickerShow('xq')">
  39. <span style="color: darkgray;">请选择小区</span>
  40. </view>
  41. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xq')">
  42. <span style="color: black;">{{XQValue.name}}</span>
  43. </view>
  44. </view>
  45. </view>
  46. <view class="uni-list">
  47. <view class="container">
  48. <view class="uni-list-cell-left">
  49. 楼栋
  50. </view>
  51. <view v-if="this.isEmpty(this.LDValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  52. @click="pickerShow('ld')">
  53. <span style="color: darkgray;">请选择楼栋</span>
  54. </view>
  55. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('ld')">
  56. <span style="color: black;">{{LDValue.name}}</span>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="uni-list" style="margin-top: 10;">
  61. <view class="container">
  62. <view class="uni-list-cell-left">
  63. 单元
  64. </view>
  65. <view v-if="this.isEmpty(this.DYValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  66. @click="pickerShow('dy')">
  67. <span style="color: darkgray;">请选择单元</span>
  68. </view>
  69. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('dy')">
  70. <span style="color: black;">{{DYValue.name}}</span>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="uni-list">
  75. <view class="container">
  76. <view class="uni-list-cell-left">
  77. 房间
  78. </view>
  79. <view v-if="this.isEmpty(this.FJValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  80. @click="pickerShow('fj')">
  81. <span style="color: darkgray;">请选择房间</span>
  82. </view>
  83. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('fj')">
  84. <span style="color: black;">{{FJValue.name}}</span>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="container">
  89. <view class="title">是否按照施工图纸施工</view>
  90. <span style="color: black;">{{this.form}}</span>
  91. <switch style="transform: scale(0.6,0.6);" @change="switchChange" checked="isChick" />
  92. </view>
  93. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  94. subtitleKey="id" v-model="name"></SelectPicker>
  95. <SelectPicker :list="dictOptions" @change="changeSelectDict" v-if="openDict" @close="closeDict"
  96. titleKey="dictLabel" subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
  97. </view>
  98. <!--拆旧管-->
  99. <view class="background">
  100. <view v-if="objValue.enginClassValue=='dismantling_old_pipe'">
  101. <view class="uni-list">
  102. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  103. 拆旧管
  104. <span
  105. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
  106. </view>
  107. <view class="container" style="margin-bottom: 20PX;">
  108. <view>
  109. 腐蚀等级
  110. </view>
  111. <view v-if="this.isEmpty(this.LevelValue.dictValue)" style="margin-top: 10;"
  112. @click="pickerShow('fsdj')">
  113. <span style="color: darkgray;">请选择腐蚀等级</span>
  114. </view>
  115. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('fsdj')">
  116. <span style="color: black;">{{LevelValue.dictLabel}}</span>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!--立杠-->
  122. <view v-else-if="objValue.enginClassValue=='vertical_bar'">
  123. <view class="uni-list" style="margin-bottom: 20px;">
  124. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  125. 立杠
  126. <span
  127. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
  128. </view>
  129. <view class="container">
  130. <view>
  131. 材 质
  132. </view>
  133. <view v-if="this.isEmpty(this.materialValue.id)" style="margin-top: 10;"
  134. @click="pickerShow('cz')">
  135. <span style="color: darkgray;">请选择材质</span>
  136. </view>
  137. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('cz')">
  138. <span style="color: black;">{{materialValue.name}}</span>
  139. </view>
  140. </view>
  141. <view class="container">
  142. <view>
  143. 规 格
  144. </view>
  145. <view v-if="this.isEmpty(this.specificationValue.id)" style="margin-top: 10;"
  146. @click="pickerShow('gg')">
  147. <span style="color: darkgray;">请选择规格</span>
  148. </view>
  149. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gg')">
  150. <span style="color: black;">{{specificationValue.name}}</span>
  151. </view>
  152. </view>
  153. <view class="container">
  154. <text>数 量</text>
  155. <input class="uni-input" type="number" v-model="inputNumberValue" placeholder="请填写数量"
  156. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  157. </view>
  158. </view>
  159. </view>
  160. <!--挂表-->
  161. <view v-else-if="objValue.enginClassValue=='pocket_watch'">
  162. <view class="uni-list" style="margin-bottom: 20px;">
  163. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  164. 挂表
  165. <span
  166. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
  167. </view>
  168. <view class="container">
  169. <view>
  170. 品 牌
  171. </view>
  172. <view v-if="this.isEmpty(this.brandValue.dictValue)" style="margin-top: 10;"
  173. @click="pickerShow('brand')">
  174. <span style="color: darkgray;">请选择品牌</span>
  175. </view>
  176. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('brand')">
  177. <span style="color: black;">{{brandValue.dictLabel}}</span>
  178. </view>
  179. </view>
  180. <view class="container">
  181. <text>数 量</text>
  182. <input class="uni-input" type="number" v-model="inputNumberValue" placeholder="请填写数量"
  183. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  184. </view>
  185. </view>
  186. </view>
  187. <!--表后管-->
  188. <view v-else-if="objValue.enginClassValue=='posterior_tube'">
  189. <view class="uni-list" style="margin-bottom: 20px;">
  190. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  191. 表后管
  192. <span
  193. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
  194. </view>
  195. <view class="container">
  196. <view>
  197. 材 质
  198. </view>
  199. <view v-if="this.isEmpty(this.materialValue.id)" style="margin-top: 10;"
  200. @click="pickerShow('cz')">
  201. <span style="color: darkgray;">请选择材质</span>
  202. </view>
  203. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('cz')">
  204. <span style="color: black;">{{materialValue.name}}</span>
  205. </view>
  206. </view>
  207. <view class="container">
  208. <view>
  209. 规 格
  210. </view>
  211. <view v-if="this.isEmpty(this.specificationValue.id)" style="margin-top: 10;"
  212. @click="pickerShow('gg')">
  213. <span style="color: darkgray;">请选择规格</span>
  214. </view>
  215. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gg')">
  216. <span style="color: black;">{{specificationValue.name}}</span>
  217. </view>
  218. </view>
  219. <view class="container">
  220. <text>数 量</text>
  221. <input class="uni-input" type="number" v-model="inputNumberValue" placeholder="请填写数量"
  222. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  223. </view>
  224. </view>
  225. </view>
  226. <!--阀管-->
  227. <view v-else-if="objValue.enginClassValue=='valve_tube'">
  228. <view class="uni-list" style="margin-bottom: 20px;">
  229. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  230. 阀管
  231. <span
  232. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;">历史</span>
  233. </view>
  234. <view class="container">
  235. <view>
  236. 上门类型
  237. </view>
  238. <view v-if="this.isEmpty(this.doorValue.dictValue)" style="margin-top: 10;"
  239. @click="pickerShow('door')">
  240. <span style="color: darkgray;">请选择上门类型</span>
  241. </view>
  242. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('door')">
  243. <span style="color: black;">{{doorValue.dictLabel}}</span>
  244. </view>
  245. </view>
  246. <view class="container">
  247. <view>
  248. 自闭阀类型
  249. </view>
  250. <view v-if="this.isEmpty(this.SelfClosValve.dictValue)" style="margin-top: 10;"
  251. @click="pickerShow('zbf')">
  252. <span style="color: darkgray;">请选择自闭阀类型</span>
  253. </view>
  254. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('zbf')">
  255. <span style="color: black;">{{SelfClosValve.dictLabel}}</span>
  256. </view>
  257. </view>
  258. <view class="container">
  259. <view>
  260. 材 质
  261. </view>
  262. <view v-if="this.isEmpty(this.materialValue.id)" style="margin-top: 10;"
  263. @click="pickerShow('cz')">
  264. <span style="color: darkgray;">请选择材质</span>
  265. </view>
  266. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('cz')">
  267. <span style="color: black;">{{materialValue.name}}</span>
  268. </view>
  269. </view>
  270. <view class="container">
  271. <view>
  272. 规 格
  273. </view>
  274. <view v-if="this.isEmpty(this.specificationValue.id)" style="margin-top: 10;"
  275. @click="pickerShow('gg')">
  276. <span style="color: darkgray;">请选择规格</span>
  277. </view>
  278. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gg')">
  279. <span style="color: black;">{{specificationValue.name}}</span>
  280. </view>
  281. </view>
  282. <view class="container">
  283. <text>数 量</text>
  284. <input class="uni-input" type="number" v-model="inputNumberValue" placeholder="请填写数量"
  285. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  286. </view>
  287. </view>
  288. </view>
  289. <view class="align-items" style="margin-top: 20px;margin-bottom: 20px;">
  290. <view class="container" style="color: gainsboro;">*请上传照片</view>
  291. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  292. <image src="/static/images/chooseimg.png" mode=""
  293. style="width: 100rpx; height: 100rpx; margin: 0 12rpx;; " @click="choose()"></image>
  294. <view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
  295. <view
  296. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ">
  297. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  298. @click="showPhoto(index)">
  299. </image>
  300. </view>
  301. <view v-else>
  302. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  303. </view>
  304. <view @click="remove(index)"
  305. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  306. <uni-icons type="close" color="darkgray" size="18"></uni-icons>
  307. </view>
  308. </view>
  309. </view>
  310. </view>
  311. </view>
  312. <view class="action-btn">
  313. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
  314. </view>
  315. </view>
  316. </template>
  317. <script>
  318. import SelectPicker from '../../../components/selectPicker/select_picker.vue'
  319. import uniIcons from '../../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
  320. import {
  321. getDicts
  322. } from "@/api/system/dict/data";
  323. import {
  324. getAreaList,
  325. getBuildingList,
  326. getUnitList,
  327. getHousesList,
  328. addTearOldPipe,
  329. getEnginMaterialQualityList,
  330. getEnginSpecificationsList,
  331. } from '@/api/common'
  332. import {
  333. getToken
  334. } from '../../../utils/auth';
  335. export default {
  336. components: {
  337. SelectPicker,
  338. uniIcons
  339. },
  340. data() {
  341. return {
  342. headers: {
  343. Authorization: "Bearer " + getToken()
  344. },
  345. type: '',
  346. open: false,
  347. objValue: '', //上一页面传过来的值 新增接口用
  348. openDict: false,
  349. selectList: [],
  350. dictOptions: [],
  351. imgArr: [],
  352. XQValue: {},
  353. XZQValue: {},
  354. projectValue: {},
  355. LevelValue: {},
  356. LDValue: {},
  357. DYValue: {},
  358. FJValue: {},
  359. FSValue: {},
  360. specificationValue: {}, //规格
  361. materialValue: {}, //材质
  362. brandValue: {}, //品牌
  363. doorValue: {}, //上门类型
  364. SelfClosValve: {}, //自闭阀类型
  365. materialList: '', //材质list
  366. XQList: '',
  367. LDList: '',
  368. DYList: '',
  369. FJList: '',
  370. progress: 0, //上传图片进度百分比
  371. loading: false,
  372. isCheck: true, //是否按照施工图纸施工
  373. inputNumberValue: '',
  374. title: '',
  375. }
  376. },
  377. created() {
  378. },
  379. onLoad(options) {
  380. if ('params' in options) {
  381. this.objValue = JSON.parse(decodeURIComponent(options.params));
  382. if (this.objValue.enginType == `old_renovation` && this.objValue.enginClassification == 'indoor_engin') {
  383. this.title = '旧改工程-室内'
  384. } else {
  385. this.title = '新建工程-室内'
  386. }
  387. uni.setNavigationBarTitle({
  388. title: this.title
  389. })
  390. }
  391. },
  392. methods: {
  393. //判断是否选择
  394. isEmpty(str) {
  395. return (!str || 0 === str.length);
  396. },
  397. showPhoto(index) {
  398. uni.previewImage({
  399. current: index,
  400. urls: this.imgArr,
  401. })
  402. },
  403. remove(index) {
  404. uni.showModal({
  405. title: '提示',
  406. content: '是否删除该图片或视频?',
  407. success: (res) => {
  408. if (res.confirm) {
  409. this.imgArr.splice(index, 1)
  410. console.log('this.imgarr', this.imgArr)
  411. if (this.imgArr.length <= 0) {
  412. this.photo = true;
  413. }
  414. }
  415. }
  416. })
  417. },
  418. choose() {
  419. let _this = this;
  420. uni.showActionSheet({
  421. title: '上传',
  422. itemList: ['图片', '视频'],
  423. success: (res) => {
  424. console.log(res)
  425. if (res.tapIndex == 0) {
  426. this.chooseimage()
  427. } else {
  428. this.choosevideo()
  429. }
  430. }
  431. })
  432. },
  433. chooseimage() {
  434. let _this = this;
  435. console.log('图片', _this.headers)
  436. uni.chooseImage({
  437. sizeType: ['album', 'camera'],
  438. success(resp) {
  439. resp.tempFiles.forEach((item, index) => {
  440. const task = uni.uploadFile({
  441. url: _this.$HTTP + `/obs`,
  442. filePath: item.path,
  443. name: 'file',
  444. formData: {},
  445. header: _this.headers,
  446. success: res => {
  447. // 判断是否json字符串,将其转为json格式
  448. console.log("结果", res)
  449. // let data = _this.$u.test.jsonString(res
  450. // .data) ? JSON.parse(res.data) : res.data;
  451. let data = JSON.parse(res.data);
  452. if (![200].includes(data.code)) {
  453. // this.uploadError(index, data);
  454. _this.$modal.msg(data.msg)
  455. } else {
  456. if (_this.progress === 100) {
  457. console.log('_this.progress', _this.progress)
  458. //console.log('data----', data)data
  459. console.log('res--', res)
  460. _this.imgArr.push(data.data.url)
  461. console.log('imgArr', _this.imgArr)
  462. _this.$modal.msg('上传成功!')
  463. _this.photo = false;
  464. }
  465. }
  466. },
  467. fail: e => {
  468. console.log(e)
  469. _this.$modal.msg('上传失败!')
  470. //_this.uploadError(index, e);
  471. },
  472. complete: res => {
  473. uni.hideLoading();
  474. _this.uploading = false;
  475. }
  476. });
  477. task.onProgressUpdate(res => {
  478. _this.progress = res.progress;
  479. console.log('onProgressUpdate', res)
  480. console.log('task.onProgressUpdate', _this.progress)
  481. uni.showLoading({
  482. title: '上传中'
  483. })
  484. if (_this.progress != 100) {
  485. _this.loading = false
  486. console.log('_this.loading false', _this.loading)
  487. } else {
  488. _this.loading = true
  489. console.log('_this.loading true', _this.loading)
  490. }
  491. });
  492. })
  493. },
  494. })
  495. },
  496. choosevideo() {
  497. let _this = this;
  498. console.log('视频')
  499. uni.chooseVideo({
  500. sourceType: ['album', 'camera'],
  501. maxDuration: 30,
  502. success(resp) {
  503. const task = uni.uploadFile({
  504. url: _this.$HTTP + `/obs`,
  505. filePath: resp.tempFilePath,
  506. name: 'file',
  507. formData: {},
  508. header: _this.headers,
  509. success: res => {
  510. // 判断是否json字符串,将其转为json格式
  511. let data = JSON.parse(res.data);
  512. if (![200].includes(res.statusCode)) {
  513. this.uploadError(index, data);
  514. } else {
  515. //上传成功
  516. if (_this.progress === 100) {
  517. console.log('_this.progress', _this.progress)
  518. _this.imgArr.push(data.data.url)
  519. console.log('imgArr', _this.imgArr)
  520. _this.$modal.msg('上传成功!')
  521. _this.photo = false;
  522. }
  523. }
  524. },
  525. fail: e => {
  526. _this.$modal.msg('上传失败!')
  527. this.uploadError(index, e);
  528. },
  529. complete: res => {
  530. uni.hideLoading();
  531. _this.uploading = false;
  532. }
  533. });
  534. task.onProgressUpdate(res => {
  535. _this.progress = res.progress;
  536. console.log('onProgressUpdate', res)
  537. uni.showLoading({
  538. title: '上传中'
  539. })
  540. if (_this.progress != 100) {
  541. _this.loading = false
  542. console.log('_this.loading false', _this.loading)
  543. } else {
  544. _this.loading = true
  545. console.log('_this.loading true', _this.loading)
  546. }
  547. });
  548. },
  549. })
  550. },
  551. pickerShow(e) {
  552. this.type = e; //赋值类型
  553. if (e == 'door') { //上门类型
  554. this.openDict = true;
  555. getDicts("visit_type").then(response => {
  556. this.dictOptions = response.data;
  557. });
  558. } else if (e == 'zbf') { //自闭阀类型
  559. this.openDict = true;
  560. getDicts("self_closing_valve_type").then(response => {
  561. this.dictOptions = response.data;
  562. });
  563. } else if (e == 'brand') { //品牌
  564. this.openDict = true;
  565. getDicts("brand").then(response => {
  566. this.dictOptions = response.data;
  567. });
  568. } else if (e == 'cz') { //材质
  569. this.open = true;
  570. getEnginMaterialQualityList("0").then(response => {
  571. this.selectList = response.data;
  572. });
  573. } else if (e == 'gg') { //规格
  574. if (this.isEmpty(this.materialValue.id)) {
  575. this.$modal.msg('请选择材质')
  576. } else {
  577. this.open = true;
  578. this.selectList = this.materialList;
  579. }
  580. } else if (e == 'fsdj') {
  581. //腐蚀等级
  582. this.openDict = true;
  583. //腐蚀等级
  584. getDicts("corrosion_level").then(response => {
  585. this.dictOptions = response.data;
  586. });
  587. } else if (e == 'gczq') { //工程周期
  588. this.openDict = true;
  589. getDicts("engin_cycle").then(response => {
  590. this.dictOptions = response.data;
  591. });
  592. } else if (e == 'xzq') { //行政区
  593. if (this.isEmpty(this.projectValue.dictValue)) {
  594. this.$modal.msg('请选择工程周期')
  595. } else {
  596. this.openDict = true;
  597. getDicts("district").then(response => {
  598. this.dictOptions = response.data;
  599. });
  600. }
  601. //this.selectList = this.dictOptions;
  602. } else if (e == 'xq') { //小区
  603. if (this.isEmpty(this.XZQValue.dictValue)) {
  604. this.$modal.msg('请选择行政区')
  605. } else {
  606. this.open = true;
  607. this.selectList = this.XQList;
  608. }
  609. } else if (e == 'ld') { //楼栋
  610. if (this.isEmpty(this.XQValue.id)) {
  611. this.$modal.msg('请选择小区')
  612. } else {
  613. this.open = true;
  614. this.selectList = this.LDList;
  615. }
  616. } else if (e == 'dy') { //单元
  617. if (this.isEmpty(this.LDValue.id)) {
  618. this.$modal.msg('请选择楼栋')
  619. } else {
  620. this.open = true;
  621. this.selectList = this.DYList;
  622. }
  623. } else if (e == 'fj') { //房间
  624. if (this.isEmpty(this.DYValue.id)) {
  625. this.$modal.msg('请选择单元')
  626. } else {
  627. this.open = true;
  628. this.selectList = this.FJList;
  629. }
  630. }
  631. },
  632. switchChange(e) {
  633. console.log('switch2 发生 change 事件,携带值为', e.detail.value)
  634. this.isCheck = e.detail.value;
  635. },
  636. changeSelectDict(item, index) {
  637. this.openDict = false;
  638. if (this.type == 'door') {
  639. this.doorValue = item
  640. } else if (this.type == 'zbf') {
  641. this.SelfClosValve = item
  642. } else if (this.type == 'brand') {
  643. this.brandValue = item
  644. } else if (this.type == 'gczq') {
  645. this.projectValue = item
  646. } else if (this.type == 'xzq') {
  647. this.XZQValue = item;
  648. //根据行政区id获取小区数据
  649. this.XQValue = ''; //重置小区数据
  650. this.LDValue = ''; //重置楼栋数据
  651. this.DYValue = ''; //重置单元数据
  652. this.FJValue = ''; //重置房间数据
  653. getAreaList(item.dictValue).then(res => {
  654. this.XQList = res.data;
  655. })
  656. } else {
  657. this.LevelValue = item;
  658. }
  659. },
  660. changeSelect(item, index) {
  661. // this.index = index;
  662. // this.address = item.communityName;
  663. this.open = false;
  664. if (this.type == 'cz') {
  665. this.materialValue = item;
  666. this.specificationValue = ''; //重置规格
  667. //根据材质ID 获取规格数据
  668. console.log('材质id', item.id)
  669. getEnginSpecificationsList(item.id).then(res => {
  670. console.log("规格数据", res.data)
  671. this.materialList = res.data
  672. })
  673. } else if (this.type == 'gg') {
  674. this.specificationValue = item;
  675. } else if (this.type == 'xq') {
  676. this.XQValue = item;
  677. //根据小区id 获取楼栋数据
  678. this.LDValue = ''; //重置楼栋数据
  679. this.DYValue = ''; //重置单元数据
  680. this.FJValue = ''; //重置房间数据
  681. getBuildingList(item.id).then(res => {
  682. this.LDList = res.data
  683. // console.log("楼栋=", res)
  684. })
  685. } else if (this.type == 'ld') {
  686. this.LDValue = item;
  687. //根据楼栋ID 获取单元数据
  688. this.DYValue = ''; //重置单元数据
  689. this.FJValue = ''; //重置房间数据
  690. getUnitList(item.id).then(res => {
  691. this.DYList = res.data
  692. // console.log("单元=", res)
  693. })
  694. } else if (this.type == 'dy') {
  695. this.DYValue = item;
  696. //根据单元数据 获取房间数据
  697. this.FJValue = ''; //重置房间数据
  698. getHousesList(item.id).then(res => {
  699. this.FJList = res.data
  700. // console.log("房间=", res)
  701. })
  702. } else if (this.type == 'fj') {
  703. this.FJValue = item;
  704. }
  705. },
  706. //关闭弹窗
  707. close(e) {
  708. this.open = false
  709. },
  710. //关闭弹窗
  711. closeDict(e) {
  712. this.openDict = false
  713. },
  714. //提交数据
  715. submit() {
  716. if (this.isEmpty(this.projectValue.dictValue)) {
  717. this.$modal.msg("请选择工程周期")
  718. } else if (this.isEmpty(this.XZQValue.dictValue)) {
  719. this.$modal.msg("请选择行政区")
  720. } else if (this.isEmpty(this.XQValue.id)) {
  721. this.$modal.msg("请选择小区")
  722. } else if (this.isEmpty(this.LDValue.id)) {
  723. this.$modal.msg("请选择楼栋")
  724. } else if (this.isEmpty(this.DYValue.id)) {
  725. this.$modal.msg("请选择单元")
  726. } else if (this.isEmpty(this.FJValue.id)) {
  727. this.$modal.msg("请选择房间")
  728. } else if (this.objValue.enginClassValue == 'dismantling_old_pipe') {
  729. if (this.isEmpty(this.LevelValue.dictValue)) {
  730. this.$modal.msg("请选择腐蚀等级") //拆旧管 判断腐蚀等级
  731. } else {
  732. this.onsubmit();
  733. }
  734. } else if (this.objValue.enginClassValue == 'vertical_bar') {
  735. //立杠 判断 材质 规格 数量
  736. if (this.isEmpty(this.materialValue.id)) {
  737. this.$modal.msg("请选择材质")
  738. } else if (this.isEmpty(this.specificationValue.id)) {
  739. this.$modal.msg("请选择规格")
  740. } else if (this.isEmpty(this.inputNumberValue)) {
  741. this.$modal.msg("请输入数量")
  742. } else {
  743. this.onsubmit();
  744. }
  745. } else if (this.objValue.enginClassValue == 'pocket_watch') {
  746. //挂表 判断 品牌 数量
  747. if (this.isEmpty(this.brandValue.dictValue)) {
  748. this.$modal.msg("请选择品牌")
  749. } else if (this.isEmpty(this.inputNumberValue)) {
  750. this.$modal.msg("请输入数量")
  751. } else {
  752. this.onsubmit();
  753. }
  754. } else if (this.objValue.enginClassValue == 'posterior_tube') {
  755. //表后管 判断 材质 规格 数量 (为必须有一张照片和一个视频)
  756. if (this.isEmpty(this.materialValue.id)) {
  757. this.$modal.msg("请选择材质")
  758. } else if (this.isEmpty(this.specificationValue.id)) {
  759. this.$modal.msg("请选择规格")
  760. } else if (this.isEmpty(this.inputNumberValue)) {
  761. this.$modal.msg("请输入数量")
  762. } else if (this.imgArr.length <= 0) {
  763. this.$modal.msg('请上传照片或视频')
  764. } else if (this.loading == false) {
  765. this.$modal.msg('照片或视频未上传完毕,无法提交!')
  766. } else {
  767. const hasImage = this.imgArr.some(item => item.endsWith('.jpg') || item.endsWith('.png') || item
  768. .endsWith('.jpeg'));
  769. const hasVideo = this.imgArr.some(item => item.endsWith('.mp4') || item.endsWith('.avi') || item
  770. .endsWith('.mov'));
  771. if (hasImage && hasVideo) {
  772. //表后管 特殊 提交
  773. let param = {
  774. district: this.XZQValue.dictValue,
  775. areaId: this.XQValue.id,
  776. buildingId: this.LDValue.id,
  777. unitId: this.DYValue.id,
  778. houseId: this.FJValue.id,
  779. enginType: this.objValue.enginType, //写死 上一页面传过来的
  780. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  781. enginCycle: this.projectValue.dictValue, //工程周期
  782. zEngineeringNodeBo: {
  783. type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
  784. zEngineeringInfoBo: {
  785. constructAccordingDrawings: this.isCheck, //是否按图纸施工
  786. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  787. zEngineeringMaterialBo: [{
  788. materialQuality: this.materialValue.dictValue, //材质
  789. specifications: this.specificationValue.id, //规格
  790. number: this.inputNumberValue //数量
  791. }]
  792. }
  793. }
  794. }
  795. addTearOldPipe(param).then(res => {
  796. if (res.code == '200') {
  797. uni.showToast({
  798. title: res.msg,
  799. icon: 'none',
  800. //显示持续时间为 1秒
  801. duration: 1000
  802. });
  803. uni.navigateBack();
  804. }
  805. })
  806. } else {
  807. this.$modal.msg('请至少上传一张照片和一个视频')
  808. }
  809. }
  810. } else if (this.objValue.enginClassValue == 'valve_tube') {
  811. //阀管 判断 材质 规格 数量
  812. if (this.isEmpty(this.doorValue.dictValue)) {
  813. this.$modal.msg("请选择上门类型")
  814. } else if (this.isEmpty(this.SelfClosValve.dictValue)) {
  815. this.$modal.msg("请选择自闭阀类型")
  816. } else if (this.isEmpty(this.materialValue.id)) {
  817. this.$modal.msg("请选择材质")
  818. } else if (this.isEmpty(this.specificationValue.id)) {
  819. this.$modal.msg("请选择规格")
  820. } else if (this.isEmpty(this.inputNumberValue)) {
  821. this.$modal.msg("请输入数量")
  822. } else {
  823. this.onsubmit();
  824. }
  825. }
  826. },
  827. onsubmit() {
  828. if (this.imgArr.length <= 0) {
  829. this.$modal.msg('请上传照片或视频')
  830. } else if (this.loading == false) {
  831. this.$modal.msg('照片或视频未上传完毕,无法提交!')
  832. } else {
  833. //提交
  834. let param = ';'
  835. if (this.objValue.enginClassValue == 'dismantling_old_pipe') { //拆旧管
  836. param = {
  837. district: this.XZQValue.dictValue,
  838. areaId: this.XQValue.id,
  839. buildingId: this.LDValue.id,
  840. unitId: this.DYValue.id,
  841. houseId: this.FJValue.id,
  842. enginType: this.objValue.enginType, //写死 上一页面传过来的
  843. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  844. enginCycle: this.projectValue.dictValue, //工程周期
  845. zEngineeringNodeBo: {
  846. type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
  847. zEngineeringInfoBo: {
  848. constructAccordingDrawings: this.isCheck, //是否按图纸施工
  849. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  850. zEngineeringMaterialBo: [{
  851. corrosionLevel: this.LevelValue.id //腐蚀等级
  852. }]
  853. }
  854. }
  855. }
  856. //this.onsubmit(param)
  857. } else if (this.objValue.enginClassValue == 'vertical_bar') { //立杠
  858. param = {
  859. district: this.XZQValue.dictValue,
  860. areaId: this.XQValue.id,
  861. buildingId: this.LDValue.id,
  862. unitId: this.DYValue.id,
  863. houseId: this.FJValue.id,
  864. enginType: this.objValue.enginType, //写死 上一页面传过来的
  865. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  866. enginCycle: this.projectValue.dictValue, //工程周期
  867. zEngineeringNodeBo: {
  868. type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
  869. zEngineeringInfoBo: {
  870. constructAccordingDrawings: this.isCheck, //是否按图纸施工
  871. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  872. zEngineeringMaterialBo: [{
  873. materialQuality: this.materialValue.dictValue, //材质
  874. specifications: this.specificationValue.id, //规格
  875. number: this.inputNumberValue //数量
  876. }]
  877. }
  878. }
  879. }
  880. } else if (this.objValue.enginClassValue == 'pocket_watch') { //挂表
  881. param = {
  882. district: this.XZQValue.dictValue,
  883. areaId: this.XQValue.id,
  884. buildingId: this.LDValue.id,
  885. unitId: this.DYValue.id,
  886. houseId: this.FJValue.id,
  887. enginType: this.objValue.enginType, //写死 上一页面传过来的
  888. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  889. enginCycle: this.projectValue.dictValue, //工程周期
  890. zEngineeringNodeBo: {
  891. type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
  892. zEngineeringInfoBo: {
  893. constructAccordingDrawings: this.isCheck, //是否按图纸施工
  894. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  895. zEngineeringMaterialBo: [{
  896. brand: this.brandValue.dictValue, //品牌
  897. number: this.inputNumberValue //数量
  898. }]
  899. }
  900. }
  901. }
  902. } else if (this.objValue.enginClassValue == 'valve_tube') { //自闭阀
  903. param = {
  904. district: this.XZQValue.dictValue,
  905. areaId: this.XQValue.id,
  906. buildingId: this.LDValue.id,
  907. unitId: this.DYValue.id,
  908. houseId: this.FJValue.id,
  909. enginType: this.objValue.enginType, //写死 上一页面传过来的
  910. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  911. enginCycle: this.projectValue.dictValue, //工程周期
  912. zEngineeringNodeBo: {
  913. type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
  914. zEngineeringInfoBo: {
  915. constructAccordingDrawings: this.isCheck, //是否按图纸施工
  916. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  917. zEngineeringMaterialBo: [{
  918. visitType: this.doorValue.dictValue, //上门类型
  919. selfClosingValveType: this.SelfClosValve.dictValue, //自闭阀类型
  920. materialQuality: this.materialValue.dictValue, //材质
  921. specifications: this.specificationValue.id, //规格
  922. number: this.inputNumberValue //数量
  923. }]
  924. }
  925. }
  926. }
  927. }
  928. addTearOldPipe(param).then(res => {
  929. if (res.code == '200') {
  930. uni.showToast({
  931. title: res.msg,
  932. icon: 'none',
  933. //显示持续时间为 1秒
  934. duration: 1000
  935. });
  936. uni.navigateBack();
  937. }
  938. })
  939. }
  940. }
  941. }
  942. }
  943. </script>
  944. <style>
  945. .container {
  946. display: flex;
  947. margin-left: 10px;
  948. margin-top: 10px;
  949. margin-right: 10px;
  950. align-items: flex-start;
  951. justify-content: space-between;
  952. }
  953. .text {
  954. font-size: 16px;
  955. color: #333;
  956. }
  957. .background {
  958. border: 15px solid hsla(0, 0%, 100%, .5);
  959. background: white;
  960. background-clip: padding-box;
  961. /*从padding开始往外面裁剪背景*/
  962. }
  963. .btn {
  964. margin-top: 40px;
  965. margin-right: 20px;
  966. margin-bottom: 120px;
  967. margin-left: 20px;
  968. height: 45px;
  969. }
  970. .number {
  971. display: flex;
  972. /* 水平居中显示子元素 */
  973. align-items: flex-start;
  974. /* 垂直居中显示子元素 */
  975. justify-content: space-between;
  976. /* 左右间距等于间距大小 */
  977. padding: 10px;
  978. /* 设置padding以提高视觉效果 */
  979. }
  980. </style>