piping_record.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  1. <template>
  2. <scroll-view>
  3. <view class="background">
  4. <!-- <view class="uni-list">
  5. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  6. <view>
  7. 工程周期
  8. </view>
  9. <view v-if="this.isEmpty(this.projectValue.dictValue)" @click="pickerShow('gczq')">
  10. <view>
  11. <span style="color: darkgray;">请选择工程周期
  12. </span>
  13. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  14. </view>
  15. </view>
  16. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gczq')">
  17. <span style="color: black;">{{projectValue.dictLabel}}
  18. </span>
  19. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  20. </view>
  21. </view>
  22. </view> -->
  23. <view class="uni-list">
  24. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  25. <view>
  26. 行政区
  27. </view>
  28. <view v-if="this.isEmpty(this.XZQValue.dictValue)" style="margin-top: 10;"
  29. @click="pickerShow('xzq')">
  30. <span style="color: darkgray;">请选择行政区</span>
  31. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  32. </view>
  33. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xzq')">
  34. <span style="color: black;">{{XZQValue.dictLabel}}</span>
  35. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="uni-list">
  40. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  41. <view>
  42. 小区
  43. </view>
  44. <view v-if="this.isEmpty(this.XQValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  45. @click="pickerShow('xq')">
  46. <span style="color: darkgray;">请选择小区</span>
  47. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  48. </view>
  49. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('xq')">
  50. <span style="color: black;">{{XQValue.name}}</span>
  51. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="uni-list">
  56. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  57. <view class="uni-list-cell-left">
  58. 楼栋
  59. </view>
  60. <view v-if="this.isEmpty(this.LDValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  61. @click="pickerShow('ld')">
  62. <span style="color: darkgray;">请选择楼栋</span>
  63. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  64. </view>
  65. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('ld')">
  66. <span style="color: black;">{{LDValue.name}}</span>
  67. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  68. </view>
  69. </view>
  70. </view>
  71. <view class="uni-list" style="margin-top: 10;">
  72. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  73. <view class="uni-list-cell-left">
  74. 单元
  75. </view>
  76. <view v-if="this.isEmpty(this.DYValue.id)" class="uni-list-cell-db" style="margin-top: 10;"
  77. @click="pickerShow('dy')">
  78. <span style="color: darkgray;">请选择单元</span>
  79. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  80. </view>
  81. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('dy')">
  82. <span style="color: black;">{{DYValue.name}}</span>
  83. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="background" style="margin-top: 20px;margin-bottom: 20px;">
  89. <view class="uni-list">
  90. <view
  91. style="font-size: 16px;margin-left: 10px;margin-top: 10px;display: flex; justify-content: space-between;margin-bottom: 10px;">
  92. {{name}}
  93. <span
  94. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 10px;"
  95. @click="history">历史</span>
  96. </view>
  97. </view>
  98. <!-- <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  99. <text>米 数</text>
  100. <input class="uni-input" type="number" v-model="inputIntegerNumberValue" maxlength="6"
  101. style="text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  102. <text style="font-weight:bold;margin-left: 10px;margin-right: 10px;">.</text>
  103. <input class="uni-input" type="number" v-model="inputDecimalNumberValue" maxlength="1"
  104. style="text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  105. </view> -->
  106. <view class="container" style="color: #b2b2b2;">*请上传照片</view>
  107. <view style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  108. <image :src="loadImgSrc('updateimg.png')" mode=""
  109. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="chooseimage()"
  110. v-show="reviewStatus!='1'"></image>
  111. <view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
  112. <view
  113. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'||item.substring(item.length-4)=='jpeg' ">
  114. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  115. @click="showPhoto(index)">
  116. </image>
  117. </view>
  118. <view v-else>
  119. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  120. </view>
  121. <view @click="remove(index)" style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  122. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  123. </image>
  124. </view>
  125. </view>
  126. </view>
  127. </view>
  128. <view class="action-btn" v-show="reviewStatus!='1'">
  129. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
  130. </view>
  131. <bottom-sheet ref="refShare" :data="historyList"></bottom-sheet>
  132. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  133. subtitleKey="id" v-model="name"></SelectPicker>
  134. <SelectPicker :list="dictOptions" @change="changeSelectDict" v-if="openDict" @close="closeDict"
  135. titleKey="dictLabel" subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
  136. </scroll-view>
  137. </template>
  138. <script>
  139. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  140. import bottomSheet from '../../components/bottomSheet/bottomSheet.vue'
  141. import {
  142. getDicts
  143. } from "@/api/system/dict/data";
  144. import {
  145. getAreaList,
  146. getBuildingList,
  147. getUnitList,
  148. getHousesList,
  149. addTearOldPipe,
  150. getEnginMaterialQualityList,
  151. getEnginSpecificationsList,
  152. getRoomProjectList,
  153. getRoomProjectId,
  154. } from '@/api/common'
  155. export default {
  156. components: {
  157. SelectPicker
  158. },
  159. data() {
  160. return {
  161. title: '',
  162. name: '管道施工记录',
  163. // headers: {
  164. // Authorization: "Bearer " + getToken()
  165. // },
  166. type: '',
  167. open: false,
  168. // reviewStatus: '', //是否可以点击
  169. // objValue: '', //上一页面传过来的值 新增接口用
  170. openDict: false,
  171. selectList: [],
  172. dictOptions: [],
  173. imgArr: [],
  174. XQValue: {},
  175. XZQValue: {},
  176. projectValue: {
  177. 'dictValue': '0'
  178. },
  179. // LevelValue: {},
  180. LDValue: {},
  181. DYValue: {},
  182. FJValue: {},
  183. // FSValue: {},
  184. // specificationValue: {}, //规格
  185. // materialValue: {}, //材质
  186. // brandValue: {}, //品牌
  187. // doorValue: {}, //上门类型
  188. // SelfClosValve: {}, //自闭阀类型
  189. // materialList: '', //材质list
  190. XQList: '',
  191. LDList: '',
  192. DYList: '',
  193. FJList: '',
  194. progress: 0, //上传图片进度百分比
  195. loading: false,
  196. // isCheck: true, //是否按照施工图纸施工
  197. // inputNumberValue: '',
  198. // inputIntegerNumberValue: '',
  199. // inputDecimalNumberValue: '',
  200. historyList: {}, //历史数据
  201. inputNumberValue: '',
  202. inputIntegerNumberValue: '',
  203. inputDecimalNumberValue: '',
  204. }
  205. },
  206. onLoad(options) {
  207. if ('params' in options) {
  208. this.objValue = JSON.parse(decodeURIComponent(options.params));
  209. if (this.objValue.enginType == `old_renovation`) {
  210. this.title = '旧改工程-管道施工记录'
  211. } else if (this.objValue.enginType == `new_built`) {
  212. this.title = '新建工程-管道施工记录'
  213. }
  214. uni.setNavigationBarTitle({
  215. title: this.title
  216. })
  217. }
  218. },
  219. methods: {
  220. //判断是否选择
  221. isEmpty(str) {
  222. return (!str || 0 === str.length);
  223. },
  224. history() {
  225. if (this.isEmpty(this.LDValue.id)) {
  226. this.$modal.msg('请选择楼栋')
  227. } else {
  228. this.$modal.msg('历史')
  229. }
  230. },
  231. submit() {
  232. // if (this.isEmpty(this.inputIntegerNumberValue)) {
  233. // this.$modal.msg("请输入米数")
  234. // } else {
  235. // if (this.isEmpty(this.inputDecimalNumberValue)) {
  236. // this.inputNumberValue = this.inputIntegerNumberValue;
  237. // } else {
  238. // this.inputNumberValue = this.inputIntegerNumberValue + "." + this.inputDecimalNumberValue;
  239. // }
  240. // //提交接口执行逻辑
  241. // }
  242. },
  243. // 显示历史弹窗
  244. handleShowSheet() {
  245. this.shareState = true;
  246. },
  247. // 隐藏历史弹窗
  248. handleHiddenShare() {
  249. this.shareState = false;
  250. },
  251. showPhoto(index) {
  252. uni.previewImage({
  253. current: index,
  254. urls: this.imgArr,
  255. })
  256. },
  257. remove(index) {
  258. uni.showModal({
  259. title: '提示',
  260. content: '是否删除该图片或视频?',
  261. success: (res) => {
  262. if (res.confirm) {
  263. this.imgArr.splice(index, 1)
  264. console.log('this.imgarr', this.imgArr)
  265. if (this.imgArr.length <= 0) {
  266. this.photo = true;
  267. }
  268. }
  269. }
  270. })
  271. },
  272. choose() {
  273. let _this = this;
  274. uni.showActionSheet({
  275. title: '上传',
  276. itemList: ['图片', '视频'],
  277. success: (res) => {
  278. console.log(res)
  279. if (res.tapIndex == 0) {
  280. this.chooseimage()
  281. } else {
  282. this.choosevideo()
  283. }
  284. }
  285. })
  286. },
  287. chooseimage() {
  288. let _this = this;
  289. console.log('图片', _this.headers)
  290. uni.chooseImage({
  291. sizeType: ['album', 'camera'],
  292. success(resp) {
  293. resp.tempFiles.forEach((item, index) => {
  294. const task = uni.uploadFile({
  295. url: _this.$HTTP + `/obs`,
  296. filePath: item.path,
  297. name: 'file',
  298. formData: {},
  299. header: _this.headers,
  300. success: res => {
  301. // 判断是否json字符串,将其转为json格式
  302. console.log("结果", res)
  303. // let data = _this.$u.test.jsonString(res
  304. // .data) ? JSON.parse(res.data) : res.data;
  305. let data = JSON.parse(res.data);
  306. if (![200].includes(data.code)) {
  307. // this.uploadError(index, data);
  308. _this.$modal.msg(data.msg)
  309. } else {
  310. if (_this.progress === 100) {
  311. console.log('_this.progress', _this.progress)
  312. //console.log('data----', data)data
  313. console.log('res--', res)
  314. _this.imgArr.push(data.data.url)
  315. console.log('imgArr', _this.imgArr)
  316. _this.$modal.msg('上传成功!')
  317. _this.photo = false;
  318. }
  319. }
  320. },
  321. fail: e => {
  322. console.log(e)
  323. _this.$modal.msg('上传失败!')
  324. //_this.uploadError(index, e);
  325. },
  326. complete: res => {
  327. uni.hideLoading();
  328. _this.uploading = false;
  329. }
  330. });
  331. task.onProgressUpdate(res => {
  332. _this.progress = res.progress;
  333. console.log('onProgressUpdate', res)
  334. console.log('task.onProgressUpdate', _this.progress)
  335. uni.showLoading({
  336. title: '上传中'
  337. })
  338. if (_this.progress != 100) {
  339. _this.loading = false
  340. console.log('_this.loading false', _this.loading)
  341. } else {
  342. _this.loading = true
  343. console.log('_this.loading true', _this.loading)
  344. }
  345. });
  346. })
  347. },
  348. })
  349. },
  350. choosevideo() {
  351. let _this = this;
  352. console.log('视频')
  353. uni.chooseVideo({
  354. sourceType: ['album', 'camera'],
  355. maxDuration: 30,
  356. success(resp) {
  357. const task = uni.uploadFile({
  358. url: _this.$HTTP + `/obs`,
  359. filePath: resp.tempFilePath,
  360. name: 'file',
  361. formData: {},
  362. header: _this.headers,
  363. success: res => {
  364. // 判断是否json字符串,将其转为json格式
  365. let data = JSON.parse(res.data);
  366. if (![200].includes(res.statusCode)) {
  367. this.uploadError(index, data);
  368. } else {
  369. //上传成功
  370. if (_this.progress === 100) {
  371. console.log('_this.progress', _this.progress)
  372. _this.imgArr.push(data.data.url)
  373. console.log('imgArr', _this.imgArr)
  374. _this.$modal.msg('上传成功!')
  375. _this.photo = false;
  376. }
  377. }
  378. },
  379. fail: e => {
  380. _this.$modal.msg('上传失败!')
  381. this.uploadError(index, e);
  382. },
  383. complete: res => {
  384. uni.hideLoading();
  385. _this.uploading = false;
  386. }
  387. });
  388. task.onProgressUpdate(res => {
  389. _this.progress = res.progress;
  390. console.log('onProgressUpdate', res)
  391. uni.showLoading({
  392. title: '上传中'
  393. })
  394. if (_this.progress != 100) {
  395. _this.loading = false
  396. console.log('_this.loading false', _this.loading)
  397. } else {
  398. _this.loading = true
  399. console.log('_this.loading true', _this.loading)
  400. }
  401. });
  402. },
  403. })
  404. },
  405. pickerShow(e) {
  406. this.type = e; //赋值类型
  407. // if (e == 'gczq') { //工程周期
  408. // this.openDict = true;
  409. // getDicts("engin_cycle").then(response => {
  410. // this.dictOptions = response.data;
  411. // });
  412. // } else
  413. if (e == 'xzq') { //行政区
  414. if (this.isEmpty(this.projectValue.dictValue)) {
  415. this.$modal.msg('请选择工程周期')
  416. } else {
  417. this.openDict = true;
  418. getDicts("district").then(response => {
  419. this.dictOptions = response.data;
  420. });
  421. }
  422. } else if (e == 'xq') { //小区
  423. if (this.isEmpty(this.XZQValue.dictValue)) {
  424. this.$modal.msg('请选择行政区')
  425. } else {
  426. this.open = true;
  427. this.selectList = this.XQList;
  428. }
  429. } else if (e == 'ld') { //楼栋
  430. if (this.isEmpty(this.XQValue.id)) {
  431. this.$modal.msg('请选择小区')
  432. } else {
  433. this.open = true;
  434. this.selectList = this.LDList;
  435. }
  436. } else if (e == 'dy') { //单元
  437. if (this.isEmpty(this.LDValue.id)) {
  438. this.$modal.msg('请选择楼栋')
  439. } else {
  440. this.open = true;
  441. this.selectList = this.DYList;
  442. }
  443. } else if (e == 'fj') { //房间
  444. if (this.isEmpty(this.DYValue.id)) {
  445. this.$modal.msg('请选择单元')
  446. } else {
  447. this.open = true;
  448. this.selectList = this.FJList;
  449. }
  450. }
  451. },
  452. changeSelectDict(item, index) {
  453. this.openDict = false;
  454. if (this.type == 'xzq') {
  455. this.XZQValue = item;
  456. //根据行政区id获取小区数据
  457. this.XQValue = ''; //重置小区数据
  458. this.LDValue = ''; //重置楼栋数据
  459. this.DYValue = ''; //重置单元数据
  460. this.FJValue = ''; //重置房间数据
  461. getAreaList(item.dictValue).then(res => {
  462. this.XQList = res.data;
  463. })
  464. }
  465. },
  466. changeSelect(item, index) {
  467. // this.index = index;
  468. // this.address = item.communityName;
  469. this.open = false;
  470. if (this.type == 'xq') {
  471. this.XQValue = item;
  472. //根据小区id 获取楼栋数据
  473. this.LDValue = ''; //重置楼栋数据
  474. this.DYValue = ''; //重置单元数据
  475. this.FJValue = ''; //重置房间数据
  476. getBuildingList(item.id).then(res => {
  477. this.LDList = res.data
  478. // console.log("楼栋=", res)
  479. })
  480. } else if (this.type == 'ld') {
  481. this.LDValue = item;
  482. //根据楼栋ID 获取单元数据
  483. this.DYValue = ''; //重置单元数据
  484. this.FJValue = ''; //重置房间数据
  485. getUnitList(item.id).then(res => {
  486. this.DYList = res.data
  487. // console.log("单元=", res)
  488. })
  489. } else if (this.type == 'dy') {
  490. this.DYValue = item;
  491. //根据单元数据 获取房间数据
  492. this.FJValue = ''; //重置房间数据
  493. getHousesList(item.id).then(res => {
  494. this.FJList = res.data
  495. // console.log("房间=", res)
  496. })
  497. } else if (this.type == 'fj') {
  498. this.FJValue = item;
  499. }
  500. },
  501. //关闭弹窗
  502. close(e) {
  503. this.open = false
  504. },
  505. //关闭弹窗
  506. closeDict(e) {
  507. this.openDict = false
  508. },
  509. }
  510. }
  511. </script>
  512. <style lang="scss">
  513. .container {
  514. display: flex;
  515. align-items: center;
  516. justify-content: space-between;
  517. padding: 10px;
  518. position: relative;
  519. }
  520. .uni-list {
  521. border: 1xp solid #eee;
  522. }
  523. .to-right-icon {
  524. width: 15px;
  525. height: 15px;
  526. position: absolute;
  527. top: 50%;
  528. transform: translateY(-50%);
  529. }
  530. .text {
  531. font-size: 16px;
  532. color: #333;
  533. }
  534. .background {
  535. // border: 15px solid hsla(0, 0%, 100%, .5);
  536. background: white;
  537. background-clip: padding-box;
  538. padding: 20rpx;
  539. border-radius: 20rpx;
  540. margin: 20rpx;
  541. /*从padding开始往外面裁剪背景*/
  542. }
  543. .btn {
  544. width: 715rpx;
  545. height: 69rpx;
  546. background: #79A4F0;
  547. border-radius: 6rpx;
  548. font-size: 25rpx;
  549. font-family: Microsoft YaHei;
  550. font-weight: 400;
  551. color: #FFFFFF;
  552. line-height: 69rpx;
  553. margin-top: 40rpx;
  554. margin-bottom: 100rpx;
  555. }
  556. .number {
  557. display: flex;
  558. /* 水平居中显示子元素 */
  559. align-items: flex-start;
  560. /* 垂直居中显示子元素 */
  561. justify-content: space-between;
  562. /* 左右间距等于间距大小 */
  563. padding: 10px;
  564. /* 设置padding以提高视觉效果 */
  565. }
  566. .textarea {
  567. margin-top: 10upx;
  568. width: 100%;
  569. border: 1rpx solid red;
  570. min-height: 100upx;
  571. line-height: 20px;
  572. }
  573. </style>