infrastructure.vue 26 KB

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