enginproject.vue 28 KB

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