courtyard.vue 25 KB

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