Commit 3ff9cfa6 authored by yf's avatar yf

修改详情页,增加选择组织组件

parent 0c0c17b9
<template>
<div style="width:100%">
<LHeader :text="text"></LHeader>
<!-- 搜索 -->
<div class="content-wrap">
<!-- <div class="search-wrap">
<van-search v-model="searchVal" placeholder="搜索" />
</div> -->
<div class="upStep" v-show="showPre">
<van-cell-group>
<div class="upStep-content">{{ deptName }}</div>
<div class="upStep-btn"><span @click="goBack">返回上级</span></div>
</van-cell-group>
</div>
<!-- 部门列表 -->
<div class="dept-list-wrap">
<van-cell-group>
<van-radio-group v-model="result" @change="changeRadio">
<van-cell
style="display:flex"
v-for="item in deptList"
clickable
:key="item.deptId"
>
<van-radio :name="item.deptId" @click="selectDept(item)">
<span>{{ item.deptName }}</span>
</van-radio>
<template #right-icon>
<van-icon
name="arrow"
class="arrow-icon"
@click="nextDept(item)"
/>
</template>
</van-cell>
</van-radio-group>
</van-cell-group>
</div>
</div>
<!-- 底部信息 -->
<footer class="footer">
<van-cell-group>
<div class="selected">
<span class="selected-title">已选择 ({{ result ? 1 : 0 }}) :</span>
<label>{{ resultName }}</label>
</div>
<!-- <div class="operate">
<van-button
size="small"
ttype="info"
plain
native-type="button"
style="border-radius: 5px; background-color: #f0f1f5;"
@click.native="cancel"
>取消
</van-button>
<van-button
size="small"
type="info"
native-type="button"
style="margin:0 10px 0 20px;border-radius: 5px;"
@click.native="save"
>保存
</van-button>
</div> -->
</van-cell-group>
</footer>
</div>
</template>
<script>
import LHeader from "@/components/header.vue";
import { getFun, postFun } from "@/service/table";
import { getUserInfo } from "@/utils/userInfo";
import { debounce } from "@/utils/common.js";
import { Toast } from "vant";
export default {
name: "select-people",
components: {
LHeader
},
created() {
this.getInsideUser(getUserInfo().secondaryUnit);
},
data() {
return {
text: "选择组织",
personName: "",
deptId: 0, // 部门id
storageList: [], // 存储上级部门
deptName: "",
showPre: false,
result: "",
resultName: "",
dutyList: [],
searchVal: "",
deptList: [], // 部门
allDeptList: [], // 部门
isFirstSearch: true
};
},
methods: {
changeRadio() {
this.resultName = this.allDeptList.find(
item => item.deptId == this.result
).deptName;
},
// 查询内部人员
getInsideUser(id, val) {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
getFun("/risk/plan/dept/list").then(res => {
this.allDeptList = res.data;
this.deptList = this.allDeptList.filter(item => item.parentId == 0);
console.log(res.data);
});
},
// // 待搜索框内容发生变化
// onInput: debounce(function() {
// if (this.isFirstSearch) {
// this.getInsideUser(getUserInfo().secondaryUnit, this.searchVal);
// } else {
// this.getInsideUser(this.deptId, this.searchVal);
// }
// }, 500),
nextDept(data) {
var depts = this.allDeptList.filter(item => item.parentId == data.deptId);
if (!depts || depts.length <= 0) {
Toast({
message: "组织下暂无数据",
position: "top"
});
return;
}
this.deptList = depts;
if (data.deptId != 0) this.showPre = true;
else this.showPre = false;
this.deptName = data.deptName;
this.deptId = data.deptId;
console.log(this.deptList);
// this.deptId = data.deptId;
// this.searchVal = "";
// this.deptName = data.deptName;
// this.isFirstSearch = false; // 如果点击过部门,则不必再用死deptId了
// this.storageList.push({ deptId: data.parentId, deptName: data.deptName });
// this.getInsideUser(this.deptId);
},
goBack() {
var parentId = this.allDeptList.find(item => item.deptId == this.deptId)
.parentId;
console.log(parentId);
if (parentId != 0) {
this.showPre = true;
var dept = this.allDeptList.find(item => item.deptId == parentId);
this.nextDept(dept);
} else {
this.deptList = this.allDeptList.filter(item => item.parentId == 0);
this.showPre = false;
}
},
selectDept(data) {
// 先把数组清空 然后再放
this.dutyList = [];
this.dutyList.push({ userId: data.userId, userName: data.userName });
},
save() {
// 把数据存到 session 的内部人员数组中
// 先取出session中的值
let obj = JSON.parse(sessionStorage.getItem("personObj"));
obj.user = this.dutyList;
// 再次存到session中
sessionStorage.setItem("personObj", JSON.stringify(obj));
// 可以见一个公共的字段 存储以后需要的人的信息
history.go(-1);
},
cancel() {
this.$router.go(-1);
}
}
};
</script>
<style lang="less" scoped>
/* @import url(); 引入css类 */
// 搜索
.content-wrap {
padding-bottom: 2.666667rem;
background-color: #f0f1f5;
width: 100%;
}
.search-wrap {
margin: 0.26667rem;
.van-search {
border-radius: 5px;
padding: 5px 12px;
}
.van-search__content {
background-color: #ffffff;
}
}
.upStep {
.van-cell-group {
display: flex;
height: 1.2rem;
align-items: center;
.upStep-btn {
width: 25%;
text-align: center;
span {
width: 1.866667rem;
background-color: #1989fa;
text-align: center;
display: inline-block;
color: white;
height: 0.8rem;
line-height: 0.8rem;
font-size: 0.346667rem;
border-radius: 0.08rem;
}
}
.upStep-content {
width: 75%;
height: 0.8rem;
line-height: 0.8rem;
padding-left: 0.42667rem;
box-sizing: border-box;
font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.dept-list-wrap {
margin-top: 0.266667rem;
}
.people-wrap {
margin-top: 0.266667rem;
/deep/ .van-radio__label {
display: flex;
align-items: center;
}
.dept-name {
margin-left: 10px;
font-size: 12px;
color: #a3a4a6;
margin-top: 1px;
}
}
.footer {
width: 100%;
height: 2.4rem;
z-index: 9;
position: fixed;
bottom: 0px;
box-shadow: 0px 8px 15px #000;
.van-cell-group {
height: 100%;
.selected {
height: 1.066667rem;
display: flex;
align-items: center;
padding-left: 10px;
border-bottom: 1px solid #cacbcb;
.selected-title {
color: #4187f7;
}
.selected-content {
width: 80%;
padding-left: 10px;
box-sizing: border-box;
}
}
.operate {
height: 1.333333rem;
display: flex;
justify-content: flex-end;
align-items: center;
.van-button {
width: 1.6rem;
}
}
}
}
</style>
<template> <template>
<div> <div>
<LHeader :text="text"></LHeader> <LHeader :text="text"></LHeader>
<van-form <van-form
@submit="onSubmit" @submit="onSubmit"
:scroll-to-error="true" :scroll-to-error="true"
:show-error="false" :show-error="false"
validate-trigger="onSubmit" validate-trigger="onSubmit"
> >
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" > <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" > style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
服务项目信息 >
</div> <img
<van-field src="@/assets/accidentIcon/bookmark.svg"
readonly alt=""
required style="position: relative;top: 32%;transform: translateY(-50%);"
name="userName" />
:value="form.userName" 服务项目信息
label="创建人员" </div>
placeholder="请输入" <van-field
:rules="[{ required: true, message: '创建人员不能为空' }]" readonly
/> required
<van-field name="userName"
readonly :value="form.userName"
required label="创建人员"
name="deptName" placeholder="请输入"
:value="form.deptName" :rules="[{ required: true, message: '创建人员不能为空' }]"
label="创建单位" />
placeholder="请输入" <van-field
:rules="[{ required: true, message: '创建单位不能为空' }]" readonly
/> required
<van-field name="deptName"
required :value="form.deptName"
name="name" label="创建单位"
v-model="form.name" placeholder="请输入"
label="任务名称" :rules="[{ required: true, message: '创建单位不能为空' }]"
placeholder="请输入" />
:rules="[{ required: true, message: '任务名称不能为空' }]" <van-field
/> required
name="name"
v-model="form.name"
label="任务名称"
placeholder="请输入"
:rules="[{ required: true, message: '任务名称不能为空' }]"
/>
<van-field <van-field
required required
clickable clickable
name="projectName" name="projectName"
:value="form.projectName" :value="form.projectName"
label="关联项目" label="关联项目"
placeholder="请选择" placeholder="请选择"
@click="showSource = true" @click="showSource = true"
:rules="[{ required: true, message: '关联项目不能为空' }]" :rules="[{ required: true, message: '关联项目不能为空' }]"
/> />
<van-popup v-model="showSource" position="bottom"> <van-popup v-model="showSource" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
value-key="name" value-key="name"
:columns="columnsSource" :columns="columnsSource"
@confirm="onConSource" @confirm="onConSource"
@cancel="showSource = false" @cancel="showSource = false"
/> />
</van-popup> </van-popup>
<van-field <van-field
required required
name="buildingNames" name="buildingNames"
:value="form.buildingNames" :value="form.buildingNames"
label="评估楼栋" label="评估楼栋"
placeholder="请输入" placeholder="请输入"
@click="getRiskList()" @click="getRiskList()"
:rules="[{ required: true, message: '评估楼栋不能为空' }]" :rules="[{ required: true, message: '评估楼栋不能为空' }]"
/> />
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" > <div
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" > style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
任务组织与分配 >
</div> <img
<van-field src="@/assets/accidentIcon/bookmark.svg"
required alt=""
clickable style="position: relative;top: 32%;transform: translateY(-50%);"
name="leaderUserName" />
:value="form.leaderUserName" 任务组织与分配
label="项目负责人" </div>
placeholder="请选择" <van-field
@click="getLeaderUserList('leaderUser')" required
:rules="[{ required: true, message: '项目负责人不能为空' }]" clickable
/> name="deptId"
:value="form.deptId"
label="评估小组选择"
placeholder="请选择"
@click="selectDept()"
:rules="[{ required: true, message: '评估小组不能为空' }]"
/>
<van-field
<van-field required
:value="form.startTime" clickable
required name="leaderUserName"
name="startTime" :value="form.leaderUserName"
label="任务开始时间" label="评估小组组长"
placeholder="请选择" placeholder="请选择"
@click="selectBeginTime('startTime')" @click="getLeaderUserList('leaderUser')"
:rules="[{ required: true, message: '任务开始时间不能为空' }]" :rules="[{ required: true, message: '评估小组组长不能为空' }]"
/> />
<van-field <van-field
clickable clickable
:value="form.endTime" required
required name="workUserNames"
name="endTime" :value="form.workUserNames"
label="任务结束时间" label="评估小组成员"
@click="selectBeginTime('endTime')" placeholder="请选择"
placeholder="请选择" @click="getExecuteUser()"
:rules="[{ required: true, message: '任务结束时间不能为空' }]" :rules="[{ required: true, message: '评估小组成员不能为空' }]"
/> />
<van-field <van-field
clickable :value="form.startTime"
required required
name="workUserNames" name="startTime"
:value="form.workUserNames" label="任务开始时间"
label="执行人员" placeholder="请选择"
placeholder="请选择" @click="selectBeginTime('startTime')"
@click="getExecuteUser()" :rules="[{ required: true, message: '任务开始时间不能为空' }]"
:rules="[{ required: true, message: '执行人员不能为空' }]" />
/>
<!-- <van-popup v-model="showControl" position="bottom"> <van-field
clickable
:value="form.endTime"
required
name="endTime"
label="任务结束时间"
@click="selectBeginTime('endTime')"
placeholder="请选择"
:rules="[{ required: true, message: '任务结束时间不能为空' }]"
/>
<!-- <van-popup v-model="showControl" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
:columns="columnsControl" :columns="columnsControl"
...@@ -123,7 +146,7 @@ ...@@ -123,7 +146,7 @@
/> />
</van-popup> --> </van-popup> -->
<van-field <!-- <van-field
required required
clickable clickable
name="approveUserName" name="approveUserName"
...@@ -132,69 +155,125 @@ ...@@ -132,69 +155,125 @@
placeholder="请选择" placeholder="请选择"
@click="getLeaderUserList('approveUser')" @click="getLeaderUserList('approveUser')"
:rules="[{ required: true, message: '事审批负责人不能为空' }]" :rules="[{ required: true, message: '事审批负责人不能为空' }]"
/> /> -->
<van-popup v-model="showTrouble" position="bottom"> <van-popup v-model="showTrouble" position="bottom">
<van-picker <van-picker
show-toolbar show-toolbar
value-key="nickName" value-key="nickName"
:columns="columnsTrouble" :columns="columnsTrouble"
@confirm="onConTrouble" @confirm="onConTrouble"
@cancel="showTrouble = false" @cancel="showTrouble = false"
/> />
</van-popup> </van-popup>
<van-popup v-model="show" position="bottom" :style="{ height: '100%' }"> <van-popup v-model="show" position="bottom" :style="{ height: '100%' }">
<!-- <selectPeople @onClose="onClose" @onSave="onSave"></selectPeople> --> <!-- <selectPeople @onClose="onClose" @onSave="onSave"></selectPeople> -->
</van-popup> </van-popup>
<van-popup v-model="riskModel" position="bottom" :style="{ height: '100%' }">
<div class="van-picker__toolbar" style="position: absolute;width: 100%;top: 0;">
<button type="button" class="van-picker__cancel" v-on:click="riskModel = false">取消</button
><button type="button" class="van-picker__confirm" @click="onRiskList(riskList)">确认</button>
</div>
<div style="display:flex;margin-top: 44px;">
<van-checkbox-group v-model="riskList" style="width: 100%;font-size: 18px;">
<van-checkbox
shape="square"
style="margin: 10px 0px;justify-content: center;"
v-for="item in riskModelList"
:key="item.id"
:name="item"
>{{ item[filedName] }}</van-checkbox
>
</van-checkbox-group>
</div>
</van-popup>
<!-- 选择时间弹出层 -->
<van-popup v-model="showTime" position="bottom">
<van-datetime-picker
type="datetime"
@confirm="onConTime"
@cancel="showTime = false"
:min-date="minDate"
v-model="currentDate"
/>
</van-popup>
<div style="margin: 16px 16px 0"> <van-popup
<van-button round block type="info" native-type="submit" v-model="riskModel"
>上报</van-button position="bottom"
> :style="{ height: '100%' }"
</div> >
</van-form> <div
<div style="margin: 10px 16px 0px; padding-bottom: 16px"> class="van-picker__toolbar"
<van-button round block type="warning" @click.native="cancel" style="position: absolute;width: 100%;top: 0;"
>取消</van-button >
<button
type="button"
class="van-picker__cancel"
v-on:click="riskModel = false"
>
取消</button
><button
type="button"
class="van-picker__confirm"
@click="onRiskList(riskList)"
>
确认
</button>
</div>
<div style="display:flex;margin-top: 44px;">
<van-checkbox-group
v-model="riskList"
style="width: 100%;font-size: 18px;"
>
<van-checkbox
shape="square"
style="margin: 10px 0px;justify-content: center;"
v-for="item in riskModelList"
:key="item.id"
:name="item"
>{{ item[filedName] }}</van-checkbox
> >
</van-checkbox-group>
</div> </div>
</van-popup>
<!-- 选择项目小组 -->
<van-popup
v-model="projectDept"
position="bottom"
:style="{ height: '100%' }"
>
<div
class="van-picker__toolbar"
style="position: absolute;width: 100%;top: 0;"
>
<button
type="button"
class="van-picker__cancel"
v-on:click="projectDept = false"
>
取消</button
><button
type="button"
class="van-picker__confirm"
@click="colseDept(riskList)"
>
确认
</button>
</div>
<div style="display:flex;margin-top: 44px;">
<selectDept></selectDept>
</div>
</van-popup>
<!-- 选择时间弹出层 -->
<van-popup v-model="showTime" position="bottom">
<van-datetime-picker
type="datetime"
@confirm="onConTime"
@cancel="showTime = false"
:min-date="minDate"
v-model="currentDate"
/>
</van-popup>
<div style="margin: 16px 16px 0">
<van-button round block type="info" native-type="submit"
>上报</van-button
>
</div>
</van-form>
<div style="margin: 10px 16px 0px; padding-bottom: 16px">
<van-button round block type="warning" @click.native="cancel"
>取消</van-button
>
</div> </div>
</div>
</template> </template>
<script> <script>
import LHeader from "@/components/header.vue"; import LHeader from "@/components/header.vue";
import selectDept from "@/components/selectDept/index.vue";
// import selectPeople from "@/views/riskTask/selectPeople/index.vue"; // import selectPeople from "@/views/riskTask/selectPeople/index.vue";
import { timestampToTime, generateId } from "@/utils/format"; import { timestampToTime, generateId } from "@/utils/format";
import { getUserInfo, getLocalUserInfo, setLocalUserInfo} from '@/utils/userInfo' import {
getUserInfo,
getLocalUserInfo,
setLocalUserInfo
} from "@/utils/userInfo";
import { getFun, postFun } from "@/service/table.js"; import { getFun, postFun } from "@/service/table.js";
// import { // import {
// getFormList, // getFormList,
...@@ -206,472 +285,471 @@ import { getFun, postFun } from "@/service/table.js"; ...@@ -206,472 +285,471 @@ import { getFun, postFun } from "@/service/table.js";
// postRiskShowMeasures, // postRiskShowMeasures,
// } from "@/service/risk"; // } from "@/service/risk";
export default { export default {
name: "risk-add", name: "risk-add",
components: { components: {
LHeader, LHeader,
selectDept
},
beforeRouteLeave(to, from, next) {
if (to.name != "matrix-grad") {
}
next();
},
data() {
return {
taskId: "",
text: "创建任务",
id: "",
form: {
name: ""
},
projectId: "", // 所属工程
projectName: "", // 所属工程
projectDirectorName: "", // 所属工程
projectDirector: "", // 所属工程
timeName: "", //
userPrefix: "", //
showProjectName: false,
projectDept: false,
riskModel: false,
filedName: "",
currentDate: new Date(),
minDate: new Date(),
showTime: false,
show: false,
riskList: [],
riskModelList: [],
columnsProjectName: [],
factor: "", //风险因素
showFactor: false,
columnsFactor: [],
source: "", //风险源
showSource: false,
columnsSource: [],
trouble: "", //事故类型
showTrouble: false,
columnsTrouble: [],
setRank: "", //风险定级
showSetRank: false,
riskRank: "", // 风险等级
showRiskRank: false,
showSetRankMode: false, // 是否显示定级方式
setRankMode: "", // 定级方式文字
setRankModeImg: [], // 定级方式图片
location: "", //风险部位
control: "", //管控层级
showControl: false,
showMainDutyDept: false,
columnsMainDutyDept: [],
mainDutyPeopLe: "", // 主责人员
mainDutyPeopLeId: "",
showMainDutyPeopLe: false,
columnsMainDutyPeopLe: [],
technology: "", //技术措施文字
technologyImg: [], //技术措施图片
administration: "", //管理措施文字
administrationImg: [], //管理措施图片
urgent: "", //应急措施文字
urgentImg: [], //应急措施图片
returnCause: "", // 退回原因
isShowreturnCause: false
};
},
created() {
var userInfo = getUserInfo();
this.form.userId = userInfo.userId;
this.form.userName = userInfo.nickName;
this.form.deptName = userInfo.dept.deptName;
this.form.deptId = userInfo.dept.deptId;
getFun(`/risk/plan/project/list`).then(res => {
this.columnsSource = res.data;
});
// this.getList();
},
methods: {
// 确定时间的方法
onConTime(date) {
console.log(
"%c [ date ]-293",
"font-size:13px; background:pink; color:#bf2c9f;",
date
);
let time = timestampToTime(date, "DT1", true);
this.form[this.timeName] = time;
this.showTime = false;
},
// 计划开始时间
selectBeginTime(val) {
this.showTime = true;
this.timeName = val;
this.currentDate = new Date();
}, },
beforeRouteLeave(to, from, next) { getLeaderUserList(e) {
if (to.name != "matrix-grad") { if (!this.form.projectId) {
this.$toast({
title: "提示",
message: "请选择关联项目!"
});
return false;
}
this.userPrefix = e;
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
getFun(`/risk/plan/user/list/${this.form.projectId}`).then(res => {
if (res.code == 200) {
this.columnsTrouble = res.data;
// 对数据进行赋值
this.$toast.clear();
this.showTrouble = true;
} else {
this.$toast.clear();
} }
next(); });
}, },
data() { onRiskList(value) {
return { console.log(
taskId: "", "%c [ value ]-331",
text: "创建任务", "font-size:13px; background:pink; color:#bf2c9f;",
id: "", value
form:{ );
name:'' if (this.filedName == "nickName") {
}, this.form.workUserIds = this.filterField("userId", value).join();
projectId: "", // 所属工程 this.form.workUserNames = this.filterField("nickName", value).join();
projectName: "", // 所属工程 console.log(
projectDirectorName: "", // 所属工程 "%c [ this.form.workUserNames ]-334",
projectDirector: "", // 所属工程 "font-size:13px; background:pink; color:#bf2c9f;",
timeName: "", // this.form.workUserNames
userPrefix: "", // );
showProjectName: false, } else {
riskModel: false, this.form.buildingIds = this.filterField("id", value).join();
filedName:'', this.form.buildingNames = this.filterField("name", value).join();
currentDate: new Date(), }
minDate: new Date(), this.riskList = [];
showTime: false, this.riskModel = false;
show: false, // this.form[this.fieldName] = value.join();
riskList: [],
riskModelList: [],
columnsProjectName: [],
factor: "", //风险因素
showFactor: false,
columnsFactor: [],
source: "", //风险源
showSource: false,
columnsSource: [],
trouble: "", //事故类型
showTrouble: false,
columnsTrouble: [],
setRank: "", //风险定级
showSetRank: false,
riskRank: "", // 风险等级
showRiskRank: false,
showSetRankMode: false, // 是否显示定级方式
setRankMode: "", // 定级方式文字
setRankModeImg: [], // 定级方式图片
location: "", //风险部位
control: "", //管控层级
showControl: false,
showMainDutyDept: false,
columnsMainDutyDept: [],
mainDutyPeopLe: "", // 主责人员
mainDutyPeopLeId: "",
showMainDutyPeopLe: false,
columnsMainDutyPeopLe: [],
technology: "", //技术措施文字
technologyImg: [], //技术措施图片
administration: "", //管理措施文字
administrationImg: [], //管理措施图片
urgent: "", //应急措施文字
urgentImg: [], //应急措施图片
returnCause: "", // 退回原因
isShowreturnCause: false,
};
}, },
created() { selectDept() {
var userInfo=getUserInfo() this.projectDept = true;
this.form.userId=userInfo.userId
this.form.userName=userInfo.nickName
this.form.deptName=userInfo.dept.deptName
this.form.deptId=userInfo.dept.deptId
getFun(`/risk/plan/project/list`).then((res) => {
this.columnsSource = res.data;
}
);
// this.getList();
}, },
methods: { colseDept() {
// 确定时间的方法 this.projectDept = false;
onConTime(date) { },
console.log('%c [ date ]-293', 'font-size:13px; background:pink; color:#bf2c9f;', date) getExecuteUser() {
let time = timestampToTime(date, "DT1", true); if (!this.form.projectId) {
this.form[this.timeName] = time; this.$toast({
this.showTime = false; title: "提示",
}, message: "请选择关联项目!"
// 计划开始时间 });
selectBeginTime(val) { return false;
this.showTime = true; }
this.timeName=val
this.currentDate = new Date();
},
getLeaderUserList(e){
if(!this.form.projectId){
this.$toast({
title: "提示",
message: "请选择关联项目!",
});
return false
}
this.userPrefix=e
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
getFun(`/risk/plan/user/list/${this.form.projectId}`).then(res => {
if (res.code == 200) {
this.columnsTrouble = res.data;
// 对数据进行赋值
this.$toast.clear();
this.showTrouble = true;
} else {
this.$toast.clear();
}
});
},
onRiskList(value) {
console.log('%c [ value ]-331', 'font-size:13px; background:pink; color:#bf2c9f;', value)
if(this.filedName=='nickName'){
this.form.workUserIds= this.filterField("userId",value).join()
this.form.workUserNames= this.filterField("nickName",value).join()
console.log('%c [ this.form.workUserNames ]-334', 'font-size:13px; background:pink; color:#bf2c9f;', this.form.workUserNames)
}else{
this.form.buildingIds= this.filterField("id",value).join()
this.form.buildingNames= this.filterField("name",value).join()
}
this.riskList=[]
this.riskModel = false;
// this.form[this.fieldName] = value.join();
},
getExecuteUser() {
if(!this.form.projectId){
this.$toast({
title: "提示",
message: "请选择关联项目!",
});
return false
}
this.filedName='nickName'
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
getFun(`/risk/plan/user/list/${this.form.projectId}`).then(res => {
if (res.code == 200) {
this.riskModelList = res.data;
// 对数据进行赋值
this.$toast.clear();
this.riskModel = true;
} else {
this.$toast.clear();
}
});
},
getRiskList() {
if(!this.form.projectId){
this.$toast({
title: "提示",
message: "请选择关联项目!",
});
return false
}
this.filedName='name'
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
getFun(`/risk/plan/building/list/${this.form.projectId}`).then(res => {
if (res.code == 200) {
this.riskModelList = res.data;
// 对数据进行赋值
this.$toast.clear();
this.riskModel = true;
} else { this.filedName = "nickName";
this.$toast.clear(); this.$toast.loading({
} message: "加载中...",
}); forbidClick: true,
}, loadingType: "spinner",
filterField(value,arr){ duration: 0
var arrs=[] });
arr.forEach(item=>{ getFun(`/risk/plan/user/list/${this.form.projectId}`).then(res => {
arrs.push(item[value]) if (res.code == 200) {
}) this.riskModelList = res.data;
return arrs // 对数据进行赋值
}, this.$toast.clear();
async deleteFile(val, detail, key) { this.riskModel = true;
// console.log(val,detail) } else {
if (val.fileId) { this.$toast.clear();
let formdata = new FormData(); }
formdata.append("key", val["fileId"]); });
let res = await postFun("/mobile/remove", formdata); },
if (res) { getRiskList() {
console.log(res); if (!this.form.projectId) {
this.$toast({ this.$toast({
title: "提示", title: "提示",
message: "删除成功!", message: "请选择关联项目!"
}); });
} else { return false;
console.log("删除失败"); }
this[key].splice(detail.index, 0, val); this.filedName = "name";
} this.$toast.loading({
} message: "加载中...",
}, forbidClick: true,
onSubmit(values) { loadingType: "spinner",
this.$toast.loading({ duration: 0
message: "加载中...", });
forbidClick: true, getFun(`/risk/plan/building/list/${this.form.projectId}`).then(res => {
loadingType: "spinner", if (res.code == 200) {
duration: 0, this.riskModelList = res.data;
}); // 对数据进行赋值
let url = "/risk/plan"; this.$toast.clear();
postFun(url, this.form) this.riskModel = true;
.then((res) => { } else {
this.$toast.clear(); this.$toast.clear();
this.$toast.success({ }
message: "提交成功", });
duration: 2000, },
}); filterField(value, arr) {
history.go(-1); var arrs = [];
}) arr.forEach(item => {
.catch(() => { arrs.push(item[value]);
this.$toast.clear(); });
this.$toast.fail("提交失败,请稍后再试"); return arrs;
}); },
this.$toast.clear(); async deleteFile(val, detail, key) {
}, // console.log(val,detail)
if (val.fileId) {
let formdata = new FormData();
formdata.append("key", val["fileId"]);
let res = await postFun("/mobile/remove", formdata);
if (res) {
console.log(res);
this.$toast({
title: "提示",
message: "删除成功!"
});
} else {
console.log("删除失败");
this[key].splice(detail.index, 0, val);
}
}
},
onSubmit(values) {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
let url = "/risk/plan";
postFun(url, this.form)
.then(res => {
this.$toast.clear();
this.$toast.success({
message: "提交成功",
duration: 2000
});
history.go(-1);
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("提交失败,请稍后再试");
});
this.$toast.clear();
},
// 请求表单数据 // 请求表单数据
getList() { getList() {
this.$toast.loading({ this.$toast.loading({
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
getFormList("/riskMain/add") getFormList("/riskMain/add")
.then((res) => { .then(res => {
this.$toast.clear(); this.$toast.clear();
this.columnsProjectName = res.data.projectInformations; this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories; this.columnsFactor = res.data.riskInventories;
this.columnsMainDutyDept = res.data.organizationList; this.columnsMainDutyDept = res.data.organizationList;
}) })
.catch(() => { .catch(() => {
this.$toast.clear(); this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试"); this.$toast.fail("加载失败,请稍后再试");
}); });
}, },
// 请求已退回详情数据 // 请求已退回详情数据
postReturnEcho() { postReturnEcho() {
this.$toast.loading({ this.$toast.loading({
message: "加载中...", message: "加载中...",
forbidClick: true, forbidClick: true,
loadingType: "spinner", loadingType: "spinner",
duration: 0, duration: 0
}); });
postriskConiCause(`/riskMain/edit/${this.taskId}`) postriskConiCause(`/riskMain/edit/${this.taskId}`)
.then((res) => { .then(res => {
// 定级方式 // 定级方式
this.urgentImg = (res.data.imgsysFiles2 || []).map( this.urgentImg = (res.data.imgsysFiles2 || []).map(item => {
(item) => { return {
return { ...item,
...item, url: item.filePath,
url: item.filePath, file: new File([], item["fileName"], {})
file: new File([], item["fileName"], {}), };
}; });
} this.administrationImg = (res.data.imgsysFiles1 || []).map(item => {
); return {
this.administrationImg = (res.data.imgsysFiles1 || []).map( ...item,
(item) => { url: item.filePath,
return { file: new File([], item["fileName"], {})
...item, };
url: item.filePath, });
file: new File([], item["fileName"], {}), this.technologyImg = (res.data.imgsysFiles0 || []).map(item => {
}; return {
} ...item,
); url: item.filePath,
this.technologyImg = (res.data.imgsysFiles0 || []).map( file: new File([], item["fileName"], {})
(item) => { };
return { });
...item, this.setRankModeImg = (res.data.imgsysFiles3 || []).map(item => {
url: item.filePath, return {
file: new File([], item["fileName"], {}), ...item,
}; url: item.filePath,
} file: new File([], item["fileName"], {})
); };
this.setRankModeImg = (res.data.imgsysFiles3 || []).map( });
(item) => {
return {
...item,
url: item.filePath,
file: new File([], item["fileName"], {}),
};
}
);
// 请求人员列表 // 请求人员列表
let formdata = new FormData(); let formdata = new FormData();
formdata.append("organizationId", data.responsibilityDept); formdata.append("organizationId", data.responsibilityDept);
postHdPeople(`/riskMain/getUserList`, formdata).then( postHdPeople(`/riskMain/getUserList`, formdata).then(res => {
(res) => { this.columnsMainDutyPeopLe = res.data;
this.columnsMainDutyPeopLe = res.data; this.mainDutyPeopLe = this.columnsMainDutyPeopLe.filter(item => {
this.mainDutyPeopLe = return item["userId"] == data.responsibilityMember;
this.columnsMainDutyPeopLe.filter((item) => { })[0]["userName"];
return ( });
item["userId"] == // console.log(data)
data.responsibilityMember this.$toast.clear();
); this.returnCause = res.data.reason;
})[0]["userName"];
}
);
// console.log(data)
this.$toast.clear();
this.returnCause = res.data.reason;
//请求风险源 //请求风险源
postHdSource(`/risk/plan/project/list`).then( postHdSource(`/risk/plan/project/list`).then(res => {
(res) => { this.columnsSource = res.data;
this.columnsSource = res.data; });
} })
); .catch(() => {
}) this.$toast.clear();
.catch(() => { });
this.$toast.clear(); },
});
},
// 所属项目 // 所属项目
onConProjectName(value) { onConProjectName(value) {
if (!value) { if (!value) {
this.showProjectName = false; this.showProjectName = false;
return; return;
} }
this.projectId = value.id; this.projectId = value.id;
this.projectName = value.projectName; this.projectName = value.projectName;
this.showProjectName = false; this.showProjectName = false;
}, },
// 风险因素 // 风险因素
onConFactor(value) { onConFactor(value) {
if (!value) { if (!value) {
this.showFactor = false; this.showFactor = false;
return; return;
} }
this.factor = value.factorType; this.factor = value.factorType;
this.showFactor = false; this.showFactor = false;
this.source = ""; this.source = "";
this.trouble = ""; this.trouble = "";
// 请求风险源 // 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then( postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
(res) => { res => {
this.columnsSource = res.data; this.columnsSource = res.data;
} }
); );
}, },
// 关联项目 // 关联项目
onConSource(value) { onConSource(value) {
if (!value) { if (!value) {
this.showSource = false; this.showSource = false;
return; return;
} }
this.form.projectId = value.id; this.form.projectId = value.id;
this.form.projectName = value.name; this.form.projectName = value.name;
this.showSource = false; this.showSource = false;
}, },
// 项目负责人 // 项目负责人
onConTrouble(value) { onConTrouble(value) {
if (!value) { if (!value) {
this.showTrouble = false; this.showTrouble = false;
return; return;
} }
this.form[this.userPrefix + "Id"] = value.userId; this.form[this.userPrefix + "Id"] = value.userId;
this.form[this.userPrefix + "Name"] = value.nickName; this.form[this.userPrefix + "Name"] = value.nickName;
console.log('this.form :>> ', this.form); console.log("this.form :>> ", this.form);
this.showTrouble = false; this.showTrouble = false;
}, },
// 风险定级 // 风险定级
onConSetRank(value) { onConSetRank(value) {
this.showSetRank = false; this.showSetRank = false;
this.setRank = value; this.setRank = value;
this.riskRank = ""; this.riskRank = "";
if (this.setRank == "矩阵式定级") { if (this.setRank == "矩阵式定级") {
this.showSetRank = false; this.showSetRank = false;
this.$router.push({ this.$router.push({
name: "matrix-grad", name: "matrix-grad"
}); });
} }
}, },
// 自己定义风险等级点击方法 // 自己定义风险等级点击方法
myRiskRank() { myRiskRank() {
if (this.setRank == "") { if (this.setRank == "") {
this.$toast("请先选择风险定级"); this.$toast("请先选择风险定级");
} else if (this.setRank == "其他定级方式") { } else if (this.setRank == "其他定级方式") {
this.showRiskRank = true; this.showRiskRank = true;
} }
}, },
// 风险等级 // 风险等级
onConRiskRank(value) { onConRiskRank(value) {
this.riskRank = value; this.riskRank = value;
this.showRiskRank = false; this.showRiskRank = false;
}, },
// 管控层级 // 管控层级
onConControl(value) { onConControl(value) {
this.control = value; this.control = value;
this.showControl = false; this.showControl = false;
}, },
// 主责部门 // 主责部门
onConMainDutyDept(value) { onConMainDutyDept(value) {
this.mainDutyDeptId = value.deptId; this.mainDutyDeptId = value.deptId;
this.mainDutyDept = value.deptName; this.mainDutyDept = value.deptName;
this.showMainDutyDept = false; this.showMainDutyDept = false;
this.mainDutyPeopLe = ""; this.mainDutyPeopLe = "";
// 请求主责人员 // 请求主责人员
let formdata = new FormData(); let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId); formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then((res) => { postHdPeople(`/riskMain/getUserList`, formdata).then(res => {
this.columnsMainDutyPeopLe = res.data; this.columnsMainDutyPeopLe = res.data;
}); });
}, },
// 主责人员 // 主责人员
onConMainDutyPeopLe(value) { onConMainDutyPeopLe(value) {
this.mainDutyPeopLeId = value.userId; this.mainDutyPeopLeId = value.userId;
this.mainDutyPeopLe = value.userName; this.mainDutyPeopLe = value.userName;
this.showMainDutyPeopLe = false; this.showMainDutyPeopLe = false;
}, },
cancel() { cancel() {
this.$router.go(-1); this.$router.go(-1);
}, },
// 选择作业人 // 选择作业人
goSelPeoTwo(val) { goSelPeoTwo(val) {
this.peopleName=val this.peopleName = val;
this.show = true; this.show = true;
},
onClose() {
this.show = false;
},
onSave(e) {
this.projectDirector=e[0].loginName
this.projectDirectorName=e[0].userName
this.show = false;
},
}, },
watch: { onClose() {
setRank(newVal, oldVal) { this.show = false;
if (newVal == "其他定级方式") {
this.showSetRankMode = true;
} else {
this.showSetRankMode = false;
}
},
}, },
onSave(e) {
this.projectDirector = e[0].loginName;
this.projectDirectorName = e[0].userName;
this.show = false;
}
},
watch: {
setRank(newVal, oldVal) {
if (newVal == "其他定级方式") {
this.showSetRankMode = true;
} else {
this.showSetRankMode = false;
}
}
}
}; };
</script> </script>
<style scoped> <style scoped>
......
...@@ -34,15 +34,15 @@ ...@@ -34,15 +34,15 @@
</van-grid-item> </van-grid-item>
</van-grid> </van-grid>
<van-steps <van-steps
:active="active" :active="phase"
active-icon="success" active-icon="success"
active-color="#38f" active-color="#38f"
style="margin: 0.26rem 0;" style="margin: 0.26rem 0;"
> >
<van-step>任务发起</van-step> <van-step name="1">任务发起</van-step>
<van-step>风险评估</van-step> <van-step name="2">风险评估</van-step>
<van-step>评估审核</van-step> <van-step name="3">评估审核</van-step>
<van-step>项目完成</van-step> <van-step name="4">项目完成</van-step>
</van-steps> </van-steps>
<van-tabs <van-tabs
v-model="active" v-model="active"
...@@ -100,13 +100,31 @@ ...@@ -100,13 +100,31 @@
:rules="[{ required: true, message: '评估楼栋不能为空' }]" :rules="[{ required: true, message: '评估楼栋不能为空' }]"
/> />
<van-field
readonly
name="deptId"
:value="form.deptId"
label="评估小组选择"
input-align="right"
:rules="[{ required: true, message: '评估小组不能为空' }]"
/>
<van-field <van-field
readonly readonly
name="leaderUserName" name="leaderUserName"
:value="form.leaderUserName" :value="form.leaderUserName"
label="项目负责人" label="评估小组组长"
input-align="right" input-align="right"
:rules="[{ required: true, message: '事故类型不能为空' }]" :rules="[{ required: true, message: '评估小组组长不能为空' }]"
/>
<van-field
clickable
name="workUserNames"
:value="form.workUserNames"
label="评估成员"
input-align="right"
:rules="[{ required: true, message: '评估成员不能为空' }]"
/> />
<van-field <van-field
...@@ -136,15 +154,6 @@ ...@@ -136,15 +154,6 @@
input-align="right" input-align="right"
:rules="[{ required: true, message: '任务结束时间不能为空' }]" :rules="[{ required: true, message: '任务结束时间不能为空' }]"
/> />
<van-field
clickable
name="workUserNames"
:value="form.workUserNames"
label="执行人员"
input-align="right"
:rules="[{ required: true, message: '执行人员不能为空' }]"
/>
</van-form> </van-form>
</van-tab> </van-tab>
<van-tab title="风险清单"> </van-tab> <van-tab title="风险清单"> </van-tab>
...@@ -283,6 +292,7 @@ export default { ...@@ -283,6 +292,7 @@ export default {
Loop: "", // 定时器 Loop: "", // 定时器
showIndex: null, // 是否显示遮罩层, showIndex: null, // 是否显示遮罩层,
active: 0, active: 0,
phase: 1,
form: {}, form: {},
tabs: [] tabs: []
}; };
...@@ -329,6 +339,7 @@ export default { ...@@ -329,6 +339,7 @@ export default {
.then(res => { .then(res => {
this.$toast.clear(); this.$toast.clear();
this.messageList = res.data || res.rows; this.messageList = res.data || res.rows;
console.log(this.messageList);
this.form = this.messageList.detailsDto; this.form = this.messageList.detailsDto;
this.riskLogList = this.messageList.approveListDtos; this.riskLogList = this.messageList.approveListDtos;
}) })
......
...@@ -3,7 +3,7 @@ module.exports = { ...@@ -3,7 +3,7 @@ module.exports = {
devServer: { devServer: {
open: true, open: true,
host: 'localhost', host: 'localhost',
port: 8080, port: 8081,
https: false, https: false,
//以上的ip和端口是我们本机的;下面为需要跨域的 //以上的ip和端口是我们本机的;下面为需要跨域的
proxy: { //配置跨域 proxy: { //配置跨域
...@@ -11,7 +11,7 @@ module.exports = { ...@@ -11,7 +11,7 @@ module.exports = {
// target: 'http://192.168.4.232:8080/', //这里是后台的地址 // target: 'http://192.168.4.232:8080/', //这里是后台的地址
// target: 'http://192.168.15.124:8080/', //这里是杨帆的地址 // target: 'http://192.168.15.124:8080/', //这里是杨帆的地址
// target: 'http://192.168.10.137:8080/', //这里是昊哥的地址 // target: 'http://192.168.10.137:8080/', //这里是昊哥的地址
target: 'http://192.168.10.36:8080/', //这里是后台的地址 target: 'http://localhost:8080/', //这里是后台的地址
ws: true, ws: true,
changOrigin: true, //允许跨域 changOrigin: true, //允许跨域
// logLevel: 'debug', // 显示代理调试信息 // logLevel: 'debug', // 显示代理调试信息
...@@ -19,14 +19,14 @@ module.exports = { ...@@ -19,14 +19,14 @@ module.exports = {
// '^/app-api': '' //请求的时候使用这个api就可以 // '^/app-api': '' //请求的时候使用这个api就可以
// } // }
}, },
// '/ps_ceninss': { // '/ps_ceninss': {
// target: 'http://192.168.3.80:8080', //这里是后台的地址 // target: 'http://192.168.3.80:8080', //这里是后台的地址
// ws: true, // ws: true,
// changOrigin: true, //允许跨域 // changOrigin: true, //允许跨域
// pathRewrite: { // pathRewrite: {
// '^/ps_ceninss': 'ps_ceninss' //请求的时候使用这个api就可以 // '^/ps_ceninss': 'ps_ceninss' //请求的时候使用这个api就可以
// } // }
// } // }
} }
} }
} }
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