municipal.vue 29 KB

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