newoverhead.vue 31 KB

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