indoor.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  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. }
  1015. getRoomProjectId(param).then(res => {
  1016. if (res.code == '200') {
  1017. if (res.data != null) {
  1018. getRoomProjectList(res.data.id, this.objValue.enginClassValue).then(res => {
  1019. this.historyList = res.data
  1020. if (res.data.zEngineeringNodeBo != null) {
  1021. this.showHistoryList();
  1022. } else {
  1023. this.$modal.msg("暂无历史信息")
  1024. }
  1025. })
  1026. } else {
  1027. this.$modal.msg("暂无工程信息")
  1028. }
  1029. } else {
  1030. this.$modal.msg(res.msg)
  1031. }
  1032. })
  1033. }
  1034. },
  1035. showHistoryList() {
  1036. this.$refs.refShare.handleShowShare();
  1037. }
  1038. }
  1039. }
  1040. </script>
  1041. <style>
  1042. .container {
  1043. display: flex;
  1044. margin-left: 10px;
  1045. margin-top: 10px;
  1046. margin-right: 10px;
  1047. align-items: flex-start;
  1048. justify-content: space-between;
  1049. }
  1050. .text {
  1051. font-size: 16px;
  1052. color: #333;
  1053. }
  1054. .background {
  1055. border: 15px solid hsla(0, 0%, 100%, .5);
  1056. background: white;
  1057. background-clip: padding-box;
  1058. /*从padding开始往外面裁剪背景*/
  1059. }
  1060. .btn {
  1061. margin-top: 40px;
  1062. margin-right: 20px;
  1063. margin-bottom: 120px;
  1064. margin-left: 20px;
  1065. height: 45px;
  1066. }
  1067. .number {
  1068. display: flex;
  1069. /* 水平居中显示子元素 */
  1070. align-items: flex-start;
  1071. /* 垂直居中显示子元素 */
  1072. justify-content: space-between;
  1073. /* 左右间距等于间距大小 */
  1074. padding: 10px;
  1075. /* 设置padding以提高视觉效果 */
  1076. }
  1077. </style>