enginproject.vue 29 KB

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