dangerous.vue 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  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.projectObj.enginName)" style="margin-top: 10;"
  11. @click="pickerShow('name')">
  12. <span style="color: darkgray;">请选择工程</span>
  13. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  14. </view>
  15. <view v-else style="margin-top: 10;" @click="pickerShow('name')">
  16. <span style="color: black;">{{projectObj.enginName}}</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. <view>
  24. 工程地点
  25. </view>
  26. <view style="margin-top: 10;">
  27. <span style="color: black;">{{projectObj.enginAddre}}</span>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="uni-list">
  32. <view class="container">
  33. <view>
  34. 作业基本信息
  35. </view>
  36. <view style="margin-top: 10;">
  37. <span style="color: black;">{{projectObj.basicInformation}}</span>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="background">
  43. <view class="uni-list">
  44. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  45. <view>
  46. 工程时间
  47. </view>
  48. <view v-if="isEmpty(this.projectTime)" @click="openDatetimePicker">
  49. <span style="color: darkgray;">请选择工程时间</span>
  50. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  51. </view>
  52. <view v-else @click="openDatetimePicker">
  53. <span style="color: black;">{{projectTime}}</span>
  54. <image :src="loadImgSrc('icon_right.png')" class="to-right-icon"></image>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="uni-list">
  59. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  60. <text>管径</text>
  61. <input class="uni-input" type="digit" v-model="projectObj.pipeDiameter" placeholder="请输入管径"
  62. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  63. </view>
  64. </view>
  65. <view class="uni-list">
  66. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  67. <text>管材</text>
  68. <input class="uni-input" type="text" v-model="projectObj.tubularProduct" placeholder="请输入管材"
  69. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  70. </view>
  71. </view>
  72. <view class="uni-list">
  73. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  74. <text>是否存在套管</text>
  75. <view>
  76. <span style="color: black;">{{bushingText}}</span>
  77. <switch v-if="isBushing" checked style="transform: scale(0.6,0.6);"
  78. @change="switchChangePipe" />
  79. <switch v-else style="transform: scale(0.6,0.6);" @change="switchChangePipe" />
  80. </view>
  81. </view>
  82. </view>
  83. <view class="uni-list">
  84. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  85. <text>管道压力</text>
  86. <input class="uni-input" type="digit" v-model="projectObj.pipePressure" placeholder="请输入管道压力"
  87. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  88. </view>
  89. </view>
  90. <view class="uni-list">
  91. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  92. <text>气源方向</text>
  93. <input class="uni-input" type="text" v-model="projectObj.gasSourceDirection" placeholder="请输入气源方向"
  94. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  95. </view>
  96. </view>
  97. <view class="uni-list">
  98. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  99. <text>作业位置</text>
  100. <input class="uni-input" type="text" v-model="projectObj.taskPosition" placeholder="请输入作业位置"
  101. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  102. </view>
  103. </view>
  104. <view class="uni-list">
  105. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  106. <text>作业相关阀门位置</text>
  107. <input class="uni-input" type="text" v-model="projectObj.valvePosition" placeholder="请输入作业相关阀门位置"
  108. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  109. </view>
  110. </view>
  111. <view class="uni-list">
  112. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  113. <text>压力报告</text>
  114. <input class="uni-input" type="text" v-model="projectObj.stressReport" placeholder="请输入压力报告"
  115. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  116. </view>
  117. </view>
  118. <view class="uni-list">
  119. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  120. <text>监理旁站记录</text>
  121. <input class="uni-input" type="text" v-model="projectObj.supervisionRecord" placeholder="请输入监理旁站记录"
  122. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  123. </view>
  124. </view>
  125. <view class="uni-list">
  126. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  127. <text>工作联系单</text>
  128. <input class="uni-input" type="text" v-model="projectObj.workContactForm" placeholder="请输入工作联系单"
  129. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  130. </view>
  131. </view>
  132. <view class="uni-list">
  133. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  134. <text>巡线确认单</text>
  135. <input class="uni-input" type="text" v-model="projectObj.linePatrolConfirmationForm"
  136. placeholder="请输入巡线确认单" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  137. </view>
  138. </view>
  139. <view class="uni-list">
  140. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  141. <text>危险作业坑大小(长,宽,深)</text>
  142. <input class="uni-input" type="digit" v-model="projectObj.hazardousWorkPitsLong" placeholder="请输入长"
  143. maxlength="9"
  144. style="margin-left: 10px;text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  145. <input class="uni-input" type="digit" v-model="projectObj.hazardousWorkPitsWide" placeholder="请输入宽"
  146. maxlength="9"
  147. style="margin-left: 10px;text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  148. <input class="uni-input" type="digit" v-model="projectObj.hazardousWorkPitsDeep" placeholder="请输入深"
  149. maxlength="9"
  150. style="margin-left: 10px;text-align: center; border: 1px solid #00aaff; border-radius: 20rpx;"></input>
  151. </view>
  152. </view>
  153. <view class="uni-list">
  154. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  155. <text>是否需要支护</text>
  156. <view>
  157. <span style="color: black;">{{needSupportText}}</span>
  158. <switch v-if="isNeedSupport" checked style="transform: scale(0.6,0.6);"
  159. @change="switchChangeSupport" />
  160. <switch v-else style="transform: scale(0.6,0.6);" @change="switchChangeSupport" />
  161. </view>
  162. </view>
  163. </view>
  164. <view class="uni-list">
  165. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  166. <text>作业坑内其他管道情况</text>
  167. <input class="uni-input" type="text" v-model="projectObj.otherPipelineConditionsWorkPit"
  168. placeholder="请输入作业坑内其他管道情况" maxlength="100"
  169. style="margin-left: 10px;text-align: right;"></input>
  170. </view>
  171. </view>
  172. <view class="uni-list">
  173. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  174. <text>现场负责人</text>
  175. <input class="uni-input" type="text" v-model="projectObj.siteHead" placeholder="请输入现场负责人"
  176. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  177. </view>
  178. </view>
  179. <view class="uni-list">
  180. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  181. <text>现场负责人联系方式</text>
  182. <input class="uni-input" type="number" v-model="projectObj.siteHeadPhone" placeholder="请输入现场负责人联系方式"
  183. maxlength="11" style="margin-left: 10px;text-align: right;"></input>
  184. </view>
  185. </view>
  186. <view class="uni-list">
  187. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  188. <text>作业人员信息</text>
  189. <input class="uni-input" type="text" v-model="projectObj.operatorInformation"
  190. placeholder="请输入作业人员信息" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  191. </view>
  192. </view>
  193. <view class="uni-list">
  194. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  195. <text>检口</text>
  196. <input class="uni-input" type="text" v-model="projectObj.inspectionPort" placeholder="请输入检口"
  197. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  198. </view>
  199. </view>
  200. <view class="uni-list">
  201. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  202. <text>管道刷油</text>
  203. <input class="uni-input" type="text" v-model="projectObj.pipelinePainting" placeholder="请输入管道刷油"
  204. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  205. </view>
  206. </view>
  207. <view class="uni-list">
  208. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  209. <text>管道防腐</text>
  210. <input class="uni-input" type="text" v-model="projectObj.pipelineCorrosionProtection"
  211. placeholder="请输入管道防腐" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  212. </view>
  213. </view>
  214. <view class="uni-list">
  215. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  216. <text>管道支护</text>
  217. <input class="uni-input" type="text" v-model="projectObj.pipelineSupport" placeholder="请输入管道支护"
  218. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  219. </view>
  220. </view>
  221. <view class="uni-list">
  222. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  223. <text>砌筑阀门井</text>
  224. <input class="uni-input" type="text" v-model="projectObj.masonryValveWell" placeholder="请输入砌筑阀门井"
  225. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  226. </view>
  227. </view>
  228. <view class="uni-list">
  229. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  230. <text>保护井</text>
  231. <input class="uni-input" type="text" v-model="projectObj.protectionWell" placeholder="请输入保护井"
  232. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  233. </view>
  234. </view>
  235. <view class="uni-list">
  236. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  237. <text>管件保护井砌筑</text>
  238. <input class="uni-input" type="text" v-model="projectObj.pipeProtectionWelMasonry"
  239. placeholder="请输入管件保护井砌筑" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  240. </view>
  241. </view>
  242. <view class="uni-list">
  243. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  244. <text>回填</text>
  245. <input class="uni-input" type="text" v-model="projectObj.backfill" placeholder="请输入回填"
  246. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  247. </view>
  248. </view>
  249. <view class="uni-list">
  250. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  251. <text>夯实</text>
  252. <input class="uni-input" type="text" v-model="projectObj.tamp" placeholder="请输入夯实" maxlength="100"
  253. style="margin-left: 10px;text-align: right;"></input>
  254. </view>
  255. </view>
  256. <view class="uni-list">
  257. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  258. <text>平整场地</text>
  259. <input class="uni-input" type="text" v-model="projectObj.levelingTheSite" placeholder="请输入平整场地"
  260. maxlength="100" style="margin-left: 10px;text-align: right;"></input>
  261. </view>
  262. </view>
  263. <view class="uni-list">
  264. <view class="container" style="border-bottom: 1px solid #f8f8f8;">
  265. <text>备注</text>
  266. <input class="uni-input" type="text" v-model="projectObj.remark" placeholder="请输入备注" maxlength="100"
  267. style="margin-left: 10px;text-align: right;"></input>
  268. </view>
  269. </view>
  270. <view class="uni-list">
  271. <view class="align-items" style="margin-bottom: 20px;">
  272. <view class="container" style="color: #b2b2b2;">*请上传文件</view>
  273. <view style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  274. <image :src="loadImgSrc('updateimg.png')" mode=""
  275. style="width: 200rpx; height: 150rpx; margin: 0 12rpx; " @click="choose"></image>
  276. <view v-for="(item,index) in fileArr" :key="index" style="position: relative;">
  277. <view style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
  278. <image
  279. 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' "
  280. :src="item.picUrl" @click="this.showPhoto(item.picUrl,fileArr)"
  281. style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
  282. </image>
  283. <video v-else-if="item.picUrl.substring(item.picUrl.length - 3) == 'mp4'"
  284. :src="item.picUrl" style="width: 100rpx; height: 100rpx; margin: 0 12rpx;">
  285. </video>
  286. <text v-else @click="chooseModel(item.picUrl,item.fileName)">
  287. {{item.fileName}}
  288. </text>
  289. </view>
  290. <view v-if="isShowRemoveFile(item)" @click="removeFile(index)"
  291. style="position: absolute; top: 0; right: 0rpx; border-radius: 50%;">
  292. <image :src="loadImgSrc('icon_close.png')" style=" width: 15px; height: 15px;">
  293. </image>
  294. </view>
  295. </view>
  296. </view>
  297. </view>
  298. </view>
  299. </view>
  300. <view class="action-btn">
  301. <button @click="submit" class="btn cu-btn block bg-blue lg round">提交</button>
  302. </view>
  303. <SelectPicker :list="rows" @change="projectListSelect" v-if="open" @close="close" titleKey="name"
  304. subtitleKey="id" v-model="name"></SelectPicker>
  305. <yt-dateTimePicker ref="myPicker" @submit="handleSubmit" :start-year="2024" :end-year="2099"
  306. :time-hide="[true, true, true, true, true, true]" :time-label="['年', '月', '日', '时', '分', '秒']" />
  307. <!-- 下载提示页面 -->
  308. <mypopup :show="show_loding" :popupText="popupText" :titleText="titleText" :cancelText="cancelText"
  309. :confirmText="confirmText" @close="cancel_loding" @confirm="confirm_loding">
  310. </mypopup>
  311. </scroll-view>
  312. </template>
  313. <script>
  314. import SelectPicker from '../../components/selectPicker/select_picker.vue'
  315. import {
  316. getToken
  317. } from '../../utils/auth';
  318. import {
  319. getDangerousWorkProjectList,
  320. getDangerousWorkProjectDetails,
  321. updateDangerousWorkProject
  322. } from '@/api/common'
  323. export default {
  324. components: {
  325. SelectPicker
  326. },
  327. data() {
  328. return {
  329. headers: {
  330. Authorization: "Bearer " + getToken()
  331. },
  332. isBushing: false,
  333. bushingText: "否",
  334. isNeedSupport: false,
  335. needSupportText: "否",
  336. file: [], // 附件
  337. pics: [], // 附件返回
  338. rows: [],
  339. open: false,
  340. projectObj: {},
  341. currentTime: "",
  342. fileArr: [],
  343. projectTime: "",
  344. imgList: [],
  345. popupText: '', //对话框内容
  346. titleText: '',
  347. cancelText: '',
  348. confirmText: '',
  349. show_loding: false,
  350. fileUrl: '', //点击的文件地址
  351. fileName: '', //点击的文件名称
  352. }
  353. },
  354. created() {
  355. this.currentTime = this.traversalTime(new Date().getTime()); //在data里定义变量-nowTime
  356. },
  357. methods: {
  358. isEmpty(str) {
  359. return (!str || 0 === str.length);
  360. },
  361. chooseModel(url, name) {
  362. this.cancelText = '复制';
  363. this.confirmText = "下载";
  364. this.titleText = "温馨提示"
  365. this.popupText = "下载或者复制链接";
  366. this.show_loding = true;
  367. this.fileName = name;
  368. this.fileUrl = url; //文件名称和下载地址赋值
  369. },
  370. //取消按钮
  371. cancel_loding() {
  372. let _this = this;
  373. _this.show_loding = false;
  374. if (!_this.isEmpty(_this.fileUrl)) {
  375. uni.setClipboardData({
  376. data: _this.fileUrl,
  377. success() {
  378. uni.showToast({
  379. title: '已复制' + _this.fileName + '地址成功 请在浏览器打开',
  380. icon: 'none'
  381. });
  382. },
  383. fail(e) {
  384. uni.showToast({
  385. title: '复制失败',
  386. icon: 'none'
  387. });
  388. }
  389. });
  390. }
  391. },
  392. //确定按钮
  393. confirm_loding() {
  394. this.show_loding = false;
  395. this.download(this.fileUrl, this.fileName);
  396. },
  397. getDownLoadFilePath() {
  398. let cachePath = `${uni.env.USER_DATA_PATH}/downloads`
  399. let fm = uni.getFileSystemManager()
  400. try {
  401. // 访问成功则存在
  402. fm.accessSync(cachePath)
  403. } catch (error) {
  404. // 不存在则新建
  405. fm.mkdirSync(cachePath, true)
  406. }
  407. return cachePath
  408. },
  409. download(url, name) {
  410. let savePath = this.getDownLoadFilePath();
  411. //var savePath = uni.env.USER_DATA_PATH + '/savePath'
  412. uni.downloadFile({
  413. url: url,
  414. success: response => {
  415. if (response.statusCode === 200) {
  416. uni.getFileSystemManager().saveFile({
  417. tempFilePath: response.tempFilePath,
  418. filePath: `${savePath}/${name}`,
  419. success: (resData) => {
  420. uni.showToast({
  421. title: '下载成功'
  422. })
  423. },
  424. fail: error => {}
  425. })
  426. }
  427. }
  428. })
  429. },
  430. showPhoto(currentUrl, arr) {
  431. let newArr = [];
  432. for (let i = 0; i < arr.length; i++) {
  433. if (arr[i].picUrl.substring(arr[i].picUrl.length - 3) == 'png' || arr[i].picUrl.substring(arr[i].picUrl.length - 3) == 'jpg' ||
  434. arr[i].picUrl.substring(arr[i].picUrl.length - 4) ==
  435. 'jpeg') {
  436. newArr.push(arr[i].picUrl);
  437. }
  438. }
  439. let mIndex = newArr.indexOf(currentUrl);
  440. uni.previewImage({
  441. current: mIndex,
  442. urls: newArr,
  443. })
  444. },
  445. pickerShow(e) {
  446. if (e == 'name') {
  447. this.open = true;
  448. let param = {};
  449. getDangerousWorkProjectList(param).then(res => {
  450. this.rows = res.data;
  451. })
  452. }
  453. },
  454. changeSelect(e) {
  455. },
  456. close() {
  457. this.open = false;
  458. },
  459. projectListSelect(item, index) {
  460. this.open = false;
  461. getDangerousWorkProjectDetails(item.id).then(res => {
  462. this.projectObj = res.data;
  463. this.projectTime = this.projectObj.enginTime;
  464. // if (this.isEmpty(this.projectTime)) {
  465. // this.projectTime = this.currentTime;
  466. // this.projectObj.enginTime = this.currentTime;
  467. // }
  468. this.isNeedSupport = this.projectObj.needSupport == "1";
  469. if (this.isNeedSupport) {
  470. this.needSupportText = "是";
  471. this.projectObj.needSupport = "1";
  472. } else {
  473. this.needSupportText = "否";
  474. this.projectObj.needSupport = "0";
  475. }
  476. this.isBushing = this.projectObj.casingPresent == "1";
  477. if (this.isBushing) {
  478. this.bushingText = "是";
  479. this.projectObj.casingPresent = "1";
  480. } else {
  481. this.bushingText = "否";
  482. this.projectObj.casingPresent = "0";
  483. }
  484. this.fileArr = this.projectObj.pics;
  485. // for (let i = 0; i < this.fileArr.length; i++) {
  486. // if (this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'png' || this
  487. // .fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'jpg' ||
  488. // this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 4) ==
  489. // 'jpeg') {
  490. // this.imgList.push(this.fileArr[i].picUrl);
  491. // }
  492. // }
  493. })
  494. },
  495. switchChangePipe(e) {
  496. this.isBushing = e.detail.value;
  497. if (this.isBushing) {
  498. this.projectObj.casingPresent = "1";
  499. this.bushingText = "是";
  500. } else {
  501. this.projectObj.casingPresent = "0";
  502. this.bushingText = "否";
  503. }
  504. },
  505. switchChangeSupport(e) {
  506. this.isNeedSupport = e.detail.value;
  507. if (this.isNeedSupport) {
  508. this.projectObj.needSupport = "1";
  509. this.needSupportText = "是";
  510. } else {
  511. this.projectObj.needSupport = "0";
  512. this.needSupportText = "否";
  513. }
  514. },
  515. choose() {
  516. let _this = this;
  517. uni.showActionSheet({
  518. title: '上传',
  519. itemList: ['图片', '视频'],
  520. success: (res) => {
  521. if (res.tapIndex == 0) {
  522. this.chooseimage()
  523. } else {
  524. this.choosevideo()
  525. }
  526. }
  527. })
  528. },
  529. chooseimage() {
  530. let _this = this;
  531. uni.chooseImage({
  532. sizeType: ['album', 'camera'],
  533. success(resp) {
  534. resp.tempFiles.forEach((item, index) => {
  535. const task = uni.uploadFile({
  536. url: _this.$HTTP + `/obs`,
  537. filePath: item.path,
  538. name: 'file',
  539. formData: {},
  540. header: _this.headers,
  541. success: res => {
  542. // 判断是否json字符串,将其转为json格式
  543. let data = JSON.parse(res.data);
  544. if (![200].includes(data.code)) {
  545. _this.$modal.msg(data.msg)
  546. } else {
  547. if (_this.progress === 100) {
  548. _this.fileArr.push({
  549. 'fileName': data.data
  550. .fileName,
  551. 'picUrl': data
  552. .data.url,
  553. });
  554. _this.imgList.push(data.data.url);
  555. _this.$modal.msg('上传成功!')
  556. _this.photo = false;
  557. }
  558. }
  559. },
  560. fail: e => {
  561. _this.$modal.msg('上传失败!')
  562. },
  563. complete: res => {
  564. uni.hideLoading();
  565. _this.uploading = false;
  566. }
  567. });
  568. task.onProgressUpdate(res => {
  569. _this.progress = res.progress;
  570. uni.showLoading({
  571. title: '上传中'
  572. })
  573. if (_this.progress != 100) {
  574. _this.loading = false
  575. } else {
  576. _this.loading = true
  577. }
  578. });
  579. })
  580. },
  581. })
  582. },
  583. choosevideo() {
  584. let _this = this;
  585. uni.chooseVideo({
  586. sourceType: ['album', 'camera'],
  587. maxDuration: 30,
  588. success(resp) {
  589. const task = uni.uploadFile({
  590. url: _this.$HTTP + `/obs`,
  591. filePath: resp.tempFilePath,
  592. name: 'file',
  593. formData: {},
  594. header: _this.headers,
  595. success: res => {
  596. // 判断是否json字符串,将其转为json格式
  597. let data = JSON.parse(res.data);
  598. if (![200].includes(res.statusCode)) {
  599. this.uploadError(index, data);
  600. } else {
  601. //上传成功
  602. if (_this.progress === 100) {
  603. _this.fileArr.push({
  604. 'fileName': data.data
  605. .fileName,
  606. 'picUrl': data
  607. .data.url,
  608. })
  609. _this.$modal.msg('上传成功!')
  610. _this.photo = false;
  611. }
  612. }
  613. },
  614. fail: e => {
  615. _this.$modal.msg('上传失败!')
  616. this.uploadError(index, e);
  617. },
  618. complete: res => {
  619. uni.hideLoading();
  620. _this.uploading = false;
  621. }
  622. });
  623. task.onProgressUpdate(res => {
  624. _this.progress = res.progress;
  625. uni.showLoading({
  626. title: '上传中'
  627. })
  628. if (_this.progress != 100) {
  629. _this.loading = false
  630. } else {
  631. _this.loading = true
  632. }
  633. });
  634. },
  635. })
  636. },
  637. isShowRemoveFile(item) {
  638. var isShow = item.createBy==undefined||item.createBy == this.$user.state.name;
  639. return isShow;
  640. },
  641. removeFile(index) {
  642. uni.showModal({
  643. title: '提示',
  644. content: '是否删除该文件?',
  645. success: (res) => {
  646. if (res.confirm) {
  647. this.fileArr.splice(index, 1)
  648. }
  649. }
  650. })
  651. },
  652. submit() {
  653. if (this.isEmpty(this.projectObj.pipeDiameter)) {
  654. this.$modal.msg('请输入管径')
  655. return;
  656. }
  657. if (this.isEmpty(this.projectObj.tubularProduct)) {
  658. this.$modal.msg('请输入管材')
  659. return;
  660. }
  661. if (this.isEmpty(this.projectObj.pipePressure)) {
  662. this.$modal.msg('请输入管道压力')
  663. return;
  664. }
  665. if (this.isEmpty(this.projectObj.gasSourceDirection)) {
  666. this.$modal.msg('请输入气源方向')
  667. return;
  668. }
  669. if (this.isEmpty(this.projectObj.taskPosition)) {
  670. this.$modal.msg('请输入作业位置')
  671. return;
  672. }
  673. if (this.isEmpty(this.projectObj.valvePosition)) {
  674. this.$modal.msg('请输入作业相关阀门位置')
  675. return;
  676. }
  677. if (this.isEmpty(this.projectObj.stressReport)) {
  678. this.$modal.msg('请输入压力报告')
  679. return;
  680. }
  681. if (this.isEmpty(this.projectObj.supervisionRecord)) {
  682. this.$modal.msg('请输入监理旁站记录')
  683. return;
  684. }
  685. if (this.isEmpty(this.projectObj.workContactForm)) {
  686. this.$modal.msg('请输入工作联系单')
  687. return;
  688. }
  689. if (this.isEmpty(this.projectObj.linePatrolConfirmationForm)) {
  690. this.$modal.msg('请输入巡线确认单')
  691. return;
  692. }
  693. if (this.isEmpty(this.projectObj.hazardousWorkPitsLong)) {
  694. this.$modal.msg('请输入危险作业坑长度')
  695. return;
  696. }
  697. if (this.isEmpty(this.projectObj.hazardousWorkPitsWide)) {
  698. this.$modal.msg('请输入危险作业坑宽度')
  699. return;
  700. }
  701. if (this.isEmpty(this.projectObj.hazardousWorkPitsDeep)) {
  702. this.$modal.msg('请输入危险作业坑深度')
  703. return;
  704. }
  705. if (this.isEmpty(this.projectObj.otherPipelineConditionsWorkPit)) {
  706. this.$modal.msg('请输入作业坑内其他管道情况')
  707. return;
  708. }
  709. if (this.isEmpty(this.projectObj.siteHead)) {
  710. this.$modal.msg('请输入现场负责人')
  711. return;
  712. }
  713. if (this.isEmpty(this.projectObj.siteHeadPhone)) {
  714. this.$modal.msg('请输入现场负责人联系方式')
  715. return;
  716. } else {
  717. if (!this.$validation.mobile(this.projectObj.siteHeadPhone)) {
  718. this.$modal.msg('请输入正确的联系方式');
  719. return;
  720. }
  721. }
  722. if (this.isEmpty(this.projectObj.operatorInformation)) {
  723. this.$modal.msg('请输入作业人员信息')
  724. return;
  725. }
  726. if (this.isEmpty(this.projectObj.inspectionPort)) {
  727. this.$modal.msg('请输入检口')
  728. return;
  729. }
  730. if (this.isEmpty(this.projectObj.pipelinePainting)) {
  731. this.$modal.msg('请输入管道刷油')
  732. return;
  733. }
  734. if (this.isEmpty(this.projectObj.pipelineCorrosionProtection)) {
  735. this.$modal.msg('请输入管道防腐')
  736. return;
  737. }
  738. if (this.isEmpty(this.projectObj.pipelineSupport)) {
  739. this.$modal.msg('请输入管道支护')
  740. return;
  741. }
  742. if (this.isEmpty(this.projectObj.masonryValveWell)) {
  743. this.$modal.msg('请输入砌筑阀门井')
  744. return;
  745. }
  746. if (this.isEmpty(this.projectObj.protectionWell)) {
  747. this.$modal.msg('请输入保护井')
  748. return;
  749. }
  750. if (this.isEmpty(this.projectObj.pipeProtectionWelMasonry)) {
  751. this.$modal.msg('请输入管件保护井砌筑')
  752. return;
  753. }
  754. if (this.isEmpty(this.projectObj.backfill)) {
  755. this.$modal.msg('请输入回填')
  756. return;
  757. }
  758. if (this.isEmpty(this.projectObj.tamp)) {
  759. this.$modal.msg('请输入夯实')
  760. return;
  761. }
  762. if (this.isEmpty(this.projectObj.levelingTheSite)) {
  763. this.$modal.msg('请输入平整场地')
  764. return;
  765. }
  766. if (this.isEmpty(this.projectObj.remark)) {
  767. this.$modal.msg('请输入备注')
  768. return;
  769. }
  770. if (this.fileArr.length <= 0) {
  771. this.$modal.msg('请选择附件')
  772. return;
  773. }
  774. this.projectObj.enginTime = this.projectTime;
  775. this.projectObj.pics = this.fileArr;
  776. // this.projectObj.files = this.fileArr;
  777. uni.showLoading()
  778. updateDangerousWorkProject(this.projectObj).then(res => {
  779. uni.hideLoading()
  780. this.$modal.msg(res.msg);
  781. setTimeout(() => {
  782. uni.navigateBack();
  783. }, 1000);
  784. })
  785. },
  786. handleSubmit(e) {
  787. this.projectTime =
  788. `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
  789. this.projectObj.enginTime = this.projectTime;
  790. },
  791. // 打开picker
  792. openDatetimePicker() {
  793. if (this.isEmpty(this.projectObj.id)) {
  794. this.$modal.msg('请选择工程')
  795. } else {
  796. this.$refs.myPicker.show();
  797. }
  798. },
  799. addTimes(m) {
  800. return m < 10 ? '0' + m : m
  801. },
  802. //获取当前时间
  803. traversalTime(timestamp) {
  804. //timestamp(时间戳)是整数,否则要parseInt转换
  805. let time = new Date(timestamp);
  806. let y = time.getFullYear();
  807. let m = time.getMonth() + 1;
  808. let d = time.getDate();
  809. let h = time.getHours();
  810. let mm = time.getMinutes();
  811. let s = time.getSeconds();
  812. return y + '-' + this.addTimes(m) + '-' + this.addTimes(d) + ' ' + this.addTimes(
  813. h) + ':' + this.addTimes(
  814. mm) + ':' + this.addTimes(s);
  815. },
  816. }
  817. }
  818. </script>
  819. <style>
  820. .container {
  821. display: flex;
  822. align-items: center;
  823. justify-content: space-between;
  824. padding: 10px;
  825. position: relative;
  826. }
  827. .uni-list {
  828. border: 1xp solid #eee;
  829. }
  830. .to-right-icon {
  831. width: 15px;
  832. height: 15px;
  833. position: absolute;
  834. top: 50%;
  835. transform: translateY(-50%);
  836. }
  837. .marginLeft5 {
  838. margin-left: 5px;
  839. }
  840. .title-txt {
  841. font-size: 15px;
  842. font-weight: bold;
  843. color: black;
  844. }
  845. .content-txt {
  846. font-size: 10px;
  847. font-weight: bold;
  848. color: black;
  849. }
  850. .background {
  851. // border: 15px solid hsla(0, 0%, 100%, .5);
  852. background: white;
  853. background-clip: padding-box;
  854. padding: 20rpx;
  855. border-radius: 20rpx;
  856. margin: 20rpx;
  857. /*从padding开始往外面裁剪背景*/
  858. }
  859. .uni-list-cell {
  860. position: relative;
  861. display: flex;
  862. flex-direction: row;
  863. justify-content: space-between;
  864. align-items: center;
  865. }
  866. .uni-list-cell-left {
  867. white-space: nowrap;
  868. font-size: 28rpx;
  869. }
  870. .centered {
  871. text-align: center;
  872. background-color: #e2f4ff;
  873. }
  874. .text {
  875. background-color: #e2f4ff;
  876. height: 20rpx;
  877. }
  878. .view_bg_build {
  879. background-color: #e2f4ff;
  880. padding: 10rpx;
  881. margin: 20rpx;
  882. }
  883. .grid-text {
  884. font-size: 14px;
  885. color: #000000;
  886. text-align: center;
  887. padding-left: 30rpx;
  888. padding-right: 30rpx;
  889. padding-top: 20rpx;
  890. padding-bottom: 20rpx;
  891. }
  892. .name {
  893. flex: 0;
  894. font-size: 14px;
  895. color: #000000;
  896. overflow: hidden;
  897. text-overflow: ellipsis;
  898. white-space: nowrap;
  899. }
  900. .table-item {
  901. overflow: hidden;
  902. text-overflow: ellipsis;
  903. white-space: nowrap;
  904. }
  905. .block-iv {
  906. width: 10px;
  907. height: 10px;
  908. }
  909. .btn {
  910. width: 715rpx;
  911. height: 69rpx;
  912. background: #79A4F0;
  913. border-radius: 6rpx;
  914. font-size: 25rpx;
  915. font-family: Microsoft YaHei;
  916. font-weight: 400;
  917. color: #FFFFFF;
  918. line-height: 69rpx;
  919. margin-top: 40rpx;
  920. margin-bottom: 100rpx;
  921. }
  922. .number {
  923. display: flex;
  924. /* 水平居中显示子元素 */
  925. align-items: flex-start;
  926. /* 垂直居中显示子元素 */
  927. justify-content: space-between;
  928. /* 左右间距等于间距大小 */
  929. padding: 10px;
  930. /* 设置padding以提高视觉效果 */
  931. }
  932. .tj-btn {
  933. height: 69rpx;
  934. background: #3184f0;
  935. border-radius: 6rpx;
  936. font-size: 25rpx;
  937. font-weight: 400;
  938. color: #FFFFFF;
  939. line-height: 69rpx;
  940. margin: 40rpx 70rpx;
  941. }
  942. .sc-btn {
  943. height: 69rpx;
  944. background: #f0686b;
  945. border-radius: 6rpx;
  946. font-size: 25rpx;
  947. font-weight: 400;
  948. color: #FFFFFF;
  949. line-height: 69rpx;
  950. margin: 40rpx;
  951. }
  952. .num-style {
  953. background: #e8f4f9;
  954. margin: 20rpx;
  955. padding: 10rpx;
  956. border-radius: 20rpx;
  957. border: 1px solid #d4e3f0;
  958. }
  959. .textarea {
  960. margin-top: 10upx;
  961. width: 100%;
  962. border: 1rpx solid red;
  963. min-height: 100upx;
  964. line-height: 20px;
  965. }
  966. .text {
  967. font-size: 16px;
  968. color: #333;
  969. }
  970. input {
  971. flex-grow: 1;
  972. font-size: 28rpx;
  973. color: #808080;
  974. }
  975. </style>