enginproject.vue 29 KB

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