tsg-app/pages/mypage/compents/xcrw/detail/dbForm.vue

305 lines
9.0 KiB
Vue
Raw Normal View History

2024-11-13 09:42:42 +08:00
<template>
<view class="contentItem">
<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>
<view style="display: flex;align-items: center;">
<text class="yuandian"></text>
<text>{{item.name}}</text>
</view>
</template>
<view class="xj-content">
<view class="xj-text" v-for="(o,i) in item.children" :key="i">
<view style="display: flex;align-items: center;">
<text>{{o.itemDesc}}</text>
<text>{{o.isNormal == 0?'异常':'正常'}}{{o.isNormal == 0?o.isHandle?'已处理':'未处理':''}})</text>
<!-- <text></text> -->
</view>
<view class="" v-if="o.isNormal == 0">
<view class="itemEve">
<text>现场图片:</text>
<view class="" v-for="item in o.inspectPics">
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;" @click="previewImage(item)"></image>
</view>
</view>
<view v-if="o.inspectVideos.length" class="itemEve">
<text>现场视频:</text>
<view class="" v-for="item in o.inspectVideos">
<video :src="item.url" style="width: 80px;height: 80px;margin: 5px;" show-fullscreen-btn :show-progress='false'></video>
</view>
</view>
<view style="display: flex;" class="itemEve">
<text>问题描述:</text>
<text>{{o.problemDesc}}</text>
</view>
</view>
<view class="" v-if="o.isHandle == 1">
<view style="" class="itemEve" v-if="o.handlePics.length">
<text>处理图片:</text>
<view class="" v-for="item in o.handlePics">
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;" @click="previewImage(item)"></image>
</view>
</view>
<view style="" v-if="o.handleVideos.length" class="itemEve">
<text>处理视频:</text>
<view class="" v-for="item in o.handleVideos">
<video :src="item.url" style="width: 80px;height: 80px;margin: 5px;" show-fullscreen-btn></video>
</view>
</view>
<view style="display: flex;" class="itemEve">
<text>处理描述:</text <text>{{o.handleDesc}}</text>
</view>
</view>
<view style="display: flex;" v-if="o.isHandle == 0" class="itemEve">
<text>责任人</text>
<text>{{o.handleUserName}}</text>
</view>
<view class="subsectioin">
<!-- <u--form labelPosition="left" :model="o" ref="uForm">
<u-form-item label="状态" prop="isNormal" borderBottom required>
<u-subsection :list="list" :current="getNormal(o.isNormal)" mode="subsection" disabled
@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">
<u-form-item label="现场图片" prop="inspectPics" borderBottom required>
<u-upload accept="image" :fileList="o.inspectPics" disabled
@afterRead="(e)=>afterRead(e,o,index,i)"
@delete="(e)=>deletePic(e,o,index,i)" name="inspectPics" multiple
:maxCount="10"></u-upload>
</u-form-item>
<u-form-item label="现场视频" prop="inspectVideos" borderBottom>
<u-upload accept="video" :fileList="o.inspectVideos" disabled
@afterRead="(e)=>afterRead(e,o,index,i)"
@delete="(e)=>deletePic(e,o,index,i)" name="inspectVideos" multiple
:maxCount="10"></u-upload>
</u-form-item>
<u-form-item label="问题描述" prop="itemProblemDesc" borderBottom required>
<u--textarea v-model="o.itemProblemDesc" placeholder="请输入内容" disabled></u--textarea>
</u-form-item>
<u-form-item label="处理状态" prop="isHandle" borderBottom required>
<u-subsection :list="listStatus" :current="getHandle(o.isHandle)" disabled
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 !== 0">
<u-form-item label="处理图片" prop="handlePics" borderBottom required>
<u-upload accept="image" :fileList="o.handlePics" disabled
@afterRead="(e)=>afterRead(e,o,index,i)"
@delete="(e)=>deletePic(e,o,index,i)" name="handlePics" multiple
:maxCount="10"></u-upload>
</u-form-item>
<u-form-item label="处理视频" prop="handleVideos" borderBottom>
<u-upload accept="video" :fileList="o.handleVideos" disabled
@afterRead="(e)=>afterRead(e,o,index,i)"
@delete="(e)=>deletePic(e,o,index,i)" name="handleVideos" multiple
:maxCount="10"></u-upload>
</u-form-item>
<u-form-item label="问题描述" prop="handleDesc" borderBottom required>
<u--textarea v-model="o.handleDesc" placeholder="请输入内容" disabled></u--textarea>
</u-form-item>
</view>
<view class="" v-if="o.isHandle == 0">
<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>
</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>
</uni-collapse>
</view>
</template>
<script>
export default {
props: {
xjItem: Array
},
data() {
return {
list: ["正常", "异常"],
listStatus: ["已处理", "未处理"],
current: 0,
listData: [],
showSex: false,
actions: [{
name: '男',
},
{
name: '女',
},
{
name: '保密',
},
],
}
},
mounted() {
// this.listData = this.xjItem
},
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 = []
}
if (!i.handleVideos) {
i.handleVideos = []
}
if (!i.inspectPics) {
i.inspectPics = []
}
if (!i.inspectVideos) {
i.inspectVideos = []
}
return i
})
return item
})
console.log(n, this.listData, 'this.listData ');
}
},
methods: {
previewImage(item){
uni.previewImage({
urls: [item.url],
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function(data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function(err) {
console.log(err.errMsg);
}
}
});
},
getIsItem(arr) {
return arr.filter(item1 => item1.isNormal !== 1 && item1.isNormal !== 0).length
},
getNormal(isNormal) {
if (isNormal == 0) {
return 0
}
if (isNormal == 1) {
return 1
}
if (isNormal == null) {
return 3
}
},
getHandle(isHandle) {
if (isHandle == 0) {
return 0
}
if (isHandle == 1) {
return 1
}
if (isHandle == null) {
return 3
}
},
}
}
</script>
<style lang="scss" scoped>
.contentItem {
height: 100%;
// overflow: auto;
overflow: auto;
.itemC {
display: flex;
justify-content: space-between;
display: flex;
color: #666666;
padding: 10px;
border-bottom: 1px solid #f0f0f0;
}
.itemNo {
color: #666666;
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%;
font-size: 16px;
border-bottom:1px solid #f0f0f0 ;
}
.subsectioin {
display: flex;
column-gap: 10px;
align-items: center;
margin-top: 10px;
}
.itemEve{
margin: 10px 0;
}
</style>