添加许可证

This commit is contained in:
caoqianming 2022-10-13 16:16:41 +08:00
parent d242a5e7c2
commit 43ab2441e8
9 changed files with 3422 additions and 7 deletions

View File

@ -275,6 +275,54 @@
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/opls/usecl",
"style": {
"navigationBarTitleText": "临时用电许可证",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/opls/soil",
"style": {
"navigationBarTitleText": "动土作业许可证",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/opls/preheat",
"style": {
"navigationBarTitleText": "预热器清堵作业许可证",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/opls/hoisting",
"style": {
"navigationBarTitleText": "吊装作业许可证",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/opls/cooler",
"style": {
"navigationBarTitleText": "篦冷机清大块作业许可证",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/opls/clear",
"style": {
"navigationBarTitleText": "清库作业许可证",
"navigationStyle": "custom",
"enablePullDownRefresh": false
}
},
{
"path": "pages/workSpace/visit/vpeopleList",
"style": {

View File

@ -9,12 +9,14 @@
<view class="name">检测部位{{row.check_place}}</view>
<view class="tel">O₂(%){{row.o2}}</view>
<view class="tel">CO{{row.co}}</view>
<view class="tel">可燃气体(V%LEL){{row.lel}}</view>
<view class="tel" v-if="oplCateCode==='fire'">可燃气体(V%LEL){{row.lel}}</view>
<view class="tel" v-if="oplCateCode==='space'">h2s{{row.h2s}}</view>
<view class="tel" v-if="oplCateCode==='cooler'">45{{row.f5}}</view>
<view class="tel">检验结论
<span v-if="row.is_ok">正常</span>
<span v-else>异常</span>
</view>
<view class="tel">检测人{{row.checker_.name}}</view>
<view class="tel" >检测人<span v-if="row.checker_">{{row.checker_.name}}</span></view>
<view class="tel">检验时间{{row.check_time}}</view>
</view>
<view style="width: 20%;">
@ -58,12 +60,21 @@
<input class="content" type="text" v-model="formData.co" maxlength="50"
placeholder="请输入" />
</view>
<view class="uni-form-item">
<view class="uni-form-item" v-if="oplCateCode==='fire'">
<view class="title">可燃气体</view>
<input class="content" type="text" v-model="formData.lel" maxlength="50"
placeholder="请输入" />
</view>
<view class="uni-form-item" v-if="oplCateCode==='space'">
<view class="title">h2s</view>
<input class="content" type="text" v-model="formData.h2s" maxlength="50"
placeholder="请输入" />
</view>
<view class="uni-form-item" v-if="oplCateCode==='cooler'">
<view class="title">45</view>
<input class="content" type="text" v-model="formData.f5" maxlength="50"
placeholder="请输入" />
</view>
<view class="uni-form-item">
<view class="title">检验结论</view>
<radio-group @change="checkboxMeasuresChange" class="content">
@ -109,9 +120,6 @@
opl: '',
check_time: null,
check_place:'',
o2:'',
co:'',
lel:'',
is_ok:true,
checker:'',
},

View File

@ -112,6 +112,7 @@
this.oplCateCode = params.oplCateCode;
this.showNext()
this.getInit()
this.getOplDetail();
},
onShow() {
this.workerList = [];
@ -125,6 +126,14 @@
this.showN = true
}
},
getOplDetail(){
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.oplDetail = res; //
debugger;
console.log(res);
});
},
formSubmit(val) {
let that = this;
that.formData.opl = that.oplId;

View File

@ -0,0 +1,554 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="添加作业许可证"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="form-info">
<view class="form-item border-bottom" style="height: 100rpx;">
<view class="">
<text class="form-left-text">关联作业</text>
</view>
<view class="form-right">
<view>{{operationName}}</view>
</view>
</view>
<view class="form-item" style="height: 100rpx;">
<view class="">
<text class="form-left-text">许可证类型</text>
</view>
<view class="form-right">
<view>动火</view>
</view>
</view>
</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业部门</text>
</view>
<view class="form-right">
<ba-tree-picker ref="deptDoPicker" :multiple='false' @select-change="deptDoChange" title="选择业务部门"
:localdata="depRange" valueKey="id" textKey="name" childrenKey="children"/>
<text type="text">{{dept_do_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showDeptDoPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业负责人</text>
</view>
<view class="form-right">
<ba-tree-picker ref="charger_Picker" :multiple='false' @select-change="select_charger_Change" title="选择部门协调员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{charger_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showChargerPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业监护人</text>
</view>
<view class="form-right">
<ba-tree-picker ref="monitor_Picker" :multiple='false' @select-change="select_monitor_Change" title="选择部门协调员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{monitor_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showMonitorPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">风险选择</text>
<!-- risks_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxRiskChange">
<label v-for="(item,index) in risklist" :key="item.value">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他风险</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_risk" maxlength="50" placeholder="请输入" />
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">措施选择</text>
<!-- measures_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxMeasuresChange">
<label v-for="(item,index) in measurelist" :key="item.value"
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他应急处置</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_emr" maxlength="50" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
</view>
</view>
</view>
</view>
<view class="btn">
<button type="primary" class="save-btn" @click="saveSubmit">下一步</button>
</view>
</view>
</template>
<script>
import baTreePicker from "../../comm/ba-tree-picker/ba-tree-picker.vue";
import nonNullCheck from '../../../utils/nonNullCheck.js';
import resetData from '../../../utils/common.js';
export default {
name: "fire",
components: {
baTreePicker
},
data() {
return {
formData: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
dept_do: '',
charger: '',
monitor: '',
other_emr: '',
other_risk: '',
risks_checked: [],
measures_checked: [],
},
header: {},
oplId: null,
oplCateCode: null,
operationName: '',
oplCateName: '',
fileList: [],
risklist: [],
measurelist: [],
range: [],
//
depRange: [],
leveloptions: [{
value: "特殊动火",
text: "特殊动火"
},
{
value: "一级动火",
text: "一级动火"
},
{
value: "二级动火",
text: "二级动火"
},
],
dept_do_name:'',
charger_name:'',
monitor_name:'',
}
},
onLoad(params) {
// debugger;
console.log(params)
this.operationId = params.operationId;
this.oplcateId = params.oplcateId;
this.type = params.type;
if (params.oplId) {
this.oplId = params.oplId;
this.formData.id = params.oplId;
this.getOplDetail()
}else{
console.log('s', this.vuex_user.belong_dept)
this.formData.dept_do = this.vuex_user.belong_dept
this.formData.cate = this.oplcateId;
this.formData.operation = this.operationId;
this.getOperation();
}
},
onShow() {
this.getdept();
this.getRange();
this.getHeader();
},
methods: {
showDeptDoPicker() {
this.$refs.deptDoPicker._show();
},
showChargerPicker() {
this.$refs.charger_Picker._show();
},
showMonitorPicker() {
this.$refs.monitor_Picker._show();
},
deptDoChange(ids, names) {
this.formData.dept_do = ids[0];
this.dept_do_name = names;
},
select_charger_Change(ids, names) {
this.formData.charger = ids[0];
this.charger_name = names;
},
select_monitor_Change(ids, names) {
this.formData.monitor = ids[0];
this.monitor_name = names;
},
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
//operation
getOperation() {
let that = this;
that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; //
that.operationName = res.name; //
this.getOplcates()
});
},
getOplDetail(){
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.formData = res; //
that.operationName = res.operation_.name;
that.dept_do_name = res.dept_do_.name;
that.charger_name = res.charger_.name;
that.monitor_name = res.monitor_.name;
this.getOplcates()
});
},
//ID===>
getOplcates() {
let that = this;
that.$u.api.oplCateItem(that.oplcateId).then((res) => {
console.log(res); //
that.risklist = [];
that.measurelist = [];
that.oplCateName = res.name;
that.oplCateCode = res.code;
let risklist = res.risk_options_;
let measurelist = res.measure_options_;
risklist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.measurelist.push(obj)
})
this.editCheckShow()
});
},
editCheckShow() {
// debugger;
let that = this;
that.risklist.forEach(item => {
if (this.formData.risks_checked.indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
})
that.measurelist.forEach(item => {
if (this.formData.measures_checked.indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
})
},
//
getRange() {
this.$u.api.areaLists({
page: 0
}).then(res => {
let range = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
range.push(obj);
})
this.range = range
})
},
//dept
getdept() {
let that = this;
that.$u.api.deptList({
page: 0
}).then(res => {
that.depRange = that.redata(res);
console.log(that.depRange)
})
},
redata(postList) {
let posts = [];
postList.forEach((item) => {
let obj = new Object();
obj = {
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
if (item.parentId == null) {
arr.push(item);
continue;
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
console.log(arr);
return arr;
},
checkboxRiskChange(e) {
let values = e.detail.value;
this.formData.risks_checked = values;
// debugger;
// console.log(this.formData.risks_checked);
},
checkboxMeasuresChange(e) {
let values = e.detail.value;
this.formData.measures_checked = values;
// debugger;
// console.log(this.formData.measures_checked);
},
select(row) {},
goBack() {
uni.navigateBack({
delta: 1
})
},
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
console.log(this.formData);
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
}
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 113px;
}
.form-info {
width: 720upx;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
.form-item {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
height: 200rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.form-left-text {
color: #212121;
margin-bottom: 33rpx;
}
.form-left {
width: 100%;
}
.form-right {
margin-left: 20rpx;
flex: 1;
color: #414141;
}
.form-right input {
font-size: 30rpx;
}
.form-date>>>.uni-date__x-input {
height: 97rpx;
font-size: 30rpx;
}
.form-date>>>.uni-icons {
display: none;
}
.form-right>>>.uni-label-pointer {
min-width: 50%;
display: inline-block;
margin-bottom: 20rpx;
}
.apply-reason-text {
width: 653rpx;
height: 179rpx;
background-color: #f6f8fc;
border: solid 1rpx #e5e5e5;
margin-top: 21rpx;
padding: 14rpx 24rpx;
font-size: 26rpx;
box-sizing: border-box;
}
.apply_require {
margin-top: 0rpx !important;
}
.form-right {
flex: 1;
color: #414141;
}
.border-bottom {
border-bottom: 1rpx solid #eeeeee;
}
</style>

View File

@ -0,0 +1,565 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="添加作业许可证"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="form-info">
<view class="form-item border-bottom" style="height: 100rpx;">
<view class="">
<text class="form-left-text">关联作业</text>
</view>
<view class="form-right">
<view>{{operationName}}</view>
</view>
</view>
<view class="form-item" style="height: 100rpx;">
<view class="">
<text class="form-left-text">许可证类型</text>
</view>
<view class="form-right">
<view>动火</view>
</view>
</view>
</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业级别</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.level" :localdata="leveloptions">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业部门</text>
</view>
<view class="form-right">
<ba-tree-picker ref="deptDoPicker" :multiple='false' @select-change="deptDoChange" title="选择业务部门"
:localdata="depRange" valueKey="id" textKey="name" childrenKey="children"/>
<text type="text">{{dept_do_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showDeptDoPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业负责人</text>
</view>
<view class="form-right">
<ba-tree-picker ref="charger_Picker" :multiple='false' @select-change="select_charger_Change" title="选择部门协调员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{charger_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showChargerPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业监护人</text>
</view>
<view class="form-right">
<ba-tree-picker ref="monitor_Picker" :multiple='false' @select-change="select_monitor_Change" title="选择部门协调员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{monitor_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showMonitorPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">风险选择</text>
<!-- risks_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxRiskChange">
<label v-for="(item,index) in risklist" :key="item.value">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他风险</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_risk" maxlength="50" placeholder="请输入" />
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">措施选择</text>
<!-- measures_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxMeasuresChange">
<label v-for="(item,index) in measurelist" :key="item.value"
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他应急处置</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_emr" maxlength="50" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
</view>
</view>
</view>
</view>
<view class="btn">
<button type="primary" class="save-btn" @click="saveSubmit">下一步</button>
</view>
</view>
</template>
<script>
import baTreePicker from "../../comm/ba-tree-picker/ba-tree-picker.vue";
import nonNullCheck from '../../../utils/nonNullCheck.js';
import resetData from '../../../utils/common.js';
export default {
name: "fire",
components: {
baTreePicker
},
data() {
return {
formData: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
level: '',
dept_do: '',
charger: '',
monitor: '',
other_emr: '',
other_risk: '',
risks_checked: [],
measures_checked: [],
},
header: {},
oplId: null,
oplCateCode: null,
operationName: '',
oplCateName: '',
fileList: [],
risklist: [],
measurelist: [],
range: [],
//
depRange: [],
leveloptions: [{
value: "一级吊装",
text: "一级吊装"
},
{
value: "二级吊装",
text: "二级吊装"
},
{
value: "三级吊装",
text: "三级吊装"
},
],
dept_do_name:'',
charger_name:'',
monitor_name:'',
}
},
onLoad(params) {
// debugger;
console.log(params)
this.operationId = params.operationId;
this.oplcateId = params.oplcateId;
this.type = params.type;
if (params.oplId) {
this.oplId = params.oplId;
this.formData.id = params.oplId;
this.getOplDetail()
}else{
console.log('s', this.vuex_user.belong_dept)
this.formData.dept_do = this.vuex_user.belong_dept
this.formData.cate = this.oplcateId;
this.formData.operation = this.operationId;
this.getOperation();
}
},
onShow() {
this.getdept();
this.getRange();
this.getHeader();
},
methods: {
showDeptDoPicker() {
this.$refs.deptDoPicker._show();
},
showChargerPicker() {
this.$refs.charger_Picker._show();
},
showMonitorPicker() {
this.$refs.monitor_Picker._show();
},
deptDoChange(ids, names) {
this.formData.dept_do = ids[0];
this.dept_do_name = names;
},
select_charger_Change(ids, names) {
this.formData.charger = ids[0];
this.charger_name = names;
},
select_monitor_Change(ids, names) {
this.formData.monitor = ids[0];
this.monitor_name = names;
},
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
//operation
getOperation() {
let that = this;
that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; //
that.operationName = res.name; //
this.getOplcates()
});
},
getOplDetail(){
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.formData = res; //
that.operationName = res.operation_.name;
that.dept_do_name = res.dept_do_.name;
that.charger_name = res.charger_.name;
that.monitor_name = res.monitor_.name;
this.getOplcates()
});
},
//ID===>
getOplcates() {
let that = this;
that.$u.api.oplCateItem(that.oplcateId).then((res) => {
console.log(res); //
that.risklist = [];
that.measurelist = [];
that.oplCateName = res.name;
that.oplCateCode = res.code;
let risklist = res.risk_options_;
let measurelist = res.measure_options_;
risklist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.measurelist.push(obj)
})
this.editCheckShow()
});
},
editCheckShow() {
// debugger;
let that = this;
that.risklist.forEach(item => {
if (this.formData.risks_checked.indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
})
that.measurelist.forEach(item => {
if (this.formData.measures_checked.indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
})
},
//
getRange() {
this.$u.api.areaLists({
page: 0
}).then(res => {
let range = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
range.push(obj);
})
this.range = range
})
},
//dept
getdept() {
let that = this;
that.$u.api.deptList({
page: 0
}).then(res => {
that.depRange = that.redata(res);
console.log(that.depRange)
})
},
redata(postList) {
let posts = [];
postList.forEach((item) => {
let obj = new Object();
obj = {
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
if (item.parentId == null) {
arr.push(item);
continue;
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
console.log(arr);
return arr;
},
checkboxRiskChange(e) {
let values = e.detail.value;
this.formData.risks_checked = values;
// debugger;
// console.log(this.formData.risks_checked);
},
checkboxMeasuresChange(e) {
let values = e.detail.value;
this.formData.measures_checked = values;
// debugger;
// console.log(this.formData.measures_checked);
},
select(row) {},
goBack() {
uni.navigateBack({
delta: 1
})
},
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
console.log(this.formData);
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
}
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 113px;
}
.form-info {
width: 720upx;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
.form-item {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
height: 200rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.form-left-text {
color: #212121;
margin-bottom: 33rpx;
}
.form-left {
width: 100%;
}
.form-right {
margin-left: 20rpx;
flex: 1;
color: #414141;
}
.form-right input {
font-size: 30rpx;
}
.form-date>>>.uni-date__x-input {
height: 97rpx;
font-size: 30rpx;
}
.form-date>>>.uni-icons {
display: none;
}
.form-right>>>.uni-label-pointer {
min-width: 50%;
display: inline-block;
margin-bottom: 20rpx;
}
.apply-reason-text {
width: 653rpx;
height: 179rpx;
background-color: #f6f8fc;
border: solid 1rpx #e5e5e5;
margin-top: 21rpx;
padding: 14rpx 24rpx;
font-size: 26rpx;
box-sizing: border-box;
}
.apply_require {
margin-top: 0rpx !important;
}
.form-right {
flex: 1;
color: #414141;
}
.border-bottom {
border-bottom: 1rpx solid #eeeeee;
}
</style>

View File

@ -0,0 +1,554 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="添加作业许可证"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="form-info">
<view class="form-item border-bottom" style="height: 100rpx;">
<view class="">
<text class="form-left-text">关联作业</text>
</view>
<view class="form-right">
<view>{{operationName}}</view>
</view>
</view>
<view class="form-item" style="height: 100rpx;">
<view class="">
<text class="form-left-text">许可证类型</text>
</view>
<view class="form-right">
<view>动火</view>
</view>
</view>
</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业部门</text>
</view>
<view class="form-right">
<ba-tree-picker ref="deptDoPicker" :multiple='false' @select-change="deptDoChange" title="选择业务部门"
:localdata="depRange" valueKey="id" textKey="name" childrenKey="children"/>
<text type="text">{{dept_do_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showDeptDoPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业负责人</text>
</view>
<view class="form-right">
<ba-tree-picker ref="charger_Picker" :multiple='false' @select-change="select_charger_Change" title="选择部门协调员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{charger_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showChargerPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="position: relative;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业监护人</text>
</view>
<view class="form-right">
<ba-tree-picker ref="monitor_Picker" :multiple='false' @select-change="select_monitor_Change" title="选择部门协调员"
:localdata="vuex_userRange" valueKey="id" textKey="name" childrenKey="children" :selectParent='false'/>
<text type="text">{{monitor_name}}</text>
<uni-icons style="position: absolute; right: 0;" @click="showMonitorPicker" type="arrowright" color="#999999"/>
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">风险选择</text>
<!-- risks_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxRiskChange">
<label v-for="(item,index) in risklist" :key="item.value">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他风险</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_risk" maxlength="50" placeholder="请输入" />
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">措施选择</text>
<!-- measures_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxMeasuresChange">
<label v-for="(item,index) in measurelist" :key="item.value"
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他应急处置</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_emr" maxlength="50" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
</view>
</view>
</view>
</view>
<view class="btn">
<button type="primary" class="save-btn" @click="saveSubmit">下一步</button>
</view>
</view>
</template>
<script>
import baTreePicker from "../../comm/ba-tree-picker/ba-tree-picker.vue";
import nonNullCheck from '../../../utils/nonNullCheck.js';
import resetData from '../../../utils/common.js';
export default {
name: "fire",
components: {
baTreePicker
},
data() {
return {
formData: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
dept_do: '',
charger: '',
monitor: '',
other_emr: '',
other_risk: '',
risks_checked: [],
measures_checked: [],
},
header: {},
oplId: null,
oplCateCode: null,
operationName: '',
oplCateName: '',
fileList: [],
risklist: [],
measurelist: [],
range: [],
//
depRange: [],
leveloptions: [{
value: "特殊动火",
text: "特殊动火"
},
{
value: "一级动火",
text: "一级动火"
},
{
value: "二级动火",
text: "二级动火"
},
],
dept_do_name:'',
charger_name:'',
monitor_name:'',
}
},
onLoad(params) {
// debugger;
console.log(params)
this.operationId = params.operationId;
this.oplcateId = params.oplcateId;
this.type = params.type;
if (params.oplId) {
this.oplId = params.oplId;
this.formData.id = params.oplId;
this.getOplDetail()
}else{
console.log('s', this.vuex_user.belong_dept)
this.formData.dept_do = this.vuex_user.belong_dept
this.formData.cate = this.oplcateId;
this.formData.operation = this.operationId;
this.getOperation();
}
},
onShow() {
this.getdept();
this.getRange();
this.getHeader();
},
methods: {
showDeptDoPicker() {
this.$refs.deptDoPicker._show();
},
showChargerPicker() {
this.$refs.charger_Picker._show();
},
showMonitorPicker() {
this.$refs.monitor_Picker._show();
},
deptDoChange(ids, names) {
this.formData.dept_do = ids[0];
this.dept_do_name = names;
},
select_charger_Change(ids, names) {
this.formData.charger = ids[0];
this.charger_name = names;
},
select_monitor_Change(ids, names) {
this.formData.monitor = ids[0];
this.monitor_name = names;
},
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
//operation
getOperation() {
let that = this;
that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; //
that.operationName = res.name; //
this.getOplcates()
});
},
getOplDetail(){
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.formData = res; //
that.operationName = res.operation_.name;
that.dept_do_name = res.dept_do_.name;
that.charger_name = res.charger_.name;
that.monitor_name = res.monitor_.name;
this.getOplcates()
});
},
//ID===>
getOplcates() {
let that = this;
that.$u.api.oplCateItem(that.oplcateId).then((res) => {
console.log(res); //
that.risklist = [];
that.measurelist = [];
that.oplCateName = res.name;
that.oplCateCode = res.code;
let risklist = res.risk_options_;
let measurelist = res.measure_options_;
risklist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.measurelist.push(obj)
})
this.editCheckShow()
});
},
editCheckShow() {
// debugger;
let that = this;
that.risklist.forEach(item => {
if (this.formData.risks_checked.indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
})
that.measurelist.forEach(item => {
if (this.formData.measures_checked.indexOf(item.id) > -1) {
item.checked = true;
} else {
item.checked = false;
}
})
},
//
getRange() {
this.$u.api.areaLists({
page: 0
}).then(res => {
let range = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
range.push(obj);
})
this.range = range
})
},
//dept
getdept() {
let that = this;
that.$u.api.deptList({
page: 0
}).then(res => {
that.depRange = that.redata(res);
console.log(that.depRange)
})
},
redata(postList) {
let posts = [];
postList.forEach((item) => {
let obj = new Object();
obj = {
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
if (item.parentId == null) {
arr.push(item);
continue;
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
console.log(arr);
return arr;
},
checkboxRiskChange(e) {
let values = e.detail.value;
this.formData.risks_checked = values;
// debugger;
// console.log(this.formData.risks_checked);
},
checkboxMeasuresChange(e) {
let values = e.detail.value;
this.formData.measures_checked = values;
// debugger;
// console.log(this.formData.measures_checked);
},
select(row) {},
goBack() {
uni.navigateBack({
delta: 1
})
},
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
console.log(this.formData);
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}&oplCateCode=${that.oplCateCode}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
}
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 113px;
}
.form-info {
width: 720upx;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
.form-item {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
height: 200rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.form-left-text {
color: #212121;
margin-bottom: 33rpx;
}
.form-left {
width: 100%;
}
.form-right {
margin-left: 20rpx;
flex: 1;
color: #414141;
}
.form-right input {
font-size: 30rpx;
}
.form-date>>>.uni-date__x-input {
height: 97rpx;
font-size: 30rpx;
}
.form-date>>>.uni-icons {
display: none;
}
.form-right>>>.uni-label-pointer {
min-width: 50%;
display: inline-block;
margin-bottom: 20rpx;
}
.apply-reason-text {
width: 653rpx;
height: 179rpx;
background-color: #f6f8fc;
border: solid 1rpx #e5e5e5;
margin-top: 21rpx;
padding: 14rpx 24rpx;
font-size: 26rpx;
box-sizing: border-box;
}
.apply_require {
margin-top: 0rpx !important;
}
.form-right {
flex: 1;
color: #414141;
}
.border-bottom {
border-bottom: 1rpx solid #eeeeee;
}
</style>

View File

@ -0,0 +1,555 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="添加作业许可证"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="form-info">
<view class="form-item border-bottom" style="height: 100rpx;">
<view class="">
<text class="form-left-text">关联作业</text>
</view>
<view class="form-right">
<view>{{operationName}}</view>
</view>
</view>
<view class="form-item" style="height: 100rpx;">
<view class="">
<text class="form-left-text">许可证类型</text>
</view>
<view class="form-right">
<view>动火</view>
</view>
</view>
</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业级别</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.level" :localdata="leveloptions">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业部门</text>
</view>
<view class="form-right">
<uni-data-picker placeholder="请选择业务部门" popup-title="请选择业务部门" :localdata="depRange"
v-model="formData.dept_do">
</uni-data-picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业负责人</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.charger" :localdata="userRange">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业监护人</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.monitor" :localdata="userRange">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">风险选择</text>
<!-- risks_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxRiskChange">
<label v-for="(item,index) in risklist" :key="item.value">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他风险</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_risk" maxlength="50" placeholder="请输入" />
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">措施选择</text>
<!-- measures_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxMeasuresChange">
<label v-for="(item,index) in measurelist" :key="item.value"
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他应急处置</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_emr" maxlength="50" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
</view>
</view>
</view>
</view>
<view class="btn">
<button type="primary" class="save-btn" @click="saveSubmit">下一步</button>
</view>
</view>
</template>
<script>
export default {
name: "fire",
data() {
return {
formData: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
level: '',
dept_do: '',
charger: '',
monitor: '',
other_emr: '',
other_risk: '',
risks_checked: [],
measures_checked: [],
},
header: {},
oplId: null,
operationName: '',
oplCateName: '',
fileList: [],
risklist: [],
measurelist: [],
range: [],
userRange: [],
//
depRange: [],
leveloptions: [{
value: "主干道",
text: "主干道"
},
{
value: "次干道",
text: "次干道"
},
],
}
},
onLoad(params) {
// debugger;
console.log(params)
this.operationId = params.operationId;
this.oplcateId = params.oplcateId;
this.type = params.type;
if (params.oplId) {
this.oplId = params.oplId;
this.formData.id = params.oplId;
}else{
console.log('s', this.vuex_user.belong_dept)
this.formData.dept_do = this.vuex_user.belong_dept
}
this.formData.cate = this.oplcateId;
this.formData.operation = this.operationId;
},
onShow() {
debugger;
this.getOperation();
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
this.getHeader();
},
methods: {
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
//operation
getOperation() {
let that = this;
that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; //
that.operationName = res.name; //
console.log(res);
});
},
// getOplDetail(){
// let that = this;
// that.$u.api.oplItem(that.oplId).then((res) => {
// that.formData = res; //
// debugger;
// console.log(res);
// });
// },
//ID===>
getOplcates() {
let that = this;
that.$u.api.oplCateItem(that.oplcateId).then((res) => {
console.log(res); //
that.risklist = [];
that.measurelist = [];
that.oplCateName = res.name;
that.oplcateCode = res.code;
let risklist = res.risk_options_;
let measurelist = res.measure_options_;
if (that.oplId !== null) {
that.editCheckShow(risklist, measurelist);
} else {
risklist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.measurelist.push(obj)
})
}
});
},
editCheckShow(risklist, measurelist) {
debugger;
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.formData = res; //
risklist.forEach(item => {
let obj = {};
obj = item;
if (res.risks_checked.indexOf(item.id) > -1) {
obj.checked = true;
} else {
obj.checked = false;
}
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
if (res.measures_checked.indexOf(item.id) > -1) {
obj.checked = true;
} else {
obj.checked = false;
}
that.measurelist.push(obj)
})
debugger;
console.log(res);
});
},
//
getRange() {
this.$u.api.areaLists({
page: 0
}).then(res => {
let range = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
range.push(obj);
})
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;
that.$u.api.deptList({
page: 0
}).then(res => {
that.depRange = that.redata(res);
console.log(that.depRange)
})
},
redata(postList) {
let posts = [];
postList.forEach((item) => {
let obj = new Object();
obj = {
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
if (item.parentId == null) {
arr.push(item);
continue;
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
console.log(arr);
return arr;
},
checkboxRiskChange(e) {
let values = e.detail.value;
this.formData.risks_checked = values;
// debugger;
// console.log(this.formData.risks_checked);
},
checkboxMeasuresChange(e) {
let values = e.detail.value;
this.formData.measures_checked = values;
// debugger;
// console.log(this.formData.measures_checked);
},
select(row) {},
goBack() {
uni.navigateBack({
delta: 1
})
},
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
console.log(this.formData);
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
}
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 113px;
}
.form-info {
width: 720upx;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
.form-item {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
height: 200rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.form-left-text {
color: #212121;
margin-bottom: 33rpx;
}
.form-left {
width: 100%;
}
.form-right {
margin-left: 20rpx;
flex: 1;
color: #414141;
}
.form-right input {
font-size: 30rpx;
}
.form-date>>>.uni-date__x-input {
height: 97rpx;
font-size: 30rpx;
}
.form-date>>>.uni-icons {
display: none;
}
.form-right>>>.uni-label-pointer {
min-width: 50%;
display: inline-block;
margin-bottom: 20rpx;
}
.apply-reason-text {
width: 653rpx;
height: 179rpx;
background-color: #f6f8fc;
border: solid 1rpx #e5e5e5;
margin-top: 21rpx;
padding: 14rpx 24rpx;
font-size: 26rpx;
box-sizing: border-box;
}
.apply_require {
margin-top: 0rpx !important;
}
.form-right {
flex: 1;
color: #414141;
}
.border-bottom {
border-bottom: 1rpx solid #eeeeee;
}
</style>

View File

@ -0,0 +1,559 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="添加作业许可证"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="form-info">
<view class="form-item border-bottom" style="height: 100rpx;">
<view class="">
<text class="form-left-text">关联作业</text>
</view>
<view class="form-right">
<view>{{operationName}}</view>
</view>
</view>
<view class="form-item" style="height: 100rpx;">
<view class="">
<text class="form-left-text">许可证类型</text>
</view>
<view class="form-right">
<view>动火</view>
</view>
</view>
</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业级别</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.level" :localdata="leveloptions">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业部门</text>
</view>
<view class="form-right">
<uni-data-picker placeholder="请选择业务部门" popup-title="请选择业务部门" :localdata="depRange"
v-model="formData.dept_do">
</uni-data-picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业负责人</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.charger" :localdata="userRange">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业监护人</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.monitor" :localdata="userRange">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">风险选择</text>
<!-- risks_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxRiskChange">
<label v-for="(item,index) in risklist" :key="item.value">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他风险</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_risk" maxlength="50" placeholder="请输入" />
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">措施选择</text>
<!-- measures_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxMeasuresChange">
<label v-for="(item,index) in measurelist" :key="item.value"
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他应急处置</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_emr" maxlength="50" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
</view>
</view>
</view>
</view>
<view class="btn">
<button type="primary" class="save-btn" @click="saveSubmit">下一步</button>
</view>
</view>
</template>
<script>
export default {
name: "fire",
data() {
return {
formData: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
level: '',
dept_do: '',
charger: '',
monitor: '',
other_emr: '',
other_risk: '',
risks_checked: [],
measures_checked: [],
},
header: {},
oplId: null,
operationName: '',
oplCateName: '',
fileList: [],
risklist: [],
measurelist: [],
range: [],
userRange: [],
//
depRange: [],
leveloptions: [{
value: "特级",
text: "特级"
},
{
value: "一级",
text: "一级"
},
{
value: "二级",
text: "二级"
},
],
}
},
onLoad(params) {
// debugger;
console.log(params)
this.operationId = params.operationId;
this.oplcateId = params.oplcateId;
this.type = params.type;
if (params.oplId) {
this.oplId = params.oplId;
this.formData.id = params.oplId;
}else{
console.log('s', this.vuex_user.belong_dept)
this.formData.dept_do = this.vuex_user.belong_dept
}
this.formData.cate = this.oplcateId;
this.formData.operation = this.operationId;
},
onShow() {
debugger;
this.getOperation();
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
this.getHeader();
},
methods: {
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
//operation
getOperation() {
let that = this;
that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; //
that.operationName = res.name; //
console.log(res);
});
},
// getOplDetail(){
// let that = this;
// that.$u.api.oplItem(that.oplId).then((res) => {
// that.formData = res; //
// debugger;
// console.log(res);
// });
// },
//ID===>
getOplcates() {
let that = this;
that.$u.api.oplCateItem(that.oplcateId).then((res) => {
console.log(res); //
that.risklist = [];
that.measurelist = [];
that.oplCateName = res.name;
that.oplcateCode = res.code;
let risklist = res.risk_options_;
let measurelist = res.measure_options_;
if (that.oplId !== null) {
that.editCheckShow(risklist, measurelist);
} else {
risklist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.measurelist.push(obj)
})
}
});
},
editCheckShow(risklist, measurelist) {
debugger;
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.formData = res; //
risklist.forEach(item => {
let obj = {};
obj = item;
if (res.risks_checked.indexOf(item.id) > -1) {
obj.checked = true;
} else {
obj.checked = false;
}
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
if (res.measures_checked.indexOf(item.id) > -1) {
obj.checked = true;
} else {
obj.checked = false;
}
that.measurelist.push(obj)
})
debugger;
console.log(res);
});
},
//
getRange() {
this.$u.api.areaLists({
page: 0
}).then(res => {
let range = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
range.push(obj);
})
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;
that.$u.api.deptList({
page: 0
}).then(res => {
that.depRange = that.redata(res);
console.log(that.depRange)
})
},
redata(postList) {
let posts = [];
postList.forEach((item) => {
let obj = new Object();
obj = {
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
if (item.parentId == null) {
arr.push(item);
continue;
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
console.log(arr);
return arr;
},
checkboxRiskChange(e) {
let values = e.detail.value;
this.formData.risks_checked = values;
// debugger;
// console.log(this.formData.risks_checked);
},
checkboxMeasuresChange(e) {
let values = e.detail.value;
this.formData.measures_checked = values;
// debugger;
// console.log(this.formData.measures_checked);
},
select(row) {},
goBack() {
uni.navigateBack({
delta: 1
})
},
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
console.log(this.formData);
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
}
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 113px;
}
.form-info {
width: 720upx;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
.form-item {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
height: 200rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.form-left-text {
color: #212121;
margin-bottom: 33rpx;
}
.form-left {
width: 100%;
}
.form-right {
margin-left: 20rpx;
flex: 1;
color: #414141;
}
.form-right input {
font-size: 30rpx;
}
.form-date>>>.uni-date__x-input {
height: 97rpx;
font-size: 30rpx;
}
.form-date>>>.uni-icons {
display: none;
}
.form-right>>>.uni-label-pointer {
min-width: 50%;
display: inline-block;
margin-bottom: 20rpx;
}
.apply-reason-text {
width: 653rpx;
height: 179rpx;
background-color: #f6f8fc;
border: solid 1rpx #e5e5e5;
margin-top: 21rpx;
padding: 14rpx 24rpx;
font-size: 26rpx;
box-sizing: border-box;
}
.apply_require {
margin-top: 0rpx !important;
}
.form-right {
flex: 1;
color: #414141;
}
.border-bottom {
border-bottom: 1rpx solid #eeeeee;
}
</style>

View File

@ -0,0 +1,563 @@
<template>
<view class="list-body">
<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="400rpx" leftText="添加作业许可证"
leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
<view class="form-info">
<view class="form-item border-bottom" style="height: 100rpx;">
<view class="">
<text class="form-left-text">关联作业</text>
</view>
<view class="form-right">
<view>{{operationName}}</view>
</view>
</view>
<view class="form-item" style="height: 100rpx;">
<view class="">
<text class="form-left-text">许可证类型</text>
</view>
<view class="form-right">
<view>动火</view>
</view>
</view>
</view>
<view class="form-info">
<view class="form-content ">
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">开始时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.start_time" @change="bindStartDateChange">
<view class="uni-input">{{formData.start_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">结束时间</text>
</view>
<view class="form-right form-date">
<picker mode="date" :value="formData.end_time" @change="bindEndDateChange">
<view class="uni-input">{{formData.end_time}}</view>
</picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业级别</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.level" :localdata="leveloptions">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业部门</text>
</view>
<view class="form-right">
<uni-data-picker placeholder="请选择业务部门" popup-title="请选择业务部门" :localdata="depRange"
v-model="formData.dept_do">
</uni-data-picker>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业负责人</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.charger" :localdata="userRange">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">作业监护人</text>
</view>
<view class="form-right">
<uni-data-select v-model="formData.monitor" :localdata="userRange">
</uni-data-select>
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">风险选择</text>
<!-- risks_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxRiskChange">
<label v-for="(item,index) in risklist" :key="item.value">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他风险</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_risk" maxlength="50" placeholder="请输入" />
</view>
</view>
<view class="form-item border-bottom" style="height: fit-content;">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">措施选择</text>
<!-- measures_checked -->
</view>
<view class="form-right">
<checkbox-group @change="checkboxMeasuresChange">
<label v-for="(item,index) in measurelist" :key="item.value"
style="margin-right: 20rpx;margin-bottom: 20rpx;">
<checkbox :value="item.id" :checked="item.checked" />{{item.name}}
</label>
</checkbox-group>
</view>
</view>
<view class="form-item border-bottom">
<view class="form-left">
<text class="star">*</text>
<text class="form-left-text">其他应急处置</text>
</view>
<view class="form-right">
<input type="text" v-model="formData.other_emr" maxlength="50" placeholder="请输入" />
</view>
</view>
</view>
<view class="form-info">
<view class="form-item " style="height: fit-content;">
<view class="title">照片</view>
<view style="flex: 3;">
<u-upload :action="vuex_apifile" :header="header" ref="uUpload"
:file-list="fileList" max-count="9" @on-success="imgUpSuccess"></u-upload>
</view>
</view>
</view>
</view>
<view class="btn">
<button type="primary" class="save-btn" @click="saveSubmit">下一步</button>
</view>
</view>
</template>
<script>
export default {
name: "fire",
data() {
return {
formData: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
level: '',
dept_do: '',
charger: '',
monitor: '',
other_emr: '',
other_risk: '',
risks_checked: [],
measures_checked: [],
},
header: {},
oplId: null,
operationName: '',
oplCateName: '',
fileList: [],
risklist: [],
measurelist: [],
range: [],
userRange: [],
//
depRange: [],
leveloptions: [{
value: "特级",
text: "特级:>30米"
},
{
value: "三级",
text: "三级:15-30米"
},
{
value: "二级",
text: "二级:>5-15米"
},
{
value: "一级",
text: "一级:1.8-5米"
},
],
}
},
onLoad(params) {
// debugger;
console.log(params)
this.operationId = params.operationId;
this.oplcateId = params.oplcateId;
this.type = params.type;
if (params.oplId) {
this.oplId = params.oplId;
this.formData.id = params.oplId;
}else{
console.log('s', this.vuex_user.belong_dept)
this.formData.dept_do = this.vuex_user.belong_dept
}
this.formData.cate = this.oplcateId;
this.formData.operation = this.operationId;
},
onShow() {
debugger;
this.getOperation();
this.getOplcates();
this.getdept();
this.getRange();
this.getUserRange();
this.getHeader();
},
methods: {
getHeader() {
this.header = {
Authorization: "Bearer " + this.vuex_token
}
},
//operation
getOperation() {
let that = this;
that.$u.api.operationItem(that.operationId).then((res) => {
that.formData.start_time = res.start_time; //
that.formData.end_time = res.end_time; //
that.operationName = res.name; //
console.log(res);
});
},
// getOplDetail(){
// let that = this;
// that.$u.api.oplItem(that.oplId).then((res) => {
// that.formData = res; //
// debugger;
// console.log(res);
// });
// },
//ID===>
getOplcates() {
let that = this;
that.$u.api.oplCateItem(that.oplcateId).then((res) => {
console.log(res); //
that.risklist = [];
that.measurelist = [];
that.oplCateName = res.name;
that.oplcateCode = res.code;
let risklist = res.risk_options_;
let measurelist = res.measure_options_;
if (that.oplId !== null) {
that.editCheckShow(risklist, measurelist);
} else {
risklist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
obj.checked = false;
that.measurelist.push(obj)
})
}
});
},
editCheckShow(risklist, measurelist) {
debugger;
let that = this;
that.$u.api.oplItem(that.oplId).then((res) => {
that.formData = res; //
risklist.forEach(item => {
let obj = {};
obj = item;
if (res.risks_checked.indexOf(item.id) > -1) {
obj.checked = true;
} else {
obj.checked = false;
}
that.risklist.push(obj)
})
measurelist.forEach(item => {
let obj = {};
obj = item;
if (res.measures_checked.indexOf(item.id) > -1) {
obj.checked = true;
} else {
obj.checked = false;
}
that.measurelist.push(obj)
})
debugger;
console.log(res);
});
},
//
getRange() {
this.$u.api.areaLists({
page: 0
}).then(res => {
let range = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
range.push(obj);
})
this.range = range
})
},
//
getUserRange() {
this.$u.api.userList({
page: 0
}).then(res => {
let user = [];
let obj = {};
res.forEach(item => {
obj = {
value: null,
text: ''
};
obj.value = item.id;
obj.text = item.name;
user.push(obj);
})
this.userRange = user
})
},
//dept
getdept() {
let that = this;
that.$u.api.deptList({
page: 0
}).then(res => {
that.depRange = that.redata(res);
console.log(that.depRange)
})
},
redata(postList) {
let posts = [];
postList.forEach((item) => {
let obj = new Object();
obj = {
...item
};
obj.value = item.id;
obj.text = item.name;
obj.parentId = item.parent;
posts.push(obj);
});
let obj = posts.reduce((res, v) => ((res[v.id] = v), res), {}); //Object
let arr = [];
for (let item of posts) {
if (item.parentId == null) {
arr.push(item);
continue;
}
let parent = obj[item.parentId];
parent.children = parent.children ? parent.children : [];
parent.children.push(item);
}
console.log(arr);
return arr;
},
checkboxRiskChange(e) {
let values = e.detail.value;
this.formData.risks_checked = values;
// debugger;
// console.log(this.formData.risks_checked);
},
checkboxMeasuresChange(e) {
let values = e.detail.value;
this.formData.measures_checked = values;
// debugger;
// console.log(this.formData.measures_checked);
},
select(row) {},
goBack() {
uni.navigateBack({
delta: 1
})
},
edit(row) {},
saveSubmit() {
debugger;
uni.showLoading({
title: '提交中'
});
let that = this;
let params = null;
console.log(this.formData);
if (that.oplId !== null) {
that.$u.api.oplUpdate(that.oplId, that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${that.oplId}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
} else {
that.$u.api.oplCreate(that.formData).then(res => {
uni.hideLoading();
params = `?oplId=${res.id}`;
uni.navigateTo({
url: '/pages/workSpace/operation/workerList' + params
})
})
}
},
}
}
</script>
<style>
>>>.uni-navbar__header,
>>>.uni-status-bar {
background-image: linear-gradient(90deg, #164cc3 0%, #2c6fd9 100%), linear-gradient(#e60012, #e60012) !important;
}
.list-body {
background-color: #f3fbff;
padding-bottom: 113px;
}
.form-info {
width: 720upx;
margin: 0 auto;
background-color: #FFFFFF;
border-radius: 5px;
padding: 12px 16px;
box-sizing: border-box;
margin-top: 12px;
}
.row {
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.uni-list-cell {
display: flex;
padding: 10upx;
margin-bottom: 20upx;
border-bottom: 1upx solid #eeeeee;
}
.add {
position: fixed;
bottom: 0;
width: 100%;
height: 120upx;
justify-content: center;
align-items: center;
}
.btn {
margin: auto;
box-shadow: 0upx 5upx 10upx rgba(0, 0, 0, 0.4);
width: 70%;
}
.save-btn {
height: 80rpx;
color: #fff;
font-size: 30upx;
justify-content: center;
align-items: center;
}
.form-item {
font-family: PingFang-SC-Medium;
font-size: 30rpx;
height: 200rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
}
.form-left-text {
color: #212121;
margin-bottom: 33rpx;
}
.form-left {
width: 100%;
}
.form-right {
margin-left: 20rpx;
flex: 1;
color: #414141;
}
.form-right input {
font-size: 30rpx;
}
.form-date>>>.uni-date__x-input {
height: 97rpx;
font-size: 30rpx;
}
.form-date>>>.uni-icons {
display: none;
}
.form-right>>>.uni-label-pointer {
min-width: 50%;
display: inline-block;
margin-bottom: 20rpx;
}
.apply-reason-text {
width: 653rpx;
height: 179rpx;
background-color: #f6f8fc;
border: solid 1rpx #e5e5e5;
margin-top: 21rpx;
padding: 14rpx 24rpx;
font-size: 26rpx;
box-sizing: border-box;
}
.apply_require {
margin-top: 0rpx !important;
}
.form-right {
flex: 1;
color: #414141;
}
.border-bottom {
border-bottom: 1rpx solid #eeeeee;
}
</style>