Commit 319bec6e authored by 胡占生's avatar 胡占生 🇨🇳

fix: 现状风险列表,新增现状列表接口联调对接

parent 1ef2a6d0
......@@ -156,6 +156,11 @@ const routes = [{
name: 'addInherent',
component: () => import('../views/riskProject/add/addInherent.vue'),
},
{
path: '/addCurrent',
name: 'addCurrent',
component: () => import('../views/riskProject/add/addCurrent.vue'),
},
]
const router = new VueRouter({
......
This diff is collapsed.
This diff is collapsed.
......@@ -6,19 +6,18 @@
</van-sticky>
<div style="margin-bottom: 1.5rem;">
<van-tabs
v-model="active"
@change="postList(searchValue);showIndex = null;"
color="#2980f7"
animated
>
<van-tab v-for="index in 8" :title="index + '号楼'" :key="index">
v-model="active"
@change="tabList"
color="#2980f7"
animated
>
<van-tab v-for="(item) in riskLogList" :title="item.name" :name="item.id" :key="item.id">
<van-dropdown-menu z-index="1000">
<van-dropdown-item v-model="value1" :options="option1" get-container="body"/>
<van-dropdown-item v-model="value2" :options="option2" get-container="body"/>
<van-dropdown-item v-model="value1" @change="changeFloor" :options="option1" get-container="body"/>
<van-dropdown-item v-model="value2" @change="changeRoom" :options="option2" get-container="body"/>
</van-dropdown-menu>
<div
class="con-list"
@touchmove="showIndex = null"
>
<van-cell-group
inset
......@@ -32,15 +31,15 @@
<van-col span="17">
<van-row gutter="">
<van-col span="9">发起时间:</van-col>
<van-col span="15">{{ item.time}}</van-col>
<van-col span="15">{{ item.createTime}}</van-col>
</van-row>
<van-row gutter="">
<van-col span="9">楼层:</van-col>
<van-col span="15">{{ item.name }}</van-col>
<van-col span="15">{{ item.floorName }}</van-col>
</van-row>
<van-row gutter="">
<van-col span="9">房间:</van-col>
<van-col span="15">{{ item.name }}</van-col>
<van-col span="15">{{ item.roomName }}</van-col>
</van-row>
</van-col>
<van-col span="7" :style="{'color':item.state == 1 ? '#0069e5':'#03b615'}">
......@@ -93,44 +92,17 @@
return {
text: "固有风险列表",
searchValue: "",
value1: 0,
value2: 'a',
option1: [
{ text: '楼层', value: 0 },
{ text: '新款商品', value: 1 },
{ text: '活动商品', value: 2 },
],
option2: [
{ text: '房间', value: 'a' },
{ text: '好评排序', value: 'b' },
{ text: '销量排序', value: 'c' },
],
planId: 0,
value1: 1,
value2: 1,
option1: [],
option2: [],
isHaveNews: false,
messageList: [
{
title:'回显风险源名称',
time:'2022-12-12',
name:'Mr.周',
state:1
}
],
riskLogList:[
{
completedTime:'审批通过',
startTime:'2022-12-12',
approvalUserName:'Mr.周',
taskName:'审批负责人'
},
{
completedTime:'审批通过',
startTime:'2022-12-12',
approvalUserName:'Mr.周',
taskName:'审批负责人'
},
],
messageList: [],
riskLogList:[],
Loop: "", // 定时器
showIndex: null, // 是否显示遮罩层,
active: 0,
active: 1,
form:{
},
......@@ -139,14 +111,29 @@
};
},
created() {
// this.postList();s
this.planId=this.$route.params.id
this.getRiskList(this.planId);
// this.postList();
},
methods: {
changeData(arr){
var arrList=[]
arr.forEach(item=>{
arrList.push(
{
text:item.name,
value:item.id
}
)
})
return arrList
},
performTasks(){
this.$router.push({
name: "addInherent",
params: {
title:'新增'
id:this.active,
planId:this.planId
},
})
},
......@@ -158,30 +145,87 @@
},
})
},
postList(select = "") {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
let formdata = new FormData();
formdata.append("select", select);
postFun(this.tabs[this.active]['api'], formdata)
.then((res) => {
this.$toast.clear();
this.messageList =res.data||res.rows;
// 判断有无数据返回
if (this.messageList.length == 0) {
this.isHaveNews = true;
buildingList(id) {
return new Promise((resolve, reject) => {
getFun(`/risk/plan/plan/building/list/${id}`).then((res) => {
this.riskLogList =res.data||res.rows;
resolve(res.data)
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试");
});
})
},
floorList(id) {
return new Promise((resolve, reject) => {
getFun(`/risk/plan/floor/list/${id}`).then((res) => {
this.option1=this.changeData(res.data)
resolve(res.data)
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
})
},
roomList(id) {
return new Promise((resolve, reject) => {
getFun(`/risk/plan/room/list/${id}`).then((res) => {
this.option2=this.changeData(res.data)
resolve(res.data)
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
})
},
riskList(planId,buildingId,floorId,roomId) {
return new Promise((resolve, reject) => {
var paramsJson={}
if(floorId||roomId){
paramsJson={
floorId,
roomId
}
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试");
}else{
paramsJson={}
}
getFun(`/risk/plan/inherent/list/${planId}/${buildingId}`,paramsJson).then((res) => {
this.messageList=res.data
resolve(res.data)
})
.catch(() => {
this.$toast.fail("加载失败,请稍后再试");
});
})
},
async getRiskList(id){
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
let building= await this.buildingList(id)
let floor= await this.floorList(building[0].id)
let room= await this.roomList(floor[0].id)
let risk= await this.riskList(id,building[0].id)
this.$toast.clear();
},
async tabList(value){
let floor= await this.floorList(value)
let room= await this.roomList(floor[0].id)
let risk= await this.riskList(this.planId,value)
},
async changeFloor(){
let room= await this.roomList(this.value1)
let risk= await this.riskList(this.planId,this.active,this.value1)
},
async changeRoom(){
let risk= await this.riskList(this.planId,this.active,this.value1,this.value2)
},
onSearch(val) {
this.postList(this.searchValue);
},
......@@ -266,6 +310,7 @@
}
.con-list {
padding: 0;
min-height: 10rem;
background-color: #f0f1f5;
.van-cell-group--inset {
margin: 0;
......
......@@ -102,6 +102,9 @@
name="location"
label="任务开始时间"
input-align="right"
:formatter="()=>{
return timestampToTimes(form.startTime)
}"
:rules="[{ required: true, message: '任务开始时间不能为空' }]"
/>
......@@ -110,6 +113,9 @@
readonly
name="location"
label="任务结束时间"
:formatter="()=>{
return timestampToTimes(form.endTime)
}"
input-align="right"
:rules="[{ required: true, message: '任务结束时间不能为空' }]"
/>
......@@ -136,7 +142,7 @@
<div class="step-wrap">
<van-row>
<van-col span="24"
><div class="info-title">{{item.startTime}}</div></van-col
><div class="info-title">{{timestampToTimes(item.startTime)}}</div></van-col
>
</van-row>
<van-row>
......@@ -149,13 +155,13 @@
<van-col span="7"
><span class="field-title">审批结果:</span></van-col
>
<van-col span="17">{{item.completedTime}}</van-col>
<van-col span="17">{{item.taskName}}</van-col>
</van-row>
<van-row>
<van-col span="7"
><span class="field-title">岗位:</span></van-col
>
<van-col span="17">{{item.taskName}}</van-col>
<van-col span="17">{{item.taskResult}}</van-col>
</van-row>
<!-- <van-row>
<van-col span="7"
......@@ -265,7 +271,7 @@
this.$router.push({
name: "riskInherent",
params: {
title:'新增'
id:this.messageList.id
},
})
},
......@@ -286,11 +292,10 @@
});
getFun(`/risk/plan/details/${id}`)
.then((res) => {
console.log('%c [ res ]-309', 'font-size:13px; background:pink; color:#bf2c9f;', res)
this.$toast.clear();
this.messageList =res.data||res.rows;
this.form= this.messageList.detailsDto
console.log('%c [ messageList ]-292', 'font-size:13px; background:pink; color:#bf2c9f;', this.messageList)
this.riskLogList= this.messageList.approveListDtos
})
.catch(() => {
this.$toast.clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment