infrastructure.vue 25 KB

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