snapshotAdd.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <!-- 随手拍-添加 -->
  2. <template>
  3. <view class="examine">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="header" @click="handleClick('manage')">
  6. <text>随手拍管理</text>
  7. <img src="@/images/Version3.3.3/icon_04.png">
  8. </view>
  9. <view class="basics">
  10. <view class="basics_li">
  11. <view class="basics_li_l">学院</view>
  12. <picker @change="collegeChange" :value="collegeIndex" :range="collegeArray" class="scope_r">
  13. <view class="basics_li_r college_r">
  14. <view>{{collegeArray[collegeIndex]}}</view>
  15. <img src="@/images/Version3.3.3/icon_06.png">
  16. </view>
  17. </picker>
  18. </view>
  19. <view class="basics_li">
  20. <view class="basics_li_l">实验室</view>
  21. <view class="basics_li_r lab_r">
  22. <input class="picker-text" @click="popupClick(1)" type="text" disabled v-model="form.fjNumber" placeholder="请选择房间" placeholder-style="font-size: 30rpx;color:#333;">
  23. <view class="img-box" @click.stop="saoCode">
  24. <img src="@/images/Version3.3.3/icon_aqjc_sm.png">
  25. </view>
  26. </view>
  27. </view>
  28. <view class="check-for-input-max-box">
  29. <view class="left-title-p">隐患描述:</view>
  30. <textarea type="text" v-model="form.yhMs" maxlength="50" placeholder="请输入隐患描述" placeholder-style="font-size:28rpx;color:#999;"></textarea>
  31. </view>
  32. <view class="check-for-img-max-box">
  33. <view class="left-title-p">隐患照片(最多上传5张):</view>
  34. <view class="right-img-box">
  35. <view class="img-box" v-for="(imgUrl,imgIndex) in form.yhImg" :key="imgIndex">
  36. <img class="img-data" :src="configURL+imgUrl">
  37. <img class="position-img" src="@/pages_manage/images/icon_ssp_closure.png" @click="delImg(imgIndex)">
  38. </view>
  39. <img class="add-button" src="@/pages_manage/images/icon_07.png" @click="selectImage()" v-if="form.yhImg.length<5">
  40. </view>
  41. </view>
  42. </view>
  43. <view class="record" ><text @click="handleClick('self')">随手拍上报记录</text></view>
  44. </scroll-view>
  45. <!-- 房间选择弹出层 -->
  46. <view class="popup-max-box" v-if="popupType">
  47. <view class="popup-null" @click="popupClick(2)"></view>
  48. <view class="popup-big-box">
  49. <view class="popup-input-box">
  50. <input type="text" maxlength="10" v-model="room" placeholder="请输入房间号">
  51. <view @click="getSelectInfoByRoom">搜索</view>
  52. </view>
  53. <view class="popup-for-max-box">
  54. <view class="popup-for-null" v-if="!roomList[0]">暂无数据</view>
  55. <view class="popup-for-box" v-for="(item,index) in roomList" :key="index">
  56. <view class="name-p">{{item.name}} ({{item.room}})</view>
  57. <view class="button-p" @click="popupClickItem(item)">确定</view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="bottom_btn" @click="handleClick('subBtn')">提交</view>
  63. </view>
  64. </template>
  65. <script>
  66. import { config } from '@/api/request/config.js'
  67. import { getSelectInfoByRoom} from '@/api/index.js'
  68. export default {
  69. name: "rectifyList",
  70. components: {
  71. },
  72. data() {
  73. return {
  74. configURL:config.base_url,
  75. pageType:0,
  76. //列表请求参数
  77. getData:{
  78. pageNum:1,
  79. pageSize:20,
  80. },
  81. form:{
  82. name:'',
  83. startTime:'',
  84. inspectResult:0,//检查结果
  85. yhMs:'',
  86. yhImg:[],
  87. },
  88. collegeIndex :0,
  89. collegeArray:['选择学院','学院名称1','学院名称2','学院名称3',],
  90. categoryIndex :0,
  91. categoryArray:['校级巡查','院级巡查'],
  92. planIndex :0,
  93. planArray:['请选择巡查计划标题','2023年3月份校级督导检查','2023年4月份校级督导检查'],
  94. resultIndex :0,
  95. resultArray:['不符合','符合'],
  96. informIndex:0,
  97. informArray:['整改告知书','整改通知书'],
  98. //房间弹层 状态
  99. popupType:false,
  100. //房间搜索字段
  101. room:"",
  102. roomList:[],
  103. }
  104. },
  105. onLoad(option) {
  106. },
  107. onShow() {
  108. },
  109. mounted(){
  110. },
  111. methods: {
  112. //滚动事件
  113. scrollGet(){},
  114. handleClick(doType){
  115. let self=this;
  116. if( doType=='manage'){//随手拍管理
  117. uni.navigateTo({
  118. url: '/pages/pages_safetyExamine/snapshotManage/snapshotList?pageType=1'
  119. });
  120. }else if(doType=='self'){//随手拍上报记录
  121. uni.navigateTo({
  122. url: '/pages/pages_safetyExamine/snapshotManage/snapshotList?pageType=2'
  123. });
  124. }else if(doType=='subBtn'){//提交
  125. }
  126. },
  127. collegeChange(e){
  128. this.collegeIndex = e.target.value;
  129. },
  130. // 图片上传
  131. selectImage() {
  132. let self = this;
  133. if(this.form.yhImg.length>4){
  134. uni.showToast({
  135. title: '最多上传5张图片',
  136. icon:"none",
  137. mask:true,
  138. duration: 2000
  139. });
  140. return
  141. }
  142. wx.chooseImage({
  143. count: 1,
  144. sizeType: ["original", "compressed"],
  145. sourceType: ["album", "camera"],
  146. success: function(res) {
  147. let tempFilePaths = res.tempFilePaths[0];
  148. self.uploadImg(tempFilePaths);
  149. }
  150. });
  151. },
  152. async uploadImg(tempFilePaths){
  153. var self = this;
  154. uni.showLoading({
  155. title: '上传中',
  156. mask: true
  157. });
  158. uni.uploadFile({
  159. url: config.base_url+'/base/file/upload', //仅为示例,非真实的接口地址
  160. header:{'Authorization':uni.getStorageSync('token')},
  161. filePath: tempFilePaths,
  162. name: 'file',
  163. formData: {
  164. 'user': 'test'
  165. },
  166. success: (uploadFileRes) => {
  167. let res = JSON.parse(uploadFileRes.data);
  168. if(res.code == 200){
  169. this.form.yhImg.push(res.data.url);
  170. console.log(res.data.url)
  171. }else{
  172. uni.showToast({
  173. title: res.msg,
  174. icon:"none",
  175. mask:true,
  176. duration: 2000
  177. });
  178. }
  179. },
  180. fail: err => {},
  181. complete: () => {
  182. uni.hideLoading()
  183. }
  184. });
  185. },
  186. //删除图片
  187. delImg(minIndex){
  188. this.form.yhImg.splice(minIndex,1);
  189. this.$forceUpdate();
  190. },
  191. //搜索房间弹层开关
  192. popupClick(type){
  193. if(type == 1){
  194. this.room = "";
  195. this.roomList = [];
  196. this.popupType = true;
  197. }else if(type == 2){
  198. this.popupType = false;
  199. }
  200. },
  201. //搜索房间接口
  202. async getSelectInfoByRoom(){
  203. let self = this;
  204. if(!this.room){
  205. uni.showToast({
  206. title: '请输入要搜索房间号',
  207. icon:"none",
  208. mask:true,
  209. duration: 2000
  210. });
  211. return
  212. }
  213. const {data} = await getSelectInfoByRoom(this.room);
  214. if(data.code==200){
  215. if(data.data[0]){
  216. this.roomList = data.data;
  217. }else{
  218. uni.showToast({
  219. title: '未找到相关房间',
  220. icon:"none",
  221. mask:true,
  222. duration: 2000
  223. });
  224. }
  225. }
  226. },
  227. //确认搜索房间
  228. popupClickItem(item){
  229. this.$set(this.form,"fjNumber",item.room)
  230. this.$set(this.form,"deptName",item.deptName)
  231. this.$set(this.form,"buildingId",item.building)
  232. this.$set(this.form,"deptId",item.deptId)
  233. this.$set(this.form,"laboratoryId",item.id)
  234. this.$set(this.form,"buildingName",item.buildName)
  235. this.$set(this.form,"laboratoryName",item.name)
  236. this.$set(this.form,"fzrId",item.userId)
  237. this.$set(this.form,"fzrName",item.safeUserName)
  238. this.$set(this.form,"fzrLxfs",item.safeUserPhone)
  239. this.popupType = false;
  240. },
  241. //调用摄像头
  242. saoCode(){
  243. let self = this;
  244. uni.scanCode({
  245. onlyFromCamera: true,
  246. success: function (res) {
  247. if(res.result.indexOf("code") != -1 && res.result.indexOf("-") != -1 && res.result.indexOf("&") != -1){
  248. let codeRoom = "";
  249. let newList = res.result.split("?")[1].split("&")
  250. let list = newList[0].split("=")[1].split("-")
  251. codeRoom = list[1];
  252. if(codeRoom){
  253. self.roomList = [];
  254. self.room = codeRoom;
  255. self.getSelectInfoByRoom();
  256. self.popupType = true;
  257. }else{
  258. uni.showToast({
  259. title: '请扫描正确的二维码',
  260. icon:"none",
  261. mask:true,
  262. duration: 2000
  263. });
  264. }
  265. }else{
  266. uni.showToast({
  267. title: '请扫描正确的二维码',
  268. icon:"none",
  269. mask:true,
  270. duration: 2000
  271. });
  272. }
  273. }
  274. });
  275. },
  276. }
  277. }
  278. </script>
  279. <style lang="stylus" scoped>
  280. .examine{
  281. height:100%;
  282. display flex;
  283. box-sizing: border-box;
  284. .info-max-box{
  285. flex: 1;
  286. overflow: scroll;
  287. padding: 120rpx 0rpx 128rpx;
  288. box-sizing: border-box;
  289. }
  290. .header{
  291. width: 749rpx;
  292. height: 100rpx;
  293. background: #FFFFFF;
  294. padding:0 40rpx 0 30rpx;
  295. box-sizing: border-box;
  296. display: flex;
  297. justify-content: space-between;
  298. align-items: center;
  299. position: fixed;
  300. left: 0;
  301. top: 0;
  302. >text{
  303. font-size: 30rpx;
  304. font-family: PingFang SC-Medium, PingFang SC;
  305. font-weight: 400;
  306. color: #333333;
  307. line-height: 42rpx;
  308. }
  309. >img{
  310. width: 8rpx;
  311. height: 14rpx;
  312. }
  313. }
  314. .basics{
  315. margin: 0 30rpx;
  316. width: 690rpx;
  317. background: #FFFFFF;
  318. border-radius: 20rpx;
  319. padding: 30rpx 28rpx 30rpx;
  320. box-sizing: border-box;
  321. .basics_li{
  322. display: flex;
  323. justify-content: flex-start;
  324. margin-bottom: 24rpx;
  325. .basics_li_l{
  326. width: 146rpx;
  327. text-align: left;
  328. font-size: 30rpx;
  329. font-family: PingFang SC-Medium, PingFang SC;
  330. font-weight: 400;
  331. color: #333333;
  332. line-height: 80rpx;
  333. }
  334. .basics_li_r{
  335. width: 486rpx;
  336. height: 80rpx;
  337. border-radius: 10rpx;
  338. opacity: 1;
  339. border: 1rpx solid #E0E0E0;
  340. padding-left: 20rpx;
  341. box-sizing: border-box;
  342. }
  343. /* 学院 */
  344. .college_r{
  345. width: 486rpx;
  346. height: 80rpx;
  347. border-radius: 10rpx;
  348. border: 1rpx solid #E0E0E0;
  349. display: flex;
  350. justify-content: flex-start;
  351. align-items: center;
  352. >view{
  353. flex:1;
  354. line-height:80rpx;
  355. font-size: 30rpx;
  356. font-family: PingFang SC-Medium, PingFang SC;
  357. font-weight: 400;
  358. color: #333333;
  359. line-height: 80rpx;
  360. }
  361. >img{
  362. width: 14rpx;
  363. height: 8rpx;
  364. margin-right: 30rpx;
  365. }
  366. }
  367. /* 实验室 */
  368. .lab_r{
  369. width: 486rpx;
  370. height: 80rpx;
  371. display: flex;
  372. justify-content: flex-start;
  373. .picker-text{
  374. width: 438rpx;
  375. height: 80rpx;
  376. }
  377. .img-box{
  378. width: 48rpx;
  379. >img{
  380. width:30rpx;
  381. height:28rpx;
  382. margin:16rpx 18rpx 0 0;
  383. }
  384. }
  385. }
  386. }
  387. /* 隐患描述 */
  388. .check-for-input-max-box{
  389. .left-title-p{
  390. width:150rpx;
  391. line-height:80rpx;
  392. text-align right
  393. font-size:30rpx;
  394. }
  395. textarea{
  396. width: 630rpx;
  397. height: 158rpx;
  398. border-radius: 20rpx 20rpx 20rpx 20rpx;
  399. border: 1rpx solid #E0E0E0;
  400. padding: 20rpx 14rpx;
  401. box-sizing: border-box;
  402. font-size: 30rpx;
  403. font-family: PingFang SC-Medium, PingFang SC;
  404. font-weight: 400;
  405. color: #333333;
  406. line-height: 34rpx;
  407. }
  408. }
  409. /* 隐患照片 */
  410. .check-for-img-max-box{
  411. .left-title-p{
  412. width: 100%;
  413. text-align: left;
  414. font-size: 30rpx;
  415. font-family: PingFang SC-Medium, PingFang SC;
  416. font-weight: 400;
  417. color: #333333;
  418. line-height: 80rpx;
  419. }
  420. .right-img-box{
  421. .img-box{
  422. display inline-block;
  423. height:200rpx;
  424. width:200rpx;
  425. position relative
  426. margin:0 14rpx 20rpx 0;
  427. border-radius 10rpx;
  428. overflow hidden;
  429. .img-data{
  430. height:200rpx;
  431. width:200rpx;
  432. }
  433. .position-img{
  434. position absolute
  435. right:0;
  436. top:0;
  437. width:36rpx;
  438. height:36rpx;
  439. }
  440. }
  441. .img-box:nth-of-type(3n+3){
  442. margin-right: 0rpx;
  443. }
  444. .add-button{
  445. margin:0 0rpx 20rpx 0;
  446. border-radius 10rpx;
  447. overflow hidden;
  448. display inline-block
  449. height:200rpx;
  450. width:200rpx;
  451. }
  452. }
  453. }
  454. }
  455. .record{
  456. overflow: hidden;
  457. >text{
  458. display: block;
  459. width: 220rpx;
  460. height: 40rpx;
  461. background: #E0E0E0;
  462. border-radius: 60rpx 60rpx 60rpx 60rpx;
  463. margin: 122rpx 0 90rpx 266rpx;
  464. font-size: 26rpx;
  465. font-family: PingFang SC-Medium, PingFang SC;
  466. font-weight: 400;
  467. color: #0183FA;
  468. line-height: 40rpx;
  469. text-align: center;
  470. }
  471. }
  472. .popup-max-box{
  473. z-index:10;
  474. height:100%;
  475. width:100%;
  476. position fixed;
  477. background rgba(0,0,0,0.2)
  478. display flex;
  479. flex-direction column
  480. .popup-null{
  481. flex:1;
  482. }
  483. .popup-big-box{
  484. border-top-left-radius:20rpx;
  485. border-top-right-radius:20rpx;
  486. background #fff
  487. .popup-input-box{
  488. padding:30rpx 20rpx;
  489. display:flex;
  490. input{
  491. flex:1;
  492. height:70rpx;
  493. border:1rpx solid #e0e0e0;
  494. border-radius:10rpx;
  495. margin-right:20rpx;
  496. padding:0 20rpx;
  497. }
  498. view{
  499. background #0183FA
  500. color:#fff;
  501. border-radius:10rpx;
  502. width:140rpx;
  503. line-height:70rpx;
  504. text-align center;
  505. font-size:28rpx;
  506. }
  507. }
  508. .popup-for-max-box{
  509. margin:0 20rpx 30rpx;
  510. height:600rpx;
  511. overflow-y scroll;
  512. .popup-for-null{
  513. line-height:100rpx;
  514. text-align center
  515. color:#999;
  516. }
  517. .popup-for-box{
  518. display:flex;
  519. padding:10px 0;
  520. .name-p{
  521. flex:1;
  522. line-height:60rpx;
  523. }
  524. .button-p{
  525. background #0183FA
  526. color:#fff;
  527. text-align center
  528. width:100rpx;
  529. line-height:60rpx;
  530. height:60rpx;
  531. border-radius:10rpx;
  532. }
  533. }
  534. }
  535. }
  536. }
  537. .bottom_btn{
  538. position: fixed;
  539. bottom: 26rpx;
  540. left: 30rpx;
  541. font-size: 30rpx;
  542. font-family: PingFang SC-Medium, PingFang SC;
  543. font-weight: 400;
  544. color: #FFFFFF;
  545. line-height: 90rpx;
  546. width: 690rpx;
  547. height: 90rpx;
  548. background: #0183FA;
  549. border-radius: 20rpx;
  550. text-align: center;
  551. }
  552. }
  553. </style>