TopPipeWork.vue 27 KB

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