新增的功能

master
xielei 2024-11-07 16:40:56 +08:00
parent 33036d899d
commit a889e04d97
7 changed files with 215 additions and 107 deletions

View File

@ -12,44 +12,40 @@
</template>
<view class="xj-content">
<view class="xj-text" v-for="(o,i) in item.children" :key="i">
<view style="display: flex;justify-content: space-between;">
<view style="display: flex;align-items: center;">
<text>{{o.itemDesc}}</text>
<text>{{o.isNormal == 0?'异常':'正常'}}</text>
<text>{{o.isNormal == 0?'异常':'正常'}}{{o.isHandle?'已处理':'未处理'}}</text>
</view>
<view class="" v-if="o.isNormal == 0">
<view style="display: flex;justify-content: space-between;">
<view style="">
<text>现场图片</text>
<view class="" v-for="item in o.inspectPics">
<image :src="item"></image>
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;" ></image>
</view>
</view>
<view style="display: flex;justify-content: space-between;">
<view v-if="o.inspectVideos.length">
<text>现场视频</text>
<view class="" v-for="item in o.inspectVideos">
<image :src="item"></image>
<video :src="item.url" style="width: 80px;height: 80px;margin: 5px;" show-fullscreen-btn :show-progress='false'></video>
</view>
</view>
<view style="display: flex;justify-content: space-between;">
<text>问题描述</text>
<text>{{o.itemProblemDesc}}</text>
</view>
<view style="display: flex;justify-content: space-between;">
<text>处理状态</text>
<text>{{o.isHandle?'已处理':'未处理'}}</text>
</view>
</view>
<view class="" v-if="o.isHandle == 1">
<view style="">
<text>处理图片</text>
<view class="" v-for="item in o.handlePics">
<image :src="item"></image>
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;"></image>
</view>
</view>
<view style="display: flex;justify-content: space-between;">
<view style="" v-if="o.handleVideos.length">
<text>处理视频</text>
<!-- <text>{{o.handleVideos}}</text> -->
<view class="" v-for="item in o.handleVideos">
<video :src="item"></video>
<video :src="item.url" style="width: 80px;height: 80px;margin: 5px;" show-fullscreen-btn></video>
</view>
</view>
<view style="display: flex;justify-content: space-between;">
@ -164,6 +160,22 @@
this.listData = n.map(item => {
item.childen = item.children.map(i => {
i.handlePics?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
i.handleVideos?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
i.inspectPics?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
i.inspectVideos?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
if (!i.handlePics) {
i.handlePics = []
}
@ -369,6 +381,8 @@
.xj-text {
margin-left: 10%;
margin-top: 2%;
font-size: 16px;
border-bottom:1px solid #f0f0f0 ;
}
.subsectioin {

View File

@ -93,7 +93,7 @@
//
async getXjItem(id){
try {
const {data} = await uni.$http.get(`/gunshiApp/xyt/inspect/detail/info?taskId=${id}`)
const {data} = await uni.$http.get(`/gunshiApp/xyt/inspect/detail/info?taskId=${this.id}`)
if(data.code == 200){
this.xjItem = data.data
}
@ -107,8 +107,8 @@
},
onLoad(option){
this.taskTitle = option.taskTitle
this.taskType = JSON.parse(option.taskType)
this.taskContent = JSON.parse(option.taskContent)
this.taskType = option.taskType
this.taskContent = option.taskContent
this.startDate = (option.startDate)
this.endDate = option.endDate == "null" ? "" : option.endDate
this.status = option.status

View File

@ -20,6 +20,7 @@
</view>
</view>
<view class="" style="style='overflow: auto;height:calc(100vh - 150px)'">
<view class="" v-for="(item,i) in list" :key="i" style="background-color: #fff;margin-top:10px;">
<view class="item">
<!-- {{item.title}} -->
@ -28,7 +29,7 @@
</view>
<view class="titleRight" @click="toDetail(item)">
<view class="border">
{{item.status == 1 ? "继续任务": "开始任务" }}
{{status[item.status]}}
</view>
<u-icon name="arrow-right" size="20"></u-icon>
</view>
@ -44,6 +45,7 @@
</view>
</view>
</view>
</view>
</view>
<u-datetime-picker
@ -70,6 +72,11 @@
export default {
data() {
return {
status:{
0:'开始任务',
1:'继续任务',
2:'已完成'
},
startTime:stm,
endTime:etm,
stm,
@ -105,7 +112,7 @@
end:moment(this.etm).format("YYYY-MM-DD"),
},
inspectUserId:userId,
statusList:[0,1]
statusList:[2]
}
try {
const res = await uni.$http.post("/gunshiApp/xyt/inspect/task/list",params)

View File

@ -129,6 +129,10 @@
this.queItem.handleUserName = uni.getStorageSync('value').userName
this.queItem.handleTime = moment().format('YYYY-MM-DD HH:mm:ss')
this.queItem.handleUserId = uni.getStorageSync('value').userId
this.queItem.handlePics.map(item=>{
item.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item.filePath
return item
})
},
methods: {
submit(){
@ -182,7 +186,7 @@
uploadFilePromise(url, name) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: 'http://local.gunshiiot.com:18083/gunshiApp/xyt/maintain/service/file/upload/singleSimple', //
url: 'http://local.gunshiiot.com:18083/gunshiApp/xyt/inspect/task/file/upload/singleSimple', //
filePath: url,
name: 'file',
formData: {

View File

@ -1,7 +1,6 @@
<template>
<view class="contentItem">
<view class="contentItem" style="height: calc(100% - 350px);">
<uni-collapse>
<uni-collapse-item title-border="none" v-for="(item,index) in listData" :key="index" :border="false"
:show-animation="true">
<template v-slot:title>
@ -15,13 +14,13 @@
<view class="xj-text" v-for="(o,i) in item.children" :key="i">
<text>{{o.itemDesc}}</text>
<view class="subsectioin">
<u--form labelPosition="left" :model="o" ref="uForm">
<u-form-item label="状态" prop="isNormal" borderBottom required>
<u--form labelPosition="left" :model="o" ref="uForm" label-width="100px">
<u-form-item label="状态" prop="isNormal" borderBottom required >
<u-subsection :list="list" :current="getNormal(o.isNormal)" mode="subsection"
@change="(e)=>change(e,o,index,i,'isNormal')"
style="width:200px;margin-left: 10px"></u-subsection>
</u-form-item>
<view class="" v-if="o.isNormal">
<view class="" v-if="o.isNormal==0">
<u-form-item label="现场图片" prop="inspectPics" borderBottom required>
<u-upload accept="image" :fileList="o.inspectPics"
@afterRead="(e)=>afterRead(e,o,index,i)"
@ -42,7 +41,7 @@
mode="subsection" @change="(e)=>change(e,o,index,i,'isHandle')"
style="width:200px;margin-left: 10px"></u-subsection>
</u-form-item>
<view class="" v-if="o.isHandle !== 1">
<view class="" v-if="o.isHandle == 1">
<u-form-item label="现场图片" prop="handlePics" borderBottom required>
<u-upload accept="image" :fileList="o.handlePics"
@afterRead="(e)=>afterRead(e,o,index,i)"
@ -59,30 +58,29 @@
<u--textarea v-model="o.handleDesc" placeholder="请输入内容"></u--textarea>
</u-form-item>
</view>
<view class="" v-if="o.isHandle == 1">
<u-form-item label="责任人" prop="handleUserId" borderBottom
@click="showSex = true; hideKeyboard()" required>
<u--input v-model="o.handleUserId" disabled disabledColor="#ffffff"
placeholder="请选择性别" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
<view class="" v-if="o.isHandle == 0">
<u-form-item label="责任人" prop="handleUserId" borderBottom required>
<uni-data-picker :localdata="treeList" popup-title="" v-model="o.handleUserId"
:border="false"
:map="{'text':'title','value':'value'}"
></uni-data-picker>
</u-form-item>
</view>
</view>
</u--form>
<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" description="如果选择保密会报错"
@close="showSex = false" @select="sexSelect">
</u-action-sheet>
</view>
</view>
</view>
</uni-collapse-item>
<view class="" style="display: flex;">
<u-button text="保存" customStyle="margin-top: 50px" @click="submit"></u-button>
<u-button type="primary" text="结束巡检" customStyle="margin-top: 50px" @click="submit"></u-button>
</view>
</uni-collapse>
<view class="" style="display: flex;">
<u-button text="保存" customStyle="margin-top: 50px" @click="submit(1)"></u-button>
<u-button type="primary" text="结束巡检" customStyle="margin-top: 50px" @click="submit(2)"></u-button>
</view>
</view>
</template>
@ -94,11 +92,13 @@
},
data() {
return {
list: ["正常", "异常"],
listStatus: ["已处理", "未处理"],
list: ["异常","正常", ],
listStatus: ["未处理","已处理"],
current: 0,
listData: [],
showSex: false,
treeList:[],
deptUserList:[],
actions: [{
name: '男',
},
@ -113,12 +113,31 @@
},
mounted() {
// this.listData = this.xjItem
this.getTreeList()
},
watch: {
xjItem: function(n, o) {
this.listData = n.map(item => {
item.childen = item.children.map(i => {
i.handlePics?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
i.handleVideos?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
i.inspectPics?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
i.inspectVideos?.map(item1=>{
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
return item1
})
if (!i.handlePics) {
i.handlePics = []
}
@ -135,10 +154,59 @@
})
return item
})
console.log(n, this.listData, 'this.listData ');
}
},
methods: {
nodeclick(e){
console.log(e,'1212');
},
buildTree (data, parentId) {
let tree = [];
data.forEach((node) => {
node.title = node.deptName;
node.key = node.deptId;
if (node.parentId === parentId) {
let children = this.buildTree(data, node.deptId);
if (children.length) {
node.children = children;
}
tree.push(node);
}
});
return tree;
},
handleTreeList(dept, user) {
const deptArr = dept.map(item => {
return {
...item,
value: item.deptId,
title: item.deptName,
disabled: item.userId ? false : true,
children: user.filter(u => u.deptId == item.deptId).map(u => ({
...u,
value: String(u.userId),
title: u.nickName
}))
}
})
console.log("deptArr",deptArr);
const treelist = this.buildTree(deptArr,0)
return treelist
},
async getTreeList (){
const res = await uni.$http.get('/gunshiApp/xyt/system/dept/list')
const resUser = await uni.$http.get('/gunshiApp/xyt/system/user/list?pageNum=1&pageSize=9999User')
this.deptUserList = resUser.data.rows
if (res.data.data?.length > 0 && resUser.data.rows?.length > 0) {
// return this.handleTreeList(res.data.data,res.data.rows)
console.log();
this.treeList = this.handleTreeList(res.data.data,resUser.data.rows)
} else {
// return []
this.treeList =[]
}
},
getIsItem(arr) {
return arr.filter(item1 => item1.isNormal !== 1 && item1.isNormal !== 0).length
},
@ -164,44 +232,55 @@
return 3
}
},
async uploadContent() {
async uploadContent(status) {
try {
let params = {
status: 2,
status: status,
list: []
}
this.listData.map(i => {
params.list.push(i.children)
params.list=i.children.map(item=>{ item.handleUserName = this.deptUserList.find(it=>it.userId==item.handleUserId)?.nickName
console.log(this.deptUserList.find(it=>it.userId==item.handleUserId));
return item
})
})
const {
data
} = await uni.$http.post(`/gunshiApp/xyt/inspect/task/finish`, params)
console.log(data,'2121');
if(data.code==200){
uni.$showMsg('提交成功');
uni.navigateTo({
url:'/pages/xcrw/index'
})
}
} catch (error) {
uni.$showMsg();
}
},
submit() {
submit(status) {
let tigger = true
//
this.listData.forEach(item => {
item.ab = item.children.filter(i => {
if (i.isNormal == 1) {
if (i.isNormal == 0) {
if (i.inspectPics?.length && i.itemProblemDesc) {
tigger = true
} else {
tigger = false
uni.$showMsg('请填写现场问题描述和上传现场照片');
}
if (i.isHandle == 0) {
if (i.isHandle == 1) {
if (i.handlePics?.length && i.handleDesc) {
tigger = true
} else {
tigger = false
uni.$showMsg('请填写处理问题描述和上传处理照片');
}
} else if (i.isHandle == 1) {
} else if (i.isHandle == 0) {
tigger = true
}
} else if (i.isNormal == 0) {
} else if (i.isNormal == 1) {
tigger = true
}
})
@ -209,7 +288,9 @@
})
console.log(tigger, 'arr');
if (tigger) {
this.uploadContent()
this.uploadContent(status)
}else{
}
//
// if()
@ -247,7 +328,7 @@
uploadFilePromise(url, name, index, index1) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: 'http://local.gunshiiot.com:18083/gunshiApp/xyt/maintain/service/file/upload/singleSimple', //
url: 'http://local.gunshiiot.com:18083/gunshiApp/xyt/inspect/task/file/upload/singleSimple', //
filePath: url,
name: 'file',
formData: {
@ -273,14 +354,15 @@
// this.model1.userInfo.sex = e.name
// this.$refs.uForm.validateField('userInfo.sex')
},
}
}
</script>
<style lang="scss" scoped>
.contentItem {
height: 260px;
overflow: auto;
// height: 260px;
// overflow: auto;
.itemC {
display: flex;

View File

@ -1,5 +1,5 @@
<template>
<view :style="{height:'100vh',overflow:'hidden'}">
<view :style="{height:'100vh'}">
<u-status-bar></u-status-bar>
<u-navbar :title="taskTitle" :autoBack="true" :titleStyle="{
fontSize:'18px'
@ -37,9 +37,12 @@
</view>
</view>
<view v-show="status == 0 && btnStatus == 0" style="display:flex;justify-content: center;margin-top: 20%;">
<view class="circle-btn" @click="startXc"></view>
<view v-show="status !== 2 && btnStatus == 0" style="display:flex;justify-content: center;margin-top: 20%;">
<view v-show="status !== 2 && btnStatus == 0" class="circle-btn" @click="startXc">{{statusType[status]}}</view>
</view>
<view class="" style="height: calc(100vh - 311px);overflow: auto;">
<view v-show="btnStatus != 0" style="margin: 10px;background-color: #fff;padding: 10px;">
<view class="item">
<view class="blueTiao"></view>
@ -47,10 +50,11 @@
巡检项
</view>
</view>
<view class="contentItem">
<view class="contentItem1" style="height: 100%;">
<db-form :xjItem="xjItem"></db-form>
</view>
</view>
</view>
</view>
</view>
</template>
@ -74,19 +78,30 @@
btnStatus: 0,
xjItem:[],
list:["正常","异常"],
current:3
current:3,
statusType:{
0:'开始巡查',
1:'继续巡查',
2:'已完成'
},
};
},
methods: {
//
async startXc(){
try {
// const {data} = await uni.$http.get(`/gunshiApp/xyt/inspect/task/startInspect/${this.id}`)
// if(data.code == 200){
// this.btnStatus = 1;
// }
this.btnStatus = 1;
this.getXjItem(this.id)
if(status == 0){
const {data} = await uni.$http.get(`/gunshiApp/xyt/inspect/task/startInspect/${this.id}`)
if(data.code == 200){
this.btnStatus = 1;
this.getXjItem(this.id)
}
}else if(status == 1){
this.btnStatus = 1;
this.getXjItem(this.id)
}
} catch (error) {
uni.$showMsg();
}
@ -102,16 +117,15 @@
uni.$showMsg();
}
},
change(e){
this.current = e;
}
},
onLoad(option){
this.taskTitle = option.taskTitle
this.taskType = JSON.parse(option.taskType)
this.taskContent = JSON.parse(option.taskContent)
this.taskType = option.taskType
this.taskContent = option.taskContent
this.startDate = (option.startDate)
this.endDate = option.endDate == "null" ? "" : option.endDate
this.status = option.status
this.id = option.id
}
@ -132,7 +146,15 @@
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
}
.circle-btn{
width: 120px;
height: 120px;
background-color: #007aff;
border-radius: 50%;
color:#fff;
text-align: center;
line-height: 120px;
}
.item {
padding-bottom: 10px;
@ -187,35 +209,4 @@
padding: 10px;
}
}
.circle-btn{
width: 120px;
height: 120px;
background-color: #007aff;
border-radius: 50%;
color:#fff;
text-align: center;
line-height: 120px;
}
.yuandian{
display: inline-block;
width: 10px;
height: 10px;
background-color: #409eff;
border-radius: 50%;
margin-right: 10px;
}
.xj-content{
height: 300px;
overflow-y: auto;
}
.xj-text{
margin-left: 10%;
margin-top: 2%;
}
.subsectioin{
display: flex;
column-gap: 10px;
align-items: center;
margin-top: 10px;
}
</style>

View File

@ -1,7 +1,7 @@
<template>
<view :style="{height:'100vh',overflow:'hidden'}">
<u-status-bar></u-status-bar>
<u-navbar title="巡查任务" :autoBack="true" :titleStyle="{
<u-navbar title="巡查任务1" :autoBack="true" :titleStyle="{
fontSize:'18px'
}" :height='44' :safeAreaInsetTop=true leftIconSize='20' leftIconColor='rgb(153, 153, 153)'>
</u-navbar>
@ -19,7 +19,10 @@
</view>
</view>
</view>
</view >
<view class="" style='overflow: auto;height:calc(100vh - 150px)'>
<view class="" v-for="(item,i) in list" :key="i" style="background-color: #fff;margin-top:10px;">
<view class="item">
<!-- {{item.title}} -->
@ -28,7 +31,7 @@
</view>
<view class="titleRight" @click="toDetail(item)">
<view class="border">
{{item.status == 1 ? "继续任务": "开始任务" }}
{{status[item.status]}}
</view>
<u-icon name="arrow-right" size="20"></u-icon>
</view>
@ -44,6 +47,7 @@
</view>
</view>
</view>
</view>
</view>
<u-datetime-picker
@ -70,6 +74,11 @@
export default {
data() {
return {
status:{
0:'开始任务',
1:'继续任务',
// 2:''
},
startTime:stm,
endTime:etm,
stm,
@ -115,6 +124,7 @@
}
},
toDetail(record){
console.log(record);
uni.navigateTo({
url:`/pages/xcrw/detail/index?taskTitle=${record.taskTitle}&taskType=${record.taskType}&taskContent=${record.taskContent}&startDate=${record.startDate}&endDate=${record.endDate}&status=${record.status}&id=${record.id}`
})