infrastructure.vue 24 KB

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