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>
<div>
<LHeader :text="text"></LHeader>
<van-form
@submit="onSubmit"
:scroll-to-error="true"
:show-error="false"
validate-trigger="onSubmit"
>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
服务项目信息
</div>
<van-field
readonly
required
name="userName"
:value="form.userName"
label="创建人员"
placeholder="请输入"
:rules="[{ required: true, message: '创建人员不能为空' }]"
/>
<van-field
readonly
required
name="deptName"
:value="form.deptName"
label="创建单位"
placeholder="请输入"
:rules="[{ required: true, message: '创建单位不能为空' }]"
/>
<van-field
required
name="name"
v-model="form.name"
label="任务名称"
placeholder="请输入"
:rules="[{ required: true, message: '任务名称不能为空' }]"
/>
<div>
<LHeader :text="text"></LHeader>
<van-form
@submit="onSubmit"
:scroll-to-error="true"
:show-error="false"
validate-trigger="onSubmit"
>
<div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
>
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
服务项目信息
</div>
<van-field
readonly
required
name="userName"
:value="form.userName"
label="创建人员"
placeholder="请输入"
:rules="[{ required: true, message: '创建人员不能为空' }]"
/>
<van-field
readonly
required
name="deptName"
:value="form.deptName"
label="创建单位"
placeholder="请输入"
:rules="[{ required: true, message: '创建单位不能为空' }]"
/>
<van-field
required
name="name"
v-model="form.name"
label="任务名称"
placeholder="请输入"
:rules="[{ required: true, message: '任务名称不能为空' }]"
/>
<van-field
required
clickable
name="projectName"
:value="form.projectName"
label="关联项目"
placeholder="请选择"
@click="showSource = true"
:rules="[{ required: true, message: '关联项目不能为空' }]"
/>
<van-popup v-model="showSource" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="columnsSource"
@confirm="onConSource"
@cancel="showSource = false"
/>
</van-popup>
<van-field
required
clickable
name="projectName"
:value="form.projectName"
label="关联项目"
placeholder="请选择"
@click="showSource = true"
:rules="[{ required: true, message: '关联项目不能为空' }]"
/>
<van-popup v-model="showSource" position="bottom">
<van-picker
show-toolbar
value-key="name"
:columns="columnsSource"
@confirm="onConSource"
@cancel="showSource = false"
/>
</van-popup>
<van-field
required
name="buildingNames"
:value="form.buildingNames"
label="评估楼栋"
placeholder="请输入"
@click="getRiskList()"
:rules="[{ required: true, message: '评估楼栋不能为空' }]"
/>
<div style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;" >
<img src="@/assets/accidentIcon/bookmark.svg" alt="" style="position: relative;top: 32%;transform: translateY(-50%);" >
任务组织与分配
</div>
<van-field
required
clickable
name="leaderUserName"
:value="form.leaderUserName"
label="项目负责人"
placeholder="请选择"
@click="getLeaderUserList('leaderUser')"
:rules="[{ required: true, message: '项目负责人不能为空' }]"
/>
<van-field
required
name="buildingNames"
:value="form.buildingNames"
label="评估楼栋"
placeholder="请输入"
@click="getRiskList()"
:rules="[{ required: true, message: '评估楼栋不能为空' }]"
/>
<div
style="height: 1rem;font-family: '微软雅黑 Bold', '微软雅黑 Regular', '微软雅黑';font-weight: 700;line-height: 1rem;"
>
<img
src="@/assets/accidentIcon/bookmark.svg"
alt=""
style="position: relative;top: 32%;transform: translateY(-50%);"
/>
任务组织与分配
</div>
<van-field
required
clickable
name="deptId"
:value="form.deptId"
label="评估小组选择"
placeholder="请选择"
@click="selectDept()"
:rules="[{ required: true, message: '评估小组不能为空' }]"
/>
<van-field
:value="form.startTime"
required
name="startTime"
label="任务开始时间"
placeholder="请选择"
@click="selectBeginTime('startTime')"
:rules="[{ required: true, message: '任务开始时间不能为空' }]"
/>
<van-field
required
clickable
name="leaderUserName"
:value="form.leaderUserName"
label="评估小组组长"
placeholder="请选择"
@click="getLeaderUserList('leaderUser')"
:rules="[{ required: true, message: '评估小组组长不能为空' }]"
/>
<van-field
clickable
:value="form.endTime"
required
name="endTime"
label="任务结束时间"
@click="selectBeginTime('endTime')"
placeholder="请选择"
:rules="[{ required: true, message: '任务结束时间不能为空' }]"
/>
<van-field
clickable
required
name="workUserNames"
:value="form.workUserNames"
label="评估小组成员"
placeholder="请选择"
@click="getExecuteUser()"
:rules="[{ required: true, message: '评估小组成员不能为空' }]"
/>
<van-field
clickable
required
name="workUserNames"
:value="form.workUserNames"
label="执行人员"
placeholder="请选择"
@click="getExecuteUser()"
:rules="[{ required: true, message: '执行人员不能为空' }]"
/>
<!-- <van-popup v-model="showControl" position="bottom">
<van-field
:value="form.startTime"
required
name="startTime"
label="任务开始时间"
placeholder="请选择"
@click="selectBeginTime('startTime')"
:rules="[{ required: true, message: '任务开始时间不能为空' }]"
/>
<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
show-toolbar
:columns="columnsControl"
......@@ -123,7 +146,7 @@
/>
</van-popup> -->
<van-field
<!-- <van-field
required
clickable
name="approveUserName"
......@@ -132,69 +155,125 @@
placeholder="请选择"
@click="getLeaderUserList('approveUser')"
:rules="[{ required: true, message: '事审批负责人不能为空' }]"
/>
<van-popup v-model="showTrouble" position="bottom">
<van-picker
show-toolbar
value-key="nickName"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
/>
</van-popup>
/> -->
<van-popup v-model="showTrouble" position="bottom">
<van-picker
show-toolbar
value-key="nickName"
:columns="columnsTrouble"
@confirm="onConTrouble"
@cancel="showTrouble = false"
/>
</van-popup>
<van-popup v-model="show" position="bottom" :style="{ height: '100%' }">
<!-- <selectPeople @onClose="onClose" @onSave="onSave"></selectPeople> -->
</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>
<van-popup v-model="show" position="bottom" :style="{ height: '100%' }">
<!-- <selectPeople @onClose="onClose" @onSave="onSave"></selectPeople> -->
</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
<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="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>
</template>
<script>
import LHeader from "@/components/header.vue";
import selectDept from "@/components/selectDept/index.vue";
// import selectPeople from "@/views/riskTask/selectPeople/index.vue";
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 {
// getFormList,
......@@ -206,472 +285,471 @@ import { getFun, postFun } from "@/service/table.js";
// postRiskShowMeasures,
// } from "@/service/risk";
export default {
name: "risk-add",
components: {
LHeader,
name: "risk-add",
components: {
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) {
if (to.name != "matrix-grad") {
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();
}
next();
});
},
data() {
return {
taskId: "",
text: "创建任务",
id: "",
form:{
name:''
},
projectId: "", // 所属工程
projectName: "", // 所属工程
projectDirectorName: "", // 所属工程
projectDirector: "", // 所属工程
timeName: "", //
userPrefix: "", //
showProjectName: 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,
};
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();
},
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();
selectDept() {
this.projectDept = true;
},
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();
},
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;
colseDept() {
this.projectDept = false;
},
getExecuteUser() {
if (!this.form.projectId) {
this.$toast({
title: "提示",
message: "请选择关联项目!"
});
return false;
}
} else {
this.$toast.clear();
}
});
},
filterField(value,arr){
var arrs=[]
arr.forEach(item=>{
arrs.push(item[value])
})
return arrs
},
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();
},
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.$toast.clear();
}
});
},
filterField(value, arr) {
var arrs = [];
arr.forEach(item => {
arrs.push(item[value]);
});
return arrs;
},
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() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
getFormList("/riskMain/add")
.then((res) => {
this.$toast.clear();
this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories;
this.columnsMainDutyDept = res.data.organizationList;
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试");
});
},
// 请求表单数据
getList() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
getFormList("/riskMain/add")
.then(res => {
this.$toast.clear();
this.columnsProjectName = res.data.projectInformations;
this.columnsFactor = res.data.riskInventories;
this.columnsMainDutyDept = res.data.organizationList;
})
.catch(() => {
this.$toast.clear();
this.$toast.fail("加载失败,请稍后再试");
});
},
// 请求已退回详情数据
postReturnEcho() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0,
});
postriskConiCause(`/riskMain/edit/${this.taskId}`)
.then((res) => {
// 定级方式
this.urgentImg = (res.data.imgsysFiles2 || []).map(
(item) => {
return {
...item,
url: item.filePath,
file: new File([], item["fileName"], {}),
};
}
);
this.administrationImg = (res.data.imgsysFiles1 || []).map(
(item) => {
return {
...item,
url: item.filePath,
file: new File([], item["fileName"], {}),
};
}
);
this.technologyImg = (res.data.imgsysFiles0 || []).map(
(item) => {
return {
...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"], {}),
};
}
);
// 请求已退回详情数据
postReturnEcho() {
this.$toast.loading({
message: "加载中...",
forbidClick: true,
loadingType: "spinner",
duration: 0
});
postriskConiCause(`/riskMain/edit/${this.taskId}`)
.then(res => {
// 定级方式
this.urgentImg = (res.data.imgsysFiles2 || []).map(item => {
return {
...item,
url: item.filePath,
file: new File([], item["fileName"], {})
};
});
this.administrationImg = (res.data.imgsysFiles1 || []).map(item => {
return {
...item,
url: item.filePath,
file: new File([], item["fileName"], {})
};
});
this.technologyImg = (res.data.imgsysFiles0 || []).map(item => {
return {
...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();
formdata.append("organizationId", data.responsibilityDept);
postHdPeople(`/riskMain/getUserList`, formdata).then(
(res) => {
this.columnsMainDutyPeopLe = res.data;
this.mainDutyPeopLe =
this.columnsMainDutyPeopLe.filter((item) => {
return (
item["userId"] ==
data.responsibilityMember
);
})[0]["userName"];
}
);
// console.log(data)
this.$toast.clear();
this.returnCause = res.data.reason;
// 请求人员列表
let formdata = new FormData();
formdata.append("organizationId", data.responsibilityDept);
postHdPeople(`/riskMain/getUserList`, formdata).then(res => {
this.columnsMainDutyPeopLe = res.data;
this.mainDutyPeopLe = this.columnsMainDutyPeopLe.filter(item => {
return item["userId"] == data.responsibilityMember;
})[0]["userName"];
});
// console.log(data)
this.$toast.clear();
this.returnCause = res.data.reason;
//请求风险源
postHdSource(`/risk/plan/project/list`).then(
(res) => {
this.columnsSource = res.data;
}
);
})
.catch(() => {
this.$toast.clear();
});
},
//请求风险源
postHdSource(`/risk/plan/project/list`).then(res => {
this.columnsSource = res.data;
});
})
.catch(() => {
this.$toast.clear();
});
},
// 所属项目
onConProjectName(value) {
if (!value) {
this.showProjectName = false;
return;
}
this.projectId = value.id;
this.projectName = value.projectName;
this.showProjectName = false;
},
// 风险因素
onConFactor(value) {
if (!value) {
this.showFactor = false;
return;
}
this.factor = value.factorType;
this.showFactor = false;
this.source = "";
this.trouble = "";
// 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
(res) => {
this.columnsSource = res.data;
}
);
},
// 关联项目
onConSource(value) {
if (!value) {
this.showSource = false;
return;
}
this.form.projectId = value.id;
this.form.projectName = value.name;
this.showSource = false;
},
// 项目负责人
onConTrouble(value) {
if (!value) {
this.showTrouble = false;
return;
}
this.form[this.userPrefix + "Id"] = value.userId;
this.form[this.userPrefix + "Name"] = value.nickName;
console.log('this.form :>> ', this.form);
this.showTrouble = false;
},
// 风险定级
onConSetRank(value) {
this.showSetRank = false;
this.setRank = value;
this.riskRank = "";
if (this.setRank == "矩阵式定级") {
this.showSetRank = false;
this.$router.push({
name: "matrix-grad",
});
}
},
// 自己定义风险等级点击方法
myRiskRank() {
if (this.setRank == "") {
this.$toast("请先选择风险定级");
} else if (this.setRank == "其他定级方式") {
this.showRiskRank = true;
}
},
// 风险等级
onConRiskRank(value) {
this.riskRank = value;
this.showRiskRank = false;
},
// 所属项目
onConProjectName(value) {
if (!value) {
this.showProjectName = false;
return;
}
this.projectId = value.id;
this.projectName = value.projectName;
this.showProjectName = false;
},
// 风险因素
onConFactor(value) {
if (!value) {
this.showFactor = false;
return;
}
this.factor = value.factorType;
this.showFactor = false;
this.source = "";
this.trouble = "";
// 请求风险源
postHdSource(`/riskMain/showSourceName?factorType=${this.factor}`).then(
res => {
this.columnsSource = res.data;
}
);
},
// 关联项目
onConSource(value) {
if (!value) {
this.showSource = false;
return;
}
this.form.projectId = value.id;
this.form.projectName = value.name;
this.showSource = false;
},
// 项目负责人
onConTrouble(value) {
if (!value) {
this.showTrouble = false;
return;
}
this.form[this.userPrefix + "Id"] = value.userId;
this.form[this.userPrefix + "Name"] = value.nickName;
console.log("this.form :>> ", this.form);
this.showTrouble = false;
},
// 风险定级
onConSetRank(value) {
this.showSetRank = false;
this.setRank = value;
this.riskRank = "";
if (this.setRank == "矩阵式定级") {
this.showSetRank = false;
this.$router.push({
name: "matrix-grad"
});
}
},
// 自己定义风险等级点击方法
myRiskRank() {
if (this.setRank == "") {
this.$toast("请先选择风险定级");
} else if (this.setRank == "其他定级方式") {
this.showRiskRank = true;
}
},
// 风险等级
onConRiskRank(value) {
this.riskRank = value;
this.showRiskRank = false;
},
// 管控层级
onConControl(value) {
this.control = value;
this.showControl = false;
},
// 主责部门
onConMainDutyDept(value) {
this.mainDutyDeptId = value.deptId;
this.mainDutyDept = value.deptName;
this.showMainDutyDept = false;
this.mainDutyPeopLe = "";
// 请求主责人员
let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then((res) => {
this.columnsMainDutyPeopLe = res.data;
});
},
// 主责人员
onConMainDutyPeopLe(value) {
this.mainDutyPeopLeId = value.userId;
this.mainDutyPeopLe = value.userName;
this.showMainDutyPeopLe = false;
},
// 管控层级
onConControl(value) {
this.control = value;
this.showControl = false;
},
// 主责部门
onConMainDutyDept(value) {
this.mainDutyDeptId = value.deptId;
this.mainDutyDept = value.deptName;
this.showMainDutyDept = false;
this.mainDutyPeopLe = "";
// 请求主责人员
let formdata = new FormData();
formdata.append("organizationId", this.mainDutyDeptId);
postHdPeople(`/riskMain/getUserList`, formdata).then(res => {
this.columnsMainDutyPeopLe = res.data;
});
},
// 主责人员
onConMainDutyPeopLe(value) {
this.mainDutyPeopLeId = value.userId;
this.mainDutyPeopLe = value.userName;
this.showMainDutyPeopLe = false;
},
cancel() {
this.$router.go(-1);
},
cancel() {
this.$router.go(-1);
},
// 选择作业人
goSelPeoTwo(val) {
this.peopleName=val
this.show = true;
},
onClose() {
this.show = false;
},
onSave(e) {
this.projectDirector=e[0].loginName
this.projectDirectorName=e[0].userName
this.show = false;
},
// 选择作业人
goSelPeoTwo(val) {
this.peopleName = val;
this.show = true;
},
watch: {
setRank(newVal, oldVal) {
if (newVal == "其他定级方式") {
this.showSetRankMode = true;
} else {
this.showSetRankMode = false;
}
},
onClose() {
this.show = 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>
<style scoped>
......
......@@ -34,15 +34,15 @@
</van-grid-item>
</van-grid>
<van-steps
:active="active"
:active="phase"
active-icon="success"
active-color="#38f"
style="margin: 0.26rem 0;"
>
<van-step>任务发起</van-step>
<van-step>风险评估</van-step>
<van-step>评估审核</van-step>
<van-step>项目完成</van-step>
<van-step name="1">任务发起</van-step>
<van-step name="2">风险评估</van-step>
<van-step name="3">评估审核</van-step>
<van-step name="4">项目完成</van-step>
</van-steps>
<van-tabs
v-model="active"
......@@ -100,13 +100,31 @@
:rules="[{ required: true, message: '评估楼栋不能为空' }]"
/>
<van-field
readonly
name="deptId"
:value="form.deptId"
label="评估小组选择"
input-align="right"
:rules="[{ required: true, message: '评估小组不能为空' }]"
/>
<van-field
readonly
name="leaderUserName"
:value="form.leaderUserName"
label="项目负责人"
label="评估小组组长"
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
......@@ -136,15 +154,6 @@
input-align="right"
:rules="[{ required: true, message: '任务结束时间不能为空' }]"
/>
<van-field
clickable
name="workUserNames"
:value="form.workUserNames"
label="执行人员"
input-align="right"
:rules="[{ required: true, message: '执行人员不能为空' }]"
/>
</van-form>
</van-tab>
<van-tab title="风险清单"> </van-tab>
......@@ -283,6 +292,7 @@ export default {
Loop: "", // 定时器
showIndex: null, // 是否显示遮罩层,
active: 0,
phase: 1,
form: {},
tabs: []
};
......@@ -329,6 +339,7 @@ export default {
.then(res => {
this.$toast.clear();
this.messageList = res.data || res.rows;
console.log(this.messageList);
this.form = this.messageList.detailsDto;
this.riskLogList = this.messageList.approveListDtos;
})
......
......@@ -3,7 +3,7 @@ module.exports = {
devServer: {
open: true,
host: 'localhost',
port: 8080,
port: 8081,
https: false,
//以上的ip和端口是我们本机的;下面为需要跨域的
proxy: { //配置跨域
......@@ -11,7 +11,7 @@ module.exports = {
// target: 'http://192.168.4.232:8080/', //这里是后台的地址
// target: 'http://192.168.15.124:8080/', //这里是杨帆的地址
// target: 'http://192.168.10.137:8080/', //这里是昊哥的地址
target: 'http://192.168.10.36:8080/', //这里是后台的地址
target: 'http://localhost:8080/', //这里是后台的地址
ws: true,
changOrigin: true, //允许跨域
// logLevel: 'debug', // 显示代理调试信息
......@@ -19,14 +19,14 @@ module.exports = {
// '^/app-api': '' //请求的时候使用这个api就可以
// }
},
// '/ps_ceninss': {
// target: 'http://192.168.3.80:8080', //这里是后台的地址
// ws: true,
// changOrigin: true, //允许跨域
// pathRewrite: {
// '^/ps_ceninss': 'ps_ceninss' //请求的时候使用这个api就可以
// }
// }
// '/ps_ceninss': {
// target: 'http://192.168.3.80:8080', //这里是后台的地址
// ws: true,
// changOrigin: true, //允许跨域
// pathRewrite: {
// '^/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