infrastructure.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940
  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. <image src="../../static/images/icon_right.png"
  14. style=" position: absolute; width: 15px;height: 15px;"></image>
  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. <image src="../../static/images/icon_right.png"
  19. style=" position: absolute; width: 15px;height: 15px;"></image>
  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. <image src="../../static/images/icon_right.png"
  111. style=" position: absolute; width: 15px;height: 15px;"></image>
  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. <image src="../../static/images/icon_right.png"
  127. style=" position: absolute; width: 15px;height: 15px;"></image>
  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. <image src="../../static/images/icon_right.png"
  132. style=" position: absolute; width: 15px;height: 15px;"></image>
  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. <image src="../../static/images/icon_right.png"
  151. style=" position: absolute; width: 15px;height: 15px;"></image>
  152. </view>
  153. <view v-else class="uni-list-cell-db" @click="pickerShow('gg')">
  154. <span style="color: black;">{{specificationValue.name}}</span>
  155. <image src="../../static/images/icon_right.png"
  156. style=" position: absolute; width: 15px;height: 15px;"></image>
  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. <image src="../../../static/images/icon_close.png"
  192. style=" width: 15px; height: 15px;"></image>
  193. </view>
  194. </view>
  195. </view>
  196. </view>
  197. </view>
  198. <view class="action-btn">
  199. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
  200. </view>
  201. <bottom-sheet ref="refShare" :data="historyList" :TitleType="objValue.value"></bottom-sheet>
  202. <yt-dateTimePicker ref="myPicker" @submit="handleSubmit" :start-year="2024" :end-year="2099"
  203. :time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
  204. <!-- 下载提示页面 -->
  205. <mypopup :show="show_loding" :popupText="popupText" :titleText="titleText" :cancelText="cancelText"
  206. :confirmText="confirmText" @close="cancel_loding" @confirm="confirm_loding">
  207. </mypopup>
  208. </view>
  209. </template>
  210. <script>
  211. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  212. import bottomSheet from '../../components/bottomSheet/bottomSheetMore.vue'
  213. import mypopup from '../../components/mypopup/mypopup.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. bottomSheet,
  232. mypopup
  233. },
  234. data() {
  235. return {
  236. historyList: {}, //历史数据
  237. show_loding: false,
  238. popupText: '', //对话框内容
  239. titleText: '',
  240. cancelText: '',
  241. confirmText: '',
  242. objValue: '', //上一页面传过来的值 新增接口用
  243. headers: {
  244. Authorization: "Bearer " + getToken()
  245. },
  246. time: '', //施工时间
  247. open: false,
  248. objValue: '', //上一页面传过来的值 新增接口用
  249. openDict: false,
  250. selectList: [],
  251. dictOptions: [],
  252. imgArr: [],
  253. fileArr: [],
  254. loading: false,
  255. specificationValue: {}, //规格
  256. materialValue: {}, //材质
  257. inputNumberValue: '',
  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. console.log(this.time)
  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. showPhoto(index) {
  320. uni.previewImage({
  321. current: index,
  322. urls: this.imgArr,
  323. })
  324. },
  325. remove(index) {
  326. uni.showModal({
  327. title: '提示',
  328. content: '是否删除该图片或视频?',
  329. success: (res) => {
  330. if (res.confirm) {
  331. this.imgArr.splice(index, 1)
  332. console.log('this.imgarr', this.imgArr)
  333. if (this.imgArr.length <= 0) {
  334. this.photo = true;
  335. }
  336. }
  337. }
  338. })
  339. },
  340. choose() {
  341. let _this = this;
  342. uni.showActionSheet({
  343. title: '上传',
  344. itemList: ['图片', '视频'],
  345. success: (res) => {
  346. console.log(res)
  347. if (res.tapIndex == 0) {
  348. this.chooseimage()
  349. } else {
  350. this.choosevideo()
  351. }
  352. }
  353. })
  354. },
  355. chooseimage() {
  356. let _this = this;
  357. console.log('图片', _this.headers)
  358. uni.chooseImage({
  359. sizeType: ['album', 'camera'],
  360. success(resp) {
  361. resp.tempFiles.forEach((item, index) => {
  362. const task = uni.uploadFile({
  363. url: _this.$HTTP + `/obs`,
  364. filePath: item.path,
  365. name: 'file',
  366. formData: {},
  367. header: _this.headers,
  368. success: res => {
  369. // 判断是否json字符串,将其转为json格式
  370. console.log("结果", res)
  371. // let data = _this.$u.test.jsonString(res
  372. // .data) ? JSON.parse(res.data) : res.data;
  373. let data = JSON.parse(res.data);
  374. if (![200].includes(data.code)) {
  375. // this.uploadError(index, data);
  376. _this.$modal.msg(data.msg)
  377. } else {
  378. if (_this.progress === 100) {
  379. console.log('_this.progress', _this.progress)
  380. //console.log('data----', data)data
  381. console.log('res--', res)
  382. _this.imgArr.push(data.data.url)
  383. console.log('imgArr', _this.imgArr)
  384. _this.$modal.msg('上传成功!')
  385. _this.photo = false;
  386. }
  387. }
  388. },
  389. fail: e => {
  390. console.log(e)
  391. _this.$modal.msg('上传失败!')
  392. //_this.uploadError(index, e);
  393. },
  394. complete: res => {
  395. uni.hideLoading();
  396. _this.uploading = false;
  397. }
  398. });
  399. task.onProgressUpdate(res => {
  400. _this.progress = res.progress;
  401. console.log('onProgressUpdate', res)
  402. console.log('task.onProgressUpdate', _this.progress)
  403. uni.showLoading({
  404. title: '上传中'
  405. })
  406. if (_this.progress != 100) {
  407. _this.loading = false
  408. console.log('_this.loading false', _this.loading)
  409. } else {
  410. _this.loading = true
  411. console.log('_this.loading true', _this.loading)
  412. }
  413. });
  414. })
  415. },
  416. })
  417. },
  418. choosevideo() {
  419. let _this = this;
  420. console.log('视频')
  421. uni.chooseVideo({
  422. sourceType: ['album', 'camera'],
  423. maxDuration: 30,
  424. success(resp) {
  425. const task = uni.uploadFile({
  426. url: _this.$HTTP + `/obs`,
  427. filePath: resp.tempFilePath,
  428. name: 'file',
  429. formData: {},
  430. header: _this.headers,
  431. success: res => {
  432. // 判断是否json字符串,将其转为json格式
  433. let data = JSON.parse(res.data);
  434. if (![200].includes(res.statusCode)) {
  435. this.uploadError(index, data);
  436. } else {
  437. //上传成功
  438. if (_this.progress === 100) {
  439. console.log('_this.progress', _this.progress)
  440. _this.imgArr.push(data.data.url)
  441. console.log('imgArr', _this.imgArr)
  442. _this.$modal.msg('上传成功!')
  443. _this.photo = false;
  444. }
  445. }
  446. },
  447. fail: e => {
  448. _this.$modal.msg('上传失败!')
  449. this.uploadError(index, e);
  450. },
  451. complete: res => {
  452. uni.hideLoading();
  453. _this.uploading = false;
  454. }
  455. });
  456. task.onProgressUpdate(res => {
  457. _this.progress = res.progress;
  458. console.log('onProgressUpdate', res)
  459. uni.showLoading({
  460. title: '上传中'
  461. })
  462. if (_this.progress != 100) {
  463. _this.loading = false
  464. console.log('_this.loading false', _this.loading)
  465. } else {
  466. _this.loading = true
  467. console.log('_this.loading true', _this.loading)
  468. }
  469. });
  470. },
  471. })
  472. },
  473. chooseModel(url, name) {
  474. this.cancelText = '复制';
  475. this.confirmText = "下载";
  476. this.titleText = "温馨提示"
  477. this.popupText = "下载或者复制链接";
  478. this.show_loding = true;
  479. this.fileName = name;
  480. this.fileUrl = url; //文件名称和下载地址赋值
  481. },
  482. //取消按钮
  483. cancel_loding() {
  484. let _this = this;
  485. _this.show_loding = false;
  486. console.log("复制")
  487. if (!_this.isEmpty(_this.fileUrl)) {
  488. console.log(_this.fileUrl)
  489. console.log(_this.fileName)
  490. uni.setClipboardData({
  491. data: _this.fileUrl,
  492. success() {
  493. uni.showToast({
  494. title: '已复制' + _this.fileName + '地址成功 请在浏览器打开',
  495. icon: 'none'
  496. });
  497. },
  498. fail(e) {
  499. console.log("失败", e)
  500. uni.showToast({
  501. title: '复制失败',
  502. icon: 'none'
  503. });
  504. }
  505. });
  506. }
  507. },
  508. //确定按钮
  509. confirm_loding() {
  510. this.show_loding = false;
  511. console.log("下载")
  512. this.download(this.fileUrl, this.fileName);
  513. },
  514. getDownLoadFilePath() {
  515. let cachePath = `${uni.env.USER_DATA_PATH}/downloads`
  516. let fm = uni.getFileSystemManager()
  517. try {
  518. // 访问成功则存在
  519. fm.accessSync(cachePath)
  520. } catch (error) {
  521. // 不存在则新建
  522. fm.mkdirSync(cachePath, true)
  523. }
  524. return cachePath
  525. },
  526. download(url, name) {
  527. let savePath = this.getDownLoadFilePath();
  528. console.log('点击下载', url);
  529. console.log('点击下载333', savePath);
  530. //var savePath = uni.env.USER_DATA_PATH + '/savePath'
  531. uni.downloadFile({
  532. url: url,
  533. success: response => {
  534. if (response.statusCode === 200) {
  535. console.log("数据", response)
  536. uni.getFileSystemManager().saveFile({
  537. tempFilePath: response.tempFilePath,
  538. filePath: `${savePath}/${name}`,
  539. success: (resData) => {
  540. console.log('保存路径', resData.savedFilePath)
  541. console.log("dd", resData)
  542. uni.showToast({
  543. title: '下载成功'
  544. })
  545. },
  546. fail: error => {
  547. console.log('error: ', error)
  548. }
  549. })
  550. }
  551. },
  552. fail: error => {
  553. console.log("ddd", error)
  554. }
  555. })
  556. },
  557. pickerShow(e) {
  558. this.type = e; //赋值类型
  559. if (e == 'gcmc') {
  560. this.open = true;
  561. getInfrastructureNameList().then(response => {
  562. this.selectList = response.data;
  563. });
  564. } else if (e == 'cz') { //材质
  565. this.open = true;
  566. getEnginMaterialQualityList("基建工程").then(response => {
  567. this.selectList = response.data;
  568. });
  569. } else if (e == 'gg') { //规格
  570. if (this.isEmpty(this.materialValue.id)) {
  571. this.$modal.msg('请选择材质')
  572. } else {
  573. this.open = true;
  574. this.selectList = this.materialList;
  575. }
  576. }
  577. },
  578. changeSelect(item, index) {
  579. // this.index = index;
  580. // this.address = item.communityName;
  581. this.open = false;
  582. if (this.type == 'gcmc') {
  583. this.projectName = item;
  584. uni.showLoading({
  585. title: '加载中'
  586. })
  587. getInfrastructureDetails(item.id).then(res => {
  588. uni.hideLoading();
  589. this.projectName.name = res.data.enginName;
  590. this.gcdzValue = res.data.enginAddre; //工程地址
  591. this.jsdwValue = res.data.constructUnit; //建设单位
  592. this.kgsjValue = res.data.startTime; //开工时间
  593. this.jhgqValue = res.data.plannedDuration; //计划工期
  594. this.jgsjValue = res.data.completedTime; //竣工时间
  595. this.gcnrValue = res.data.enginContent; //工程内容
  596. this.fileArr = res.data.pics;
  597. this.id = res.data.id;
  598. })
  599. } else if (this.type == 'cz') {
  600. this.materialValue = item;
  601. this.specificationValue = ''; //重置规格
  602. //根据材质ID 获取规格数据
  603. getEnginSpecificationsList(item.id).then(res => {
  604. this.materialList = res.data
  605. })
  606. } else if (this.type == 'gg') {
  607. this.specificationValue = item;
  608. }
  609. },
  610. //关闭弹窗
  611. close(e) {
  612. this.open = false
  613. },
  614. history() {
  615. if (this.isEmpty(this.projectName.id)) {
  616. this.$modal.msg('请选择工程名称')
  617. return
  618. }
  619. getInfrastructureList(this.id, this.objValue.value).then(response => {
  620. this.historyList = response.data
  621. if (response.data.zEngineeringNodeBo.zEngineeringInfoBoList != null) {
  622. this.$refs.refShare.handleShowShare();
  623. } else {
  624. this.$modal.msg("暂无历史信息")
  625. }
  626. });
  627. },
  628. submit() {
  629. //提交
  630. if (this.isEmpty(this.projectName.id)) {
  631. this.$modal.msg('请选择工程名称')
  632. return
  633. }
  634. if (this.isNew) {
  635. if (this.isEmpty(this.materialNewValue)) {
  636. this.$modal.msg("请输入材质")
  637. return
  638. }
  639. if (this.isEmpty(this.specificationNewValue)) {
  640. this.$modal.msg("请输入规格")
  641. return
  642. }
  643. } else {
  644. if (this.isEmpty(this.materialValue.id)) {
  645. this.$modal.msg("请选择材质")
  646. return
  647. }
  648. if (this.isEmpty(this.specificationValue.id)) {
  649. this.$modal.msg("请选择规格")
  650. return
  651. }
  652. }
  653. if (this.isEmpty(this.inputNumberValue)) {
  654. this.$modal.msg("请输入数量")
  655. return
  656. }
  657. if (this.imgArr.length <= 0) {
  658. this.$modal.msg('请上传照片或视频')
  659. return
  660. }
  661. if (this.loading == false) {
  662. this.$modal.msg('照片或视频未上传完毕,无法提交!')
  663. return
  664. }
  665. if (this.isNew) {
  666. //新增
  667. this.zEngineeringMaterialBo.push({
  668. specifications: this.specificationNewValue,
  669. materialQuality: this.materialNewValue,
  670. number: this.inputNumberValue,
  671. })
  672. } else {
  673. //选择的
  674. this.zEngineeringMaterialBo.push({
  675. materialQuality: this.materialValue.id, //材质
  676. specifications: this.specificationValue.id, //规格
  677. number: this.inputNumberValue //数量
  678. })
  679. }
  680. let param = {
  681. enginName: this.projectName.name,
  682. enginAddre: this.gcdzValue, //工程地址
  683. constructUnit: this.jsdwValue, //建设单位
  684. startTime: this.kgsjValue, //开工时间
  685. plannedDuration: this.jhgqValue, //计划工期
  686. completedTime: this.jgsjValue, //竣工时间
  687. enginContent: this.gcnrValue, //工程内容 长度100
  688. files: this.fileArr, // 文件信息 数组
  689. id: this.id, // 基建工程id
  690. zEngineeringNodeBo: {
  691. type: this.objValue.value,
  692. zEngineeringInfoBo: {
  693. constructTime: this.time,
  694. zEngiineeringPhotoBoList: this.imgArr,
  695. zEngineeringMaterialBo: this.zEngineeringMaterialBo
  696. }
  697. }
  698. }
  699. SubmitInfrastructure(param).then(res => {
  700. if (res.code == '200') {
  701. uni.showToast({
  702. title: res.msg,
  703. icon: 'none',
  704. //显示持续时间为 3秒
  705. duration: 1000
  706. });
  707. setTimeout(function() {
  708. uni.navigateBack();
  709. }, 1000)
  710. }
  711. })
  712. },
  713. }
  714. }
  715. </script>
  716. <style>
  717. .container {
  718. display: flex;
  719. margin-left: 10px;
  720. margin-top: 10px;
  721. margin-right: 10px;
  722. align-items: flex-start;
  723. justify-content: space-between;
  724. }
  725. .text {
  726. font-size: 16px;
  727. color: #333;
  728. }
  729. .background {
  730. border: 15px solid hsla(0, 0%, 100%, .5);
  731. background: white;
  732. background-clip: padding-box;
  733. padding-left: 5px;
  734. padding-right: 10px;
  735. /*从padding开始往外面裁剪背景*/
  736. }
  737. .btn {
  738. margin-top: 40px;
  739. margin-right: 20px;
  740. margin-bottom: 120px;
  741. margin-left: 20px;
  742. height: 45px;
  743. }
  744. .number {
  745. display: flex;
  746. /* 水平居中显示子元素 */
  747. align-items: flex-start;
  748. /* 垂直居中显示子元素 */
  749. justify-content: space-between;
  750. /* 左右间距等于间距大小 */
  751. padding: 10px;
  752. /* 设置padding以提高视觉效果 */
  753. }
  754. .textarea {
  755. margin-top: 10upx;
  756. width: 100%;
  757. border: 1rpx solid red;
  758. min-height: 100upx;
  759. line-height: 20px;
  760. }
  761. page {
  762. background: #f2f2f2;
  763. }
  764. .flex-x {
  765. display: flex;
  766. align-items: center;
  767. }
  768. .template_title,
  769. .template_title1,
  770. .template_title_list {
  771. height: 90rpx;
  772. background: #fff;
  773. justify-content: space-between;
  774. padding: 0 30rpx;
  775. box-sizing: border-box;
  776. }
  777. .template_title1 {
  778. background: none;
  779. }
  780. .template_title_list {
  781. margin-bottom: 4rpx;
  782. }
  783. .template_title>view,
  784. .template_title1>view {
  785. font-size: 32rpx;
  786. color: #8f8f8f;
  787. flex-shrink: 0;
  788. margin-right: 20rpx;
  789. }
  790. .template_title>input {
  791. font-size: 28rpx;
  792. color: #808080;
  793. text-align: right;
  794. flex-grow: 1;
  795. }
  796. /* 添加内容 */
  797. .add_con>text {
  798. font-size: 40rpx;
  799. color: #f16765;
  800. display: block;
  801. margin-right: 20rpx;
  802. margin-left: 10rpx;
  803. line-height: 44rpx;
  804. }
  805. .add_con>view {
  806. font-size: 32rpx;
  807. color: #7885cb;
  808. }
  809. /* 删除内容 */
  810. .del {
  811. font-size: 32rpx;
  812. color: #f16765;
  813. margin-right: 14rpx;
  814. padding: 20rpx;
  815. }
  816. input {
  817. flex-grow: 1;
  818. font-size: 28rpx;
  819. color: #808080;
  820. }
  821. .btn {
  822. margin-top: 100rpx;
  823. }
  824. </style>