municipal.vue 29 KB

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