dangerous.vue 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082
  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. debugger
  440. let mIndex = newArr.indexOf(currentUrl);
  441. uni.previewImage({
  442. current: mIndex,
  443. urls: newArr,
  444. })
  445. },
  446. pickerShow(e) {
  447. if (e == 'name') {
  448. this.open = true;
  449. let param = {};
  450. getDangerousWorkProjectList(param).then(res => {
  451. this.rows = res.data;
  452. })
  453. }
  454. },
  455. changeSelect(e) {
  456. },
  457. close() {
  458. this.open = false;
  459. },
  460. projectListSelect(item, index) {
  461. this.open = false;
  462. getDangerousWorkProjectDetails(item.id).then(res => {
  463. this.projectObj = res.data;
  464. this.projectTime = this.projectObj.enginTime;
  465. // if (this.isEmpty(this.projectTime)) {
  466. // this.projectTime = this.currentTime;
  467. // this.projectObj.enginTime = this.currentTime;
  468. // }
  469. this.isNeedSupport = this.projectObj.needSupport == "1";
  470. if (this.isNeedSupport) {
  471. this.needSupportText = "是";
  472. this.projectObj.needSupport = "1";
  473. } else {
  474. this.needSupportText = "否";
  475. this.projectObj.needSupport = "0";
  476. }
  477. this.isBushing = this.projectObj.casingPresent == "1";
  478. if (this.isBushing) {
  479. this.bushingText = "是";
  480. this.projectObj.casingPresent = "1";
  481. } else {
  482. this.bushingText = "否";
  483. this.projectObj.casingPresent = "0";
  484. }
  485. this.fileArr = this.projectObj.pics;
  486. // for (let i = 0; i < this.fileArr.length; i++) {
  487. // if (this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'png' || this
  488. // .fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 3) == 'jpg' ||
  489. // this.fileArr[i].picUrl.substring(this.fileArr[i].picUrl.length - 4) ==
  490. // 'jpeg') {
  491. // this.imgList.push(this.fileArr[i].picUrl);
  492. // }
  493. // }
  494. })
  495. },
  496. switchChangePipe(e) {
  497. this.isBushing = e.detail.value;
  498. if (this.isBushing) {
  499. this.projectObj.casingPresent = "1";
  500. this.bushingText = "是";
  501. } else {
  502. this.projectObj.casingPresent = "0";
  503. this.bushingText = "否";
  504. }
  505. },
  506. switchChangeSupport(e) {
  507. this.isNeedSupport = e.detail.value;
  508. if (this.isNeedSupport) {
  509. this.projectObj.needSupport = "1";
  510. this.needSupportText = "是";
  511. } else {
  512. this.projectObj.needSupport = "0";
  513. this.needSupportText = "否";
  514. }
  515. },
  516. choose() {
  517. let _this = this;
  518. uni.showActionSheet({
  519. title: '上传',
  520. itemList: ['图片', '视频'],
  521. success: (res) => {
  522. if (res.tapIndex == 0) {
  523. this.chooseimage()
  524. } else {
  525. this.choosevideo()
  526. }
  527. }
  528. })
  529. },
  530. chooseimage() {
  531. let _this = this;
  532. uni.chooseImage({
  533. sizeType: ['album', 'camera'],
  534. success(resp) {
  535. resp.tempFiles.forEach((item, index) => {
  536. const task = uni.uploadFile({
  537. url: _this.$HTTP + `/obs`,
  538. filePath: item.path,
  539. name: 'file',
  540. formData: {},
  541. header: _this.headers,
  542. success: res => {
  543. // 判断是否json字符串,将其转为json格式
  544. let data = JSON.parse(res.data);
  545. if (![200].includes(data.code)) {
  546. _this.$modal.msg(data.msg)
  547. } else {
  548. if (_this.progress === 100) {
  549. _this.fileArr.push({
  550. 'fileName': data.data
  551. .fileName,
  552. 'picUrl': data
  553. .data.url,
  554. });
  555. _this.imgList.push(data.data.url);
  556. _this.$modal.msg('上传成功!')
  557. _this.photo = false;
  558. }
  559. }
  560. },
  561. fail: e => {
  562. _this.$modal.msg('上传失败!')
  563. },
  564. complete: res => {
  565. uni.hideLoading();
  566. _this.uploading = false;
  567. }
  568. });
  569. task.onProgressUpdate(res => {
  570. _this.progress = res.progress;
  571. uni.showLoading({
  572. title: '上传中'
  573. })
  574. if (_this.progress != 100) {
  575. _this.loading = false
  576. } else {
  577. _this.loading = true
  578. }
  579. });
  580. })
  581. },
  582. })
  583. },
  584. choosevideo() {
  585. let _this = this;
  586. uni.chooseVideo({
  587. sourceType: ['album', 'camera'],
  588. maxDuration: 30,
  589. success(resp) {
  590. const task = uni.uploadFile({
  591. url: _this.$HTTP + `/obs`,
  592. filePath: resp.tempFilePath,
  593. name: 'file',
  594. formData: {},
  595. header: _this.headers,
  596. success: res => {
  597. // 判断是否json字符串,将其转为json格式
  598. let data = JSON.parse(res.data);
  599. if (![200].includes(res.statusCode)) {
  600. this.uploadError(index, data);
  601. } else {
  602. //上传成功
  603. if (_this.progress === 100) {
  604. _this.fileArr.push({
  605. 'fileName': data.data
  606. .fileName,
  607. 'picUrl': data
  608. .data.url,
  609. })
  610. _this.$modal.msg('上传成功!')
  611. _this.photo = false;
  612. }
  613. }
  614. },
  615. fail: e => {
  616. _this.$modal.msg('上传失败!')
  617. this.uploadError(index, e);
  618. },
  619. complete: res => {
  620. uni.hideLoading();
  621. _this.uploading = false;
  622. }
  623. });
  624. task.onProgressUpdate(res => {
  625. _this.progress = res.progress;
  626. uni.showLoading({
  627. title: '上传中'
  628. })
  629. if (_this.progress != 100) {
  630. _this.loading = false
  631. } else {
  632. _this.loading = true
  633. }
  634. });
  635. },
  636. })
  637. },
  638. isShowRemoveFile(item) {
  639. var isShow = item.createBy==undefined||item.createBy == this.$user.state.name;
  640. return isShow;
  641. },
  642. removeFile(index) {
  643. uni.showModal({
  644. title: '提示',
  645. content: '是否删除该文件?',
  646. success: (res) => {
  647. if (res.confirm) {
  648. this.fileArr.splice(index, 1)
  649. }
  650. }
  651. })
  652. },
  653. submit() {
  654. if (this.isEmpty(this.projectObj.pipeDiameter)) {
  655. this.$modal.msg('请输入管径')
  656. return;
  657. }
  658. if (this.isEmpty(this.projectObj.tubularProduct)) {
  659. this.$modal.msg('请输入管材')
  660. return;
  661. }
  662. if (this.isEmpty(this.projectObj.pipePressure)) {
  663. this.$modal.msg('请输入管道压力')
  664. return;
  665. }
  666. if (this.isEmpty(this.projectObj.gasSourceDirection)) {
  667. this.$modal.msg('请输入气源方向')
  668. return;
  669. }
  670. if (this.isEmpty(this.projectObj.taskPosition)) {
  671. this.$modal.msg('请输入作业位置')
  672. return;
  673. }
  674. if (this.isEmpty(this.projectObj.valvePosition)) {
  675. this.$modal.msg('请输入作业相关阀门位置')
  676. return;
  677. }
  678. if (this.isEmpty(this.projectObj.stressReport)) {
  679. this.$modal.msg('请输入压力报告')
  680. return;
  681. }
  682. if (this.isEmpty(this.projectObj.supervisionRecord)) {
  683. this.$modal.msg('请输入监理旁站记录')
  684. return;
  685. }
  686. if (this.isEmpty(this.projectObj.workContactForm)) {
  687. this.$modal.msg('请输入工作联系单')
  688. return;
  689. }
  690. if (this.isEmpty(this.projectObj.linePatrolConfirmationForm)) {
  691. this.$modal.msg('请输入巡线确认单')
  692. return;
  693. }
  694. if (this.isEmpty(this.projectObj.hazardousWorkPitsLong)) {
  695. this.$modal.msg('请输入危险作业坑长度')
  696. return;
  697. }
  698. if (this.isEmpty(this.projectObj.hazardousWorkPitsWide)) {
  699. this.$modal.msg('请输入危险作业坑宽度')
  700. return;
  701. }
  702. if (this.isEmpty(this.projectObj.hazardousWorkPitsDeep)) {
  703. this.$modal.msg('请输入危险作业坑深度')
  704. return;
  705. }
  706. if (this.isEmpty(this.projectObj.otherPipelineConditionsWorkPit)) {
  707. this.$modal.msg('请输入作业坑内其他管道情况')
  708. return;
  709. }
  710. if (this.isEmpty(this.projectObj.siteHead)) {
  711. this.$modal.msg('请输入现场负责人')
  712. return;
  713. }
  714. if (this.isEmpty(this.projectObj.siteHeadPhone)) {
  715. this.$modal.msg('请输入现场负责人联系方式')
  716. return;
  717. } else {
  718. if (!this.$validation.mobile(this.projectObj.siteHeadPhone)) {
  719. this.$modal.msg('请输入正确的联系方式');
  720. return;
  721. }
  722. }
  723. if (this.isEmpty(this.projectObj.operatorInformation)) {
  724. this.$modal.msg('请输入作业人员信息')
  725. return;
  726. }
  727. if (this.isEmpty(this.projectObj.inspectionPort)) {
  728. this.$modal.msg('请输入检口')
  729. return;
  730. }
  731. if (this.isEmpty(this.projectObj.pipelinePainting)) {
  732. this.$modal.msg('请输入管道刷油')
  733. return;
  734. }
  735. if (this.isEmpty(this.projectObj.pipelineCorrosionProtection)) {
  736. this.$modal.msg('请输入管道防腐')
  737. return;
  738. }
  739. if (this.isEmpty(this.projectObj.pipelineSupport)) {
  740. this.$modal.msg('请输入管道支护')
  741. return;
  742. }
  743. if (this.isEmpty(this.projectObj.masonryValveWell)) {
  744. this.$modal.msg('请输入砌筑阀门井')
  745. return;
  746. }
  747. if (this.isEmpty(this.projectObj.protectionWell)) {
  748. this.$modal.msg('请输入保护井')
  749. return;
  750. }
  751. if (this.isEmpty(this.projectObj.pipeProtectionWelMasonry)) {
  752. this.$modal.msg('请输入管件保护井砌筑')
  753. return;
  754. }
  755. if (this.isEmpty(this.projectObj.backfill)) {
  756. this.$modal.msg('请输入回填')
  757. return;
  758. }
  759. if (this.isEmpty(this.projectObj.tamp)) {
  760. this.$modal.msg('请输入夯实')
  761. return;
  762. }
  763. if (this.isEmpty(this.projectObj.levelingTheSite)) {
  764. this.$modal.msg('请输入平整场地')
  765. return;
  766. }
  767. if (this.isEmpty(this.projectObj.remark)) {
  768. this.$modal.msg('请输入备注')
  769. return;
  770. }
  771. if (this.fileArr.length <= 0) {
  772. this.$modal.msg('请选择附件')
  773. return;
  774. }
  775. this.projectObj.enginTime = this.projectTime;
  776. this.projectObj.pics = this.fileArr;
  777. // this.projectObj.files = this.fileArr;
  778. uni.showLoading()
  779. updateDangerousWorkProject(this.projectObj).then(res => {
  780. uni.hideLoading()
  781. this.$modal.msg(res.msg);
  782. setTimeout(() => {
  783. uni.navigateBack();
  784. }, 1000);
  785. })
  786. },
  787. handleSubmit(e) {
  788. this.projectTime =
  789. `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}:${e.second}`;
  790. this.projectObj.enginTime = this.projectTime;
  791. },
  792. // 打开picker
  793. openDatetimePicker() {
  794. if (this.isEmpty(this.projectObj.id)) {
  795. this.$modal.msg('请选择工程')
  796. } else {
  797. this.$refs.myPicker.show();
  798. }
  799. },
  800. addTimes(m) {
  801. return m < 10 ? '0' + m : m
  802. },
  803. //获取当前时间
  804. traversalTime(timestamp) {
  805. //timestamp(时间戳)是整数,否则要parseInt转换
  806. let time = new Date(timestamp);
  807. let y = time.getFullYear();
  808. let m = time.getMonth() + 1;
  809. let d = time.getDate();
  810. let h = time.getHours();
  811. let mm = time.getMinutes();
  812. let s = time.getSeconds();
  813. return y + '-' + this.addTimes(m) + '-' + this.addTimes(d) + ' ' + this.addTimes(
  814. h) + ':' + this.addTimes(
  815. mm) + ':' + this.addTimes(s);
  816. },
  817. }
  818. }
  819. </script>
  820. <style>
  821. .container {
  822. display: flex;
  823. align-items: center;
  824. justify-content: space-between;
  825. padding: 10px;
  826. position: relative;
  827. }
  828. .uni-list {
  829. border: 1xp solid #eee;
  830. }
  831. .to-right-icon {
  832. width: 15px;
  833. height: 15px;
  834. position: absolute;
  835. top: 50%;
  836. transform: translateY(-50%);
  837. }
  838. .marginLeft5 {
  839. margin-left: 5px;
  840. }
  841. .title-txt {
  842. font-size: 15px;
  843. font-weight: bold;
  844. color: black;
  845. }
  846. .content-txt {
  847. font-size: 10px;
  848. font-weight: bold;
  849. color: black;
  850. }
  851. .background {
  852. // border: 15px solid hsla(0, 0%, 100%, .5);
  853. background: white;
  854. background-clip: padding-box;
  855. padding: 20rpx;
  856. border-radius: 20rpx;
  857. margin: 20rpx;
  858. /*从padding开始往外面裁剪背景*/
  859. }
  860. .uni-list-cell {
  861. position: relative;
  862. display: flex;
  863. flex-direction: row;
  864. justify-content: space-between;
  865. align-items: center;
  866. }
  867. .uni-list-cell-left {
  868. white-space: nowrap;
  869. font-size: 28rpx;
  870. }
  871. .centered {
  872. text-align: center;
  873. background-color: #e2f4ff;
  874. }
  875. .text {
  876. background-color: #e2f4ff;
  877. height: 20rpx;
  878. }
  879. .view_bg_build {
  880. background-color: #e2f4ff;
  881. padding: 10rpx;
  882. margin: 20rpx;
  883. }
  884. .grid-text {
  885. font-size: 14px;
  886. color: #000000;
  887. text-align: center;
  888. padding-left: 30rpx;
  889. padding-right: 30rpx;
  890. padding-top: 20rpx;
  891. padding-bottom: 20rpx;
  892. }
  893. .name {
  894. flex: 0;
  895. font-size: 14px;
  896. color: #000000;
  897. overflow: hidden;
  898. text-overflow: ellipsis;
  899. white-space: nowrap;
  900. }
  901. .table-item {
  902. overflow: hidden;
  903. text-overflow: ellipsis;
  904. white-space: nowrap;
  905. }
  906. .block-iv {
  907. width: 10px;
  908. height: 10px;
  909. }
  910. .btn {
  911. width: 715rpx;
  912. height: 69rpx;
  913. background: #79A4F0;
  914. border-radius: 6rpx;
  915. font-size: 25rpx;
  916. font-family: Microsoft YaHei;
  917. font-weight: 400;
  918. color: #FFFFFF;
  919. line-height: 69rpx;
  920. margin-top: 40rpx;
  921. margin-bottom: 100rpx;
  922. }
  923. .number {
  924. display: flex;
  925. /* 水平居中显示子元素 */
  926. align-items: flex-start;
  927. /* 垂直居中显示子元素 */
  928. justify-content: space-between;
  929. /* 左右间距等于间距大小 */
  930. padding: 10px;
  931. /* 设置padding以提高视觉效果 */
  932. }
  933. .tj-btn {
  934. height: 69rpx;
  935. background: #3184f0;
  936. border-radius: 6rpx;
  937. font-size: 25rpx;
  938. font-weight: 400;
  939. color: #FFFFFF;
  940. line-height: 69rpx;
  941. margin: 40rpx 70rpx;
  942. }
  943. .sc-btn {
  944. height: 69rpx;
  945. background: #f0686b;
  946. border-radius: 6rpx;
  947. font-size: 25rpx;
  948. font-weight: 400;
  949. color: #FFFFFF;
  950. line-height: 69rpx;
  951. margin: 40rpx;
  952. }
  953. .num-style {
  954. background: #e8f4f9;
  955. margin: 20rpx;
  956. padding: 10rpx;
  957. border-radius: 20rpx;
  958. border: 1px solid #d4e3f0;
  959. }
  960. .textarea {
  961. margin-top: 10upx;
  962. width: 100%;
  963. border: 1rpx solid red;
  964. min-height: 100upx;
  965. line-height: 20px;
  966. }
  967. .text {
  968. font-size: 16px;
  969. color: #333;
  970. }
  971. input {
  972. flex-grow: 1;
  973. font-size: 28rpx;
  974. color: #808080;
  975. }
  976. </style>