infrastructure.vue 25 KB

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