municipal.vue 27 KB

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