municipal.vue 28 KB

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