infrastructure.vue 25 KB

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