enginproject.vue 29 KB

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