infrastructure.vue 25 KB

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