dangerous.vue 30 KB

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