添加普通作业许可

This commit is contained in:
caoqianming 2022-11-01 16:27:15 +08:00
parent 9c5b84b9e4
commit 8427ea66f1
13 changed files with 722 additions and 18 deletions

View File

@ -285,6 +285,17 @@ const routes = [
"perms": ["operation"]
},
"component": "opm/usecl"
},
{
"name": "normal",
"path": "/opm/normal",
"meta": {
"title": "普通作业许可证",
"icon": "el-icon-menu",
"hidden": true,
"perms": ["operation"]
},
"component": "opm/normal"
}
]
},

View File

@ -662,7 +662,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -660,7 +660,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -673,7 +673,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -499,7 +499,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -498,7 +498,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

689
src/views/opm/normal.vue Normal file
View File

@ -0,0 +1,689 @@
<template>
<el-container>
<el-header>
<el-steps
:active="active"
style="width: 100%"
:align-center="true"
finish-status="success"
>
<el-step
v-for="(item, index) of stepTitle"
:key="index"
:title="item"
style="50%"
@click="handleStep(index)"
>
</el-step>
</el-steps>
</el-header>
<!--基本信息!-->
<el-main class="nopadding" v-show="active === 0">
<el-form
v-show="active === 0"
ref="dialogForm"
:model="form"
:rules="rules"
label-width="110px"
style="margin: 40px 40px 0px 40px"
>
<el-row>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="关联作业">
<el-input
v-model="form.name"
type="text"
:disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业许可种类">
<el-input
v-model="pagtitle"
type="text"
:disabled="true"
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业开始时间" prop="start_time">
<el-date-picker
v-model="form.start_time"
type="datetime"
placeholder="选择开始时间"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业结束时间" prop="end_time">
<el-date-picker
v-model="form.end_time"
type="datetime"
placeholder="选择开始时间"
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24" >
<el-form-item label="作业部门" prop="dept_do">
<el-cascader
placeholder="选择作业部门"
getCheckedNodes="true"
v-model="form.dept_do"
:options="deptoptions"
:props="{
expandTrigger: 'hover', //
label: 'label', //
value: 'value', //
emitPath: false, // false
checkStrictly: true
}"
clearable
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业负责人" prop="charger">
<el-input
v-model="form.charger_name"
style="width:200px"
disabled
></el-input>
<!-- <el-select v-model="form.charger_name" placeholder="选择作业负责人">
<el-option
v-for="item in useroptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select> -->
<ehsUserSelect :multiple="false" @submit="getCharger"/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业监护人" prop="monitor">
<el-input
v-model="form.monitor_name"
style="width:200px"
disabled
></el-input>
<ehsUserSelect :multiple="false" @submit="getMonitor"/>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="风险选择" prop="risks_checked">
<el-checkbox-group v-model="form.risks_checked">
<el-checkbox
v-for="(item, index) in risklist"
:key="index"
:label="item.id"
>{{ item.name }}
</el-checkbox
>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="其他风险">
<el-input
v-model="form.other_risk"
type="text"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="措施选择" prop="measures_checked">
<el-checkbox-group v-model="form.measures_checked">
<el-checkbox
v-for="(item, index) in measurelist"
:key="index"
:label="item.id"
>{{ item.name }}
</el-checkbox
>
</el-checkbox-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div style="margin-bottom: 20px; text-align:center">
<el-button type="primary" plain @click="handleNextStep"
>下一步
</el-button>
</div>
</el-main>
<!--作业人员!-->
<el-main class="nopadding" v-show="active === 1">
<div class="left-panel" style="margin: 10px">
<el-button
type="primary"
icon="el-icon-plus"
@click="addworker"
></el-button>
</div>
<scTable
ref="workerTable"
:data="apiworkerObj"
row-key="id"
hidePagination
stripe
hideDo
style="height: 300px;"
>
<el-table-column
label="#"
fixed="left"
type="index"
width="50"
></el-table-column>
<el-table-column label="姓名" prop="name" width="150">
<template #default="scope">
{{ scope.row.worker_.name }}
</template>
</el-table-column>
<el-table-column label="工作职责" prop="duty" width="150">
</el-table-column>
<el-table-column label="证书" prop="certificates" width="150">
<template #default="scope">
<el-tag v-for="item in scope.row.certificates_"
:key="item.number"
:label="item.name"
:value="item.number">{{item.name}}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="150"
></el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="200">
<template #default="scope">
<el-popconfirm
title="确定删除该作业人员吗?"
@confirm="delWorker(scope.row)"
>
<template #reference>
<el-button text type="danger" size="small">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</scTable>
<el-dialog v-model="workerdialog" draggable title="选择作业人员">
<el-form
ref="workerForm"
:model="formworker"
:rules="rules"
:disabled="mode == 'show'"
label-width="80px"
width="70%"
style="margin: 40px 40px 40px 40px"
>
<el-row>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="作业人员">
<el-input
v-model="formworker.worker_name"
style="width:200px"
disabled
></el-input>
<ehsUserSelect :multiple="false" @submit="getWorker"/>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="工作职责">
<el-select
v-model="formworker.duty"
filterable
allow-create
default-first-option
:reserve-keyword="false"
>
<el-option
v-for="item in dutyOptions"
:key="item.value"
:label="item.label"
:value="item.label"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="证书">
<el-select
v-model="formworker.certificates"
multiple
placeholder="选择证书"
>
<el-option
v-for="item in certificatesOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="dialogcart = false"> </el-button>
<el-button type="primary" @click="submitWorker"> </el-button>
</template>
</el-dialog>
<div style="margin-top:20px;text-align:center">
<el-button @click="handleLastStep" style="margin-right:4px">上一步</el-button>
<el-button
:loading="tLoading"
v-for=" item in initForm.transitions"
:key="item.id"
type="primary"
@click="submitTicketCreate(item.id)"
style="margin-right:4px"
>{{item.name}}
</el-button>
<el-button @click="submitOut" type="warning">退出</el-button>
</div>
</el-main>
</el-container>
</template>
<style scoped>
.clearfix {
font-size: 20px;
}
.box-card p {
line-height: 20px;
}
.content {
margin-top: 10px;
}
.stepSuc:hover {
cursor: pointer;
}
.stepErr:hover {
cursor: not-allowed;
}
</style>
<script>
import {genTree} from "@/utils/verificate";
const defaultformworker = {
id: "",
worker: null,
duty: "作业人员",
certificates: [],
opl: "",
};
const defaultformgas = {
id: "",
check_time: null,
opl:""
};
export default {
name: "fire",
components: {},
data() {
return {
active: 0,
stepSuc: [0],
stepTitle: ["基本信息", "作业人员"],
query: {},
selection: [],
issave: false, //
search: {
keyword: null,
},
form: {
id: "",
start_time: null,
end_time: null,
operation: "",
cate: "",
risks_checked: [],
},
initForm: {},
operationId: "",
oplcateId: "",
oplcateCode: "",
oplId: "",
leveloptions: [
{ id: "主干道", name: "主干道" },
{ id: "次干渠", name: "次干渠" }
],
deptoptions: [],
useroptions: [],
risklist: [],
measurelist: [],
pagtitle: "",
dutyOptions: [
{value: 10, label: "作业人员"},
{value: 20, label: "起重司机"},
{value: 30, label: "司索人员"},
{value: 40, label: "起重指挥"},
{value: 40, label: "电工"},
],
certificatesOptions: [],
formworker: defaultformworker,
apiworkerObj: [],
workerdialog: false,
gasdialog: false,
formgas: defaultformgas,
apigasObj: [],
is_ok_: {
true: "正常",
false: "不正常",
},
tLoading: false,
rules: {
start_time: [
{required: true, message: '请选择'}
],
end_time: [
{required: true, message: '请选择'}
],
dept_do: [
{required: true, message: '请选择'}
],
charger: [
{required: true, message: '请选择'}
],
monitor: [
{required: true, message: '请选择'}
],
risks_checked: [
{required: true, message: '请选择'}
],
measures_checked: [
{required: true, message: '请选择'}
],
}
};
},
mounted() {
this.operationId = this.$route.query.operationid; //ID
this.oplcateId = this.$route.query.oplcateId; //ID
this.oplId = this.$route.query.oplId; //ID
this.getoplData();
this.getInit();
this.getDept();
// this.getUser();
},
methods: {
getCharger(data) {
this.form.charger=data.id;
this.form.charger_name=data.name
},
getChecker(data){
this.formgas.checker=data.id;
this.formgas.checker_name=data.name
},
getMonitor(data) {
this.form.monitor=data.id;
this.form.monitor_name=data.name
},
getWorker(data) {
this.formworker.worker=data.id,
this.formworker.worker_name=data.name
this.selectWorker()
},
getoplData() {
if (this.oplId == "") {
this.getOperation();
this.getOplcates();
} else {
this.getData();
}
},
//oplId
getData() {
this.$API.opm.opl.read.req(this.oplId).then((res) => {
this.form = res;
this.oplId = res.id;
this.oplcateId = res.cate;
this.operationId = res.operation;
this.getOperation();
this.getOplcates();
});
},
//operationId
getOperation() {
this.$API.opm.operation.read.req(this.operationId).then((res) => {
this.form.start_time = res.start_time; //
this.form.end_time = res.end_time; //
this.form.name = res.name; //
console.log(res);
});
},
//
getDept() {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},
//
//
//ID===>
getOplcates() {
this.$API.opm.oplcate.read.req(this.oplcateId).then((res) => {
console.log(res); //
this.pagtitle = res.name;
this.oplcateCode = res.code;
this.risklist = res.risk_options_; //
this.measurelist = res.measure_options_; //
});
},
handleStep(val) {
//
if (this.stepSuc.includes(val) === true) {
this.active = val;
}
},
//
handleLastStep() {
if (--this.active === 0) {
this.active = 0;
}
},
//
handleNextStep() {
if (this.active == 0) {
this.$refs.dialogForm.validate((valid) => {
if (valid) {
//
if (this.oplId == "") {
//
debugger;
this.form.cate = this.oplcateId;
this.form.operation = this.operationId;
console.log(this.form);
this.$API.opm.opl.create
.req(this.form)
.then((res) => {
this.$emit("success", this.form);
this.$message.success("创建成功");
this.issave = true;
this.active = 1;
this.oplId = res.id;
this.getworkerList();
this.getgasList();
return res;
})
.catch((err) => {
return err;
});
} else if (this.oplId != "") {
this.$API.opm.opl.update.req(this.oplId, this.form).then(() => {
this.$message.success("基本修改成功!");
this.issave = true;
this.active = 1;
this.getgasList();
this.getworkerList();
});
} else {
this.active = 1;
}
}
})
}
// this.stepSuc.push(++this.active)
},
//
selectWorker() {
this.$API.hrm.certificate.list
.req({employee__user: this.formworker.worker, page: 0})
.then((res) => {
this.certificatesOptions = res;
console.log(res);
});
},
//
getworkerList() {
this.$API.opm.worker.list.req({opl: this.oplId, page: 0}).then((res) => {
this.apiworkerObj = res;
console.log(res);
});
},
//Form
addworker() {
this.workerdialog = true;
this.formworker = Object.assign({}, defaultformworker);
},
//
delWorker(row) {
this.$API.opm.worker.delete
.req(row.id)
.then((res) => {
this.$message.success("作业人员删除成功");
this.getworkerList()
return res;
})
.catch((err) => {
return err;
});
},
//
submitWorker() {
this.formworker.opl = this.oplId;
this.$refs.workerForm.validate(async (valid) => {
this.$API.opm.worker.create
.req(this.formworker)
.then((res) => {
this.$message.success("创建作业人员成功");
this.getworkerList();
this.workerdialog = false;
})
.catch((err) => {
return err;
});
});
},
//
getgasList() {
this.$API.opm.gas.list.req({opl: this.oplId, page: 0}).then((res) => {
this.apigasObj = res;
console.log(res);
});
},
//Form
addgas() {
this.gasdialog = true;
this.formgas = Object.assign({}, defaultformgas);
},
//
submitgas() {
this.formgas.opl = this.oplId;
this.$refs.gasForm.validate(async (valid) => {
this.$API.opm.gas.create
.req(this.formgas)
.then((res) => {
this.$message.success("创建气体检测记录成功");
this.getgasList();
this.gasdialog = false;
})
.catch((err) => {
return err;
});
});
},
//
delgas(row) {
this.$API.opm.gas.delete
.req(row.id)
.then((res) => {
this.$message.success("气体检测记录删除成功");
this.getgasList()
return res;
})
.catch((err) => {
return err;
});
},
//
getInit() {
this.$API.wf.workflow.initkey.req('opl_normal').then((res) => {
this.initForm = res;
});
},
//,
submitTicketCreate(id) {
if(this.apiworkerObj.length==0){
this.$message.warning("请添加作业人员");
return
}
let ticket = {};
ticket.workflow = this.initForm.workflow;
ticket.ticket_data = {opl: this.oplId};
ticket.transition = id;
ticket.title = this.form.name + '-申请';
this.tLoading = true
this.$API.wf.ticket.create.req(ticket).then((res) => {
this.tLoading = false
this.$message.success("提交成功");
this.submitOut()
}).catch(e=>{this.tLoading=false});
},
//退
submitOut() {
this.$router.push({
name: "opl",
query: {
id: this.operationId,//ID
},
});
}
},
};
</script>

View File

@ -20,14 +20,13 @@
<el-table-column label="标识" prop="code" width="180">
</el-table-column>
<el-table-column label="排序" prop="sort" width="180">
</el-table-column>
<el-table-column label="操作" fixed="right" align="right" width="170">
<template #default="scope">
<el-button-group>
<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
<el-button text type="warning" size="small" @click="table_edit(scope.row, scope.$index)" v-auth="'opl_cate.update'">编辑</el-button>
</el-button-group>
<el-button link type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
<el-button link type="warning" size="small" @click="table_edit(scope.row, scope.$index)" v-auth="'opl_cate.update'">编辑</el-button>
</template>
</el-table-column>

View File

@ -26,8 +26,12 @@
<el-input v-model="form.name" type="text" clearable></el-input>
</el-form-item>
</el-col>
<el-col :md="8" :sm="12" :xs="24">
<el-form-item label="排序">
<el-input-number v-model="form.sort" :min="1"/>
</el-form-item>
</el-col>
<!-- <el-col :md="8" :sm="12" :xs="24">
<el-form-item label="工作流">
<el-select v-model="form.workflow">
<el-option
@ -38,7 +42,7 @@
/>
</el-select>
</el-form-item>
</el-col>
</el-col> -->
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="风险分析">
<el-transfer
@ -124,7 +128,7 @@ export default {
};
},
mounted() {
this.getWorkflow();
// this.getWorkflow();
this.getRisk();
this.getMeasure();
this.getClose();

View File

@ -501,7 +501,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -499,7 +499,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -676,7 +676,7 @@
},
//
getDept() {
this.$API.system.dept.list.req({page: 0}).then((res) => {
this.$API.system.dept.list.req({page: 0, type__in:'dept,rparty'}).then((res) => {
this.deptoptions = genTree(res);
});
},

View File

@ -78,6 +78,7 @@
label: 'label', //
value: 'value', //
emitPath: false, // false
checkStrictly: true
}"
clearable
/>
@ -571,7 +572,7 @@ export default {
},
//
getDept() {
this.$API.system.dept.list.req({ page: 0 }).then((res) => {
this.$API.system.dept.list.req({ page: 0, type__in:'dept,rparty' }).then((res) => {
this.deptoptions = genTree(res);
});
},