enginproject.vue 28 KB

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