indoor.vue 38 KB

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