overhead.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  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" style="margin-bottom: 10px;">
  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. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  75. subtitleKey="id" v-model="name"></SelectPicker>
  76. <SelectPicker :list="dictOptions" @change="changeSelectDict" v-if="openDict" @close="closeDict"
  77. titleKey="dictLabel" subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
  78. </view>
  79. <view class="background">
  80. <view>
  81. <view class="uni-list">
  82. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  83. {{objValue.enginClassValue}}
  84. <span
  85. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;"
  86. @click="history">历史</span>
  87. </view>
  88. <view class="container">
  89. <view>
  90. 施工时间
  91. </view>
  92. <view style="margin-top: 10;" @click="openDatetimePicker('sg')">
  93. <span style="color: black;">{{time}}</span>
  94. </view>
  95. </view>
  96. <view class="container" v-if="objValue.enginClassValue=='回填'">
  97. <view>
  98. 回填时间
  99. </view>
  100. <view style="margin-top: 10;" @click="openDatetimePicker('ht')">
  101. <span style="color: black;">{{BackfillingTime ? BackfillingTime:'请选择回填时间'}}</span>
  102. </view>
  103. </view>
  104. <view class="container" v-else-if="objValue.enginClassValue=='打压'">
  105. <view>
  106. 分段打压是否合格
  107. </view>
  108. <view v-if="this.isEmpty(this.isOkValue)" style="margin-top: 10;" @click="showActionsheet()">
  109. <span style="color: darkgray;">请选择分段打压是否合格</span>
  110. </view>
  111. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="showActionsheet()">
  112. <span style="color: black;">{{isOkLabel}}</span>
  113. </view>
  114. </view>
  115. <view class="container">
  116. <view class="uni-common-mt" style="width: 100%;">
  117. <text class="uni-title uni-common-pl">施工内容</text>
  118. <view style="width: 100%;padding-right: 20rpx;box-sizing: border-box;">
  119. <textarea class="textarea" placeholder="请输入施工内容" maxlength="255"
  120. placeholder-style="padding: 10rpx;"
  121. style="width: 100%;height: 100%;border: 1rpx solid #cccccc; border-radius: 15rpx;padding: 10rpx;line-height:normal;"
  122. auto-height v-model="projectContent"></textarea>
  123. </view>
  124. </view>
  125. </view>
  126. <view class="container">
  127. <view>
  128. 材 质
  129. </view>
  130. <view v-if="this.isEmpty(this.materialValue.id)" style="margin-top: 10;"
  131. @click="pickerShow('cz')">
  132. <span style="color: darkgray;">请选择材质</span>
  133. </view>
  134. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('cz')">
  135. <span style="color: black;">{{materialValue.name}}</span>
  136. </view>
  137. </view>
  138. <view class="container">
  139. <view>
  140. 规 格
  141. </view>
  142. <view v-if="this.isEmpty(this.specificationValue.id)" style="margin-top: 10;"
  143. @click="pickerShow('gg')">
  144. <span style="color: darkgray;">请选择规格</span>
  145. </view>
  146. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gg')">
  147. <span style="color: black;">{{specificationValue.name}}</span>
  148. </view>
  149. </view>
  150. <view class="container">
  151. <text>数 量</text>
  152. <input class="uni-input" type="number" v-model="inputNumberValue" placeholder="请填写数量"
  153. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  154. </view>
  155. <!-- <view class="container">
  156. <text>负责人</text>
  157. <text>{{user.nickName}}</text>
  158. </view>
  159. <view class="container">
  160. <text>负责人联系电话</text>
  161. <text>{{user.phonenumber}}</text>
  162. </view> -->
  163. </view>
  164. <view class="align-items" style="margin-top: 20px;margin-bottom: 20px;">
  165. <view class="container" style="color: gainsboro;">*请上传照片</view>
  166. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  167. <image src="/static/images/chooseimg.png" mode=""
  168. style="width: 100rpx; height: 100rpx; margin: 0 12rpx;; " @click="choose()"></image>
  169. <view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
  170. <view
  171. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ">
  172. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  173. @click="showPhoto(index)">
  174. </image>
  175. </view>
  176. <view v-else>
  177. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  178. </view>
  179. <view @click="remove(index)"
  180. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  181. <uni-icons type="close" color="darkgray" size="18"></uni-icons>
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. </view>
  187. </view>
  188. <view class="action-btn">
  189. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
  190. </view>
  191. <bottom-sheet ref="refShare" :data="historyList"></bottom-sheet>
  192. <yt-dateTimePicker ref="myPicker" @submit="handleSubmit" :start-year="2024" :end-year="2099"
  193. :time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
  194. </view>
  195. </template>
  196. <script>
  197. import SelectPicker from '../../../components/selectPicker/select_picker.vue'
  198. import bottomSheet from '../../../components/bottomSheet/bottomSheet.vue'
  199. import {
  200. getDicts
  201. } from "@/api/system/dict/data";
  202. import {
  203. getAreaList,
  204. getBuildingList,
  205. getUnitList,
  206. addTearOldPipe,
  207. getEnginMaterialQualityList,
  208. getEnginSpecificationsList,
  209. getRoomProjectList,
  210. getRoomProjectId,
  211. } from '@/api/common'
  212. import {
  213. getToken
  214. } from '../../../utils/auth';
  215. import {
  216. getUserProfile
  217. } from "@/api/system/user"
  218. export default {
  219. components: {
  220. SelectPicker,
  221. bottomSheet,
  222. },
  223. data() {
  224. return {
  225. headers: {
  226. Authorization: "Bearer " + getToken()
  227. },
  228. user: {
  229. nickName: "",
  230. phonenumber: "",
  231. email: "",
  232. sex: ""
  233. },
  234. startDate: '2022-02-04',
  235. endDate: '2025-02-04',
  236. mode: 4,
  237. type: '',
  238. open: false,
  239. objValue: '', //上一页面传过来的值 新增接口用
  240. openDict: false,
  241. selectList: [],
  242. dictOptions: [],
  243. imgArr: [],
  244. XQValue: {},
  245. XZQValue: {},
  246. projectValue: {},
  247. LevelValue: {},
  248. isOkValue: '', //分段打压是否合格
  249. isOkLabel: '', //分段打压是否合格label
  250. LDValue: {},
  251. DYValue: {},
  252. FJValue: {},
  253. time: '', //施工时间
  254. timeType: '', //时间类型
  255. BackfillingTime: '', //回填时间
  256. showTime: false,
  257. specificationValue: {}, //规格
  258. projectContent: '', //施工内容
  259. materialValue: {}, //材质
  260. brandValue: {}, //品牌
  261. doorValue: {}, //上门类型
  262. SelfClosValve: {}, //自闭阀类型
  263. materialList: '', //材质list
  264. XQList: '',
  265. LDList: '',
  266. progress: 0, //上传图片进度百分比
  267. loading: false,
  268. inputNumberValue: '',
  269. title: '',
  270. historyList: {} //历史数据
  271. }
  272. },
  273. created() {
  274. this.getUser();
  275. this.time = this.traversalTime(new Date().getTime()) //在data里定义变量-nowTime
  276. },
  277. onLoad(options) {
  278. if ('params' in options) {
  279. this.objValue = JSON.parse(decodeURIComponent(options.params));
  280. if (this.objValue.enginType == `old_renovation`) {
  281. this.title = '旧改工程-架空'
  282. } else if (this.objValue.enginType == `new_built`) {
  283. this.title = '新建工程-架空'
  284. }
  285. uni.setNavigationBarTitle({
  286. title: this.title
  287. })
  288. }
  289. },
  290. methods: {
  291. getUser() {
  292. getUserProfile().then(response => {
  293. this.user = response.data.user
  294. })
  295. },
  296. // 打开picker
  297. openDatetimePicker(type) {
  298. this.timeType = type;
  299. this.$refs.myPicker.show();
  300. },
  301. // 关闭picker
  302. closeDatetimePicker() {
  303. this.$refs.myPicker.hide();
  304. },
  305. handleSubmit(e) {
  306. if (this.timeType == 'ht') {
  307. this.BackfillingTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
  308. } else {
  309. this.time = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
  310. }
  311. },
  312. //获取当前时间
  313. traversalTime(timestamp) {
  314. //timestamp(时间戳)是整数,否则要parseInt转换
  315. let time = new Date(timestamp);
  316. let y = time.getFullYear();
  317. let m = time.getMonth() + 1;
  318. let d = time.getDate();
  319. let h = time.getHours();
  320. let mm = time.getMinutes();
  321. let s = time.getSeconds();
  322. return y + '-' + this.addTimes(m) + '-' + this.addTimes(d) + ' ' + this.addTimes(h) + ':' + this.addTimes(
  323. mm) + ':' + this.addTimes(s);
  324. },
  325. addTimes(m) {
  326. return m < 10 ? '0' + m : m
  327. },
  328. //判断是否选择
  329. isEmpty(str) {
  330. return (!str || 0 === str.length);
  331. },
  332. // 显示历史弹窗
  333. handleShowSheet() {
  334. this.shareState = true;
  335. },
  336. // 隐藏历史弹窗
  337. handleHiddenShare() {
  338. this.shareState = false;
  339. },
  340. showPhoto(index) {
  341. uni.previewImage({
  342. current: index,
  343. urls: this.imgArr,
  344. })
  345. },
  346. remove(index) {
  347. uni.showModal({
  348. title: '提示',
  349. content: '是否删除该图片或视频?',
  350. success: (res) => {
  351. if (res.confirm) {
  352. this.imgArr.splice(index, 1)
  353. console.log('this.imgarr', this.imgArr)
  354. if (this.imgArr.length <= 0) {
  355. this.photo = true;
  356. }
  357. }
  358. }
  359. })
  360. },
  361. choose() {
  362. let _this = this;
  363. uni.showActionSheet({
  364. title: '上传',
  365. itemList: ['图片', '视频'],
  366. success: (res) => {
  367. console.log(res)
  368. if (res.tapIndex == 0) {
  369. this.chooseimage()
  370. } else {
  371. this.choosevideo()
  372. }
  373. }
  374. })
  375. },
  376. chooseimage() {
  377. let _this = this;
  378. console.log('图片', _this.headers)
  379. uni.chooseImage({
  380. sizeType: ['album', 'camera'],
  381. success(resp) {
  382. resp.tempFiles.forEach((item, index) => {
  383. const task = uni.uploadFile({
  384. url: _this.$HTTP + `/obs`,
  385. filePath: item.path,
  386. name: 'file',
  387. formData: {},
  388. header: _this.headers,
  389. success: res => {
  390. // 判断是否json字符串,将其转为json格式
  391. console.log("结果", res)
  392. // let data = _this.$u.test.jsonString(res
  393. // .data) ? JSON.parse(res.data) : res.data;
  394. let data = JSON.parse(res.data);
  395. if (![200].includes(data.code)) {
  396. // this.uploadError(index, data);
  397. _this.$modal.msg(data.msg)
  398. } else {
  399. if (_this.progress === 100) {
  400. console.log('_this.progress', _this.progress)
  401. //console.log('data----', data)data
  402. console.log('res--', res)
  403. _this.imgArr.push(data.data.url)
  404. console.log('imgArr', _this.imgArr)
  405. _this.$modal.msg('上传成功!')
  406. _this.photo = false;
  407. }
  408. }
  409. },
  410. fail: e => {
  411. console.log(e)
  412. _this.$modal.msg('上传失败!')
  413. //_this.uploadError(index, e);
  414. },
  415. complete: res => {
  416. uni.hideLoading();
  417. _this.uploading = false;
  418. }
  419. });
  420. task.onProgressUpdate(res => {
  421. _this.progress = res.progress;
  422. console.log('onProgressUpdate', res)
  423. console.log('task.onProgressUpdate', _this.progress)
  424. uni.showLoading({
  425. title: '上传中'
  426. })
  427. if (_this.progress != 100) {
  428. _this.loading = false
  429. console.log('_this.loading false', _this.loading)
  430. } else {
  431. _this.loading = true
  432. console.log('_this.loading true', _this.loading)
  433. }
  434. });
  435. })
  436. },
  437. })
  438. },
  439. choosevideo() {
  440. let _this = this;
  441. console.log('视频')
  442. uni.chooseVideo({
  443. sourceType: ['album', 'camera'],
  444. maxDuration: 30,
  445. success(resp) {
  446. const task = uni.uploadFile({
  447. url: _this.$HTTP + `/obs`,
  448. filePath: resp.tempFilePath,
  449. name: 'file',
  450. formData: {},
  451. header: _this.headers,
  452. success: res => {
  453. // 判断是否json字符串,将其转为json格式
  454. let data = JSON.parse(res.data);
  455. if (![200].includes(res.statusCode)) {
  456. this.uploadError(index, data);
  457. } else {
  458. //上传成功
  459. if (_this.progress === 100) {
  460. console.log('_this.progress', _this.progress)
  461. _this.imgArr.push(data.data.url)
  462. console.log('imgArr', _this.imgArr)
  463. _this.$modal.msg('上传成功!')
  464. _this.photo = false;
  465. }
  466. }
  467. },
  468. fail: e => {
  469. _this.$modal.msg('上传失败!')
  470. this.uploadError(index, e);
  471. },
  472. complete: res => {
  473. uni.hideLoading();
  474. _this.uploading = false;
  475. }
  476. });
  477. task.onProgressUpdate(res => {
  478. _this.progress = res.progress;
  479. console.log('onProgressUpdate', res)
  480. uni.showLoading({
  481. title: '上传中'
  482. })
  483. if (_this.progress != 100) {
  484. _this.loading = false
  485. console.log('_this.loading false', _this.loading)
  486. } else {
  487. _this.loading = true
  488. console.log('_this.loading true', _this.loading)
  489. }
  490. });
  491. },
  492. })
  493. },
  494. showActionsheet() {
  495. //分段打压是否合格
  496. getDicts("sys_yes_no").then(response => {
  497. this.dictOptions = response.data;
  498. let array = [];
  499. this.dictOptions.forEach((item, index) => {
  500. array.push(item.dictLabel)
  501. });
  502. uni.showActionSheet({
  503. itemList: array,
  504. success: (res) => {
  505. // console.log('选择了第' + (res.tapIndex + 1) + '个选项');
  506. // console.log(this.dictOptions[res.tapIndex].dictValue)
  507. this.isOkValue = this.dictOptions[res.tapIndex].dictValue;
  508. this.isOkLabel = this.dictOptions[res.tapIndex].dictLabel;
  509. },
  510. fail: (err) => {
  511. console.log('弹窗取消');
  512. }
  513. });
  514. });
  515. },
  516. pickerShow(e) {
  517. this.type = e; //赋值类型
  518. if (e == 'cz') { //材质
  519. this.open = true;
  520. getEnginMaterialQualityList("民用工程").then(response => {
  521. this.selectList = response.data;
  522. });
  523. } else if (e == 'gg') { //规格
  524. if (this.isEmpty(this.materialValue.id)) {
  525. this.$modal.msg('请选择材质')
  526. } else {
  527. this.open = true;
  528. this.selectList = this.materialList;
  529. }
  530. } else if (e == 'gczq') { //工程周期
  531. this.openDict = true;
  532. getDicts("engin_cycle").then(response => {
  533. this.dictOptions = response.data;
  534. });
  535. } else if (e == 'xzq') { //行政区
  536. if (this.isEmpty(this.projectValue.dictValue)) {
  537. this.$modal.msg('请选择工程周期')
  538. } else {
  539. this.openDict = true;
  540. getDicts("district").then(response => {
  541. this.dictOptions = response.data;
  542. });
  543. }
  544. //this.selectList = this.dictOptions;
  545. } else if (e == 'xq') { //小区
  546. if (this.isEmpty(this.XZQValue.dictValue)) {
  547. this.$modal.msg('请选择行政区')
  548. } else {
  549. this.open = true;
  550. this.selectList = this.XQList;
  551. }
  552. } else if (e == 'ld') { //楼栋
  553. if (this.isEmpty(this.XQValue.id)) {
  554. this.$modal.msg('请选择小区')
  555. } else {
  556. this.open = true;
  557. this.selectList = this.LDList;
  558. }
  559. } else if (e == 'dy') { //单元
  560. if (this.isEmpty(this.LDValue.id)) {
  561. this.$modal.msg('请选择楼栋')
  562. } else {
  563. this.open = true;
  564. this.selectList = this.DYList;
  565. }
  566. }
  567. },
  568. changeSelectDict(item, index) {
  569. this.openDict = false;
  570. if (this.type == 'isok') {
  571. this.isOkValue = item
  572. } else if (this.type == 'gczq') {
  573. this.projectValue = item
  574. } else if (this.type == 'xzq') {
  575. this.XZQValue = item;
  576. //根据行政区id获取小区数据
  577. this.XQValue = ''; //重置小区数据
  578. this.LDValue = ''; //重置楼栋数据
  579. this.DYValue = ''; //重置单元数据
  580. getAreaList(item.dictValue).then(res => {
  581. this.XQList = res.data;
  582. })
  583. }
  584. },
  585. changeSelect(item, index) {
  586. // this.index = index;
  587. // this.address = item.communityName;
  588. this.open = false;
  589. if (this.type == 'cz') {
  590. this.materialValue = item;
  591. this.specificationValue = ''; //重置规格
  592. //根据材质ID 获取规格数据
  593. getEnginSpecificationsList(item.id).then(res => {
  594. this.materialList = res.data
  595. })
  596. } else if (this.type == 'gg') {
  597. this.specificationValue = item;
  598. } else if (this.type == 'xq') {
  599. this.XQValue = item;
  600. //根据小区id 获取楼栋数据
  601. this.LDValue = ''; //重置楼栋数据
  602. this.DYValue = ''; //重置单元数据
  603. this.FJValue = ''; //重置房间数据
  604. getBuildingList(item.id).then(res => {
  605. this.LDList = res.data
  606. // console.log("楼栋=", res)
  607. })
  608. } else if (this.type == 'ld') {
  609. this.LDValue = item;
  610. //根据楼栋ID 获取单元数据
  611. this.DYValue = ''; //重置单元数据
  612. this.FJValue = ''; //重置房间数据
  613. getUnitList(item.id).then(res => {
  614. this.DYList = res.data
  615. // console.log("单元=", res)
  616. })
  617. } else if (this.type == 'dy') {
  618. this.DYValue = item;
  619. }
  620. },
  621. //关闭弹窗
  622. close(e) {
  623. this.open = false
  624. },
  625. //关闭弹窗
  626. closeDict(e) {
  627. this.openDict = false
  628. },
  629. //提交数据
  630. submit() {
  631. if (this.isEmpty(this.projectValue.dictValue)) {
  632. this.$modal.msg("请选择工程周期")
  633. return
  634. }
  635. if (this.isEmpty(this.XZQValue.dictValue)) {
  636. this.$modal.msg("请选择行政区")
  637. return
  638. }
  639. if (this.isEmpty(this.XQValue.id)) {
  640. this.$modal.msg("请选择小区")
  641. return
  642. } else if (this.isEmpty(this.LDValue.id)) {
  643. this.$modal.msg("请选择楼栋")
  644. }
  645. if (this.objValue.enginClassValue == '回填' && this.isEmpty(this.BackfillingTime)) {
  646. this.$modal.msg("请选择回填时间")
  647. return
  648. }
  649. if (this.objValue.enginClassValue == '打压' && this.isEmpty(this.isOkValue)) {
  650. this.$modal.msg("请选择分段打压是否合格")
  651. return
  652. }
  653. if (this.isEmpty(this.materialValue.id)) {
  654. this.$modal.msg("请选择材质")
  655. return
  656. }
  657. if (this.isEmpty(this.specificationValue.id)) {
  658. this.$modal.msg("请选择规格")
  659. return
  660. }
  661. if (this.isEmpty(this.inputNumberValue)) {
  662. this.$modal.msg("请输入数量")
  663. return
  664. }
  665. if (this.imgArr.length <= 0) {
  666. this.$modal.msg('请上传照片或视频')
  667. return
  668. }
  669. if (this.loading == false) {
  670. this.$modal.msg('照片或视频未上传完毕,无法提交!')
  671. return
  672. }
  673. //提交
  674. this.onsubmit();
  675. },
  676. onsubmit() {
  677. this.$modal.loading('提交中')
  678. let unitId = '';
  679. let houseId = '';
  680. let buildingId = '';
  681. if (this.isEmpty(this.DYValue.id)) {
  682. unitId = '';
  683. } else {
  684. unitId = this.DYValue.id
  685. }
  686. //提交
  687. let param = {
  688. district: this.XZQValue.dictValue,
  689. areaId: this.XQValue.id,
  690. buildingId: this.LDValue.id,
  691. unitId: unitId,
  692. houseId: houseId, //传空
  693. enginType: this.objValue.enginType, //写死 上一页面传过来的 新建/旧改
  694. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  695. enginCycle: this.projectValue.dictValue, //工程周期
  696. zEngineeringNodeBo: {
  697. type: this.objValue.enginClassValue, //写死 上一页面传过来的 (拆旧管等 字典值)
  698. zEngineeringInfoBo: {
  699. //constructAccordingDrawings: this.isCheck, //是否按图纸施工
  700. segmentedCompressionQualified: this.isOkValue, // 分段打压是否台格
  701. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  702. constructTime: this.time, //施工时间
  703. backfillTime: this.BackfillingTime, // 回填时间
  704. remark: this.projectContent, //施工内容
  705. headName: this.user.nickName, // 负责人名称
  706. headPhone: this.user.phonenumber, // 负责人电话
  707. zEngineeringMaterialBo: [{
  708. materialQuality: this.materialValue.id, //材质
  709. specifications: this.specificationValue.id, //规格
  710. number: this.inputNumberValue //数量
  711. }]
  712. }
  713. }
  714. }
  715. addTearOldPipe(param).then(res => {
  716. if (res.code == '200') {
  717. uni.showToast({
  718. title: res.msg,
  719. icon: 'none',
  720. //显示持续时间为 3秒
  721. duration: 2000
  722. });
  723. setTimeout(function() {
  724. uni.navigateBack();
  725. }, 1000)
  726. }
  727. this.$modal.closeLoading()
  728. })
  729. },
  730. history() {
  731. if (this.isEmpty(this.projectValue.dictValue)) {
  732. this.$modal.msg("请选择工程周期")
  733. } else if (this.isEmpty(this.XZQValue.dictValue)) {
  734. this.$modal.msg("请选择行政区")
  735. } else if (this.isEmpty(this.XQValue.id)) {
  736. this.$modal.msg("请选择小区")
  737. } else if (this.isEmpty(this.LDValue.id)) {
  738. this.$modal.msg("请选择楼栋")
  739. }
  740. // else if (this.isEmpty(this.DYValue.id)) {
  741. // this.$modal.msg("请选择单元")
  742. // }
  743. // else if (this.isEmpty(this.FJValue.id)) {
  744. // this.$modal.msg("请选择房间")
  745. // }
  746. else {
  747. let unitId = '';
  748. let houseId = '';
  749. if (this.isEmpty(this.DYValue.id)) {
  750. unitId = '';
  751. } else {
  752. unitId = this.DYValue.id
  753. }
  754. let param = {
  755. areaId: this.XQValue.id, // 小区id
  756. buildingId: this.LDValue.id, // 楼宇id
  757. unitId: unitId, // 单元id
  758. houseId: houseId, // 房间id
  759. enginCycle: this.projectValue.dictValue, // 工程周期
  760. enginType: this.objValue.enginType, //写死 上一页面传过来的 新建/旧改
  761. enginClassification: this.objValue.enginClassification, //写死 上一页面传过来的 //室内 - 庭院 - 架空
  762. }
  763. getRoomProjectId(param).then(res => {
  764. if (res.code == '200') {
  765. if (res.data != null) {
  766. getRoomProjectList(res.data.id, this.objValue.enginClassValue).then(
  767. res => {
  768. this.historyList = res.data
  769. if (res.data.zEngineeringNodeBo != null) {
  770. this.showHistoryList();
  771. } else {
  772. this.$modal.msg("暂无历史信息")
  773. }
  774. })
  775. } else {
  776. this.$modal.msg("暂无工程信息")
  777. }
  778. } else {
  779. this.$modal.msg(res.msg)
  780. }
  781. })
  782. }
  783. },
  784. showHistoryList() {
  785. this.$refs.refShare.handleShowShare();
  786. }
  787. }
  788. }
  789. </script>
  790. <style>
  791. .container {
  792. display: flex;
  793. margin-left: 10px;
  794. margin-top: 10px;
  795. margin-right: 10px;
  796. align-items: flex-start;
  797. justify-content: space-between;
  798. }
  799. .text {
  800. font-size: 16px;
  801. color: #333;
  802. }
  803. .background {
  804. border: 15px solid hsla(0, 0%, 100%, .5);
  805. background: white;
  806. background-clip: padding-box;
  807. /*从padding开始往外面裁剪背景*/
  808. }
  809. .btn {
  810. margin-top: 40px;
  811. margin-right: 20px;
  812. margin-bottom: 120px;
  813. margin-left: 20px;
  814. height: 45px;
  815. }
  816. .number {
  817. display: flex;
  818. /* 水平居中显示子元素 */
  819. align-items: flex-start;
  820. /* 垂直居中显示子元素 */
  821. justify-content: space-between;
  822. /* 左右间距等于间距大小 */
  823. padding: 10px;
  824. /* 设置padding以提高视觉效果 */
  825. }
  826. .textarea {
  827. margin-top: 10upx;
  828. width: 100%;
  829. border: 1rpx solid red;
  830. min-height: 100upx;
  831. line-height: 20px;
  832. }
  833. </style>