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

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

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