1233 lines
35 KiB
Vue
Raw Normal View History

2022-06-08 15:48:09 +08:00
<template>
<!-- 新增问题 -->
<view class="addIssue">
<headers :showBack="true">
<view class="headerName">
{{pageTitle}}
</view>
</headers>
<view class="content">
<view class="type flex">
<view class="name"><text class="star">*</text>检查部位</view>
<picker @click="$refs.locationTree._show()" :disabled="true" class="picker">
<view class="uni-input uni-select cl" v-if="checkPointName==''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select flex2" v-else>
<view style="width: 98%;" class="ellipsis">{{checkPointName}}</view>
</view>
</picker>
</view>
<view class="type flex">
<view class="name">类型</view>
<view>
<radio-group @change="radioChange" class="radio-wrap">
<label class="radio">
<radio value="type1" checked="true" />质量问题
</label>
<label class="radio">
<radio value="type2" />排查记录
</label>
</radio-group>
</view>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>问题描述</view>
<picker :disabled="true" @click="$refs.issueTree._show()" class="picker">
<view class="uni-input uni-select cl" v-if="form.dangerItemContent==''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{form.dangerItemContent}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-else>
<view class="name"><text class="star">*</text>排查分类</view>
<picker :disabled="true" @click="$refs.issueTree._show()" class="picker">
<view class="uni-input uni-select cl" v-if="form.dangerItemContent==''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{form.dangerItemContent}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>问题分类</view>
<picker class="picker" @click="$refs.issueTree._show()" :disabled="true">
<view class="uni-input uni-select cl" v-if="issueName==''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{issueName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex3">
<view class="name">补充说明</view>
<textarea class="textarea" maxlength="-1" placeholder-class="cl" name="inspectContent"
@input='supplementTextarea' :value="form.dangerDesc" placeholder="请输入"></textarea>
</view>
<view class="type flex3" v-if="typeCheck == 'type1'">
<view class="name">整改要求</view>
<textarea class="textarea" maxlength="-1" placeholder-class="cl" name="inspectContent"
@input='claimTextarea' :value="form.remark" placeholder="请输入"></textarea>
</view>
2023-02-07 16:36:36 +08:00
<!-- 新增四个字段 -->
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star"></text>分部工程</view>
<picker @change="(e)=>checkSubListData(e)"
:value="subsectionIndex"
class="picker"
:range="listData"
range-key="subdivisionProjectName">
2023-03-20 18:43:57 +08:00
<view class="uni-input uni-select cl" v-if="subsectionIndex==0">
<!-- {{listData[subsectionIndex].subdivisionProjectName}} -->
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
2023-02-07 16:36:36 +08:00
</view>
<view class="uni-input uni-select" v-else>
{{listData[subsectionIndex].subdivisionProjectName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star"></text>分项工程</view>
<picker :value="subentryIndex" class="picker" :range="subListData" range-key="subdivisionProjectName">
2023-03-20 18:43:57 +08:00
<view class="uni-input uni-select cl" v-if="subentryIndex==0">
2023-02-07 16:36:36 +08:00
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>
{{subListData[subentryIndex].subdivisionProjectName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star"></text>巡检楼层</view>
<input class="inpuStyle uni-select cl" :value="form.floor" placeholder="请输入" />
</view>
<view class="type flex3">
<view class="name">事件描述</view>
<textarea class="textarea" maxlength="-1" placeholder-class="cl" name="inspectContent"
@input='eventDescription' :value="form.addedDescription" placeholder="请输入"></textarea>
</view>
<!-- 新增字段分割线------------ -->
2022-06-08 15:48:09 +08:00
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>问题等级</view>
<picker @change="(e)=>bindPickerChange(e,1)" :value="issueGradeIndex" class="picker"
:range="issueGradeList" range-key="name">
<view class="uni-input uni-select cl" v-if="issueGradeIndex==null">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{issueGradeList[issueGradeIndex].name}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>紧急程度</view>
<picker @change="(e)=>bindPickerChange(e,2)" :value="urgencyIndex" class="picker" :range="urgencyList"
range-key="name">
<view class="uni-input uni-select cl" v-if="urgencyIndex==null">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{urgencyList[urgencyIndex].name}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<!-- <view class="type flex">
<view class="name"><text class="star">*</text>检查人</view>
<picker @change="(e)=>bindPickerChange(e,3)" :value="inspectManIndex" class="picker" :range="personList"
range-key="workerName">
<view class="uni-input uni-select cl" v-if="inspectManIndex==null">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{personList[inspectManIndex].workerName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view> -->
<view class="type flex">
<view class="name"><text class="star">*</text>检查时间</view>
<picker @change="(e)=>bindPickerChange(e,4)" mode="date" :value="form.inspectTime" class="picker">
<view class="uni-input uni-select cl" v-if="form.inspectTime===''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{form.inspectTime}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex">
<view class="name">分包单位</view>
<picker @click="clickUnit" :disabled="true" class="picker">
<view class="uni-input uni-select cl" v-if="form.enterpriseName==''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select flex2" v-else>
<view style="width: 98%;" class="ellipsis">{{form.enterpriseName}}</view>
<uni-icons @click="deletesBtn(1)" type="clear" size="22"></uni-icons>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>整改时限</view>
<picker @change="(e)=>bindPickerChange(e,5)" mode="date" :value="form.changeLimitTime" class="picker">
<view class="uni-input uni-select cl" v-if="form.changeLimitTime===''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{form.changeLimitTime}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>整改人</view>
<picker @change="(e)=>bindPickerChange(e,6)" :value="changePeopleIndex" class="picker"
:range="personList" range-key="workerName">
<view class="uni-input uni-select cl" v-if="changePeopleIndex==null">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{personList[changePeopleIndex].workerName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>复查人</view>
<picker @change="(e)=>bindPickerChange(e,7)" :value="reviewIndex" class="picker" :range="personList"
range-key="workerName">
<view class="uni-input uni-select cl" v-if="reviewIndex==null">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{personList[reviewIndex].workerName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name"><text class="star">*</text>核检人</view>
<picker @change="(e)=>bindPickerChange(e,8)" :value="verifyManIndex" class="picker" :range="personList"
range-key="workerName">
<view class="uni-input uni-select cl" v-if="verifyManIndex==null">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-input uni-select" v-else>{{personList[verifyManIndex].workerName}}
<image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name">通知人</view>
<picker @click="$refs.informTree._show()" :disabled="true" class="picker">
<view class="uni-input uni-select cl" v-if="notifier===''">
请选择 <image class="icon-down" src="/static/icon-down-black.png"></image>
</view>
<view class="uni-select flex2" v-else>
<view style="line-height:20px; width:80%; padding:6px 0;">{{notifier}}</view>
<image class="icon-down" style="width:13px; height:13px;" src="/static/icon-down-black.png">
</image>
</view>
</picker>
</view>
<view class="type flex" v-if="typeCheck == 'type1'">
<view class="name">现场整改</view>
<view class="flex">
<text :class="form.status==2?'status':''">未完成</text>
<switch :checked="form.status==5" @change="switchChange"
style="margin: 0 10px;transform: scale(0.74,0.7)" />
<text :class="form.status==5?'status':''">已完成</text>
</view>
</view>
<view class="type flex3">
<view class="name">上传图片</view>
<view class="uni-form-input imgBox_wrap">
<view class="imgBox" v-show="imgFileList.length>0" v-for="(item,index) in imgFileList" :key="index">
<image :src="url_config+'image/'+item.url" class="img"
@click="previewImage(url_config+'image/'+item.url)"></image>
<uni-icons @click="deleteImg(item,1)" class="deleteImg" type="clear" size="24"></uni-icons>
</view>
<view class="addImgBox" @click="uploadImg" v-if="imgFileList.length<5">
<image src="/static/icon-add.png" class="icon-add"></image>
</view>
</view>
</view>
<view class="type">
<view>视频(mp4)附件</view>
<view class="imgBox flex2" style="width:100%;height:28px;" v-show="videoFileList.length>0"
v-for="(item,index) in videoFileList" :key="index">
<text
style="color: #4181FE;width: 95%; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;"
@click="playVideo(url_config+'image/'+item.url,'video')">{{item.name}}</text>
<uni-icons @click="deleteImg(item,2)" type="clear" size="18" style="margin: 5px;"></uni-icons>
</view>
<view class="addImgBox" @click="uploadVideo" v-if="videoFileList.length<5" style="margin-left: 88px;">
<image src="/static/icon-add.png" class="icon-add"></image>
</view>
</view>
<view class="addSaveBtn" @click="addSaveBtn">新增保存</view>
</view>
<!-- 分包单位弹窗 -->
<view class="unitDialog" v-if="unitDialog" @click="unitDialog=false">
<view class="unitContent">
<view class="tabs flex2">
<view @click.stop="checkTypeBtn(1)"
:class="checkType==1?'checkName tabs_name':'noCheckName tabs_name'">专业分包商</view>
<view @click.stop="checkTypeBtn(6)"
:class="checkType==6?'checkName tabs_name':'noCheckName tabs_name'">劳务分包商</view>
</view>
<view class="unitList" v-if="subpackageLsit.length>0">
<view class="title">公司名称</view>
<view class="list_val" v-for="(item,index) in subpackageLsit" @click="checkSubpackage(item)"
:class="index%2==0?'bg_999':''">{{item.enterpriseName}}</view>
</view>
<view class="placeholderBox" v-if="subpackageLsit.length==0">
<image src="/static/noData.png" mode="" class="noDataImg"></image>
<view class="text">
暂无数据
</view>
</view>
</view>
</view>
<!-- 检查部位 -->
<tki-tree ref="locationTree" @confirm="(val)=>checkPointBtn(val,1)" idKey='id' :range="checkPointList"
rangeKey="regionName" confirmColor="#4e8af7" />
<!-- 问题分类 -->
<tki-tree ref="issueTree" @confirm="(val)=>checkPointBtn(val,2)" idKey='id' :range="issueList"
rangeKey="dangerName" confirmColor="#4e8af7" />
<!-- 通知人 -->
<tki-tree ref="informTree" :multiple="true" @confirm="(val)=>checkPointBtn(val,3)" idKey='id'
:range="personList" rangeKey="workerName" confirmColor="#4e8af7" />
</view>
</template>
<script>
import tkiTree from "@/components/tki-tree/tki-tree.vue"
export default {
components: {
tkiTree
},
data() {
return {
pageTitle: '新增检查记录',
projectSn: '',
checkType: 1, //分包商类型 1专业分包 6劳务分包
form: {
regionId: "", // 检查部位
regionName: "",
dangerItemContent: "",
dangerItemId: "",
dangerTypeId: "",
dangerDesc: "",
remark: "",
routineId: 0,
level: 0,
urgentLevel: 0,
inspectManId: "",
inspectTime: "",
enterpriseSn: "",
enterpriseName: "",
changeLimitTime: "",
changeId: "",
reviewId: "",
verifyManId: "",
notifyPerson: [],
status: 2, // 现场整改状态 2未完成 5已完成
measurePoints: '',
imageUrl: "",
fileUrl: "",
recordType: 1,
2023-02-07 16:36:36 +08:00
subsectionId: '', //分部工程
subentryId: '', //分项工程
floor:'',//巡检楼层
addedDescription:'',//事件描述
2022-06-08 15:48:09 +08:00
},
checkPointList: [], //获取检查部位数据
checkPointName: '',
issueList: [], //问题分类 || 问题描述
issueName: '',
issueGradeList: [{
name: '一级',
value: 1
},
{
name: '二级',
value: 2
},
{
name: '三级',
value: 3
},
{
name: '四级',
value: 4
},
], //问题等级
issueGradeIndex: 0,
urgencyList: [{
name: '一般',
value: 1
},
{
name: '严重',
value: 2
},
{
name: '紧要',
value: 3
},
], //紧急程度
urgencyIndex: 0,
personList: [], //人员列表 -- 检查人、整改人、复查人、核验人、通知人
inspectManIndex: null, //检查人
changePeopleIndex: null, //整改人
verifyManIndex: null, //核验人
reviewIndex: null, //复查人
notifier: '', //通知人
unitDialog: false, //分包商弹窗
subpackageLsit: [], //分包商数据列表
videoFileList: [],
imgFileList: [],
basicInfo: {},
selectIndex: null,
userInfo: '',
typeCheck: 'type1', // 类型 type1为质量问题 type2为排查记录
2023-02-07 16:36:36 +08:00
listData: [], //分部工程
subListData: [], //分项工程
subsectionIndex:0,//分部工程
subentryIndex:0,////分项工程
2022-06-08 15:48:09 +08:00
}
},
onLoad(option) {
this.pageTitle = option.type == 'add' ? '新增检查记录' : '编辑检查记录';
this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
this.getCheckPointList();
this.getIssueList();
2023-02-07 16:36:36 +08:00
this.getPersonList();
this.getProgressListData()
2022-06-08 15:48:09 +08:00
console.log(this.userInfo)
},
methods: {
2023-02-07 16:36:36 +08:00
//分部工程改动事件
checkSubListData(e) {
console.log("一级菜单改动了 ", e);
this.subsectionIndex=e.detail.value
console.log("拿到的索引 ", this.subListData);
this.subListData=this.listData[this.subsectionIndex].children;
this.subentryIndex=0;
},
//获取分部分项工程, 以父子节点形式呈现
getProgressListData() {
this.sendRequest({
url: 'xmgl/subdivisionProject/getParentChildList',
method: 'get',
data: {
projectSn: this.projectSn
},
success: res => {
if (res.code == 200) {
this.listData = res.result;
console.log('获取分部分项工程, 以父子节点形式呈现', this.listData)
if (this.listData.length >= 1) {
this.form.subsectionId = this.listData[0].id
if (this.listData[0].children.length >= 1) {
this.subListData = this.listData[0].children;
this.form.subentryId = this.listData[0].children[0].id;
2023-03-20 18:43:57 +08:00
}else{
this.subListData=['暂无数据']
2023-02-07 16:36:36 +08:00
}
2023-03-20 18:43:57 +08:00
}else{
this.listData=['暂无数据']
2023-02-07 16:36:36 +08:00
}
}
}
})
},
//--------------------分割线
radioChange() {
2022-06-08 15:48:09 +08:00
},
//获取检查部位 列表
getCheckPointList() {
this.sendRequest({
url: 'xmgl/qualityRegion/list',
method: 'post',
data: {
projectSn: this.projectSn
},
success: res => {
if (res.code == 200) {
this.checkPointList = res.result;
console.log(this.checkPointList)
}
}
})
},
//确定选中--回显
checkPointBtn(val, type) {
// type==1 检查部位 2 问题分类 3,通知人
if (type == 1) {
// console.log(this.checkPointList, val, this.personList)
this.form.regionId = val[0].id;
let arr = JSON.parse(JSON.stringify(val[0].parents));
let obj = {
id: val[0].id,
regionName: val[0].regionName
};
arr.push(obj);
//获取选中的字符串 名称
var regionName = arr.map(function(item, index) {
return item.regionName;
}).join("/");
this.checkPointName = regionName;
this.form.regionName = regionName;
this.personList.forEach((item, index) => {
if (item.userId === val[0].dutyId) {
this.changePeopleIndex = index
}
});
this.form.changeId = val[0].dutyId;
this.notifier = val[0].intendanceNames;
this.form.notifyPerson = val[0].intendanceIds;
this.form.remark = val[0].remark
} else if (type == 2) {
//设置问题描述
this.form.dangerItemContent = val[0].dangerName;
this.form.dangerItemId = val[0].id;
//设置问题类型
if (val[0].parents.length == 0) {
this.form.dangerTypeId = val[0].id;
this.issueName = val[0].dangerName;
} else {
this.form.dangerTypeId = val[0].parents[0].id;
this.issueName = val[0].parents[0].dangerName + '/' + val[0].dangerName;
}
} else if (type == 3) {
console.log(val)
this.notifier = val.map((item, index) => {
return item.workerName
}).join(',');
this.form.notifyPerson = val.map((item, index) => {
return item.workerName
}).join(',')
}
},
//获取问题分类
getIssueList() {
this.sendRequest({
url: 'xmgl/dangerTypeRecord/selectDangerTypeAndItemList',
method: 'post',
data: {
projectSn: this.projectSn
},
success: (res) => {
if (res.result.length > 0) {
res.result.forEach(item => {
if (item.children && item.children.length > 0) {
item.children.forEach(itm => {
if (itm.itemList && itm.itemList.length > 0) {
itm.itemList.forEach(item2 => {
item2.dangerName = item2.content
})
itm.children = itm.itemList
}
})
}
})
console.log(res.result)
this.issueList = res.result
}
}
})
},
//补充说明
supplementTextarea(e) {
this.form.dangerDesc = e.detail.value
},
//整改要求
claimTextarea(e) {
this.form.remark = e.detail.value
},
2023-02-07 16:36:36 +08:00
//事件描述
eventDescription(e){
this.form.addedDescription=e.detail.value
},
2022-06-08 15:48:09 +08:00
//获取分包公司
getSubpackageLsit() {
let data = {
enterpriseTypeId: this.checkType,
pageNo: 1,
pageSize: 999,
projectSn: this.projectSn,
};
this.sendRequest({
url: 'xmgl/projectEnterprise/list',
method: 'post',
data: data,
success: (res) => {
if (res.result.records.length > 0) {
this.subpackageLsit = res.result.records;
} else {
this.subpackageLsit = [];
}
}
})
},
//下拉选择回显
bindPickerChange(e, type) {
console.log(e)
//type ==1 问题等级;2紧急情况;3检查人;4 检查时间;5整改时限; 6整改人; 7复查人; 8核验人;
if (type == 1) {
this.issueGradeIndex = e.detail.value;
this.form.level = this.issueGradeList[e.detail.value].value;
} else if (type == 2) {
this.urgencyIndex = e.detail.value;
this.form.urgentLevel = this.urgencyList[e.detail.value].value;
} else if (type == 3) {
this.inspectManIndex = e.detail.value;
this.form.inspectManId = this.personList[e.detail.value].userId
} else if (type == 4) {
this.form.inspectTime = e.detail.value;
} else if (type == 5) {
this.form.changeLimitTime = e.detail.value;
} else if (type == 6) {
this.changePeopleIndex = e.detail.value;
this.form.changeId = this.personList[e.detail.value].userId;
console.log(this.changePeopleIndex, this.form.changeId)
} else if (type == 7) {
this.reviewIndex = e.detail.value;
this.form.reviewId = this.personList[e.detail.value].userId;
} else if (type == 8) {
this.verifyManIndex = e.detail.value;
this.form.verifyManId = this.personList[e.detail.value].userId;
}
},
//获取人员列表--- 检查人、整改人、复查人、核验人、通知人
getPersonList() {
this.sendRequest({
url: 'xmgl/systemUser/getProjectChilderSystemUserList',
method: 'post',
data: {
projectSn: this.projectSn
},
success: res => {
console.log(res.result)
if (res.result.length > 0) {
this.personList = res.result;
}
}
})
},
//选择的分包公司
checkSubpackage(val) {
// if (this.checkType == 1) {
this.form.enterpriseSn = val.enterpriseSn;
this.form.enterpriseName = val.enterpriseName;
// } else {
// this.form.enterpriseSn = val.enterpriseSn;
// this.form.enterpriseName = val.enterpriseName;
// }
this.unitDialog = false;
},
//删除---公用
deletesBtn(type) {
window.event.stopPropagation();
//type==1 分包单位
if (type == 1) {
this.form.enterpriseSn = '';
this.form.enterpriseName = '';
}
},
//现场整改是否完成
switchChange(e) {
if (e.detail.value) {
this.form.status = 5;
} else {
this.form.status = 2;
}
},
//选择分包单位
clickUnit() {
this.unitDialog = true;
this.getSubpackageLsit();
},
//切换分包商
checkTypeBtn(type) {
this.checkType = type;
this.getSubpackageLsit();
},
//上传附件
uploadImg() {
var that = this
uni.chooseImage({
count: 5 - that.imgFileList.length,
success(res) {
const tempFilePaths = res.tempFilePaths;
uni.uploadFile({
url: that.url_config + 'upload/image', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'files',
success: (uploadFileRes) => {
let data = {
name: JSON.parse(uploadFileRes.data).data[0].filename,
url: JSON.parse(uploadFileRes.data).data[0].imageUrl
};
that.imgFileList.push(data)
}
});
}
})
},
//删除附件
deleteImg(val, type) {
let that = this;
uni.showModal({
title: '提示',
content: '确定删除该附件吗?',
success: function(res) {
if (res.confirm) {
if (type == 1) {
let fileArr = JSON.parse(JSON.stringify(that.imgFileList));
fileArr.forEach((item, index) => {
if (item.url == val.url) {
fileArr.splice(index, 1)
}
})
that.imgFileList = fileArr;
} else if (type == 2) {
let fileArr = JSON.parse(JSON.stringify(that.videoFileList));
fileArr.forEach((item, index) => {
if (item.url == val.url) {
fileArr.splice(index, 1)
}
})
that.videoFileList = fileArr;
}
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
//上传视频
uploadVideo() {
var that = this;
uni.chooseVideo({
count: 5 - that.videoFileList.length,
sourceType: ['camera', 'album'],
success: function(res) {
let url = res.tempFilePath;
uni.uploadFile({
url: that.url_config + 'upload/image', //仅为示例,非真实的接口地址
filePath: url,
name: 'files',
success: (uploadFileRes) => {
let obj = {
name: JSON.parse(uploadFileRes.data).data[0].filename,
url: JSON.parse(uploadFileRes.data).data[0].imageUrl
}
that.videoFileList.push(obj);
}
})
}
})
},
//查看视频
playVideo(url, type) {
uni.navigateTo({
url: '../carWashManage/mediaPlay?url=' + url + '&type=' + type
})
},
//预览图片
previewImage(url) {
uni.previewImage({
urls: [url]
})
},
//新增保存
addSaveBtn() {
let arr = [],
2023-02-07 16:36:36 +08:00
arr2 = [];
2022-06-08 15:48:09 +08:00
this.videoFileList.forEach(item => {
arr.push(item.name + "*" + this.url_config + 'image/' + item.url)
})
this.imgFileList.forEach(item => {
arr2.push(item.name + "*" + this.url_config + 'image/' + item.url)
})
// this.form.fileUrl = this.videoFileList.length>0?JSON.stringify(this.videoFileList):'';
// this.form.imageUrl = this.imgFileList.length>0?JSON.stringify(this.imgFileList):'';
this.form.fileUrl = arr.join(',')
this.form.imageUrl = arr2.join(',')
let data = JSON.parse(JSON.stringify(this.form));
if (data.regionId == '') {
uni.showToast({
title: '请选择检查部位',
icon: 'none'
})
return
}
if (data.dangerItemContent == '' && this.typeCheck == "type1") {
uni.showToast({
title: '请选择问题描述',
icon: 'none'
})
return
} else if (data.dangerItemContent == '') {
uni.showToast({
title: '请选择排查分类',
icon: 'none'
})
return
}
if (data.dangerTypeId == '' && this.typeCheck == "type1") {
uni.showToast({
title: '请选择问题分类',
icon: 'none'
})
return
}
2023-02-06 11:14:16 +08:00
// if (data.inspectManId == '') {
// uni.showToast({
// title: '请选择检查人',
// icon: 'none'
// })
// return
// }
2022-06-08 15:48:09 +08:00
if (data.inspectTime == '') {
uni.showToast({
title: '请选择检查时间',
icon: 'none'
})
return
}
if (data.changeLimitTime == '' && this.typeCheck == "type1") {
uni.showToast({
title: '请选择整改时限',
icon: 'none'
})
return
}
if (data.changeId == '' && this.typeCheck == "type1") {
uni.showToast({
title: '请选择整改人',
icon: 'none'
})
return
}
if (data.reviewId == '' && this.typeCheck == "type1") {
uni.showToast({
title: '请选择复查人',
icon: 'none'
})
return
}
if (data.verifyManId == '' && this.typeCheck == "type1") {
uni.showToast({
title: '请选择核查人',
icon: 'none'
})
return
};
data.level = data.level == 0 ? Number(data.level) + 1 : data.level;
data.urgentLevel = data.urgentLevel == 0 ? Number(data.urgentLevel) + 1 : data.urgentLevel;
data.projectSn = this.projectSn;
data.inspectManId = this.userInfo.userId
data.creatorId = this.userInfo.userId
if (this.typeCheck == "type1") {
// 质量问题
this.sendRequest({
url: 'xmgl/qualityInspectionRecord/add',
method: 'post',
data: data,
success: (res) => {
console.log(res)
if (res.code == 200) {
uni.showToast({
title: '保存成功'
})
setTimeout(() => {
uni.navigateBack({})
}, 1200)
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}
})
} else {
// 排查记录
let data2 = {
dangerDesc: data.dangerDesc,
dangerItemContent: data.dangerItemContent,
dangerItemId: data.dangerItemId,
dangerTypeId: data.dangerTypeId,
enterpriseName: data.enterpriseName,
enterpriseSn: data.enterpriseSn,
fileUrl: data.fileUrl,
imageUrl: data.imageUrl,
inspectManId: data.inspectManId,
inspectTime: data.inspectTime,
projectSn: data.projectSn,
recordType: 2,
regionId: data.regionId,
regionName: data.regionName,
routineInspect: 0
}
this.sendRequest({
url: 'xmgl/qualityInspectionRecord/add',
method: 'post',
data: data2,
success: (res) => {
console.log(res)
if (res.code == 200) {
uni.showToast({
title: '保存成功'
})
setTimeout(() => {
uni.navigateBack({})
}, 1200)
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}
})
}
},
// 单选框切换
radioChange(value) {
this.typeCheck = value.detail.value
// 重制内容
this.form = {
regionId: "", // 检查部位
regionName: "",
dangerItemContent: "",
dangerItemId: "",
dangerTypeId: "",
dangerDesc: "",
remark: "",
routineId: 0,
level: 0,
urgentLevel: 0,
inspectManId: "",
inspectTime: "",
enterpriseSn: "",
enterpriseName: "",
changeLimitTime: "",
changeId: "",
reviewId: "",
verifyManId: "",
notifyPerson: [],
status: 2, // 现场整改状态 2未完成 5已完成
measurePoints: '',
imageUrl: "",
fileUrl: "",
recordType: 1,
};
this.checkPointName = ""
this.videoFileList = [];
2023-02-07 16:36:36 +08:00
this.imgFileList = [];
2022-06-08 15:48:09 +08:00
}
}
}
</script>
<style scoped lang="scss">
.flex {
display: flex;
align-items: center;
}
.flex2 {
display: flex;
align-items: center;
justify-content: space-between;
}
.flex3 {
display: flex;
}
.content {
width: 100%;
box-sizing: border-box;
padding: 20px 30rpx;
}
.type {
font-size: 30rpx;
line-height: 40px;
margin-bottom: 8px;
/* border-bottom: 1px solid rgba(194, 194, 194, 0.2); */
}
.type .name {
margin-right: 6px;
width: 176rpx;
text-align: right;
}
2023-02-07 16:36:36 +08:00
2022-06-08 15:48:09 +08:00
.radio-wrap {
display: flex;
align-items: center;
2023-02-07 16:36:36 +08:00
2022-06-08 15:48:09 +08:00
.radio {
margin-right: 20px;
}
}
.accessory {
width: 100%;
height: 70px;
padding: 0 10px;
box-sizing: border-box;
}
.accessoryImg {
width: 110rpx;
height: 60px;
margin-right: 8px;
}
.picker {
width: 70%;
border: 1px solid rgba(42, 43, 91, 0.3);
padding: 0px 30rpx;
box-sizing: border-box;
border-radius: 30px;
}
.uni-input {
line-height: 32px;
}
.textarea {
2023-03-20 18:43:57 +08:00
width: calc(79% - 32px);
2022-06-08 15:48:09 +08:00
border-radius: 10px;
border: 1px solid rgba(42, 43, 91, 0.3);
padding: 8px 15px;
box-sizing: border-box;
height: 50px;
}
2023-02-07 16:36:36 +08:00
.inpuStyle{
width: calc(80% - 35px);
border-radius: 20px;
border: 1px solid rgba(42, 43, 91, 0.3);
padding: 8px 15px;
box-sizing: border-box;
height: 35px;
2023-03-20 18:43:57 +08:00
color: #000;
2023-02-07 16:36:36 +08:00
}
2022-06-08 15:48:09 +08:00
.cl {
font-size: 30rpx;
}
.imgBox_wrap {
display: flex;
flex-wrap: wrap;
margin-top: 10px;
width: 75%;
}
.imgBox {
width: 60px;
height: 60px;
display: inline-flex;
position: relative;
margin-right: 15px;
margin-bottom: 8px;
.img {
width: 100%;
height: 100%;
border-radius: 10px;
}
.deleteImg {
position: absolute;
right: -10px;
top: -18px;
}
}
.addImgBox {
border: 1px solid rgba(42, 43, 91, 0.1);
background-color: #f6f5f8;
width: 60px;
height: 60px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 10px;
font-size: 12px;
.icon-add {
width: 18px;
height: 18px;
}
}
.unitDialog {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 111;
background-color: rgba(0, 0, 0, 0.5);
}
.unitContent {
width: 85%;
height: 70%;
margin: 25% auto 0;
background-color: #fff;
box-sizing: border-box;
padding: 20px 30rpx;
border-radius: 5px;
box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}
.tabs {
border-bottom: 1px solid rgba(153, 153, 153, 0.5);
}
.tabs_name {
width: 40%;
text-align: center;
padding: 5px 10rpx;
box-sizing: border-box;
font-size: 30rpx;
}
.checkName {
border-bottom: 2px solid #4181FE;
color: #4181FE;
}
.noCheckName {
padding-top: 4px;
}
.unitList {
margin: 10px 0;
font-size: 30rpx;
.title {
margin-bottom: 10px;
}
.list_val {
padding: 8px 10px;
}
}
.bg_999 {
background-color: rgba(153, 153, 153, 0.1);
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status {
color: #007AFF;
}
.addSaveBtn {
margin: 30px auto;
width: 60%;
padding: 10px 0;
text-align: center;
background-color: #4181FE;
color: #fff;
font-size: 34rpx;
border-radius: 30px;
letter-spacing: 2px;
box-shadow: 0 3px 10px rgba(65, 129, 254, 0.8);
}
.addSaveBtn:active {
background-color: rgba(65, 129, 254, 0.8);
}
2023-02-07 16:36:36 +08:00
.radio-box {
2022-06-08 15:48:09 +08:00
display: flex;
}
2023-02-07 16:36:36 +08:00
.radio-item {
2022-06-08 15:48:09 +08:00
display: flex;
margin-right: 20rpx;
align-items: center;
font-size: 28rpx;
2023-02-07 16:36:36 +08:00
/deep/ .uni-radio-input {
2022-06-08 15:48:09 +08:00
width: 32rpx;
height: 32rpx;
}
}
2023-02-07 16:36:36 +08:00
.radio-text {
2022-06-08 15:48:09 +08:00
height: 72rpx;
}
</style>