dangerous.vue 30 KB

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