dangerous.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  1. <template>
  2. <!-- 危险作业工程 -->
  3. <view>
  4. <view class="background">
  5. <view class="uni-list">
  6. <view class="container">
  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. style=" position: absolute; width: 15px;height: 15px;"></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. style=" position: absolute; width: 15px;height: 15px;"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <view class="uni-list">
  24. <view class="container">
  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">
  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. style=" position: absolute; width: 15px;height: 15px;"></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. style=" position: absolute; width: 15px;height: 15px;"></image>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="uni-list">
  63. <view class="container">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  145. <text>危险作业坑大小(长,宽,深)</text>
  146. <input class="uni-input" type="digit" v-model="projectObj.hazardousWorkPitsLong" placeholder="请输入长"
  147. maxlength="9" style="margin-left: 10px;text-align: right;"></input>
  148. <input class="uni-input" type="digit" v-model="projectObj.hazardousWorkPitsWide" placeholder="请输入宽"
  149. maxlength="9" style="margin-left: 10px;text-align: right;"></input>
  150. <input class="uni-input" type="digit" v-model="projectObj.hazardousWorkPitsDeep" placeholder="请输入深"
  151. maxlength="9" style="margin-left: 10px;text-align: right;"></input>
  152. </view>
  153. </view>
  154. <view class="uni-list">
  155. <view class="container">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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">
  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: gainsboro;">*请上传文件</view>
  274. <view style="display: flex; flex-wrap: wrap;margin-top: 10px; margin-left: 10px;">
  275. <!-- -->
  276. <image src="/static/images/chooseimg.png" mode=""
  277. style="width: 100rpx; height: 100rpx; 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 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. </view>
  314. </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. margin-left: 10px;
  775. margin-top: 10px;
  776. margin-right: 10px;
  777. align-items: flex-start;
  778. justify-content: space-between;
  779. }
  780. .marginLeft5 {
  781. margin-left: 5px;
  782. }
  783. .title-txt {
  784. font-size: 15px;
  785. font-weight: bold;
  786. color: black;
  787. }
  788. .content-txt {
  789. font-size: 10px;
  790. font-weight: bold;
  791. color: black;
  792. }
  793. .background {
  794. margin: 8px;
  795. padding: 10px;
  796. background-color: #fff;
  797. border-radius: 5px;
  798. padding-left: 5px;
  799. padding-right: 10px;
  800. }
  801. .uni-list-cell {
  802. position: relative;
  803. display: flex;
  804. flex-direction: row;
  805. justify-content: space-between;
  806. align-items: center;
  807. }
  808. .uni-list-cell-left {
  809. white-space: nowrap;
  810. font-size: 28rpx;
  811. }
  812. .centered {
  813. text-align: center;
  814. background-color: #e2f4ff;
  815. }
  816. .text {
  817. background-color: #e2f4ff;
  818. height: 20rpx;
  819. }
  820. .view_bg_build {
  821. background-color: #e2f4ff;
  822. padding: 10rpx;
  823. margin: 20rpx;
  824. }
  825. .grid-text {
  826. font-size: 14px;
  827. color: #000000;
  828. text-align: center;
  829. padding-left: 30rpx;
  830. padding-right: 30rpx;
  831. padding-top: 20rpx;
  832. padding-bottom: 20rpx;
  833. }
  834. .name {
  835. flex: 0;
  836. font-size: 14px;
  837. color: #000000;
  838. overflow: hidden;
  839. text-overflow: ellipsis;
  840. white-space: nowrap;
  841. }
  842. .table-item {
  843. overflow: hidden;
  844. text-overflow: ellipsis;
  845. white-space: nowrap;
  846. }
  847. .block-iv {
  848. width: 10px;
  849. height: 10px;
  850. }
  851. .btn {
  852. margin-top: 40px;
  853. margin-right: 20px;
  854. margin-bottom: 120px;
  855. margin-left: 20px;
  856. height: 45px;
  857. }
  858. .number {
  859. display: flex;
  860. /* 水平居中显示子元素 */
  861. align-items: flex-start;
  862. /* 垂直居中显示子元素 */
  863. justify-content: space-between;
  864. /* 左右间距等于间距大小 */
  865. padding: 10px;
  866. /* 设置padding以提高视觉效果 */
  867. }
  868. .textarea {
  869. margin-top: 10upx;
  870. width: 100%;
  871. border: 1rpx solid red;
  872. min-height: 100upx;
  873. line-height: 20px;
  874. }
  875. .text {
  876. font-size: 16px;
  877. color: #333;
  878. }
  879. input {
  880. flex-grow: 1;
  881. font-size: 28rpx;
  882. color: #808080;
  883. }
  884. </style>