municipal.vue 28 KB

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