municipal.vue 29 KB

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