municipal.vue 27 KB

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