municipal.vue 28 KB

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