parent
94aabf89f4
commit
d3ea1684ab
3 changed files with 587 additions and 613 deletions
@ -1,293 +1,280 @@ |
|||||||
<template> |
<template> |
||||||
<view> |
<view> |
||||||
<view class="investigation-item" |
<view class="investigation-item" :class="investigationSelect === index ? 'active' : ''" |
||||||
:class="investigationSelect === index ? 'active' : ''" |
v-for="(item, index) in investigationList" :key="item.name" @click="handleSelect(item, index)"> |
||||||
v-for="(item, index) in investigationList" |
<text>{{ item.name }}</text> |
||||||
:key="item.name" |
<uni-icons type="checkmarkempty" size="24" |
||||||
@click="handleSelect(item, index)" |
:style="{color: '#2663BF', visibility: investigationSelect === index ? 'visible' : 'hidden'}" /> |
||||||
> |
</view> |
||||||
<text>{{ item.name }}</text> |
<u-popup :show="showInvestigationDetail" @close="showInvestigationDetail = false"> |
||||||
<uni-icons type="checkmarkempty" size="24" :style="{color: '#2663BF', visibility: investigationSelect === index ? 'visible' : 'hidden'}"/> |
<view class="custom-pop-head"> |
||||||
</view> |
<view class="left" @click="showInvestigationDetail = false">取消</view> |
||||||
<u-popup :show="showInvestigationDetail" @close="showInvestigationDetail = false"> |
<view class="title">{{ investigationDetailTitle }}</view> |
||||||
<view class="custom-pop-head"> |
<view class="right" @click="investigationDetailHandle">确认</view> |
||||||
<view class="left" @click="showInvestigationDetail = false">取消</view> |
</view> |
||||||
<view class="title">{{ investigationDetailTitle }}</view> |
<view class="box" style="max-height: 800rpx;overflow-y: auto"> |
||||||
<view class="right" @click="investigationDetailHandle">确认</view> |
<view class="investigation-item" v-for="(item, index) in investigationDetailList" :key="index" |
||||||
</view> |
style="width: 96%; padding: 0"> |
||||||
<view class="box" style="max-height: 800rpx;overflow-y: auto"> |
<view class="detail-item" v-if="item.type === 'number' || item.type === '1'"> |
||||||
<view class="investigation-item" |
<uni-forms-item :label="item.name" label-width="300px" |
||||||
v-for="(item, index) in investigationDetailList" |
style="display: flex;align-items: center"> |
||||||
:key="index" |
<u-input placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" |
||||||
style="width: 96%; padding: 0" |
type="number"> |
||||||
> |
<u-text :text="item.unit" slot="suffix" margin="0 3px 0 0" type="tips"></u-text> |
||||||
<view class="detail-item" v-if="item.type === 'number' || item.type === '1'"> |
</u-input> |
||||||
<uni-forms-item :label="item.name" label-width="300px" style="display: flex;align-items: center"> |
</uni-forms-item> |
||||||
<u-input |
</view> |
||||||
placeholder="请输入" |
<view class="detail-item" v-else-if="item.type === 'text' || item.type === '2'"> |
||||||
border="none" |
<uni-forms-item :label="item.name" label-width="300px" |
||||||
v-model="item.standar" |
style="display: flex;align-items: center"> |
||||||
inputAlign="right" |
<u-input placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" /> |
||||||
type="number" |
</uni-forms-item> |
||||||
> |
</view> |
||||||
<u-text |
<view class="detail-item" v-else-if="item.type === 'check' || item.type === '3'"> |
||||||
:text="item.unit" |
<uni-forms-item :label="item.name" label-width="300px" |
||||||
slot="suffix" |
style="display: flex;align-items: center"> |
||||||
margin="0 3px 0 0" |
<u-checkbox v-model="item.standar" :customStyle="{justifyContent: 'space-between'}" |
||||||
type="tips" |
:name="'sdfs'" /> |
||||||
></u-text> |
</uni-forms-item> |
||||||
</u-input> |
</view> |
||||||
</uni-forms-item> |
<view class="detail-item" v-else-if="item.type === 'upload' || item.type === '4'"> |
||||||
</view> |
<uni-forms-item :label="item.name" label-position="top" label-width="300px" |
||||||
<view class="detail-item" v-else-if="item.type === 'text' || item.type === '2'"> |
style="display: flex;align-items: center" /> |
||||||
<uni-forms-item :label="item.name" label-width="300px" style="display: flex;align-items: center"> |
<u-upload :fileList="item.fileList" @afterRead="(e) => afterRead(e, item)" |
||||||
<u-input |
@delete="(e) => deletePic(e, item)" name="1" :maxCount="1"></u-upload> |
||||||
placeholder="请输入" |
</view> |
||||||
border="none" |
</view> |
||||||
v-model="item.standar" |
</view> |
||||||
inputAlign="right" |
<view class="blank" /> |
||||||
/> |
</u-popup> |
||||||
</uni-forms-item> |
</view> |
||||||
</view> |
|
||||||
<view class="detail-item" v-else-if="item.type === 'check' || item.type === '3'"> |
|
||||||
<uni-forms-item :label="item.name" label-width="300px" style="display: flex;align-items: center"> |
|
||||||
<u-checkbox |
|
||||||
v-model="item.standar" |
|
||||||
:customStyle="{justifyContent: 'space-between'}" |
|
||||||
:name="'sdfs'" |
|
||||||
/> |
|
||||||
</uni-forms-item> |
|
||||||
</view> |
|
||||||
<view class="detail-item" v-else-if="item.type === 'upload' || item.type === '4'"> |
|
||||||
<uni-forms-item :label="item.name" label-position="top" label-width="300px" style="display: flex;align-items: center" /> |
|
||||||
<u-upload |
|
||||||
:fileList="item.fileList" |
|
||||||
@afterRead="(e) => afterRead(e, item)" |
|
||||||
@delete="(e) => deletePic(e, item)" |
|
||||||
name="1" |
|
||||||
:maxCount="1" |
|
||||||
></u-upload> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view class="blank" /> |
|
||||||
</u-popup> |
|
||||||
</view> |
|
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
export default { |
export default { |
||||||
// 组件 |
// 组件 |
||||||
components: {}, |
components: {}, |
||||||
props: { |
props: { |
||||||
sid: { |
sid: { |
||||||
type: String, |
type: String, |
||||||
default: '01' |
default: '01' |
||||||
} |
} |
||||||
}, |
}, |
||||||
data() { |
data() { |
||||||
return { |
return { |
||||||
// 公用的js |
// 公用的js |
||||||
$: this.$, |
$: this.$, |
||||||
investigationSelect: null, |
investigationSelect: null, |
||||||
investigationList: [], |
investigationList: [], |
||||||
showInvestigationDetail: false, |
showInvestigationDetail: false, |
||||||
investigationDetailTitle: '', |
investigationDetailTitle: '', |
||||||
investigationDetailList: [] |
investigationDetailList: [] |
||||||
} |
} |
||||||
}, |
}, |
||||||
// 页面加载 |
// 页面加载 |
||||||
onLoad(e) { |
onLoad(e) { |
||||||
console.log(12312312312) |
console.log(12312312312) |
||||||
// this.getData() |
// this.getData() |
||||||
}, |
}, |
||||||
mounted(){ |
mounted() { |
||||||
if (this.sid) { |
if (this.sid) { |
||||||
this.getData() |
this.getData() |
||||||
} |
} |
||||||
}, |
}, |
||||||
// 页面显示 |
// 页面显示 |
||||||
onShow() { |
onShow() {}, |
||||||
}, |
// 计算属性 |
||||||
// 计算属性 |
computed: {}, |
||||||
computed: {}, |
// 方法 |
||||||
// 方法 |
methods: { |
||||||
methods: { |
// 删除图片 |
||||||
// 删除图片 |
deletePic(event, item) { |
||||||
deletePic(event, item) { |
item.fileList.splice(event.index, 1) |
||||||
item.fileList.splice(event.index, 1) |
}, |
||||||
}, |
//获取随机id |
||||||
//获取随机id |
uuid(len, binary) { |
||||||
uuid(len, binary) { |
len = !len ? 36 : len; |
||||||
len = !len ? 36 : len; |
binary = !binary ? 16 : binary; |
||||||
binary = !binary ? 16 : binary; |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
var r = Math.random() * binary | 0, |
||||||
var r = Math.random() * binary | 0, |
v = c == 'x' ? r : (r & 0x3 | 0x8); |
||||||
v = c == 'x' ? r : (r & 0x3 | 0x8); |
return v.toString(binary); |
||||||
return v.toString(binary); |
}).substring(0, len) |
||||||
}).substring(0, len) |
}, |
||||||
}, |
// 新增图片 |
||||||
// 新增图片 |
async afterRead(event, item) { |
||||||
async afterRead(event, item) { |
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
||||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
const id = this.uuid() |
||||||
const id = this.uuid() |
if (!item.fileList) { |
||||||
item.fileList.push({ |
item.fileList = [] |
||||||
id, |
} |
||||||
...event.file, |
this.$forceUpdate() |
||||||
status: 'uploading', |
item.fileList.push({ |
||||||
message: '上传中' |
id, |
||||||
}) |
...event.file, |
||||||
const result = await this.uploadFilePromise(item.fileList[0].url) |
status: 'uploading', |
||||||
const resultInfo = JSON.parse(result) |
message: '上传中' |
||||||
const index = item.fileList.findIndex(v => v.id === id) |
}) |
||||||
if (resultInfo.code == 200) { |
const result = await this.uploadFilePromise(item.fileList[0].url) |
||||||
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
const resultInfo = JSON.parse(result) |
||||||
status: 'success', |
const index = item.fileList.findIndex(v => v.id === id) |
||||||
message: '', |
if (resultInfo.code == 200) { |
||||||
result: resultInfo, |
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
||||||
url: resultInfo.result |
status: 'success', |
||||||
})) |
message: '', |
||||||
} else { |
result: resultInfo, |
||||||
this.$.toast('上传失败') |
url: resultInfo.result |
||||||
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
})) |
||||||
status: 'error', |
} else { |
||||||
message: '失败', |
this.$.toast('上传失败') |
||||||
})) |
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
||||||
} |
status: 'error', |
||||||
}, |
message: '失败', |
||||||
uploadFilePromise(url) { |
})) |
||||||
return new Promise((resolve, reject) => { |
} |
||||||
let a = uni.uploadFile({ |
}, |
||||||
url: this.$.baseUrl + '/hiddenDanger/ftp/uploadFileToFtp', // 仅为示例,非真实的接口地址 |
uploadFilePromise(url) { |
||||||
filePath: url, |
return new Promise((resolve, reject) => { |
||||||
name: 'file', |
let a = uni.uploadFile({ |
||||||
success: (res) => { |
url: this.$.baseUrl + '/hiddenDanger/ftp/uploadFileToFtp', // 仅为示例,非真实的接口地址 |
||||||
resolve(res.data) |
filePath: url, |
||||||
} |
name: 'file', |
||||||
}); |
success: (res) => { |
||||||
}) |
resolve(res.data) |
||||||
}, |
} |
||||||
getData(){ |
}); |
||||||
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { |
}) |
||||||
if(res.code == 200){ |
}, |
||||||
this.investigationList = res.result |
getData() { |
||||||
} |
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { |
||||||
}) |
if (res.code == 200) { |
||||||
}, |
this.investigationList = res.result |
||||||
getData2(sid){ |
} |
||||||
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangerInfo', {sid}, 'GET').then(res => { |
}) |
||||||
if(res.code == 200){ |
}, |
||||||
console.log(res.result) |
getData2(sid) { |
||||||
this.investigationDetailList = res.result.map(item => { |
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangerInfo', { |
||||||
switch (item.type) { |
sid |
||||||
case "1": |
}, 'GET').then(res => { |
||||||
item.standar = 0 |
if (res.code == 200) { |
||||||
break; |
console.log(res.result) |
||||||
case "2": |
this.investigationDetailList = res.result.map(item => { |
||||||
item.standar = '' |
switch (item.type) { |
||||||
break; |
case "1": |
||||||
case "3": |
item.standar = 0 |
||||||
item.standar = false |
break; |
||||||
break; |
case "2": |
||||||
case "4": |
item.standar = '' |
||||||
item.fileList = [] |
break; |
||||||
break; |
case "3": |
||||||
} |
item.standar = false |
||||||
return item |
break; |
||||||
}) |
case "4": |
||||||
} |
item.fileList = [] |
||||||
}) |
break; |
||||||
}, |
} |
||||||
// 跳转页面 |
return item |
||||||
skipPage(even){ |
}) |
||||||
this.$.open(even) |
} |
||||||
}, |
}) |
||||||
handleSelect(item, index){ |
}, |
||||||
this.investigationSelect = index |
// 跳转页面 |
||||||
this.investigationDetailTitle = item.name |
skipPage(even) { |
||||||
this.showInvestigationDetail = true |
this.$.open(even) |
||||||
this.getData2(item.nid) |
}, |
||||||
// this.$emit('select', this.investigationSelect, this.investigationList[index]) |
handleSelect(item, index) { |
||||||
}, |
this.investigationSelect = index |
||||||
investigationDetailHandle(){ |
this.investigationDetailTitle = item.name |
||||||
this.showInvestigationDetail = false |
this.showInvestigationDetail = true |
||||||
this.$emit('select', this.investigationList[this.investigationSelect], this.investigationDetailList) |
this.getData2(item.nid) |
||||||
} |
// this.$emit('select', this.investigationSelect, this.investigationList[index]) |
||||||
}, |
}, |
||||||
onReady() { |
investigationDetailHandle() { |
||||||
}, |
this.showInvestigationDetail = false |
||||||
// 页面卸载 |
this.$emit('select', this.investigationList[this.investigationSelect], this.investigationDetailList) |
||||||
onUnload() { |
} |
||||||
|
}, |
||||||
|
onReady() {}, |
||||||
|
// 页面卸载 |
||||||
|
onUnload() { |
||||||
|
|
||||||
}, |
}, |
||||||
// 触发下拉刷新 |
// 触发下拉刷新 |
||||||
onPullDownRefresh() { |
onPullDownRefresh() { |
||||||
// 延迟关闭刷新动画 |
// 延迟关闭刷新动画 |
||||||
setTimeout(() => { |
setTimeout(() => { |
||||||
uni.stopPullDownRefresh(); |
uni.stopPullDownRefresh(); |
||||||
}, 1500); |
}, 1500); |
||||||
}, |
}, |
||||||
// 页面上拉触底事件的处理函数 |
// 页面上拉触底事件的处理函数 |
||||||
onReachBottom() { |
onReachBottom() {}, |
||||||
}, |
} |
||||||
} |
|
||||||
</script> |
</script> |
||||||
|
|
||||||
<style> |
<style> |
||||||
page { |
page { |
||||||
background:#FFFFFF; |
background: #FFFFFF; |
||||||
} |
} |
||||||
</style> |
</style> |
||||||
<style lang="scss" scoped> |
<style lang="scss" scoped> |
||||||
.investigation-item { |
.investigation-item { |
||||||
margin:0 auto 20rpx; |
margin: 0 auto 20rpx; |
||||||
width: 90%; |
width: 90%; |
||||||
border-radius: 8rpx; |
border-radius: 8rpx; |
||||||
padding: 20rpx; |
padding: 20rpx; |
||||||
box-sizing: border-box; |
box-sizing: border-box; |
||||||
display: flex; |
display: flex; |
||||||
justify-content: space-between; |
justify-content: space-between; |
||||||
align-items: center; |
align-items: center; |
||||||
overflow: hidden; |
overflow: hidden; |
||||||
&.active { |
|
||||||
background: #DFEBF8; |
&.active { |
||||||
} |
background: #DFEBF8; |
||||||
} |
} |
||||||
.detail-item { |
} |
||||||
width: 100%; |
|
||||||
background: #F0F3F7; |
.detail-item { |
||||||
padding: 20rpx 30rpx; |
width: 100%; |
||||||
border-radius: 8rpx; |
background: #F0F3F7; |
||||||
box-sizing: border-box; |
padding: 20rpx 30rpx; |
||||||
/deep/ .uni-forms-item__content { |
border-radius: 8rpx; |
||||||
justify-content: flex-end; |
box-sizing: border-box; |
||||||
text-align: right; |
|
||||||
display: flex; |
/deep/ .uni-forms-item__content { |
||||||
} |
justify-content: flex-end; |
||||||
/deep/ .uni-forms-item { |
text-align: right; |
||||||
margin-bottom: 0; |
display: flex; |
||||||
} |
} |
||||||
/deep/ .uni-forms-item__label { |
|
||||||
font-size: 16px; |
/deep/ .uni-forms-item { |
||||||
} |
margin-bottom: 0; |
||||||
} |
} |
||||||
.custom-pop-head { |
|
||||||
width: 100%; |
/deep/ .uni-forms-item__label { |
||||||
padding: 20rpx; |
font-size: 16px; |
||||||
box-sizing: border-box; |
} |
||||||
display: flex; |
} |
||||||
align-items: center; |
|
||||||
justify-content: space-between; |
.custom-pop-head { |
||||||
border-bottom: 1px solid #E6E6E6; |
width: 100%; |
||||||
margin-bottom: 20rpx; |
padding: 20rpx; |
||||||
.left { |
box-sizing: border-box; |
||||||
color: #666666; |
display: flex; |
||||||
} |
align-items: center; |
||||||
.title { |
justify-content: space-between; |
||||||
font-size: 16px; |
border-bottom: 1px solid #E6E6E6; |
||||||
} |
margin-bottom: 20rpx; |
||||||
.right { |
|
||||||
color: #2663BF; |
.left { |
||||||
} |
color: #666666; |
||||||
} |
} |
||||||
|
|
||||||
|
.title { |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
|
||||||
|
.right { |
||||||
|
color: #2663BF; |
||||||
|
} |
||||||
|
} |
||||||
</style> |
</style> |
@ -1,314 +1,300 @@ |
|||||||
<template> |
<template> |
||||||
<view> |
<view> |
||||||
|
|
||||||
<view class="custom-pop-head"> |
<view class="custom-pop-head"> |
||||||
<view class="left" @click="$emit('show',false)">取消</view> |
<view class="left" @click="$emit('show',false)">取消</view> |
||||||
<view class="title">{{ investigationDetailTitle }}</view> |
<view class="title">{{ investigationDetailTitle }}</view> |
||||||
<view class="right" @click="investigationDetailHandle">确认</view> |
<view class="right" @click="investigationDetailHandle">确认</view> |
||||||
</view> |
</view> |
||||||
<view class="box" style="max-height: 800rpx;overflow-y: auto"> |
<view class="box" style="max-height: 800rpx;overflow-y: auto"> |
||||||
<view class="investigation-item" |
<view class="investigation-item" v-for="(item, index) in investigationDetailList" :key="index" |
||||||
v-for="(item, index) in investigationDetailList" |
style="width: 96%; padding: 0"> |
||||||
:key="index" |
<view class="detail-item" v-if="item.type === 'number' || item.type === '1'"> |
||||||
style="width: 96%; padding: 0" |
<uni-forms-item :label="item.name" label-width="500rpx" style="display: flex;align-items: center"> |
||||||
> |
<u-input placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" |
||||||
<view class="detail-item" v-if="item.type === 'number' || item.type === '1'"> |
type="number"> |
||||||
<uni-forms-item :label="item.name" label-width="500rpx" style="display: flex;align-items: center"> |
<u-text :text="item.unit" slot="suffix" margin="0 3px 0 0" type="tips"></u-text> |
||||||
<u-input |
</u-input> |
||||||
placeholder="请输入" |
</uni-forms-item> |
||||||
border="none" |
</view> |
||||||
v-model="item.standar" |
<view class="detail-item" v-else-if="item.type === 'text' || item.type === '2'"> |
||||||
inputAlign="right" |
<uni-forms-item :label="item.name" label-width="500rpx" style="display: flex;align-items: center"> |
||||||
type="number" |
<u-input placeholder="请输入" border="none" v-model="item.standar" inputAlign="right" /> |
||||||
> |
</uni-forms-item> |
||||||
<u-text |
</view> |
||||||
:text="item.unit" |
<view class="detail-item" v-else-if="item.type === 'check' || item.type === '3'"> |
||||||
slot="suffix" |
<uni-forms-item :label="item.name" label-width="500rpx" style="display: flex;align-items: center"> |
||||||
margin="0 3px 0 0" |
<u-checkbox v-model="item.standar" :customStyle="{justifyContent: 'space-between'}" |
||||||
type="tips" |
:name="'sdfs'" /> |
||||||
></u-text> |
</uni-forms-item> |
||||||
</u-input> |
</view> |
||||||
</uni-forms-item> |
<view class="detail-item" v-else-if="item.type === 'upload' || item.type === '4'"> |
||||||
</view> |
<uni-forms-item :label="item.name" label-position="top" label-width="300px" |
||||||
<view class="detail-item" v-else-if="item.type === 'text' || item.type === '2'"> |
style="display: flex;align-items: center" /> |
||||||
<uni-forms-item :label="item.name" label-width="500rpx" style="display: flex;align-items: center"> |
<u-upload :fileList="item.fileList" @afterRead="(e) => afterRead(e, item)" |
||||||
<u-input |
@delete="(e) => deletePic(e, item)" name="1" :maxCount="1"></u-upload> |
||||||
placeholder="请输入" |
</view> |
||||||
border="none" |
</view> |
||||||
v-model="item.standar" |
</view> |
||||||
inputAlign="right" |
<view class="blank" /> |
||||||
/> |
</view> |
||||||
</uni-forms-item> |
</template> |
||||||
</view> |
|
||||||
<view class="detail-item" v-else-if="item.type === 'check' || item.type === '3'"> |
|
||||||
<uni-forms-item :label="item.name" label-width="500rpx" style="display: flex;align-items: center"> |
|
||||||
<u-checkbox |
|
||||||
v-model="item.standar" |
|
||||||
:customStyle="{justifyContent: 'space-between'}" |
|
||||||
:name="'sdfs'" |
|
||||||
/> |
|
||||||
</uni-forms-item> |
|
||||||
</view> |
|
||||||
<view class="detail-item" v-else-if="item.type === 'upload' || item.type === '4'"> |
|
||||||
<uni-forms-item :label="item.name" label-position="top" label-width="300px" style="display: flex;align-items: center" /> |
|
||||||
<u-upload |
|
||||||
:fileList="item.fileList" |
|
||||||
@afterRead="(e) => afterRead(e, item)" |
|
||||||
@delete="(e) => deletePic(e, item)" |
|
||||||
name="1" |
|
||||||
:maxCount="1" |
|
||||||
></u-upload> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
</view> |
|
||||||
<view class="blank" /> |
|
||||||
</view> |
|
||||||
</template> |
|
||||||
|
|
||||||
<script> |
<script> |
||||||
export default { |
export default { |
||||||
// 组件 |
// 组件 |
||||||
components: {}, |
components: {}, |
||||||
props: { |
props: { |
||||||
sid: { |
sid: { |
||||||
type: String, |
type: String, |
||||||
default: '01' |
default: '01' |
||||||
}, |
}, |
||||||
json: { |
json: { |
||||||
type: Object, |
type: Object, |
||||||
default: {} |
default: {} |
||||||
}, |
}, |
||||||
}, |
}, |
||||||
data() { |
data() { |
||||||
return { |
return { |
||||||
// 公用的js |
// 公用的js |
||||||
$: this.$, |
$: this.$, |
||||||
investigationSelect: null, |
investigationSelect: null, |
||||||
investigationList: [], |
investigationList: [], |
||||||
showInvestigationDetail: false, |
showInvestigationDetail: false, |
||||||
investigationDetailTitle: '', |
investigationDetailTitle: '', |
||||||
investigationDetailList: [] |
investigationDetailList: [] |
||||||
} |
} |
||||||
}, |
}, |
||||||
// 页面加载 |
// 页面加载 |
||||||
onLoad(e) { |
onLoad(e) { |
||||||
// this.getData() |
// this.getData() |
||||||
}, |
}, |
||||||
mounted(){ |
mounted() { |
||||||
if (this.json.name) { |
if (this.json.name) { |
||||||
this.investigationDetailList = this.json.extraConfigs.map(item => { |
this.investigationDetailList = this.json.extraConfigs.map(item => { |
||||||
switch (item.type) { |
if (!item.fileList) { |
||||||
// case "1": |
item.fileList = [] |
||||||
// item.standar = 0 |
} |
||||||
// break; |
switch (item.type) { |
||||||
// case "2": |
// case "1": |
||||||
// item.standar = '' |
// item.standar = 0 |
||||||
// break; |
// break; |
||||||
// case "3": |
// case "2": |
||||||
// item.standar = false |
// item.standar = '' |
||||||
// break; |
// break; |
||||||
// case "4": |
// case "3": |
||||||
// item.fileList = [ |
// item.standar = false |
||||||
// { |
// break; |
||||||
// "id": "20229a8c-db46-4447-be3e-6731665f7bd0", |
// case "4": |
||||||
// "type": "image", |
// item.fileList = [ |
||||||
// "url": "https://img-blog.csdnimg.cn/20210823085628540.jpeg", |
// { |
||||||
// "thumb": "blob:http://localhost:8080/4343e24a-edc5-4693-8fbd-f99647ea3bd5", |
// "id": "20229a8c-db46-4447-be3e-6731665f7bd0", |
||||||
// "size": 11600, |
// "type": "image", |
||||||
// "name": "静态人流量统计.png", |
// "url": "https://img-blog.csdnimg.cn/20210823085628540.jpeg", |
||||||
// "status": "success", |
// "thumb": "blob:http://localhost:8080/4343e24a-edc5-4693-8fbd-f99647ea3bd5", |
||||||
// "message": "", |
// "size": 11600, |
||||||
// "result": { |
// "name": "静态人流量统计.png", |
||||||
// "code": 200, |
// "status": "success", |
||||||
// "message": "操作成功", |
// "message": "", |
||||||
// "result": "https://img-blog.csdnimg.cn/20210823085628540.jpeg" |
// "result": { |
||||||
// } |
// "code": 200, |
||||||
// } |
// "message": "操作成功", |
||||||
// ] |
// "result": "https://img-blog.csdnimg.cn/20210823085628540.jpeg" |
||||||
// break; |
// } |
||||||
} |
// } |
||||||
return item |
// ] |
||||||
}) |
// break; |
||||||
} |
} |
||||||
}, |
return item |
||||||
// 页面显示 |
}) |
||||||
onShow() { |
} |
||||||
}, |
}, |
||||||
// 计算属性 |
// 页面显示 |
||||||
computed: {}, |
onShow() {}, |
||||||
// 方法 |
// 计算属性 |
||||||
methods: { |
computed: {}, |
||||||
// 删除图片 |
// 方法 |
||||||
deletePic(event, item) { |
methods: { |
||||||
item.fileList.splice(event.index, 1) |
// 删除图片 |
||||||
}, |
deletePic(event, item) { |
||||||
//获取随机id |
item.fileList.splice(event.index, 1) |
||||||
uuid(len, binary) { |
}, |
||||||
len = !len ? 36 : len; |
//获取随机id |
||||||
binary = !binary ? 16 : binary; |
uuid(len, binary) { |
||||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
len = !len ? 36 : len; |
||||||
var r = Math.random() * binary | 0, |
binary = !binary ? 16 : binary; |
||||||
v = c == 'x' ? r : (r & 0x3 | 0x8); |
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
||||||
return v.toString(binary); |
var r = Math.random() * binary | 0, |
||||||
}).substring(0, len) |
v = c == 'x' ? r : (r & 0x3 | 0x8); |
||||||
}, |
return v.toString(binary); |
||||||
// 新增图片 |
}).substring(0, len) |
||||||
async afterRead(event, item) { |
}, |
||||||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
// 新增图片 |
||||||
const id = this.uuid() |
async afterRead(event, item) { |
||||||
item.fileList.push({ |
|
||||||
id, |
|
||||||
...event.file, |
|
||||||
status: 'uploading', |
|
||||||
message: '上传中' |
|
||||||
}) |
|
||||||
const result = await this.uploadFilePromise(item.fileList[0].url) |
|
||||||
const resultInfo = JSON.parse(result) |
|
||||||
const index = item.fileList.findIndex(v => v.id === id) |
|
||||||
if (resultInfo.code == 200) { |
|
||||||
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
|
||||||
status: 'success', |
|
||||||
message: '', |
|
||||||
result: resultInfo, |
|
||||||
url: resultInfo.result |
|
||||||
})) |
|
||||||
} else { |
|
||||||
this.$.toast('上传失败') |
|
||||||
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
|
||||||
status: 'error', |
|
||||||
message: '失败', |
|
||||||
})) |
|
||||||
} |
|
||||||
}, |
|
||||||
uploadFilePromise(url) { |
|
||||||
return new Promise((resolve, reject) => { |
|
||||||
let a = uni.uploadFile({ |
|
||||||
url: this.$.baseUrl + '/hiddenDanger/ftp/uploadFileToFtp', // 仅为示例,非真实的接口地址 |
|
||||||
filePath: url, |
|
||||||
name: 'file', |
|
||||||
success: (res) => { |
|
||||||
resolve(res.data) |
|
||||||
} |
|
||||||
}); |
|
||||||
}) |
|
||||||
}, |
|
||||||
getData(){ |
|
||||||
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangerInfo', {sid: this.$props.sid}, 'GET').then(res => { |
|
||||||
if(res.code == 200){ |
|
||||||
this.investigationDetailList = res.result.map(item => { |
|
||||||
switch (item.type) { |
|
||||||
case "1": |
|
||||||
item.standar = 0 |
|
||||||
break; |
|
||||||
case "2": |
|
||||||
item.standar = '' |
|
||||||
break; |
|
||||||
case "3": |
|
||||||
item.standar = false |
|
||||||
break; |
|
||||||
case "4": |
|
||||||
item.fileList = [] |
|
||||||
break; |
|
||||||
} |
|
||||||
return item |
|
||||||
}) |
|
||||||
} |
|
||||||
}) |
|
||||||
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { |
|
||||||
if(res.code == 200){ |
|
||||||
this.investigationList = res.result |
|
||||||
} |
|
||||||
}) |
|
||||||
}, |
|
||||||
// 跳转页面 |
|
||||||
skipPage(even){ |
|
||||||
this.$.open(even) |
|
||||||
}, |
|
||||||
handleSelect(item, index){ |
|
||||||
this.investigationSelect = index |
|
||||||
this.investigationDetailTitle = item.name |
|
||||||
this.showInvestigationDetail = true |
|
||||||
// this.$emit('select', this.investigationSelect, this.investigationList[index]) |
|
||||||
}, |
|
||||||
investigationDetailHandle(){ |
|
||||||
this.$emit('select',this.json) |
|
||||||
} |
|
||||||
}, |
|
||||||
onReady() { |
|
||||||
}, |
|
||||||
// 页面卸载 |
|
||||||
onUnload() { |
|
||||||
|
|
||||||
}, |
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
||||||
// 触发下拉刷新 |
const id = this.uuid() |
||||||
onPullDownRefresh() { |
item.fileList.push({ |
||||||
// 延迟关闭刷新动画 |
id, |
||||||
setTimeout(() => { |
...event.file, |
||||||
uni.stopPullDownRefresh(); |
status: 'uploading', |
||||||
}, 1500); |
message: '上传中' |
||||||
}, |
}) |
||||||
// 页面上拉触底事件的处理函数 |
const result = await this.uploadFilePromise(item.fileList[0].url) |
||||||
onReachBottom() { |
const resultInfo = JSON.parse(result) |
||||||
}, |
const index = item.fileList.findIndex(v => v.id === id) |
||||||
} |
if (resultInfo.code == 200) { |
||||||
</script> |
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
||||||
|
status: 'success', |
||||||
|
message: '', |
||||||
|
result: resultInfo, |
||||||
|
url: resultInfo.result |
||||||
|
})) |
||||||
|
} else { |
||||||
|
this.$.toast('上传失败') |
||||||
|
item.fileList.splice(index, 1, Object.assign(item.fileList[index], { |
||||||
|
status: 'error', |
||||||
|
message: '失败', |
||||||
|
})) |
||||||
|
} |
||||||
|
}, |
||||||
|
uploadFilePromise(url) { |
||||||
|
return new Promise((resolve, reject) => { |
||||||
|
let a = uni.uploadFile({ |
||||||
|
url: this.$.baseUrl + '/hiddenDanger/ftp/uploadFileToFtp', // 仅为示例,非真实的接口地址 |
||||||
|
filePath: url, |
||||||
|
name: 'file', |
||||||
|
success: (res) => { |
||||||
|
resolve(res.data) |
||||||
|
} |
||||||
|
}); |
||||||
|
}) |
||||||
|
}, |
||||||
|
getData() { |
||||||
|
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangerInfo', { |
||||||
|
sid: this.$props.sid |
||||||
|
}, 'GET').then(res => { |
||||||
|
if (res.code == 200) { |
||||||
|
this.investigationDetailList = res.result.map(item => { |
||||||
|
switch (item.type) { |
||||||
|
case "1": |
||||||
|
item.standar = 0 |
||||||
|
break; |
||||||
|
case "2": |
||||||
|
item.standar = '' |
||||||
|
break; |
||||||
|
case "3": |
||||||
|
item.standar = false |
||||||
|
break; |
||||||
|
case "4": |
||||||
|
item.fileList = [] |
||||||
|
break; |
||||||
|
} |
||||||
|
return item |
||||||
|
}) |
||||||
|
} |
||||||
|
}) |
||||||
|
this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => { |
||||||
|
if (res.code == 200) { |
||||||
|
this.investigationList = res.result |
||||||
|
} |
||||||
|
}) |
||||||
|
}, |
||||||
|
// 跳转页面 |
||||||
|
skipPage(even) { |
||||||
|
this.$.open(even) |
||||||
|
}, |
||||||
|
handleSelect(item, index) { |
||||||
|
this.investigationSelect = index |
||||||
|
this.investigationDetailTitle = item.name |
||||||
|
this.showInvestigationDetail = true |
||||||
|
// this.$emit('select', this.investigationSelect, this.investigationList[index]) |
||||||
|
}, |
||||||
|
investigationDetailHandle() { |
||||||
|
this.$emit('select', this.json) |
||||||
|
} |
||||||
|
}, |
||||||
|
onReady() {}, |
||||||
|
// 页面卸载 |
||||||
|
onUnload() { |
||||||
|
|
||||||
<style> |
}, |
||||||
page { |
// 触发下拉刷新 |
||||||
background:#FFFFFF; |
onPullDownRefresh() { |
||||||
} |
// 延迟关闭刷新动画 |
||||||
</style> |
setTimeout(() => { |
||||||
<style lang="scss" scoped> |
uni.stopPullDownRefresh(); |
||||||
.investigation-item { |
}, 1500); |
||||||
margin:0 auto 20rpx; |
}, |
||||||
width: 90%; |
// 页面上拉触底事件的处理函数 |
||||||
border-radius: 8rpx; |
onReachBottom() {}, |
||||||
padding: 20rpx; |
} |
||||||
box-sizing: border-box; |
</script> |
||||||
display: flex; |
|
||||||
justify-content: space-between; |
|
||||||
align-items: center; |
|
||||||
overflow: hidden; |
|
||||||
&.active { |
|
||||||
background: #DFEBF8; |
|
||||||
} |
|
||||||
} |
|
||||||
.detail-item { |
|
||||||
width: 100%; |
|
||||||
background: #F0F3F7; |
|
||||||
padding: 20rpx 30rpx; |
|
||||||
border-radius: 8rpx; |
|
||||||
box-sizing: border-box; |
|
||||||
/deep/ .uni-forms-item__content { |
|
||||||
justify-content: flex-end; |
|
||||||
text-align: right; |
|
||||||
display: flex; |
|
||||||
} |
|
||||||
/deep/ .uni-forms-item { |
|
||||||
margin-bottom: 0; |
|
||||||
} |
|
||||||
/deep/ .uni-forms-item__label { |
|
||||||
font-size: 16px; |
|
||||||
} |
|
||||||
} |
|
||||||
.custom-pop-head { |
|
||||||
width: 100%; |
|
||||||
padding: 20rpx; |
|
||||||
box-sizing: border-box; |
|
||||||
display: flex; |
|
||||||
align-items: center; |
|
||||||
justify-content: space-between; |
|
||||||
border-bottom: 1px solid #E6E6E6; |
|
||||||
margin-bottom: 20rpx; |
|
||||||
.left { |
|
||||||
color: #666666; |
|
||||||
} |
|
||||||
.title { |
|
||||||
font-size: 16px; |
|
||||||
} |
|
||||||
.right { |
|
||||||
color: #2663BF; |
|
||||||
} |
|
||||||
} |
|
||||||
</style> |
|
||||||
|
|
||||||
|
<style> |
||||||
|
page { |
||||||
|
background: #FFFFFF; |
||||||
|
} |
||||||
|
</style> |
||||||
|
<style lang="scss" scoped> |
||||||
|
.investigation-item { |
||||||
|
margin: 0 auto 20rpx; |
||||||
|
width: 90%; |
||||||
|
border-radius: 8rpx; |
||||||
|
padding: 20rpx; |
||||||
|
box-sizing: border-box; |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
align-items: center; |
||||||
|
overflow: hidden; |
||||||
|
|
||||||
|
&.active { |
||||||
|
background: #DFEBF8; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.detail-item { |
||||||
|
width: 100%; |
||||||
|
background: #F0F3F7; |
||||||
|
padding: 20rpx 30rpx; |
||||||
|
border-radius: 8rpx; |
||||||
|
box-sizing: border-box; |
||||||
|
|
||||||
|
/deep/ .uni-forms-item__content { |
||||||
|
justify-content: flex-end; |
||||||
|
text-align: right; |
||||||
|
display: flex; |
||||||
|
} |
||||||
|
|
||||||
|
/deep/ .uni-forms-item { |
||||||
|
margin-bottom: 0; |
||||||
|
} |
||||||
|
|
||||||
|
/deep/ .uni-forms-item__label { |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.custom-pop-head { |
||||||
|
width: 100%; |
||||||
|
padding: 20rpx; |
||||||
|
box-sizing: border-box; |
||||||
|
display: flex; |
||||||
|
align-items: center; |
||||||
|
justify-content: space-between; |
||||||
|
border-bottom: 1px solid #E6E6E6; |
||||||
|
margin-bottom: 20rpx; |
||||||
|
|
||||||
|
.left { |
||||||
|
color: #666666; |
||||||
|
} |
||||||
|
|
||||||
|
.title { |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
|
||||||
|
.right { |
||||||
|
color: #2663BF; |
||||||
|
} |
||||||
|
} |
||||||
|
</style> |
Loading…
Reference in new issue