snapshotAdd.vue 14 KB

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