dangerous.vue 30 KB

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