historyDetailsEnginproject.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942
  1. <template>
  2. <scroll-view>
  3. <view class="uni-media-list" v-for="(value, key) in dataJson.zEngineeringNodeBo.zEngineeringInfoBoList"
  4. :key="key" v-if="isEdit(value)">
  5. <view class="uni-media-list-body">
  6. <view>
  7. <view class="uni-media-list-text-top">
  8. <view class="tit-text">施工时间:</view>{{value.updateTime}}
  9. </view>
  10. <view class="uni-media-list-text-top">
  11. <view class="uni-common-mt" style="width: 100%;">
  12. <text class="tit-text" style=" font-size: 13px;color:
  13. #000;margin-top: 5px;">施工内容:</text>
  14. <view style="width: 100%;box-sizing: border-box;">
  15. <textarea class="textarea" maxlength="255" placeholder-style="padding: 10rpx;"
  16. style="width: 100%;height: 100%;border: 1rpx solid #cccccc; border-radius: 15rpx;padding: 10rpx;line-height:normal;"
  17. auto-height :value="value.remark"
  18. @blur="bindTextAreaBlur($event.target.value,key)"></textarea>
  19. </view>
  20. </view>
  21. </view>
  22. <view v-if="title=='表组'||title=='室内管线'||title=='室外管线'">
  23. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  24. <image :src="loadImgSrc('updateimg.png')" mode=""
  25. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('other',key)">
  26. </image>
  27. <view v-for="(item,index) in value.zEngiineeringPhotoBoList" :key="index"
  28. style="position: relative;">
  29. <view
  30. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg'||item.substring(item.length-4)=='jpeg' ">
  31. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  32. @click="showPhoto(index,value.zEngiineeringPhotoBoList)">
  33. </image>
  34. </view>
  35. <view v-else>
  36. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  37. </view>
  38. <view @click="remove(index,key)"
  39. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  40. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  41. </image>
  42. </view>
  43. </view>
  44. <view class="cz-style" v-for="(a,index) in value.zEngineeringMaterialBo" :key="index">
  45. <view class="uni-media-list-text-top" style=" ">
  46. <view class="tit-text">材质:</view>
  47. <view class="uni-list-cell-db" style="margin-top: 10;"
  48. @click="pickerShow('cz',key,index)">
  49. <span
  50. style="color: black;">{{a.materialQualityName==''?'请选择材质':a.materialQualityName}}</span>
  51. </view>
  52. </view>
  53. <view class="uni-media-list-text-top" style=" ">
  54. <view class="tit-text">规格:</view>
  55. <view class="uni-list-cell-db" style="margin-top: 10;"
  56. @click="pickerShow('gg',key,index)">
  57. <span
  58. style="color: black;">{{a.specificationsName==''?'请选择规格':a.specificationsName}}</span>
  59. </view>
  60. </view>
  61. <view class="uni-media-list-text-top" style="border-bottom: 1px solid #f8f8f8;">
  62. <text class="tit-text">米 数</text>
  63. <view style="display: flex; justify-content: right; width: 70%;">
  64. <input class="uni-input" type="number" :value="getIntegerPart(a.number,0)"
  65. @change="setInfoBoNumber(key,index,$event.target.value,0)" maxlength="6"
  66. style="text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  67. <text style="font-weight:bold;margin-left: 10px;margin-right: 10px;">.</text>
  68. <input class="uni-input" type="number" :value="getIntegerPart(a.number,1)"
  69. @change="setInfoBoNumber(key,index,$event.target.value,1)" maxlength="1"
  70. style="text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  71. </view>
  72. </view>
  73. <button v-if="index!=0" @click="btnDel(key,index)" class="sc-btn">删除</button>
  74. </view>
  75. <button @click="btnAdd(key,index)" class="tj-btn">添加</button>
  76. </view>
  77. </view>
  78. <view v-if="title=='调压柜'">
  79. <view class="uni-common-mt" style="width: 100%;">
  80. <text class="uni-title uni-common-pl" style=" font-size: 13px;color:
  81. #000;margin-top: 5px; margin-left: 8px;">调压箱铭牌照片:</text>
  82. </view>
  83. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
  84. <image :src="loadImgSrc('updateimg.png')" mode=""
  85. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('Box',key)">
  86. </image>
  87. <view v-for="(item,index) in value.boxBrand" :key="index" style="position: relative;">
  88. <view
  89. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' || item.substring(item.length - 3) == 'jpeg'">
  90. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  91. @click="showPhoto(index,value.boxBrand)">
  92. </image>
  93. </view>
  94. <view v-else>
  95. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  96. </view>
  97. <view @click="removeht(index,key,'Box')"
  98. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  99. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  100. </image>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="uni-common-mt" style="width: 100%;">
  105. <text class="uni-title uni-common-pl" style=" font-size: 13px;color:
  106. #000;margin-top: 5px;margin-left: 8px;">调压箱内石粉回填照片:</text>
  107. </view>
  108. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
  109. <image :src="loadImgSrc('updateimg.png')" mode=""
  110. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('Sfht',key)">
  111. </image>
  112. <view v-for="(item,index) in value.stonePowder" :key="index" style="position: relative;">
  113. <view
  114. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' || item.substring(item.length - 3) == 'jpeg'">
  115. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  116. @click="showPhoto(index,value.stonePowder)">
  117. </image>
  118. </view>
  119. <view v-else>
  120. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  121. </view>
  122. <view @click="removeht(index,key,'Sfht')"
  123. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  124. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  125. </image>
  126. </view>
  127. </view>
  128. </view>
  129. <view class="uni-common-mt" style="width: 100%;">
  130. <text class="uni-title uni-common-pl" style=" font-size: 13px;color:
  131. #000;margin-top: 5px;margin-left: 8px;">调压箱防雷接地照片:</text>
  132. </view>
  133. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
  134. <image :src="loadImgSrc('updateimg.png')" mode=""
  135. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('Fljd',key)">
  136. </image>
  137. <view v-for="(item,index) in value.lightning" :key="index" style="position: relative;">
  138. <view
  139. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' || item.substring(item.length - 3) == 'jpeg'">
  140. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  141. @click="showPhoto(index,value.lightning)">
  142. </image>
  143. </view>
  144. <view v-else>
  145. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  146. </view>
  147. <view @click="removeht(index,key,'Fljd')"
  148. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  149. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  150. </image>
  151. </view>
  152. </view>
  153. </view>
  154. <view class="uni-common-mt" style="width: 100%;">
  155. <text class="uni-title uni-common-pl" style=" font-size: 13px;color:
  156. #000;margin-top: 5px;margin-left: 8px;">调压箱底腿连接照片:</text>
  157. </view>
  158. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
  159. <image :src="loadImgSrc('updateimg.png')" mode=""
  160. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('Dtlj',key)">
  161. </image>
  162. <view v-for="(item,index) in value.bottomLeg" :key="index" style="position: relative;">
  163. <view
  164. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' || item.substring(item.length - 3) == 'jpeg'">
  165. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  166. @click="showPhoto(index,value.bottomLeg)">
  167. </image>
  168. </view>
  169. <view v-else>
  170. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  171. </view>
  172. <view @click="removeht(index,key,'Dtlj')"
  173. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  174. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  175. </image>
  176. </view>
  177. </view>
  178. </view>
  179. <view class="uni-common-mt" style="width: 100%;">
  180. <text class="uni-title uni-common-pl" style=" font-size: 13px;color:
  181. #000;margin-top: 5px;margin-left: 8px;">调压箱护栏及地面硬化(远景)照片:</text>
  182. </view>
  183. <view class="" style="display: flex; flex-wrap: wrap;margin-top: 10px;">
  184. <image :src="loadImgSrc('updateimg.png')" mode=""
  185. style="width: 200rpx; height: 150rpx; margin: 0 12rpx;; " @click="choose('Hldmyh',key)">
  186. </image>
  187. <view v-for="(item,index) in value.groundHardening" :key="index"
  188. style="position: relative;">
  189. <view
  190. v-if="item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' || item.substring(item.length - 3) == 'jpeg'">
  191. <image :src="item" mode="" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"
  192. @click="showPhoto(index,value.groundHardening)">
  193. </image>
  194. </view>
  195. <view v-else>
  196. <video :src="item" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;"></video>
  197. </view>
  198. <view @click="removeht(index,key,'Hldmyh')"
  199. style="position: absolute; top: 0; right: 14rpx; border-radius: 50%;">
  200. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  201. </image>
  202. </view>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. <SelectPicker :list="selectList" @change="changeSelect" v-if="open" @close="close" titleKey="name"
  210. subtitleKey="id">
  211. </SelectPicker>
  212. <SelectPicker :list="dictOptions" @change="changeSelectDict" v-if="openDict" @close="closeDict"
  213. titleKey="dictLabel" subtitleKey="dictValue" v-model="name"></SelectPicker>
  214. <view class="action-btn" v-if="hideButton==false">
  215. <button @click="submit" class="btn cu-btn block bg-blue lg round">确认</button>
  216. </view>
  217. </scroll-view>
  218. </template>
  219. <script>
  220. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  221. import {
  222. getDicts
  223. } from "@/api/system/dict/data";
  224. import {
  225. getToken
  226. } from '../../utils/auth';
  227. import user from '@/store/modules/user'
  228. import {
  229. getHistoryEnginprojectDetails,
  230. getEnginMaterialQualityList,
  231. Putengineering,
  232. getEnginSpecificationsList
  233. } from '@/api/common'
  234. export default {
  235. components: {
  236. SelectPicker,
  237. },
  238. data() {
  239. return {
  240. // playVideo: false,//视频播放放大
  241. // playVideoSrc:'',
  242. selectZbfList: [],
  243. dictOptions: [],
  244. openDict: false,
  245. dataIndex: 0, //数据用第几条
  246. selectIndex: 0, //材质规格用的第几条
  247. imageIndex: 0,
  248. headers: {
  249. Authorization: "Bearer " + getToken()
  250. },
  251. nodeId: '',
  252. type: '',
  253. title: '',
  254. dataJson: '',
  255. enginClassification: '',
  256. enginType: '',
  257. enginClassValue: '',
  258. selectList: [],
  259. open: false,
  260. selectType: '',
  261. hideButton: false,
  262. }
  263. },
  264. onLoad(options) {
  265. if ('params' in options) {
  266. let e = JSON.parse(decodeURIComponent(options.params));
  267. this.nodeId = e.id;
  268. this.type = e.type;
  269. getHistoryEnginprojectDetails(this.nodeId, this.type).then(response => {
  270. if (response.data.zEngineeringNodeBo != null) {
  271. this.hideButton = false;
  272. this.dataJson = response.data;
  273. this.title = response.data.enginClassification;
  274. this.enginType = response.data.enginType;
  275. this.enginClassification = response.data.enginClassification;
  276. } else {
  277. this.hideButton = true;
  278. this.$modal.msg("暂无历史信息")
  279. }
  280. });
  281. }
  282. },
  283. methods: {
  284. //关闭弹窗
  285. close(e) {
  286. this.open = false
  287. },
  288. btnAdd(key, index) {
  289. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo.push({
  290. 'materialQuality': '',
  291. 'materialQualityName': '',
  292. 'number': '',
  293. 'specifications': '',
  294. 'specificationsName': ''
  295. });
  296. },
  297. btnDel(key, index) {
  298. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo.splice(index, 1);
  299. },
  300. pickerShow(e, index, indexTwo) {
  301. this.dataIndex = index;
  302. this.selectIndex = indexTwo; //材质规格 第几条
  303. this.selectType = e;
  304. if (e == 'cz') {
  305. this.open = true;
  306. getEnginMaterialQualityList("工业工程").then(response => {
  307. this.selectList = response.data;
  308. });
  309. }
  310. if (e == 'gg') {
  311. if (this.isEmpty(this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex]
  312. .zEngineeringMaterialBo[this.selectIndex].materialQuality)) {
  313. this.$modal.msg('请选择材质')
  314. } else {
  315. this.open = true;
  316. getEnginSpecificationsList(this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex]
  317. .zEngineeringMaterialBo[this.selectIndex].materialQuality).then(res => {
  318. this.selectList = res.data
  319. })
  320. }
  321. }
  322. },
  323. changeSelect(item, index) {
  324. this.open = false;
  325. if (this.selectType == 'cz') {
  326. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  327. .selectIndex]
  328. .materialQuality = item.id;
  329. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  330. .selectIndex]
  331. .materialQualityName = item.name;
  332. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  333. .selectIndex]
  334. .specifications = '';
  335. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  336. .selectIndex]
  337. .specificationsName = '';
  338. } else if (this.selectType == 'gg') {
  339. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  340. .selectIndex]
  341. .specifications = item.id;
  342. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[this.dataIndex].zEngineeringMaterialBo[this
  343. .selectIndex]
  344. .specificationsName = item.name;
  345. }
  346. },
  347. // 截取小数点前的字符串
  348. getIntegerPart(numStr, i) {
  349. return numStr.toString().split('.')[i] == undefined ? '0' : numStr.toString().split('.')[i];
  350. },
  351. setInfoBoNumber(key, index, number, i) {
  352. let Ynumber = this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[index]
  353. .number;
  354. let resAry = Ynumber.toString().split('.');
  355. resAry[i] = number
  356. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].zEngineeringMaterialBo[index].number = resAry
  357. .join('.');
  358. },
  359. bindTextAreaBlur(e, index) {
  360. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[index].remark = e;
  361. },
  362. removeht(index, key, type) {
  363. uni.showModal({
  364. title: '提示',
  365. content: '是否删除该图片或视频?',
  366. success: (res) => {
  367. if (res.confirm) {
  368. if (type == 'Box') {
  369. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].boxBrand
  370. .splice(index, 1)
  371. } else if (type == 'Sfht') {
  372. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].stonePowder
  373. .splice(index, 1)
  374. } else if (type == 'Fljd') {
  375. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key].lightning
  376. .splice(index, 1)
  377. } else if (type == 'Dtlj') {
  378. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key]
  379. .bottomLeg
  380. .splice(index, 1)
  381. } else if (type == 'Hldmyh') {
  382. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList[key]
  383. .groundHardening
  384. .splice(index, 1)
  385. }
  386. }
  387. }
  388. })
  389. },
  390. remove(index, key) {
  391. uni.showModal({
  392. title: '提示',
  393. content: '是否删除该图片或视频?',
  394. success: (res) => {
  395. if (res.confirm) {
  396. this.dataJson.zEngineeringNodeBo
  397. .zEngineeringInfoBoList[key]
  398. .zEngiineeringPhotoBoList.splice(index, 1)
  399. }
  400. }
  401. })
  402. },
  403. choose(type, index) {
  404. this.dataIndex = index;
  405. let _this = this;
  406. uni.showActionSheet({
  407. title: '上传',
  408. itemList: ['图片', '视频'],
  409. success: (res) => {
  410. if (res.tapIndex == 0) {
  411. this.chooseimage(type)
  412. } else {
  413. this.choosevideo(type)
  414. }
  415. }
  416. })
  417. },
  418. chooseimage(e) {
  419. let _this = this;
  420. uni.chooseImage({
  421. sizeType: ['album', 'camera'],
  422. success(resp) {
  423. resp.tempFiles.forEach((item, index) => {
  424. const task = uni.uploadFile({
  425. url: _this.$HTTP + `/obs`,
  426. filePath: item.path,
  427. name: 'file',
  428. formData: {},
  429. header: _this.headers,
  430. success: res => {
  431. let data = JSON.parse(res.data);
  432. if (![200].includes(data.code)) {
  433. _this.$modal.msg(data.msg)
  434. } else {
  435. if (_this.progress === 100) {
  436. if (e == 'other') {
  437. _this.dataJson.zEngineeringNodeBo
  438. .zEngineeringInfoBoList[_this.dataIndex]
  439. .zEngiineeringPhotoBoList.push(data.data
  440. .url);
  441. } else if (e == 'Box') {
  442. _this.dataJson.zEngineeringNodeBo
  443. .zEngineeringInfoBoList[_this.dataIndex]
  444. .boxBrand.push(data.data
  445. .url);
  446. } else if (e == 'Sfht') {
  447. _this.dataJson.zEngineeringNodeBo
  448. .zEngineeringInfoBoList[_this.dataIndex]
  449. .stonePowder.push(data.data
  450. .url);
  451. } else if (e == 'Fljd') {
  452. _this.dataJson.zEngineeringNodeBo
  453. .zEngineeringInfoBoList[_this.dataIndex]
  454. .lightning.push(data.data
  455. .url);
  456. } else if (e == 'Dtlj') {
  457. _this.dataJson.zEngineeringNodeBo
  458. .zEngineeringInfoBoList[_this.dataIndex]
  459. .bottomLeg.push(data.data
  460. .url);
  461. } else if (e == 'Hldmyh') {
  462. _this.dataJson.zEngineeringNodeBo
  463. .zEngineeringInfoBoList[_this.dataIndex]
  464. .groundHardening.push(data.data
  465. .url);
  466. }
  467. _this.$modal.msg('上传成功!')
  468. }
  469. }
  470. },
  471. fail: e => {
  472. _this.$modal.msg('上传失败!')
  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. },
  494. choosevideo(e) {
  495. let _this = this;
  496. uni.chooseVideo({
  497. sourceType: ['album', 'camera'],
  498. maxDuration: 30,
  499. success(resp) {
  500. const task = uni.uploadFile({
  501. url: _this.$HTTP + `/obs`,
  502. filePath: resp.tempFilePath,
  503. name: 'file',
  504. formData: {},
  505. header: _this.headers,
  506. success: res => {
  507. let data = JSON.parse(res.data);
  508. if (![200].includes(res.statusCode)) {
  509. this.uploadError(index, data);
  510. } else {
  511. //上传成功
  512. if (_this.progress === 100) {
  513. if (e == 'other') {
  514. _this.dataJson.zEngineeringNodeBo
  515. .zEngineeringInfoBoList[_this.dataIndex]
  516. .zEngiineeringPhotoBoList.push(data.data.url);
  517. } else if (e == 'Box') {
  518. _this.dataJson.zEngineeringNodeBo
  519. .zEngineeringInfoBoList[_this.dataIndex]
  520. .boxBrand.push(data.data.url);
  521. } else if (e == 'Sfht') {
  522. _this.dataJson.zEngineeringNodeBo
  523. .zEngineeringInfoBoList[_this.dataIndex]
  524. .stonePowder.push(data.data.url);
  525. } else if (e == 'Fljd') {
  526. _this.dataJson.zEngineeringNodeBo
  527. .zEngineeringInfoBoList[_this.dataIndex]
  528. .lightning.push(data.data.url);
  529. } else if (e == 'Dtlj') {
  530. _this.dataJson.zEngineeringNodeBo
  531. .zEngineeringInfoBoList[_this.dataIndex]
  532. .bottomLeg.push(data.data.url);
  533. } else if (e == 'Hldmyh') {
  534. _this.dataJson.zEngineeringNodeBo
  535. .zEngineeringInfoBoList[_this.dataIndex]
  536. .groundHardening.push(data.data.url);
  537. }
  538. _this.$modal.msg('上传成功!')
  539. }
  540. }
  541. },
  542. fail: e => {
  543. _this.$modal.msg('上传失败!')
  544. this.uploadError(index, e);
  545. },
  546. complete: res => {
  547. uni.hideLoading();
  548. _this.uploading = false;
  549. }
  550. });
  551. task.onProgressUpdate(res => {
  552. _this.progress = res.progress;
  553. uni.showLoading({
  554. title: '上传中'
  555. })
  556. if (_this.progress != 100) {
  557. _this.loading = false
  558. } else {
  559. _this.loading = true
  560. }
  561. });
  562. },
  563. })
  564. },
  565. showPhoto(index, arr) {
  566. let newArr = [];
  567. arr.forEach((item, index) => {
  568. if (item.substring(item.length - 3) == 'png' || item.substring(item.length - 3) == 'jpg' ||
  569. item.substring(item.length - 4) == 'jpeg') {
  570. newArr.push(item)
  571. }
  572. });
  573. uni.previewImage({
  574. current: index,
  575. urls: newArr,
  576. })
  577. },
  578. // showVideo(arr) {
  579. // this.playVideo = true;
  580. // this.playVideoSrc = arr;
  581. // },
  582. // closeVideo(){
  583. // this.playVideo = false;
  584. // },
  585. isEmpty(str) {
  586. return (!str || 0 === str.length);
  587. },
  588. isEdit(item) {
  589. var isShow = item.createBy == this.$user.state.name;
  590. return isShow;
  591. },
  592. submit() {
  593. let isSubmit = true;
  594. if (this.title == '调压柜') {
  595. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  596. if (res.boxBrand.length == 0) {
  597. this.$modal.msg("请上传调压箱铭牌照片");
  598. isSubmit = false;
  599. }
  600. if (res.stonePowder.length == 0) {
  601. this.$modal.msg("请上传调压箱内石粉回填照片");
  602. isSubmit = false;
  603. }
  604. if (res.lightning.length == 0) {
  605. this.$modal.msg("请上传调压箱防雷接地照片");
  606. isSubmit = false;
  607. }
  608. if (res.bottomLeg.length == 0) {
  609. this.$modal.msg("请上传调压箱底腿连接照片");
  610. isSubmit = false;
  611. }
  612. if (res.groundHardening.length == 0) {
  613. this.$modal.msg("请上传调压箱护栏及地面硬化(远景)照片");
  614. isSubmit = false;
  615. }
  616. })
  617. } else {
  618. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  619. res.zEngineeringMaterialBo.forEach((itme) => {
  620. if (itme.specifications == '') {
  621. this.$modal.msg("请选择规格");
  622. isSubmit = false;
  623. }
  624. if (itme.number == '') {
  625. this.$modal.msg("请输入米数");
  626. isSubmit = false;
  627. }
  628. })
  629. })
  630. this.dataJson.zEngineeringNodeBo.zEngineeringInfoBoList.forEach((res) => {
  631. if (res.zEngiineeringPhotoBoList.length == 0) {
  632. this.$modal.msg("请上传照片");
  633. isSubmit = false;
  634. }
  635. })
  636. }
  637. if (!isSubmit) {
  638. return
  639. }
  640. Putengineering(this.dataJson).then(
  641. response => {
  642. if (response.code == '200') {
  643. uni.hideLoading()
  644. uni.showToast({
  645. title: response.msg,
  646. icon: 'none',
  647. duration: 2000
  648. });
  649. setTimeout(function() {
  650. uni.navigateBack();
  651. }, 1000)
  652. }
  653. });
  654. }
  655. }
  656. }
  657. </script>
  658. <style lang="scss">
  659. .uni-media-list-body {
  660. background: #fff;
  661. border: 1px solid #eee;
  662. border-radius: 40rpx;
  663. margin: 20rpx;
  664. padding: 10rpx 0 40rpx;
  665. box-shadow: 0 0 5px #eee;
  666. }
  667. .uni-media-list-text-top {
  668. display: flex;
  669. align-items: center;
  670. justify-content: space-between;
  671. padding: 10px;
  672. position: relative;
  673. }
  674. .to-right-icon {
  675. width: 15px;
  676. height: 15px;
  677. position: absolute;
  678. top: 50%;
  679. transform: translateY(-50%);
  680. }
  681. .share {
  682. width: 100%;
  683. height: 100%;
  684. }
  685. .tit-text {
  686. color: #4f535a;
  687. margin-right: 20rpx;
  688. }
  689. .normal-text {}
  690. .cz-style {
  691. background: #e8f4f9;
  692. margin: 20rpx;
  693. padding: 10rpx;
  694. border-radius: 20rpx;
  695. border: 1px solid #d4e3f0;
  696. }
  697. .uni-media-list-text-top {
  698. font-size: 14px;
  699. color: #696969;
  700. padding: 20rpx 20rpx;
  701. border-bottom: 1px solid #eee;
  702. display: flex;
  703. align-items: center;
  704. }
  705. .share-box {
  706. width: 100%;
  707. height: 100%;
  708. position: fixed;
  709. top: 0rpx;
  710. left: 0rpx;
  711. bottom: 0rpx;
  712. right: 0rpx;
  713. background-color: rgba(0, 0, 0, 0.4);
  714. transition: .3s;
  715. z-index: 999;
  716. }
  717. // 进入分享动画
  718. .share-show {
  719. transition: all 0.3s ease;
  720. transform: translateY(0%) !important;
  721. border-radius: 20px 20px 0px 0px;
  722. }
  723. .scroll-Y {
  724. height: 58vh;
  725. }
  726. // 离开分享动画
  727. .share-item {
  728. position: fixed;
  729. left: 0;
  730. bottom: 0;
  731. width: 100%;
  732. height: 70%;
  733. background-color: #FFFFFF;
  734. transition: all 0.3s ease;
  735. transform: translateY(100%);
  736. z-index: 1999;
  737. .share-to {
  738. width: 100%;
  739. height: 30px;
  740. display: flex;
  741. justify-content: center;
  742. margin: 30rpx 0;
  743. align-items: center;
  744. }
  745. .content {
  746. width: 100%;
  747. height: auto;
  748. display: flex;
  749. flex-wrap: wrap;
  750. .block {
  751. width: 100%;
  752. display: flex;
  753. flex-direction: column;
  754. justify-content: center;
  755. align-items: left;
  756. height: auto;
  757. image {
  758. width: 80rpx;
  759. height: 80rpx;
  760. }
  761. text {
  762. margin-top: 16rpx;
  763. font-size: 28rpx;
  764. color: #606266;
  765. }
  766. }
  767. }
  768. .cancel {
  769. width: 100%;
  770. height: 3rem;
  771. display: flex;
  772. justify-content: center;
  773. align-items: center;
  774. border-top: 1rpx solid #E4E7ED;
  775. }
  776. }
  777. .uni-media-list-text-top {
  778. display: flex;
  779. align-items: center;
  780. justify-content: space-between;
  781. padding: 10px;
  782. position: relative;
  783. }
  784. .uni-list {
  785. border: 1xp solid #eee;
  786. }
  787. .to-right-icon {
  788. width: 15px;
  789. height: 15px;
  790. position: absolute;
  791. top: 50%;
  792. transform: translateY(-50%);
  793. }
  794. .text {
  795. font-size: 16px;
  796. color: #333;
  797. }
  798. .tj-btn {
  799. height: 69rpx;
  800. background: #3184f0;
  801. border-radius: 6rpx;
  802. font-size: 25rpx;
  803. font-weight: 400;
  804. width: 100%;
  805. color: #FFFFFF;
  806. line-height: 69rpx;
  807. margin: 40rpx 70rpx;
  808. }
  809. .sc-btn {
  810. height: 69rpx;
  811. background: #f0686b;
  812. border-radius: 6rpx;
  813. font-size: 25rpx;
  814. font-weight: 400;
  815. color: #FFFFFF;
  816. line-height: 69rpx;
  817. margin: 40rpx;
  818. }
  819. // .gesture-area {
  820. // //加浮动弹窗
  821. // width: 100%;
  822. // height: 100%;
  823. // }
  824. </style>