Commit a67581e8 authored by yf's avatar yf

修改新增

parent 538db5a1
...@@ -5,33 +5,40 @@ ...@@ -5,33 +5,40 @@
<LHeader :text="text"></LHeader> <LHeader :text="text"></LHeader>
</van-sticky> </van-sticky>
<div style="margin-bottom: 1.5rem;"> <div style="margin-bottom: 1.5rem;">
<van-tabs <van-tabs v-model="active" @change="tabList" color="#2980f7" animated>
v-model="active" <van-tab :title="buildingName">
@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-menu z-index="1000">
<van-dropdown-item v-model="value1" @change="changeFloor" :options="option1" get-container="body"/> <van-dropdown-item
<van-dropdown-item v-model="value2" @change="changeRoom" :options="option2" get-container="body"/> 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> </van-dropdown-menu>
<div <div class="con-list">
class="con-list"
>
<van-cell-group <van-cell-group
inset inset
v-for="(item, index) in messageList" v-for="(item, index) in messageList"
:key="index" :key="index"
@click="touchstart(index, item)" @click="touchstart(index, item)"
> >
<div style="font-size: 0.45rem;padding: 5px 0;">{{item.title}}</div> <div style="font-size: 0.45rem;padding: 5px 0;">
{{ item.title }}
</div>
<van-row gutter=""> <van-row gutter="">
<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">{{ timestampToTimes(item.createTime)}}</van-col> <van-col span="15">{{
timestampToTimes(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>
...@@ -42,14 +49,16 @@ ...@@ -42,14 +49,16 @@
<van-col span="15">{{ item.roomName }}</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' }"
>
{{ "●待审批" }}
</van-col> </van-col>
</van-row> </van-row>
<van-overlay :show="showIndex == index"> <van-overlay :show="showIndex == index">
<div class="wrapper" @click.stop="showIndex = null"> <div class="wrapper" @click.stop="showIndex = null">
<van-button round type="primary" @click="goDetail(item)" <van-button round type="primary" @click="goDetail(item)"
>编辑</van-button >编辑</van-button
> >
<!-- <van-button round type="info" @click="goConfirm(item)" v-show="active==0" <!-- <van-button round type="info" @click="goConfirm(item)" v-show="active==0"
...@@ -66,7 +75,7 @@ ...@@ -66,7 +75,7 @@
position: fixed; position: fixed;
top: 30%; top: 30%;
" "
v-if="messageList['length']==0" v-if="messageList['length'] == 0"
> >
暂无数据 暂无数据
</div> </div>
...@@ -74,7 +83,8 @@ ...@@ -74,7 +83,8 @@
</van-tab> </van-tab>
</van-tabs> </van-tabs>
</div> </div>
<div style="display: flex; <div
style="display: flex;
justify-content: space-around; justify-content: space-around;
background-color: #fff; background-color: #fff;
border-top: 1px solid #e3e3e3; border-top: 1px solid #e3e3e3;
...@@ -82,164 +92,174 @@ ...@@ -82,164 +92,174 @@
width: 100%; width: 100%;
text-align: center; text-align: center;
position: fixed; position: fixed;
bottom: 0;"> bottom: 0;"
<div @click="performTasks" style="color: #4bced0;font-size: 14px;font-weight: 600;"> >
<div
@click="performTasks"
style="color: #4bced0;font-size: 14px;font-weight: 600;"
>
<div style="font-size: 22px;"><van-icon name="plus" /></div> <div style="font-size: 22px;"><van-icon name="plus" /></div>
<div>新增固有风险</div> <div>新增固有风险</div>
</div> </div>
<div
@click="endTasks"
style="color: #D9001B;font-size: 14px;font-weight: 600;"
>
<div style="font-size: 22px;"><van-icon name="cross" /></div>
<div>任务执行结束</div>
</div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import LHeader from "@/components/header.vue"; import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table.js"; import { getFun, postFun } from "@/service/table.js";
import { timestampToTime, generateId } from "@/utils/format"; import { timestampToTime, generateId } from "@/utils/format";
export default { export default {
name:'risk-confirme', name: "risk-confirme",
components: { components: {
LHeader, LHeader
}, },
data() { data() {
return { return {
text: "固有风险列表", text: "固有风险列表",
searchValue: "", searchValue: "",
planId: 0, planId: 0,
buildingId: 0,
buildingName: "",
value1: 1, value1: 1,
value2: 1, value2: 1,
option1: [], option1: [],
option2: [], option2: [],
isHaveNews: false, isHaveNews: false,
messageList: [], messageList: [],
riskLogList:[], riskLogList: [],
Loop: "", // 定时器 Loop: "", // 定时器
showIndex: null, // 是否显示遮罩层, showIndex: null, // 是否显示遮罩层,
active: 1, active: 1,
form:{ form: {},
tabs: []
},
tabs: [
],
}; };
}, },
created() { created() {
this.planId=this.$route.params.id || sessionStorage.getItem('planId') this.planId = this.$route.params.id || sessionStorage.getItem("planId");
this.buildingId = this.$route.params.buildingId;
this.buildingName = this.$route.params.buildingName;
console.log(this.buildingId, this.buildingName);
this.getRiskList(this.planId); this.getRiskList(this.planId);
// this.postList(); // this.postList();
}, },
methods: { methods: {
timestampToTimes(time){ timestampToTimes(time) {
return timestampToTime(new Date(time),"DT2", true) return timestampToTime(new Date(time), "DT2", true);
}, },
changeData(arr){ changeData(arr) {
var arrList=[] var arrList = [];
arr.forEach(item=>{ arr.forEach(item => {
arrList.push( arrList.push({
{ text: item.name,
text:item.name, value: item.id
value:item.id });
} });
) return arrList;
})
return arrList
}, },
performTasks(){ //新增固有风险
performTasks() {
this.$router.push({ this.$router.push({
name: "addInherent", name: "addInherent",
params: { params: {
id:this.active, id: this.active,
planId:this.planId planId: this.planId
}
});
}, },
}) //任务执行结束
endTasks() {
//toDo
}, },
handadd(){ handadd() {
this.$router.push({ this.$router.push({
name: "riskAdd", name: "riskAdd",
params: { params: {
title:'新增' title: "新增"
}, }
})
},
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) { floorList(id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getFun(`/risk/plan/floor/list/${id}`).then((res) => { getFun(`/risk/plan/floor/list/${id}`)
this.option1=this.changeData(res.data) .then(res => {
resolve(res.data) this.option1 = this.changeData(res.data);
resolve(res.data);
}) })
.catch(() => { .catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}) });
}, },
roomList(id) { roomList(id) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getFun(`/risk/plan/room/list/${id}`).then((res) => { getFun(`/risk/plan/room/list/${id}`)
this.option2=this.changeData(res.data) .then(res => {
resolve(res.data) this.option2 = this.changeData(res.data);
resolve(res.data);
}) })
.catch(() => { .catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}) });
}, },
riskList(planId,buildingId,floorId,roomId) { riskList(planId, buildingId, floorId, roomId) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var paramsJson={} var paramsJson = {};
if(floorId||roomId){ if (floorId || roomId) {
paramsJson={ paramsJson = {
floorId, floorId,
roomId roomId
};
} else {
paramsJson = {};
} }
}else{ getFun(`/risk/plan/inherent/list/${planId}/${buildingId}`, paramsJson)
paramsJson={} .then(res => {
} this.messageList = res.data;
getFun(`/risk/plan/inherent/list/${planId}/${buildingId}`,paramsJson).then((res) => { resolve(res.data);
this.messageList=res.data
resolve(res.data)
}) })
.catch(() => { .catch(() => {
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}) });
}, },
async getRiskList(id){ async getRiskList(id) {
this.$toast.loading({ this.$toast.loading({
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
let building= await this.buildingList(id) let floor = await this.floorList(this.buildingId);
let floor= await this.floorList(building[0].id) let room = await this.roomList(floor[0].id);
let room= await this.roomList(floor[0].id) let risk = await this.riskList(id, this.buildingId);
let risk= await this.riskList(id,building[0].id)
this.$toast.clear(); this.$toast.clear();
}, },
async tabList(value){ async tabList(value) {
let floor= await this.floorList(value) let floor = await this.floorList(value);
let room= await this.roomList(floor[0].id) let room = await this.roomList(floor[0].id);
let risk= await this.riskList(this.planId,value) let risk = await this.riskList(this.planId, value);
}, },
async changeFloor(){ async changeFloor() {
let room= await this.roomList(this.value1) let room = await this.roomList(this.value1);
let risk= await this.riskList(this.planId,this.active,this.value1) let risk = await this.riskList(this.planId, this.active, this.value1);
}, },
async changeRoom(){ async changeRoom() {
let risk= await this.riskList(this.planId,this.active,this.value1,this.value2) 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);
...@@ -256,9 +276,9 @@ ...@@ -256,9 +276,9 @@
this.$router.push({ this.$router.push({
name: "addCurrent", name: "addCurrent",
params: { params: {
inherentId: data.businessId||data.id, inherentId: data.businessId || data.id,
buildingIds:this.active, buildingIds: this.active
}, }
}); });
this.showIndex = null; this.showIndex = null;
}, },
...@@ -267,31 +287,30 @@ ...@@ -267,31 +287,30 @@
this.$router.push({ this.$router.push({
name: "risk-affirm", name: "risk-affirm",
params: { params: {
data: data, data: data
}, }
}); });
this.showIndex = null; this.showIndex = null;
},
},
};
</script>
<style lang="less" scoped>
#app {
font-family: "";
color: #2c3e50
} }
.cell-wrap {
position: relative;
} }
p { };
</script>
<style lang="less" scoped>
#app {
font-family: "";
color: #2c3e50;
}
.cell-wrap {
position: relative;
}
p {
font-size: 0.4rem; font-size: 0.4rem;
font-weight: none; font-weight: none;
padding-left: 0.16rem; padding-left: 0.16rem;
margin: 0.186667rem 0; margin: 0.186667rem 0;
color: #7f7f7f; color: #7f7f7f;
} }
.van-cell-group--inset { .van-cell-group--inset {
margin: 0; margin: 0;
margin-bottom: 10px; margin-bottom: 10px;
padding: 10px; padding: 10px;
...@@ -301,30 +320,30 @@ ...@@ -301,30 +320,30 @@
margin-bottom: 0.133333rem; margin-bottom: 0.133333rem;
line-height: 0.64rem; line-height: 0.64rem;
} }
} }
.journal-wrap { .journal-wrap {
position: relative; position: relative;
} }
.supervise-wrap { .supervise-wrap {
position: relative; position: relative;
} }
.info-title { .info-title {
color: #2980f7; color: #2980f7;
font-weight: none; font-weight: none;
} }
.field-title { .field-title {
color: black; color: black;
font-weight: none; font-weight: none;
} }
.more { .more {
position: absolute; position: absolute;
bottom: 0.32rem; bottom: 0.32rem;
right: 15px; right: 15px;
color: #2a80f7; color: #2a80f7;
font-weight: none; font-weight: none;
z-index: 99; z-index: 99;
} }
.con-list { .con-list {
padding: 0; padding: 0;
min-height: 10rem; min-height: 10rem;
background-color: #f0f1f5; background-color: #f0f1f5;
...@@ -353,6 +372,5 @@ ...@@ -353,6 +372,5 @@
} }
} }
} }
} }
</style> </style>
\ No newline at end of file
...@@ -301,7 +301,9 @@ export default { ...@@ -301,7 +301,9 @@ export default {
this.$router.push({ this.$router.push({
name: "riskInherent", name: "riskInherent",
params: { params: {
id: this.messageList.id id: this.messageList.id,
buildingId: this.messageList.riskBuildingListDtos[0].buildingId,
buildingName: this.messageList.riskBuildingListDtos[0].buildingName
} }
}); });
}, },
......
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