enginproject.vue 30 KB

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