enginproject.vue 29 KB

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