infrastructure.vue 25 KB

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