infrastructure.vue 28 KB

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