enginproject.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978
  1. <template>
  2. <view>
  3. <view class="background">
  4. <view class="uni-list">
  5. <view class="container">
  6. <view>
  7. 工程类型
  8. </view>
  9. <view v-if="this.isEmpty(this.projectType.dictValue)" style="margin-top: 10;"
  10. @click="pickerShow('gclx',0)">
  11. <span style="color: darkgray;">请选择工程类型</span>
  12. </view>
  13. <view v-else class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gclx',0)">
  14. <span style="color: black;">{{projectType.dictLabel}}</span>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="uni-list">
  19. <view class="container">
  20. <text>工程名称</text>
  21. <input class="uni-input" type="text" v-model="projectName" placeholder="请填写工程名称" maxlength="100"
  22. style="margin-left: 10px;text-align: right;"></input>
  23. </view>
  24. </view>
  25. <view class="uni-list">
  26. <view class="container">
  27. <text>建设单位</text>
  28. <input class="uni-input" type="text" v-model="jsdwValue" placeholder="请填写建设单位" maxlength="100"
  29. style="margin-left: 10px;text-align: right;"></input>
  30. </view>
  31. </view>
  32. <view class="uni-list">
  33. <view class="container">
  34. <text>项目负责人</text>
  35. <input class="uni-input" type="text" v-model="xmfzrValue" placeholder="请填写项目负责人" maxlength="16"
  36. style="margin-left: 10px;text-align: right;"></input>
  37. </view>
  38. </view>
  39. <view class="uni-list">
  40. <view class="container">
  41. <text>现场负责人</text>
  42. <input class="uni-input" type="text" v-model="xcfzrValue" placeholder="请填写现场负责人" maxlength="16"
  43. style="margin-left: 10px;text-align: right;"></input>
  44. </view>
  45. </view>
  46. <view class="uni-list">
  47. <view class="container">
  48. <text>设计单位</text>
  49. <input class="uni-input" type="text" v-model="sjdwValue" placeholder="请填写设计单位" maxlength="100"
  50. style="margin-left: 10px;text-align: right;"></input>
  51. </view>
  52. </view>
  53. <view class="uni-list">
  54. <view class="container">
  55. <text>设计负责人</text>
  56. <input class="uni-input" type="text" v-model="sjfzrValue" placeholder="请填写设计负责人" maxlength="16"
  57. style="margin-left: 10px;text-align: right;"></input>
  58. </view>
  59. </view>
  60. <view class="uni-list">
  61. <view class="container">
  62. <text>设计联系电话</text>
  63. <input class="uni-input" type="number" v-model="sjPhoneValue" placeholder="请填写设计联系电话"
  64. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  65. </view>
  66. </view>
  67. <view class="uni-list">
  68. <view class="container">
  69. <text>监理单位</text>
  70. <input class="uni-input" type="text" v-model="jldwValue" placeholder="请填写监理单位" maxlength="100"
  71. style="margin-left: 10px;text-align: right;"></input>
  72. </view>
  73. </view>
  74. <view class="uni-list">
  75. <view class="container">
  76. <text>监理负责人</text>
  77. <input class="uni-input" type="text" v-model="jlfzrValue" placeholder="请填写监理负责人" maxlength="16"
  78. style="margin-left: 10px;text-align: right;"></input>
  79. </view>
  80. </view>
  81. <view class="uni-list">
  82. <view class="container">
  83. <text>监理联系电话</text>
  84. <input class="uni-input" type="number" v-model="jlPhoneValue" placeholder="请填写监理联系电话"
  85. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  86. </view>
  87. </view>
  88. <view class="uni-list">
  89. <view class="align-items" style="margin-bottom: 20px;">
  90. <view class="container" style="color: gainsboro;">*请上传文件</view>
  91. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  92. <image src="/static/images/chooseimg.png" mode=""
  93. style="width: 100rpx; height: 100rpx; margin: 0 12rpx;; " @click="chooseFile()"></image>
  94. <view v-for="(item,index) in fileArr" :key="index" style="position: relative;">
  95. <view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">{{item.name}}
  96. <!-- <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
  97. </image> -->
  98. </view>
  99. <view @click="removeFile(index)"
  100. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  101. <uni-icons type="close" color="darkgray" size="18"></uni-icons>
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  108. subtitleKey="id" v-model="name"></SelectPicker>
  109. <SelectPicker :list="dictOptions" @change="changeSelectDict" v-if="openDict" @close="closeDict"
  110. titleKey="dictLabel" subtitleKey="dictValue" v-model="dictLabel"></SelectPicker>
  111. </view>
  112. <view class="background">
  113. <view>
  114. <view class="uni-list">
  115. <view style="font-size: 16px;margin-left: 10px;margin-top: 10px;">
  116. {{objValue.value}}
  117. <span
  118. style="color: blue;font-size: 14px; display: flex;justify-content:flex-end; margin-right: 15px;"
  119. @click="history">历史</span>
  120. </view>
  121. <view class="container">
  122. <view>
  123. 施工时间
  124. </view>
  125. <view style="margin-top: 10;" @click="openDatetimePicker()">
  126. <span style="color: black;">{{time}}</span>
  127. </view>
  128. </view>
  129. <view v-for="(a,index) in czggslList" :key="index">
  130. <view class="container">
  131. <view>
  132. 材质
  133. </view>
  134. <view class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('cz',index)">
  135. <span style="color: black;">{{a.cz.id==''?'请选择材质':a.cz.name}}</span>
  136. </view>
  137. </view>
  138. <view class="container">
  139. <view>
  140. 规格
  141. </view>
  142. <view class="uni-list-cell-db" style="margin-top: 10;" @click="pickerShow('gg',index)">
  143. <span style="color: black;">{{a.gg.id==''?'请选择规格':a.gg.name}}</span>
  144. </view>
  145. </view>
  146. <view class="container">
  147. <text>数量</text>
  148. <input class="uni-input" type="number" v-model="a.sl" placeholder="请填写数量" maxlength="11"
  149. style="margin-left: 10px;text-align: right;"></input>
  150. </view>
  151. <button v-if="index!=0" @click="this.czggslList.splice(index,1)">删除</button>
  152. </view>
  153. <button
  154. @click="this.czggslList.push({cz:{id: '',name: ''},gg:{id: '',name: ''},sl:''})">添加</button>
  155. </view>
  156. <view class="align-items" style="margin-top: 20px;margin-bottom: 20px;">
  157. <view class="container" style="color: gainsboro;">*请上传照片</view>
  158. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  159. <image src="/static/images/chooseimg.png" mode=""
  160. style="width: 100rpx; height: 100rpx; margin: 0 12rpx;; " @click="choose()"></image>
  161. <view v-for="(item,index) in imgArr" :key="index" style="position: relative;">
  162. <view
  163. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ">
  164. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  165. @click="showPhoto(index)">
  166. </image>
  167. </view>
  168. <view v-else>
  169. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  170. </view>
  171. <view @click="remove(index)"
  172. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  173. <uni-icons type="close" color="darkgray" size="18"></uni-icons>
  174. </view>
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. </view>
  180. <view class="action-btn">
  181. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认上传</button>
  182. </view>
  183. <bottom-sheet ref="refShare" :data="historyList"></bottom-sheet>
  184. <yt-dateTimePicker ref="myPicker" @submit="handleSubmit" :start-year="2024" :end-year="2099"
  185. :time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
  186. </view>
  187. </template>
  188. <script>
  189. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  190. import bottomSheet from '../../components/bottomSheet/bottomSheet.vue'
  191. import uniIcons from '../../uni_modules/uni-icons/components/uni-icons/uni-icons.vue'
  192. import {
  193. getDicts
  194. } from "@/api/system/dict/data";
  195. import {
  196. getEnginMaterialQualityList,
  197. getEnginSpecificationsList,
  198. getRoomProjectList,
  199. getRoomProjectId,
  200. Submitengineering,
  201. } from '@/api/common'
  202. import {
  203. getToken
  204. } from '../../utils/auth';
  205. import {
  206. getUserProfile
  207. } from "@/api/system/user"
  208. export default {
  209. components: {
  210. SelectPicker,
  211. uniIcons,
  212. bottomSheet,
  213. },
  214. data() {
  215. return {
  216. zEngineeringMaterialBo: [], //给后台传的值 用料列表
  217. czggslList: [{
  218. cz: {
  219. id: '',
  220. name: ''
  221. },
  222. gg: {
  223. id: '',
  224. name: ''
  225. },
  226. sl: ''
  227. }, ],
  228. conLists: [],
  229. headers: {
  230. Authorization: "Bearer " + getToken()
  231. },
  232. time: '', //施工时间
  233. user: {
  234. nickName: "",
  235. phonenumber: "",
  236. email: "",
  237. sex: ""
  238. },
  239. loading: false,
  240. loadingFile: false,
  241. projectType: {}, //工程类型
  242. open: false,
  243. objValue: '', //上一页面传过来的值 新增接口用
  244. openDict: false,
  245. specificationValue: {}, //规格
  246. projectContent: '', //施工内容
  247. materialValue: {}, //材质
  248. selectList: [],
  249. dictOptions: [],
  250. imgArr: [],
  251. fileArr: [],
  252. fileNameArr: [],
  253. type: '',
  254. jlPhoneValue: '', //监理电话
  255. jlfzrValue: '', //监理负责人
  256. jldwValue: '', //监理单位
  257. sjPhoneValue: '', //设计电话
  258. sjfzrValue: '', //设计负责人
  259. sjdwValue: '', //设计单位
  260. xcfzrValue: '', //现场负责人
  261. xmfzrValue: '', //项目负责人
  262. jsdwValue: '', //建设单位
  263. projectName: '', //工程名称
  264. SelectIndex: '', //选择的索引值
  265. }
  266. },
  267. created() {
  268. this.getUser();
  269. this.time = this.traversalTime(new Date().getTime()) //在data里定义变量-nowTime
  270. console.log(this.time)
  271. },
  272. onLoad(options) {
  273. if ('params' in options) {
  274. this.objValue = JSON.parse(decodeURIComponent(options.params));
  275. if (this.objValue.enginType == `old_renovation`) {
  276. this.title = '旧改工程-庭院'
  277. } else if (this.objValue.enginType == `new_built`) {
  278. this.title = '新建工程-庭院'
  279. }
  280. uni.setNavigationBarTitle({
  281. title: this.title
  282. })
  283. }
  284. },
  285. methods: {
  286. //判断是否选择
  287. isEmpty(str) {
  288. return (!str || 0 === str.length);
  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.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. getUser() {
  318. getUserProfile().then(response => {
  319. this.user = response.data.user
  320. })
  321. },
  322. pickerShow(e, index) {
  323. this.SelectIndex = index;
  324. this.type = e; //赋值类型
  325. if (e == 'cz') { //材质
  326. this.open = true;
  327. getEnginMaterialQualityList("民用工程").then(response => {
  328. this.selectList = response.data;
  329. });
  330. } else if (e == 'gg') { //规格
  331. if (this.isEmpty(this.czggslList[index].cz.id)) {
  332. this.$modal.msg('请选择材质')
  333. // this.czggslList[index].cz = this.materialValue.id
  334. } else {
  335. this.open = true;
  336. this.selectList = this.materialList;
  337. }
  338. } else if (e == 'gclx') { //工程类型
  339. this.openDict = true;
  340. getDicts("industry_engin_type").then(response => {
  341. this.dictOptions = response.data;
  342. });
  343. }
  344. },
  345. chooseFile() {
  346. let _this = this;
  347. console.log('文件')
  348. uni.chooseMessageFile({
  349. // sizeType: ['album', 'camera'],
  350. type: 'all',
  351. success(resp) {
  352. resp.tempFiles.forEach((item, index) => {
  353. const task = uni.uploadFile({
  354. url: _this.$HTTP + `/obs`,
  355. filePath: item.path,
  356. name: 'file',
  357. formData: {},
  358. header: _this.headers,
  359. success: res => {
  360. // 判断是否json字符串,将其转为json格式
  361. console.log("结果", res)
  362. // let data = _this.$u.test.jsonString(res
  363. // .data) ? JSON.parse(res.data) : res.data;
  364. let data = JSON.parse(res.data);
  365. if (![200].includes(data.code)) {
  366. // this.uploadError(index, data);
  367. _this.$modal.msg(data.msg)
  368. } else {
  369. if (_this.progress === 100) {
  370. console.log('_this.progress', _this.progress)
  371. //console.log('data----', data)data
  372. console.log('res--', res)
  373. _this.fileArr.push({
  374. 'name': item.name,
  375. 'url': data.data.url
  376. })
  377. _this.fileNameArr.push(item.name)
  378. console.log('fileArr', _this.fileArr)
  379. _this.$modal.msg('上传成功!')
  380. }
  381. }
  382. },
  383. fail: e => {
  384. console.log(e)
  385. _this.$modal.msg('上传失败!')
  386. //_this.uploadError(index, e);
  387. },
  388. complete: res => {
  389. uni.hideLoading();
  390. _this.uploading = false;
  391. }
  392. });
  393. task.onProgressUpdate(res => {
  394. _this.progress = res.progress;
  395. console.log('onProgressUpdate', res)
  396. console.log('task.onProgressUpdate', _this.progress)
  397. uni.showLoading({
  398. title: '上传中'
  399. })
  400. if (_this.progress != 100) {
  401. _this.loading = false
  402. console.log('_this.loading false', _this.loading)
  403. } else {
  404. _this.loading = true
  405. console.log('_this.loading true', _this.loading)
  406. }
  407. });
  408. })
  409. },
  410. })
  411. },
  412. showPhoto(index) {
  413. uni.previewImage({
  414. current: index,
  415. urls: this.imgArr,
  416. })
  417. },
  418. removeFile(index) {
  419. uni.showModal({
  420. title: '提示',
  421. content: '是否删除该文件?',
  422. success: (res) => {
  423. if (res.confirm) {
  424. this.fileArr.splice(index, 1)
  425. this.fileNameArr.splice(index, 1)
  426. console.log('this.fileArr', this.fileArr)
  427. }
  428. }
  429. })
  430. },
  431. remove(index) {
  432. uni.showModal({
  433. title: '提示',
  434. content: '是否删除该图片或视频?',
  435. success: (res) => {
  436. if (res.confirm) {
  437. this.imgArr.splice(index, 1)
  438. console.log('this.imgarr', this.imgArr)
  439. // if (this.imgArr.length <= 0) {
  440. // this.photo = true;
  441. // }
  442. }
  443. }
  444. })
  445. },
  446. choose() {
  447. let _this = this;
  448. uni.showActionSheet({
  449. title: '上传',
  450. itemList: ['图片', '视频'],
  451. success: (res) => {
  452. console.log(res)
  453. if (res.tapIndex == 0) {
  454. this.chooseimage()
  455. } else {
  456. this.choosevideo()
  457. }
  458. }
  459. })
  460. },
  461. chooseimage() {
  462. let _this = this;
  463. console.log('图片', _this.headers)
  464. uni.chooseImage({
  465. sizeType: ['album', 'camera'],
  466. success(resp) {
  467. resp.tempFiles.forEach((item, index) => {
  468. const task = uni.uploadFile({
  469. url: _this.$HTTP + `/obs`,
  470. filePath: item.path,
  471. name: 'file',
  472. formData: {},
  473. header: _this.headers,
  474. success: res => {
  475. // 判断是否json字符串,将其转为json格式
  476. console.log("结果", res)
  477. // let data = _this.$u.test.jsonString(res
  478. // .data) ? JSON.parse(res.data) : res.data;
  479. let data = JSON.parse(res.data);
  480. if (![200].includes(data.code)) {
  481. // this.uploadError(index, data);
  482. _this.$modal.msg(data.msg)
  483. } else {
  484. if (_this.progress === 100) {
  485. console.log('_this.progress', _this.progress)
  486. //console.log('data----', data)data
  487. console.log('res--', res)
  488. _this.imgArr.push(data.data.url)
  489. console.log('imgArr', _this.imgArr)
  490. _this.$modal.msg('上传成功!')
  491. //_this.photo = false;
  492. }
  493. }
  494. },
  495. fail: e => {
  496. console.log(e)
  497. _this.$modal.msg('上传失败!')
  498. //_this.uploadError(index, e);
  499. },
  500. complete: res => {
  501. uni.hideLoading();
  502. _this.uploading = false;
  503. }
  504. });
  505. task.onProgressUpdate(res => {
  506. _this.progress = res.progress;
  507. console.log('onProgressUpdate', res)
  508. console.log('task.onProgressUpdate', _this.progress)
  509. uni.showLoading({
  510. title: '上传中'
  511. })
  512. if (_this.progress != 100) {
  513. _this.loading = false
  514. console.log('_this.loading false', _this.loading)
  515. } else {
  516. _this.loading = true
  517. console.log('_this.loading true', _this.loading)
  518. }
  519. });
  520. })
  521. },
  522. })
  523. },
  524. choosevideo() {
  525. let _this = this;
  526. console.log('视频')
  527. uni.chooseVideo({
  528. sourceType: ['album', 'camera'],
  529. maxDuration: 30,
  530. success(resp) {
  531. const task = uni.uploadFile({
  532. url: _this.$HTTP + `/obs`,
  533. filePath: resp.tempFilePath,
  534. name: 'file',
  535. formData: {},
  536. header: _this.headers,
  537. success: res => {
  538. // 判断是否json字符串,将其转为json格式
  539. let data = JSON.parse(res.data);
  540. if (![200].includes(res.statusCode)) {
  541. this.uploadError(index, data);
  542. } else {
  543. //上传成功
  544. if (_this.progress === 100) {
  545. console.log('_this.progress', _this.progress)
  546. _this.imgArr.push(data.data.url)
  547. console.log('imgArr', _this.imgArr)
  548. _this.$modal.msg('上传成功!')
  549. //_this.photo = false;
  550. }
  551. }
  552. },
  553. fail: e => {
  554. _this.$modal.msg('上传失败!')
  555. this.uploadError(index, e);
  556. },
  557. complete: res => {
  558. uni.hideLoading();
  559. _this.uploading = false;
  560. }
  561. });
  562. task.onProgressUpdate(res => {
  563. _this.progress = res.progress;
  564. console.log('onProgressUpdate', res)
  565. uni.showLoading({
  566. title: '上传中'
  567. })
  568. if (_this.progress != 100) {
  569. _this.loadingFile = false
  570. console.log('_this.loading false', _this.loading)
  571. } else {
  572. _this.loadingFile = true
  573. console.log('_this.loading true', _this.loading)
  574. }
  575. });
  576. },
  577. })
  578. },
  579. changeSelectDict(item, index) {
  580. this.openDict = false;
  581. this.projectType = item
  582. },
  583. changeSelect(item, index) {
  584. // this.index = index;
  585. // this.address = item.communityName;
  586. this.open = false;
  587. if (this.type == 'cz') {
  588. this.materialValue = item;
  589. this.specificationValue = ''; //重置规格
  590. //根据材质ID 获取规格数据
  591. getEnginSpecificationsList(item.id).then(res => {
  592. this.materialList = res.data
  593. this.czggslList[this.SelectIndex].cz.id = this.materialValue.id
  594. this.czggslList[this.SelectIndex].cz.name = this.materialValue.name
  595. })
  596. } else if (this.type == 'gg') {
  597. this.specificationValue = item;
  598. this.czggslList[this.SelectIndex].gg.id = this.specificationValue.id
  599. this.czggslList[this.SelectIndex].gg.name = this.specificationValue.name
  600. } else if (this.type == 'gclx') {
  601. this.projectType = item
  602. }
  603. },
  604. //关闭弹窗
  605. close(e) {
  606. this.open = false
  607. },
  608. //关闭弹窗
  609. closeDict(e) {
  610. this.openDict = false
  611. },
  612. submit() {
  613. console.log("文件", this.fileArr)
  614. if (this.isEmpty(this.projectType.dictValue)) {
  615. this.$modal.msg('请选择工程类型')
  616. return
  617. }
  618. if (this.isEmpty(this.projectName)) {
  619. this.$modal.msg('工程名称不能为空')
  620. return
  621. }
  622. if (this.isEmpty(this.jsdwValue)) {
  623. this.$modal.msg('建设单位不能为空')
  624. return
  625. }
  626. if (this.isEmpty(this.xmfzrValue)) {
  627. this.$modal.msg('项目负责人不能为空')
  628. return
  629. }
  630. if (this.isEmpty(this.xcfzrValue)) {
  631. this.$modal.msg('现场负责人不能为空')
  632. return
  633. }
  634. if (this.isEmpty(this.sjdwValue)) {
  635. this.$modal.msg('设计单位不能为空')
  636. return
  637. }
  638. if (this.isEmpty(this.sjfzrValue)) {
  639. this.$modal.msg('设计负责人不能为空')
  640. return
  641. }
  642. if (this.isEmpty(this.sjPhoneValue)) {
  643. this.$modal.msg('设计联系电话不能为空')
  644. return
  645. }
  646. if (!this.$validation.mobile(this.sjPhoneValue)) {
  647. this.$modal.msg('设计联系电话格式错误')
  648. return
  649. }
  650. if (this.isEmpty(this.jldwValue)) {
  651. this.$modal.msg('监理单位不能为空')
  652. return
  653. }
  654. if (this.isEmpty(this.jlfzrValue)) {
  655. this.$modal.msg('监理负责人不能为空')
  656. return
  657. }
  658. if (this.isEmpty(this.jlPhoneValue)) {
  659. this.$modal.msg('监理联系电话不能为空')
  660. return
  661. }
  662. if (!this.$validation.mobile(this.jlPhoneValue)) {
  663. this.$modal.msg('监理联系电话格式错误')
  664. return
  665. }
  666. if (this.fileArr.length <= 0) {
  667. this.$modal.msg('请上传文件')
  668. } else if (this.loadingFile == false) {
  669. this.$modal.msg('文件未上传完毕,无法提交!')
  670. }
  671. try {
  672. //console.log("刚开始", this.czggslList);
  673. this.czggslList.forEach((list) => {
  674. if (this.isEmpty(list.cz.id)) {
  675. this.$modal.msg('材质不能为空')
  676. throw new Error('End Loop')
  677. }
  678. if (this.isEmpty(list.gg.id)) {
  679. this.$modal.msg('规格不能为空')
  680. throw new Error('End Loop')
  681. }
  682. if (this.isEmpty(list.sl)) {
  683. this.$modal.msg('数量不能为空')
  684. throw new Error('End Loop')
  685. }
  686. })
  687. } catch (e) {
  688. if (e.message === 'End Loop') throw e
  689. }
  690. if (this.imgArr.length <= 0) {
  691. this.$modal.msg('请上传照片或视频')
  692. return
  693. }
  694. if (this.loading == false) {
  695. this.$modal.msg('照片或视频未上传完毕,无法提交!')
  696. return
  697. }
  698. this.czggslList.forEach((list) => {
  699. this.zEngineeringMaterialBo.push({
  700. materialQuality: list.cz.id,
  701. specifications: list.gg.id,
  702. number: list.sl
  703. })
  704. }),
  705. console.log("数据", this.zEngineeringMaterialBo)
  706. let param = {
  707. files: this.fileArr, //文件
  708. type: '1', // 用来区分工业工程=1、市政工程=2
  709. enginName: this.projectName, //工程名称
  710. enginType: this.projectType.dictValue, // 工程类型
  711. constructUnit: this.jsdwValue, // 建筑单位
  712. projectHead: this.xmfzrValue, // 项目负责人
  713. sceneHead: this.xcfzrValue, // 现场负责人
  714. designUnit: this.sjdwValue, // 设计单位
  715. designHead: this.sjfzrValue, // 设计负责人
  716. designPhone: this.sjPhoneValue, // 设计联系电话
  717. supervisionUnit: this.jldwValue, // 监理单位
  718. supervisionHead: this.jlfzrValue, // 监理负责人
  719. supervisionPhone: this.jlPhoneValue, // 监理联系电话
  720. enginClassification: this.objValue.value, // 工程分类 上一页面传过来的
  721. zEngineeringNodeBo: {
  722. type: '工业工程', // 写死
  723. zEngineeringInfoBo: {
  724. zEngiineeringPhotoBoList: this.imgArr, //照片集合
  725. zEngineeringMaterialBo: this.zEngineeringMaterialBo // 用料对象
  726. }
  727. }
  728. }
  729. Submitengineering(param).then(res => {
  730. if (res.code == '200') {
  731. uni.showToast({
  732. title: res.msg,
  733. icon: 'none',
  734. //显示持续时间为 3秒
  735. duration: 2000
  736. });
  737. setTimeout(function() {
  738. uni.navigateBack();
  739. }, 1000)
  740. }
  741. })
  742. }
  743. }
  744. }
  745. </script>
  746. <style>
  747. .container {
  748. display: flex;
  749. margin-left: 10px;
  750. margin-top: 10px;
  751. margin-right: 10px;
  752. align-items: flex-start;
  753. justify-content: space-between;
  754. }
  755. .text {
  756. font-size: 16px;
  757. color: #333;
  758. }
  759. .background {
  760. border: 15px solid hsla(0, 0%, 100%, .5);
  761. background: white;
  762. background-clip: padding-box;
  763. /*从padding开始往外面裁剪背景*/
  764. }
  765. .btn {
  766. margin-top: 40px;
  767. margin-right: 20px;
  768. margin-bottom: 120px;
  769. margin-left: 20px;
  770. height: 45px;
  771. }
  772. .number {
  773. display: flex;
  774. /* 水平居中显示子元素 */
  775. align-items: flex-start;
  776. /* 垂直居中显示子元素 */
  777. justify-content: space-between;
  778. /* 左右间距等于间距大小 */
  779. padding: 10px;
  780. /* 设置padding以提高视觉效果 */
  781. }
  782. .textarea {
  783. margin-top: 10upx;
  784. width: 100%;
  785. border: 1rpx solid red;
  786. min-height: 100upx;
  787. line-height: 20px;
  788. }
  789. page {
  790. background: #f2f2f2;
  791. }
  792. .flex-x {
  793. display: flex;
  794. align-items: center;
  795. }
  796. .template_title,
  797. .template_title1,
  798. .template_title_list {
  799. height: 90rpx;
  800. background: #fff;
  801. justify-content: space-between;
  802. padding: 0 30rpx;
  803. box-sizing: border-box;
  804. }
  805. .template_title1 {
  806. background: none;
  807. }
  808. .template_title_list {
  809. margin-bottom: 4rpx;
  810. }
  811. .template_title>view,
  812. .template_title1>view {
  813. font-size: 32rpx;
  814. color: #8f8f8f;
  815. flex-shrink: 0;
  816. margin-right: 20rpx;
  817. }
  818. .template_title>input {
  819. font-size: 28rpx;
  820. color: #808080;
  821. text-align: right;
  822. flex-grow: 1;
  823. }
  824. /* 添加内容 */
  825. .add_con>text {
  826. font-size: 40rpx;
  827. color: #f16765;
  828. display: block;
  829. margin-right: 20rpx;
  830. margin-left: 10rpx;
  831. line-height: 44rpx;
  832. }
  833. .add_con>view {
  834. font-size: 32rpx;
  835. color: #7885cb;
  836. }
  837. /* 删除内容 */
  838. .del {
  839. font-size: 32rpx;
  840. color: #f16765;
  841. margin-right: 14rpx;
  842. padding: 20rpx;
  843. }
  844. input {
  845. flex-grow: 1;
  846. font-size: 28rpx;
  847. color: #808080;
  848. }
  849. .btn {
  850. margin-top: 100rpx;
  851. }
  852. </style>