123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713 |
- <!-- 随手拍-添加 -->
- <template>
- <view class="examine">
- <view class="header" @click="handleClick('manage')">
- <text>随手拍管理</text>
- <img src="@/pages_safetyExamine/images/icon_04.png">
- </view>
- <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
- <view class="basics">
- <view class="basics_li">
- <view class="basics_li_l">学院</view>
- <picker @change="collegeChange" :value="collegeIndex" :range="collegeArray" class="scope_r">
- <view class="basics_li_r college_r">
- <view>{{form.deptName?form.deptName:'选择学院'}}</view>
- <img src="@/pages_safetyExamine/images/icon_06.png">
- </view>
- </picker>
- </view>
- <view class="basics_li">
- <view class="basics_li_l">实验室</view>
- <view class="basics_li_r lab_r">
- <input class="picker-text" @click="popupClick(1)" type="text" disabled v-model="form.subName"
- placeholder="请输入实验室关键词查询" placeholder-style="font-size: 30rpx;color:#333;">
- <view class="img-box" @click.stop="saoCode">
- <img src="@/pages_safetyExamine/images/icon_aqjc_sm.png">
- </view>
- </view>
- </view>
- <view class="check-for-input-max-box">
- <view class="left-title-p">隐患描述:</view>
- <textarea type="text" v-model="form.hazardDescribe" maxlength="50" placeholder="请输入隐患描述"
- placeholder-style="font-size:28rpx;color:#999;"></textarea>
- </view>
- <view class="check-for-img-max-box">
- <view class="left-title-p">隐患照片(最多上传5张):</view>
- <view class="right-img-box">
- <view class="img-box" v-for="(imgUrl,imgIndex) in form.imgDtoList" :key="imgIndex">
- <img class="img-data" :src="configURL+imgUrl.fileUrl">
- <img class="position-img" src="@/pages_safetyExamine/images/icon_ssp_closure.png"
- @click="delImg(imgIndex)">
- </view>
- <img class="add-button" src="@/pages_safetyExamine/images/icon_07.png" @click="selectImage()"
- v-if="form.imgDtoList.length<5">
- </view>
- </view>
- </view>
- <view class="record"><text @click="handleClick('self')">随手拍上报记录</text></view>
- </scroll-view>
- <!-- 房间选择弹出层 -->
- <view class="popup-max-box" v-if="popupType">
- <view class="popup-null" @click="popupClick(2)"></view>
- <view class="popup-big-box">
- <view class="popup-input-box">
- <input type="text" maxlength="10" v-model="room" placeholder="请输入关键字">
- <view @click="buildBySub">搜索</view>
- </view>
- <view class="popup-for-max-box">
- <view class="popup-for-null" v-if="!roomList[0]">暂无数据</view>
- <view class="popup-for-box" v-for="(item,index) in roomList" :key="index">
- <view class="name-p">{{item.subName}} ({{item.roomNum?item.roomNum:'-'}})</view>
- <view class="button-p" @click="popupClickItem(item)">确定</view>
- </view>
- </view>
- </view>
- </view>
- <view class="bottom_btn" @click="submitForm()">提交</view>
- </view>
- </template>
- <script>
- import {
- config
- } from '@/api/request/config.js'
- import {
- laboratorySubRelInfoGetRelList,
- getUserCollegCheck,
- systemDeptDropList,
- checkClapAdd,
- } from '@/pages_safetyExamine/api/index.js'
- export default {
- name: "rectifyList",
- components: {
- },
- data() {
- return {
- configURL: config.base_url,
- pageType: 0,
- //列表请求参数
- getData: {
- pageNum: 1,
- pageSize: 20,
- },
- form: {
- deptId: '',
- deptName: '',
- subId: '',
- subName: '',
- hazardDescribe: '',
- imgDtoList: [],
- },
- collegeIndex: 0,
- collegeArray: [],
- categoryIndex: 0,
- collegeList: [],
- categoryArray: ['校级巡查', '院级巡查'],
- planIndex: 0,
- planArray: ['请选择巡查计划标题', '2023年3月份校级督导检查', '2023年4月份校级督导检查'],
- resultIndex: 0,
- resultArray: ['不符合', '符合'],
- informIndex: 0,
- informArray: ['整改告知书', '整改通知书'],
- //房间弹层 状态
- popupType: false,
- //房间搜索字段
- room: "",
- roomList: [],
- }
- },
- onLoad(option) {
- },
- onShow() {
- },
- mounted() {
- this.listDepartments();
- // this.getUserCollegCheck();
- },
- methods: {
- //滚动事件
- scrollGet() {},
- handleClick(doType) {
- let self = this;
- if (doType == 'manage') { //随手拍管理
- uni.navigateTo({
- url: '/pages_safetyExamine/views/snapshotManage/snapshotList?pageType=1'
- });
- } else if (doType == 'self') { //随手拍上报记录
- uni.navigateTo({
- url: '/pages_safetyExamine/views/snapshotManage/snapshotList?pageType=2'
- });
- } else if (doType == 'subBtn') { //提交
- }
- },
- collegeChange(e) {
- this.collegeIndex = e.target.value;
- this.form.deptId = this.collegeList[e.target.value].deptId
- this.form.deptName = this.collegeList[e.target.value].deptName
- },
- // 图片上传
- selectImage() {
- let self = this;
- if (this.form.imgDtoList.length > 4) {
- uni.showToast({
- title: '最多上传5张图片',
- icon: "none",
- mask: true,
- duration: 2000
- });
- return
- }
- wx.chooseImage({
- count: 5,
- sizeType: ["original", "compressed"],
- sourceType: ["album", "camera"],
- success: function(res) {
- //let tempFilePaths = res.tempFilePaths[0];
- self.uploadImg(res.tempFilePaths);
- }
- });
- },
- async uploadImg(tempFilePaths) {
- var self = this;
- uni.showLoading({
- title: '上传中',
- mask: true
- });
- for (let i = 0; i < tempFilePaths.length; i++) {
- console.log(tempFilePaths[i])
- uni.uploadFile({
- url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
- header: {
- 'Authorization': uni.getStorageSync('token')
- },
- filePath: tempFilePaths[i],
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- let res = JSON.parse(uploadFileRes.data);
- console.log(res.data)
- if (res.code == 200) {
- this.form.imgDtoList.push({
- 'fileUrl': res.data.url,
- 'fileName': res.data.name
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none",
- mask: true,
- duration: 2000
- });
- }
- },
- fail: err => {},
- complete: () => {
- uni.hideLoading()
- }
- });
- }
- },
- //删除图片
- delImg(minIndex) {
- this.form.imgDtoList.splice(minIndex, 1);
- this.$forceUpdate();
- },
- //搜索房间弹层开关
- popupClick(type) {
- if (type == 1) {
- this.room = "";
- this.roomList = [];
- this.popupType = true;
- this.buildBySub();
- } else if (type == 2) {
- this.popupType = false;
- }
- },
- //搜索房间接口
- async buildBySub() {
- let self = this;
- const {
- data
- } = await laboratorySubRelInfoGetRelList({
- 'searchValue': this.room,
- 'deptId': this.form.deptId
- });
- if (data.code == 200) {
- if (data.data[0]) {
- this.roomList = data.data;
- } else {
- uni.showToast({
- title: '未找到相关实验室',
- icon: "none",
- mask: true,
- duration: 2000
- });
- }
- }
- },
- //确认搜索房间
- popupClickItem(item) {
- console.log(item)
- this.$set(this.form, "subId", item.subId)
- this.$set(this.form, "subName", item.subName)
- this.$set(this.form, "deptId", item.deptId)
- for (let i = 0; i < this.collegeList.length; i++) {
- if (item.deptId == this.collegeList[i].deptId) {
- this.$set(this.form, "deptName", this.collegeList[i].deptName)
- }
- }
- this.popupType = false;
- },
- //调用摄像头
- saoCode() {
- let self = this;
- uni.scanCode({
- onlyFromCamera: true,
- success: function(res) {
- if (res.result.indexOf("code") != -1 && res.result.indexOf("-") != -1 && res.result
- .indexOf("&") != -1) {
- let codeRoom = "";
- let newList = res.result.split("?")[1].split("&")
- let list = newList[0].split("=")[1].split("-")
- codeRoom = list[1];
- if (codeRoom) {
- self.roomList = [];
- self.room = codeRoom;
- self.buildBySub();
- self.popupType = true;
- } else {
- uni.showToast({
- title: '请扫描正确的二维码',
- icon: "none",
- mask: true,
- duration: 2000
- });
- }
- } else {
- uni.showToast({
- title: '请扫描正确的二维码',
- icon: "none",
- mask: true,
- duration: 2000
- });
- }
- }
- });
- },
- //查询用户身份信息
- async getUserCollegCheck() {
- let _this = this;
- const {
- data
- } = await getUserCollegCheck();
- if (data.code == 200) {
- this.form.deptId = data.data.dept.deptId;
- this.form.deptName = data.data.dept.deptName;
- }
- },
- //查询学院列表
- async listDepartments() {
- let self = this;
- const {
- data
- } = await systemDeptDropList({
- deptName: '',
- level: 2,
- deptType: 1
- });
- if (data.code == 200) {
- for (let i = 0; i < data.data.length; i++) {
- self.collegeArray.push(data.data[i].deptName)
- }
- self.collegeList = data.data;
- }
- },
- //添加
- async submitForm() {
- let _this = this;
- if (!this.form.deptId) {
- uni.showToast({
- title: '请选择学院!',
- icon: "none",
- mask: true,
- duration: 2000
- });
- return
- }
- if (!this.form.subId) {
- uni.showToast({
- title: '请选择实验室!',
- icon: "none",
- mask: true,
- duration: 2000
- });
- return
- }
- if (this.form.imgDtoList.length == 0) {
- uni.showToast({
- title: '请上传隐患照片!',
- icon: "none",
- mask: true,
- duration: 2000
- });
- return
- }
- const {
- data
- } = await checkClapAdd(_this.form);
- if (data.code == 200) {
- uni.showToast({
- title: '提交成功',
- icon: "none",
- mask: true,
- duration: 2000
- });
- uni.navigateTo({
- url: '/pages_safetyExamine/views/snapshotManage/snapshotList?pageType=2'
- });
- }
- },
- }
- }
- </script>
- <style lang="stylus" scoped>
- .examine {
- height: 100%;
- display flex;
- box-sizing: border-box;
- .info-max-box {
- flex: 1;
- overflow: scroll;
- padding: 120rpx 0rpx 128rpx;
- box-sizing: border-box;
- }
- .header {
- width: 749rpx;
- height: 100rpx;
- background: #FFFFFF;
- padding: 0 40rpx 0 30rpx;
- box-sizing: border-box;
- display: flex;
- justify-content: space-between;
- align-items: center;
- position: fixed;
- left: 0;
- top: 0;
- >text {
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 42rpx;
- }
- >img {
- width: 8rpx;
- height: 14rpx;
- }
- }
- .basics {
- margin: 0 30rpx;
- width: 690rpx;
- background: #FFFFFF;
- border-radius: 20rpx;
- padding: 30rpx 28rpx 30rpx;
- box-sizing: border-box;
- .basics_li {
- display: flex;
- justify-content: flex-start;
- margin-bottom: 24rpx;
- .basics_li_l {
- width: 146rpx;
- text-align: left;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 80rpx;
- }
- .basics_li_r {
- width: 486rpx;
- height: 80rpx;
- border-radius: 10rpx;
- opacity: 1;
- border: 1rpx solid #E0E0E0;
- padding-left: 20rpx;
- box-sizing: border-box;
- }
- /* 学院 */
- .college_r {
- width: 486rpx;
- height: 80rpx;
- border-radius: 10rpx;
- border: 1rpx solid #E0E0E0;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- >view {
- flex: 1;
- line-height: 80rpx;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 80rpx;
- }
- >img {
- width: 14rpx;
- height: 8rpx;
- margin-right: 30rpx;
- }
- }
- /* 实验室 */
- .lab_r {
- width: 486rpx;
- height: 80rpx;
- display: flex;
- justify-content: flex-start;
- .picker-text {
- width: 438rpx;
- height: 80rpx;
- }
- .img-box {
- width: 48rpx;
- >img {
- width: 30rpx;
- height: 28rpx;
- margin: 26rpx 18rpx 0 0;
- }
- }
- }
- }
- /* 隐患描述 */
- .check-for-input-max-box {
- .left-title-p {
- width: 150rpx;
- line-height: 80rpx;
- text-align right;
- font-size: 30rpx;
- }
- textarea {
- width: 630rpx;
- height: 158rpx;
- border-radius: 20rpx 20rpx 20rpx 20rpx;
- border: 1rpx solid #E0E0E0;
- padding: 20rpx 14rpx;
- box-sizing: border-box;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 34rpx;
- }
- }
- /* 隐患照片 */
- .check-for-img-max-box {
- .left-title-p {
- width: 100%;
- text-align: left;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 80rpx;
- }
- .right-img-box {
- .img-box {
- display inline-block;
- height: 200rpx;
- width: 200rpx;
- position relative;
- margin: 0 14rpx 20rpx 0;
- border-radius 10rpx;
- overflow hidden;
- .img-data {
- height: 200rpx;
- width: 200rpx;
- }
- .position-img {
- position absolute;
- right: 0;
- top: 0;
- width: 36rpx;
- height: 36rpx;
- }
- }
- .img-box:nth-of-type(3n+3) {
- margin-right: 0rpx;
- }
- .add-button {
- margin: 0 0rpx 20rpx 0;
- border-radius 10rpx;
- overflow hidden;
- display inline-block;
- height: 200rpx;
- width: 200rpx;
- }
- }
- }
- }
- .record {
- overflow: hidden;
- >text {
- display: block;
- width: 220rpx;
- height: 40rpx;
- background: #E0E0E0;
- border-radius: 60rpx 60rpx 60rpx 60rpx;
- margin: 122rpx 0 90rpx 266rpx;
- font-size: 26rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #0183FA;
- line-height: 40rpx;
- text-align: center;
- }
- }
- .popup-max-box {
- z-index: 10;
- height: 100%;
- width: 100%;
- position fixed;
- background rgba(0, 0, 0, 0.2);
- display flex;
- flex-direction column;
- .popup-null {
- flex: 1;
- }
- .popup-big-box {
- border-top-left-radius: 20rpx;
- border-top-right-radius: 20rpx;
- background #fff;
- .popup-input-box {
- padding: 30rpx 20rpx;
- display: flex;
- input {
- flex: 1;
- height: 70rpx;
- border: 1rpx solid #e0e0e0;
- border-radius: 10rpx;
- margin-right: 20rpx;
- padding: 0 20rpx;
- }
- view {
- background #0183FA;
- color: #fff;
- border-radius: 10rpx;
- width: 140rpx;
- line-height: 70rpx;
- text-align center;
- font-size: 28rpx;
- }
- }
- .popup-for-max-box {
- margin: 0 20rpx 30rpx;
- height: 600rpx;
- overflow-y scroll;
- .popup-for-null {
- line-height: 100rpx;
- text-align center;
- color: #999;
- }
- .popup-for-box {
- display: flex;
- padding: 10px 0;
- .name-p {
- flex: 1;
- line-height: 60rpx;
- }
- .button-p {
- background #0183FA;
- color: #fff;
- text-align center;
- width: 100rpx;
- line-height: 60rpx;
- height: 60rpx;
- border-radius: 10rpx;
- }
- }
- }
- }
- }
- .bottom_btn {
- position: fixed;
- bottom: 26rpx;
- left: 30rpx;
- font-size: 30rpx;
- font-family: PingFang SC-Medium, PingFang SC;
- font-weight: 400;
- color: #FFFFFF;
- line-height: 90rpx;
- width: 690rpx;
- height: 90rpx;
- background: #0183FA;
- border-radius: 20rpx;
- text-align: center;
- }
- }
- </style>
|