新增的功能
parent
a889e04d97
commit
6fd9d88f1c
|
|
@ -71,14 +71,12 @@
|
|||
</u-form-item>
|
||||
<u-form-item label="处理图片" prop="handlePics" borderBottom required labelPosition='top'>
|
||||
<u-upload accept="image" :fileList="queItem.handlePics || []" disabled
|
||||
@afterRead="(e)=>afterRead(e,queItem)"
|
||||
@delete="(e)=>deletePic(e,queItem)" name="handlePics" multiple
|
||||
name="handlePics" multiple
|
||||
:maxCount="10"></u-upload>
|
||||
</u-form-item>
|
||||
<u-form-item label="处理视频" prop="handleVideos" borderBottom labelPosition='top'>
|
||||
<u-upload accept="video" :fileList="queItem.handleVideos" disabled
|
||||
@afterRead="(e)=>afterRead(e,queItem)"
|
||||
@delete="(e)=>deletePic(e,queItem)" name="handleVideos" multiple
|
||||
name="handleVideos" multiple
|
||||
:maxCount="10"></u-upload>
|
||||
</u-form-item>
|
||||
</view>
|
||||
|
|
@ -111,86 +109,32 @@
|
|||
},
|
||||
onLoad(options) {
|
||||
this.queItem = JSON.parse(options.item)
|
||||
|
||||
this.queItem.handleVideos?.map(item1=>{
|
||||
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
|
||||
return item1
|
||||
})
|
||||
this.queItem.handlePics?.map(item1=>{
|
||||
item1.url ='http://223.75.53.141:9102/test.by-lyf.tmp' + item1.filePath
|
||||
return item1
|
||||
})
|
||||
console.log(this.queItem);
|
||||
},
|
||||
methods: {
|
||||
submit(){
|
||||
//
|
||||
if(this.queItem.handlePics?.length < 0 || !this.queItem.handleDesc){
|
||||
console.log(this.queItem);
|
||||
uni.$showMsg('请填写处理内容和上传图片');
|
||||
return;
|
||||
}else{
|
||||
console.log(this.queItem);
|
||||
uni.$http.post('/gunshiApp/xyt/inspect/detail/handle', this.queItem).then(res => {
|
||||
uni.$showMsg(res.data.description);
|
||||
})
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 删除图片
|
||||
deletePic(event, o) {
|
||||
this.queItem[event.name].splice(event.index, 1)
|
||||
},
|
||||
// 新增图片
|
||||
async afterRead(event, o) {
|
||||
// let file
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
console.log(event,'2342132');
|
||||
let lists = [].concat(event.file)
|
||||
|
||||
if(!this.queItem[event.name]){
|
||||
this.queItem[event.name]=[]
|
||||
}
|
||||
let fileListLen = this.queItem[event.name]?.length
|
||||
console.log(this.queItem[event.name]);
|
||||
lists.map((item) => {
|
||||
this.queItem[event.name].push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中'
|
||||
})
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await this.uploadFilePromise(lists[i].url, event.name)
|
||||
console.log(result);
|
||||
let item = this.queItem[event.name][fileListLen]
|
||||
this.queItem[event.name].splice(fileListLen, 1, Object.assign(item, {
|
||||
status: 'success',
|
||||
message: '',
|
||||
...result
|
||||
}))
|
||||
fileListLen++
|
||||
}
|
||||
},
|
||||
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', // 仅为示例,非真实的接口地址
|
||||
filePath: url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
user: 'test'
|
||||
},
|
||||
success: (res) => {
|
||||
setTimeout(() => {
|
||||
// this.listData[index].children[index1][name].push({...res.data.data,url:res.data.data.filePath})
|
||||
console.log(res.data)
|
||||
resolve(JSON.parse(res.data).data)
|
||||
}, 1000)
|
||||
}
|
||||
});
|
||||
// resolve(a)
|
||||
})
|
||||
},
|
||||
confirm(e) {
|
||||
console.log(e);
|
||||
this.model.stm = e[0]
|
||||
this.model.etm = e[1]
|
||||
this.show = false
|
||||
},
|
||||
cancel() {
|
||||
this.show = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -14,46 +14,48 @@
|
|||
<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.isHandle?'已处理':'未处理'}})</text>
|
||||
<text>({{o.isNormal == 0?'异常':'正常'}}{{o.isNormal == 0?o.isHandle?'已处理':'未处理':''}})</text>
|
||||
<!-- <text></text> -->
|
||||
|
||||
</view>
|
||||
<view class="" v-if="o.isNormal == 0">
|
||||
<view style="">
|
||||
<text>现场图片</text>
|
||||
<view class="itemEve">
|
||||
<text>现场图片:</text>
|
||||
<view class="" v-for="item in o.inspectPics">
|
||||
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;" ></image>
|
||||
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;" @click="previewImage(item)"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="o.inspectVideos.length">
|
||||
<text>现场视频</text>
|
||||
<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;justify-content: space-between;">
|
||||
<text>问题描述</text>
|
||||
<view style="display: flex;" class="itemEve">
|
||||
<text>问题描述:</text>
|
||||
<text>{{o.itemProblemDesc}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="" v-if="o.isHandle == 1">
|
||||
<view style="">
|
||||
<text>处理图片</text>
|
||||
<view style="" class="itemEve">
|
||||
<text>处理图片:</text>
|
||||
<view class="" v-for="item in o.handlePics">
|
||||
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;"></image>
|
||||
<image :src="item.url" style="width: 80px;height: 80px;margin: 5px;" @click="previewImage(item)"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view style="" v-if="o.handleVideos.length">
|
||||
<text>处理视频</text>
|
||||
<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;justify-content: space-between;">
|
||||
<text>问题描述</text <text>{{o.handleDesc}}</text>
|
||||
<view style="display: flex;" class="itemEve">
|
||||
<text>问题描述:</text <text>{{o.handleDesc}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="display: flex;justify-content: space-between;" v-if="o.isHandle == 0">
|
||||
<view style="display: flex;" v-if="o.isHandle == 0" class="itemEve">
|
||||
<text>责任人</text>
|
||||
<text>{{o.handleUserName}}</text>
|
||||
</view>
|
||||
|
|
@ -196,6 +198,20 @@
|
|||
}
|
||||
},
|
||||
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
|
||||
},
|
||||
|
|
@ -221,115 +237,6 @@
|
|||
return 3
|
||||
}
|
||||
},
|
||||
async uploadContent() {
|
||||
try {
|
||||
let params = {
|
||||
status: 2,
|
||||
list: []
|
||||
}
|
||||
this.listData.map(i => {
|
||||
params.list.push(i.children)
|
||||
})
|
||||
const {
|
||||
data
|
||||
} = await uni.$http.post(`/gunshiApp/xyt/inspect/task/finish`, params)
|
||||
|
||||
} catch (error) {
|
||||
uni.$showMsg();
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
let tigger = true
|
||||
//判断是否符合提交条件
|
||||
this.listData.forEach(item => {
|
||||
item.ab = item.children.filter(i => {
|
||||
if (i.isNormal == 1) {
|
||||
if (i.inspectPics?.length && i.itemProblemDesc) {
|
||||
tigger = true
|
||||
} else {
|
||||
tigger = false
|
||||
}
|
||||
if (i.isHandle == 0) {
|
||||
if (i.handlePics?.length && i.handleDesc) {
|
||||
tigger = true
|
||||
} else {
|
||||
tigger = false
|
||||
}
|
||||
} else if (i.isHandle == 1) {
|
||||
tigger = true
|
||||
}
|
||||
} else if (i.isNormal == 0) {
|
||||
tigger = true
|
||||
}
|
||||
})
|
||||
return item
|
||||
})
|
||||
console.log(tigger, 'arr');
|
||||
if (tigger) {
|
||||
this.uploadContent()
|
||||
}
|
||||
//
|
||||
// if()
|
||||
},
|
||||
// 删除图片
|
||||
deletePic(event, o, index, index1) {
|
||||
this.listData[index].children[index1][event.name].splice(event.index, 1)
|
||||
},
|
||||
// 新增图片
|
||||
async afterRead(event, o, index, index1) {
|
||||
console.log(event, index1, this.listData[index]);
|
||||
// let file
|
||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||||
let lists = [].concat(event.file)
|
||||
let fileListLen = this.listData[index].children[index1][event.name]?.length
|
||||
lists.map((item) => {
|
||||
this.listData[index].children[index1][event.name].push({
|
||||
...item,
|
||||
status: 'uploading',
|
||||
message: '上传中'
|
||||
})
|
||||
})
|
||||
for (let i = 0; i < lists.length; i++) {
|
||||
const result = await this.uploadFilePromise(lists[i].url, event.name, index, index1)
|
||||
console.log(result);
|
||||
let item = this.listData[index].children[index1][event.name][fileListLen]
|
||||
this.listData[index].children[index1][event.name].splice(fileListLen, 1, Object.assign(item, {
|
||||
status: 'success',
|
||||
message: '',
|
||||
...result
|
||||
}))
|
||||
fileListLen++
|
||||
}
|
||||
},
|
||||
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', // 仅为示例,非真实的接口地址
|
||||
filePath: url,
|
||||
name: 'file',
|
||||
formData: {
|
||||
user: 'test'
|
||||
},
|
||||
success: (res) => {
|
||||
setTimeout(() => {
|
||||
// this.listData[index].children[index1][name].push({...res.data.data,url:res.data.data.filePath})
|
||||
console.log(res.data)
|
||||
resolve(JSON.parse(res.data).data)
|
||||
}, 1000)
|
||||
}
|
||||
});
|
||||
// resolve(a)
|
||||
})
|
||||
},
|
||||
change(e, o, index, i, key) {
|
||||
|
||||
this.listData[index].children[i][key] = e;
|
||||
this.$forceUpdate()
|
||||
},
|
||||
sexSelect(e) {
|
||||
// this.model1.userInfo.sex = e.name
|
||||
// this.$refs.uForm.validateField('userInfo.sex')
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -391,4 +298,7 @@
|
|||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.itemEve{
|
||||
margin: 10px 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -126,7 +126,7 @@
|
|||
onLoad(options) {
|
||||
this.queItem = JSON.parse(options.item)
|
||||
console.log(uni.getStorageSync('value'));
|
||||
this.queItem.handleUserName = uni.getStorageSync('value').userName
|
||||
this.queItem.handleUserName = uni.getStorageSync('value').nickName
|
||||
this.queItem.handleTime = moment().format('YYYY-MM-DD HH:mm:ss')
|
||||
this.queItem.handleUserId = uni.getStorageSync('value').userId
|
||||
this.queItem.handlePics.map(item=>{
|
||||
|
|
@ -145,6 +145,11 @@
|
|||
console.log(this.queItem);
|
||||
uni.$http.post('/gunshiApp/xyt/inspect/detail/handle', this.queItem).then(res => {
|
||||
uni.$showMsg(res.data.description);
|
||||
if(res.data.code == 200){
|
||||
uni.redirectTo({
|
||||
url:'/pages/wtcl/index'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
formData: {
|
||||
reportUserName:uni.getStorageSync('value').userName,
|
||||
reportUserName:uni.getStorageSync('value').nickName,
|
||||
reportTime:moment().format('YYYY-MM-DD HH:mm:ss'),
|
||||
userId:uni.getStorageSync('value').userId
|
||||
},
|
||||
|
|
@ -28,7 +28,7 @@ export default {
|
|||
debugger;
|
||||
const userList=uni.getStorageSync('value')
|
||||
console.log(userList,'3456789045678945678');
|
||||
this.formData.reportUserName = uni.getStorageSync('value').userName
|
||||
this.formData.reportUserName = uni.getStorageSync('value').nickName
|
||||
this.formData.userId = uni.getStorageSync('value').userId
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ export default {
|
|||
uni.$http.post('/gunshiApp/xyt/maintain/service/insert',{...params,...this.formData}).then(res=>{
|
||||
if(res.data.code == 200){
|
||||
uni.$u.toast('新增成功')
|
||||
uni.navigateBack()
|
||||
uni.switchTab({
|
||||
url: '/pages/homeIndex/index'
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
<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" label-width="100px">
|
||||
<u--form labelPosition="left" :model="o" ref="uForm" label-width="80px">
|
||||
<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>
|
||||
style="width:150px"></u-subsection>
|
||||
</u-form-item>
|
||||
<view class="" v-if="o.isNormal==0">
|
||||
<u-form-item label="现场图片" prop="inspectPics" borderBottom required>
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
<u-form-item label="处理状态" prop="isHandle" borderBottom required>
|
||||
<u-subsection :list="listStatus" :current="getHandle(o.isHandle)"
|
||||
mode="subsection" @change="(e)=>change(e,o,index,i,'isHandle')"
|
||||
style="width:200px;margin-left: 10px"></u-subsection>
|
||||
style="width:150px"></u-subsection>
|
||||
</u-form-item>
|
||||
<view class="" v-if="o.isHandle == 1">
|
||||
<u-form-item label="现场图片" prop="handlePics" borderBottom required>
|
||||
|
|
@ -63,7 +63,18 @@
|
|||
<uni-data-picker :localdata="treeList" popup-title="请选择班级" v-model="o.handleUserId"
|
||||
:border="false"
|
||||
:map="{'text':'title','value':'value'}"
|
||||
></uni-data-picker>
|
||||
v-slot:default="{data, error, options}"
|
||||
>
|
||||
<view v-if="error" class="error">
|
||||
<text>{{error}}</text>
|
||||
</view>
|
||||
<view v-else-if="data.length" class="selected">
|
||||
<text>{{data[data.length-1].text}}</text>
|
||||
</view>
|
||||
<view v-else>
|
||||
<text>请选择</text>
|
||||
</view>
|
||||
</uni-data-picker>
|
||||
</u-form-item>
|
||||
|
||||
</view>
|
||||
|
|
@ -196,7 +207,7 @@
|
|||
},
|
||||
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')
|
||||
const resUser = await uni.$http.get('/gunshiApp/xyt/system/user/list?pageNum=1&pageSize=9999')
|
||||
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)
|
||||
|
|
@ -250,7 +261,7 @@
|
|||
console.log(data,'2121');
|
||||
if(data.code==200){
|
||||
uni.$showMsg('提交成功');
|
||||
uni.navigateTo({
|
||||
uni.redirectTo({
|
||||
url:'/pages/xcrw/index'
|
||||
})
|
||||
}
|
||||
|
|
@ -405,6 +416,7 @@
|
|||
|
||||
.xj-text {
|
||||
margin-left: 10%;
|
||||
margin-right: 10%;
|
||||
margin-top: 2%;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue