enginproject.vue 28 KB

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