This commit is contained in:
2309368887@qq.com 2022-06-24 09:18:18 +08:00
parent 2039b52b40
commit 25e9acae47
6 changed files with 958 additions and 203 deletions

View File

@ -21,6 +21,13 @@ export default {
data); data);
} }
}, },
read:{
name: "查询",
req: async function(id){
return await http.get(
`${config.API_URL}/opm/opl_cate/${id}/`);
}
},
create: { create: {
name: "创建", name: "创建",
req: async function(data){ req: async function(data){
@ -51,6 +58,13 @@ export default {
); );
} }
}, },
read:{
name: "查询",
req: async function(id){
return await http.get(
`${config.API_URL}/opm/operation/${id}/`);
}
},
update: { update: {
name: "更新", name: "更新",
req: async function(id, data){ req: async function(id, data){

View File

@ -123,13 +123,13 @@ const routes = [
}, },
"component": "wf/ticket" "component": "wf/ticket"
}, },
{ {
"name": "configuration", "name": "configuration",
"path": "/wf/configuration", "path": "/wf/configuration",
"meta": { "meta": {
"title": "工单", "title": "工单",
"icon": "el-icon-menu", "icon": "el-icon-menu",
"hidden":true "hidden": true
}, },
"component": "wf/configuration" "component": "wf/configuration"
}, },
@ -162,6 +162,28 @@ const routes = [
}, },
"component": "opm/oplcate" "component": "opm/oplcate"
}, },
,
{
"name": "opl",
"path": "/opm/opl/:id",
"meta": {
"title": "作业许可证",
"icon": "el-icon-menu",
"hidden": true
},
"component": "opm/opl"
},
,
{
"name": "fire",
"path": "/opm/fire/:id",
"meta": {
"title": "许可证基本信息",
"icon": "el-icon-menu",
"hidden": true
},
"component": "opm/fire"
},
] ]
}, },
{ {
@ -249,15 +271,15 @@ const routes = [
}, },
"component": "am/area" "component": "am/area"
}, },
{ {
"name": "eqm", "name": "eqm",
"path": "/am/eqm", "path": "/am/eqm",
"meta": { "meta": {
"title": "门禁通道", "title": "门禁通道",
"icon": "el-icon-menu", "icon": "el-icon-menu",
}, },
"component": "am/em1" "component": "am/em1"
}, },
] ]
}, },
{ {

378
src/views/opm/fire.vue Normal file
View File

@ -0,0 +1,378 @@
<template>
<el-container>
<el-header>
<el-steps :active="active" finish-status="success">
<el-step
v-for="(item, index) of stepTitle"
:key="index"
:title="item"
@click="handleStep(index)"
>
</el-step>
</el-steps>
</el-header>
<el-main class="nopadding">
<el-form
v-show="active === 0"
ref="dialogForm"
:model="form"
:rules="rules"
label-width="110px"
style="margin: 40px 40px 40px 40px"
>
<el-row>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="关联作业">
<el-input
v-model="operationId"
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="作业开始时间">
<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="作业结束时间">
<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="作业级别">
<el-select v-model="form.level" placeholder="选择作业级别">
<el-option
v-for="item in leveloptions"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业部门">
<el-cascader
placeholder="选择作业部门"
getCheckedNodes="true"
v-model="form.dept_do"
:options="deptoptions"
:props="{
expandTrigger: 'hover', //
label: 'label', //
value: 'value', //
emitPath: false, // false
}"
clearable
/>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业负责人">
<el-select v-model="form.charger" placeholder="选择作业负责人">
<el-option
v-for="item in useroptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业监护人">
<el-select v-model="form.monitor" placeholder="选择作业监护人">
<el-option
v-for="item in useroptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
</el-col>
<!--
临时用电
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="安装/拆除">
<el-input v-model="work_type" type="text" clearable></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="安装/拆除时间">
<el-input v-model="work_time" type="text" clearable></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="验收时间">
<el-input v-model="accept_time" type="text" clearable></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="用电地点">
<el-input v-model="power_to" type="text" clearable></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="电源接入点">
<el-input v-model="power_from" type="text" clearable></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="用电开始">
<el-input
v-model="power_start_time"
type="text"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="用电截至">
<el-input
v-model="power_end_time"
type="text"
clearable
></el-input>
</el-form-item>
</el-col>
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="计划用电天数">
<el-input v-model="power_days" type="text" clearable></el-input>
</el-form-item>
</el-col> !-->
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="风险选择">
<el-checkbox-group
v-model="form.risks_checked"
@change="handleCheckedRisksChange"
>
<el-checkbox
v-for="(item, index) in risklist"
:key="index"
:label="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="12" :sm="12" :xs="24">
<el-form-item label="逃生路径">
<el-input v-model="escape_route" type="text" clearable></el-input>
</el-form-item>
</el-col> !-->
<el-col :md="24" :sm="12" :xs="24">
<el-form-item label="措施选择">
<el-checkbox-group
v-model="form.measures_checked"
@change="handleCheckedMeasuresChange"
>
<el-checkbox
v-for="(item, index) in measurelist"
:key="index"
:label="item.name"
></el-checkbox>
</el-checkbox-group>
</el-form-item>
</el-col>
<el-col :md="24" :sm="12" :xs="24">
<el-card class="box-card">
<div class="clearfix">
<span>应急处置</span>
</div>
<div class="content">
<p>1发生火灾时立即使用消防器材边灭火边报告</p>
<p>2预判火势无法控制时应立即疏散人群并拨打110或119求救</p>
<p>
3发生人员烫伤时用清水对烫伤部位进行冲洗或浸泡用干净的纱布或衣物盖住被烫伤部位伤势严重时立即拨打120送医若贴身衣服与伤口粘在一起时可用剪刀剪开然后缓慢剥离衣物
</p>
</div>
</el-card>
<el-form-item label="其他应急处置">
<el-input
v-model="form.other_emr"
type="text"
clearable
></el-input>
</el-form-item>
</el-col>
<!--
<el-col :md="12" :sm="12" :xs="24">
<el-form-item label="作业审批照片">
<el-input v-model="create_imgs" type="text" clearable></el-input>
</el-form-item>
</el-col>
!-->
</el-row>
<el-row>
<el-col :md="24" :sm="12" :xs="24">
<el-form-item>
<el-button style="margin-top: 12px" @click="handleNextStep"
>下一步</el-button
>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div v-show="active === 1">
面板2
<el-button style="margin-top: 12px" @click="handleLastStep"
>上一步</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";
export default {
name: "fire",
components: {},
data() {
return {
active: 0,
stepSuc:[0],
stepTitle:['基本信息','作业人员'],
apiObj: this.$API.opm.oplcate.list,
query: {},
selection: [],
search: {
keyword: null,
},
form: {
start_time: null,
end_time: null,
},
operationId: "",
oplId: "",
leveloptions: [
{ id: 10, name: "特殊动火" },
{ id: 20, name: "一级动火" },
{ id: 30, name: "二级动火" },
],
deptoptions: [],
useroptions: [],
risklist: [],
measurelist: [],
pagtitle: "",
};
},
mounted() {
this.operationId = this.$route.params.operationid; //
this.oplId = this.$route.params.oplId; //
this.getOperation();
this.getOplcates();
this.getDept();
this.getUser();
this.getOplcates();
},
methods: {
//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; //
console.log(res);
});
},
//
getDept() {
this.$API.system.dept.list.req({ page: 0 }).then((res) => {
this.deptoptions = genTree(res);
});
},
//
getUser() {
this.$API.system.user.list.req({ page: 0 }).then((res) => {
this.useroptions = res;
});
},
//ID
getOplcates() {
this.$API.opm.oplcate.read.req(this.oplId).then((res) => {
console.log(res); //
this.pagtitle = res.name;
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(){
this.stepSuc.push(++this.active)
},
},
};
</script>

View File

@ -1,162 +1,274 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<div class="left-panel"> <div class="left-panel">
<el-button type="primary" icon="el-icon-plus" @click="add"></el-button> <el-button type="primary" icon="el-icon-plus" @click="add"></el-button>
<!-- <el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button> <!-- <el-button type="danger" plain icon="el-icon-delete" :disabled="selection.length==0" @click="batch_del"></el-button>
<el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button> --> <el-button type="primary" plain :disabled="selection.length!=1" @click="permission">权限设置</el-button> -->
</div> </div>
<div class="right-panel"> <div class="right-panel">
<div class="right-panel-search"> <div class="right-panel-search">
<el-input v-model="search.keyword" placeholder="名称" clearable @click="upsearch"></el-input> <el-input
<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button> v-model="search.keyword"
</div> placeholder="名称"
</div> clearable
</el-header> @click="upsearch"
<el-main class="nopadding"> ></el-input>
<scTable ref="table" :apiObj="apiObj" row-key="id" @selection-change="selectionChange" stripe @resetQuery="resetQuery" > <el-button
<el-table-column label="#" type="index" width="50"></el-table-column> type="primary"
<el-table-column label="名称" prop="name" width="200"></el-table-column> icon="el-icon-search"
<el-table-column label="标识" prop="code" width="180"> @click="upsearch"
></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
@selection-change="selectionChange"
stripe
@resetQuery="resetQuery"
>
<el-table-column
label="#"
fixed="left"
type="index"
width="50"
></el-table-column>
<el-table-column
label="作业简介"
prop="name"
width="200"
fixed="left"
></el-table-column>
<el-table-column label="作业状态" prop="state" width="180" fixed="left">
<template #default="scope">{{
stateoptions[scope.row.state]
}}</template></el-table-column
>
<el-table-column
label="生产状态"
prop="state_work"
width="180"
fixed="left"
></el-table-column>
<el-table-column
label="具体地点"
prop="place"
width="180"
></el-table-column>
<el-table-column
label="作业开始时间"
prop="start_time"
width="180"
></el-table-column>
<el-table-column
label="作业结束时间"
prop="end_time"
width="180"
></el-table-column>
</el-table-column> <el-table-column
label="作业区域"
<el-table-column label="操作" fixed="right" align="right" width="170"> prop="area"
<template #default="scope"> width="180"
<el-button-group> ></el-table-column>
<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button> <el-table-column
<el-button text type="warning" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button> label="属地部门"
prop="dept_ter"
</el-button-group> width="180"
</template> ></el-table-column>
</el-table-column> <el-table-column
label="业务部门"
</scTable> prop="dept_bus"
</el-main> width="180"
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog> ></el-table-column>
</el-container> <el-table-column
label="业务部门协调员"
prop="coordinator"
</template> width="180"
></el-table-column>
<el-table-column
label="创建人"
prop="create_by"
width="180"
></el-table-column>
<el-table-column
label="创建时间"
prop="create_time"
width="180"
></el-table-column>
<el-table-column label="操作" fixed="right" align="left" width="170">
<template #default="scope">
<el-button-group>
<el-button
text
type="primary"
size="small"
@click="creatopl(scope.row)"
>许可证</el-button>
<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)"
>编辑</el-button
>
</el-button-group>
</template>
</el-table-column>
</scTable>
</el-main>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</el-container>
</template>
<script> <script>
import saveDialog from './operation_form.vue' import saveDialog from "./operation_form.vue";
export default { export default {
name: 'operation', name: "operation",
components: { components: {
saveDialog saveDialog,
}, },
data() { data() {
return { return {
dialog: { dialog: {
save: false, save: false,
permission: false permission: false,
}, },
apiObj: this.$API.opm.operation.list, apiObj: this.$API.opm.operation.list,
query: {}, query: {},
selection: [], selection: [],
search: { search: {
keyword: null keyword: null,
} },
} stateoptions: {
}, 10: "创建中",
methods: { 20: "审批中",
// 30: "待作业",
add(){ 40: "作业中",
this.dialog.save = true 50: "已关闭",
this.$nextTick(() => { },
this.$refs.saveDialog.open('add') };
}) },
}, methods: {
// //
table_edit(row){ add() {
this.dialog.save = true this.dialog.save = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.saveDialog.open('edit').setData(row) this.$refs.saveDialog.open("add");
}) });
}, },
//
table_show(row){
this.dialog.save = true
this.$nextTick(() => {
this.$refs.saveDialog.open('show').setData(row)
})
},
//
permission(){
this.dialog.permission = true
this.$nextTick(() => {
this.$refs.permissionDialog.open()
})
},
//
async table_del(row){
var reqData = {id: row.id}
var res = await this.$API.demo.post.post(reqData);
if(res.code == 200){
this.$refs.table.refresh()
this.$message.success("删除成功")
}else{
this.$alert(res.message, "提示", {type: 'error'})
}
},
//
async batch_del(){
this.$confirm(`确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`, '提示', {
type: 'warning'
}).then(() => {
const loading = this.$loading();
this.$refs.table.refresh()
loading.close();
this.$message.success("操作成功")
}).catch(() => {
}) //
}, table_edit(row) {
// this.dialog.save = true;
selectionChange(selection){ this.$nextTick(() => {
this.selection = selection; this.$refs.saveDialog.open("edit").setData(row);
}, });
// },
changeSwitch(val, row){ //
row.status = row.status == '1'?'0':'1' table_show(row) {
row.$switch_status = true; this.dialog.save = true;
setTimeout(()=>{ this.$nextTick(() => {
delete row.$switch_status; this.$refs.saveDialog.open("show").setData(row);
row.status = val; });
this.$message.success("操作成功") },
}, 500) //
}, creatopl(row){
//
upsearch(){
}, this.$router.push({name: "opl", params: {id: row.id} })
//ID },
filterTree(id){ //
var target = null; permission() {
function filter(tree){ this.dialog.permission = true;
tree.forEach(item => { this.$nextTick(() => {
if(item.id == id){ this.$refs.permissionDialog.open();
target = item });
} },
if(item.children){ //
filter(item.children) async table_del(row) {
} var reqData = { id: row.id };
}) var res = await this.$API.demo.post.post(reqData);
} if (res.code == 200) {
filter(this.$refs.table.tableData) this.$refs.table.refresh();
return target this.$message.success("删除成功");
}, } else {
// this.$alert(res.message, "提示", { type: "error" });
handleSaveSuccess(data, mode){ }
if(mode=='add'){ },
this.$refs.table.refresh() //
}else if(mode=='edit'){ async batch_del() {
this.$refs.table.refresh() this.$confirm(
} `确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`,
}, "提示",
resetQuery(){ {
this.query = {} type: "warning",
} }
} )
} .then(() => {
</script> const loading = this.$loading();
this.$refs.table.refresh();
loading.close();
this.$message.success("操作成功");
})
.catch(() => {});
},
//
selectionChange(selection) {
this.selection = selection;
},
//
changeSwitch(val, row) {
row.status = row.status == "1" ? "0" : "1";
row.$switch_status = true;
setTimeout(() => {
delete row.$switch_status;
row.status = val;
this.$message.success("操作成功");
}, 500);
},
//
upsearch() {},
//ID
filterTree(id) {
var target = null;
function filter(tree) {
tree.forEach((item) => {
if (item.id == id) {
target = item;
}
if (item.children) {
filter(item.children);
}
});
}
filter(this.$refs.table.tableData);
return target;
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
resetQuery() {
this.query = {};
},
},
};
</script>

View File

@ -65,45 +65,30 @@
v-for="item in areaoptions" v-for="item in areaoptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.name" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24" :xs="24"> <el-col :md="12" :sm="24" :xs="24">
<el-form-item label="所属部门"> <el-form-item label="业务部门">
<el-cascader <el-cascader
placeholder="选择所属部门" placeholder="选择业务部门"
v-model="form.belong_dept" getCheckedNodes="true"
:props="{
expandTrigger: 'hover', //
label: 'label', //
value: 'value', //
emitPath: false, // false
}"
v-model="form.dept_bus"
:options="deptoptions" :options="deptoptions"
clearable clearable
/> />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="属地部门">
<el-select v-model="form.dept_ter" placeholder="选择属地部门">
<el-option
v-for="item in deptoptions"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="业务部门">
<el-select v-model="form.dept_bus" placeholder="选择业务部门">
<el-option
v-for="item in deptoptions"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :md="12" :sm="24" :xs="24"> <el-col :md="12" :sm="24" :xs="24">
<el-form-item label="部门协调员"> <el-form-item label="部门协调员">
@ -115,10 +100,27 @@
v-for="item in coordinatoroptions" v-for="item in coordinatoroptions"
:key="item.id" :key="item.id"
:label="item.name" :label="item.name"
:value="item.name" :value="item.id"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col>
<el-col :md="12" :sm="24" :xs="24">
<el-form-item label="属地部门">
<el-cascader
placeholder="选择属地部门"
getCheckedNodes="true"
v-model="form.dept_ter"
:options="deptoptions"
:props="{
expandTrigger: 'hover', //
label: 'label', //
value: 'value', //
emitPath: false, // false
}"
clearable
/>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
@ -134,7 +136,7 @@
</template> </template>
<script> <script>
import {genTree} from "@/utils/verificate"; import { genTree } from "@/utils/verificate";
export default { export default {
emits: ["success", "closed"], emits: ["success", "closed"],
data() { data() {
@ -164,33 +166,42 @@ export default {
stateoptions: [ stateoptions: [
{ id: 10, name: "运行" }, { id: 10, name: "运行" },
{ id: 20, name: "停机" }, { id: 20, name: "停机" },
{ id: 20, name: "检修" }, { id: 30, name: "检修" },
], ],
deptoptions: [], deptoptions: [],
areaoptions: [], areaoptions: [],
coordinatoroptions:[],
}; };
}, },
mounted() { mounted() {
this.getDept(); this.getDept();
this.getArea(); this.getArea();
this.getUser();
}, },
methods: { methods: {
//, //,
getDept() { getDept() {
this.$API.system.dept.list.req({ page: 0 }).then((res) => { this.$API.system.dept.list.req({ page: 0 }).then((res) => {
this.deptoptions = genTree(res); this.deptoptions = genTree(res);
console.log(this.deptoptions);
}); });
}, },
// //
getArea() { getArea() {
this.$API.am.area.list.req({ page: 0 }).then((res) => { this.$API.am.area.list.req({ page: 0 }).then((res) => {
console.log(res);
this.areaoptions = res; this.areaoptions = res;
}); });
}, },
//
getUser() {
this.$API.system.user.list.req({ page: 0 }).then((res) => {
this.coordinatoroptions = res;
});
},
// //
open(mode = "add") { open(mode = "add") {
this.mode = mode; this.mode = mode;
@ -205,7 +216,8 @@ export default {
try { try {
var res; var res;
if (this.mode == "add") { if (this.mode == "add") {
res = await this.$API.opm.operation.create.req(this.form); res = await this.$API.opm.operation.create.req(this.form);
console.log(this.form);
} else if (this.mode == "edit") { } else if (this.mode == "edit") {
res = await this.$API.opm.operation.update.req( res = await this.$API.opm.operation.update.req(
this.form.id, this.form.id,

217
src/views/opm/opl.vue Normal file
View File

@ -0,0 +1,217 @@
<template>
<el-container>
<el-header>
<div class="left-panel">
<el-button
icon="el-icon-plus"
style="margin: 3px 0px 0px 10px"
v-for="(item, index) in oplcateList"
:key="index"
:title="item.name"
type="primary"
@click="addFire(item.id)"
>
{{ item.name }}
</el-button>
</div>
<div class="right-panel">
<div class="right-panel-search">
<el-input
v-model="search.keyword"
placeholder="名称"
clearable
@click="upsearch"
></el-input>
<el-button
type="primary"
icon="el-icon-search"
@click="upsearch"
></el-button>
</div>
</div>
</el-header>
<el-main class="nopadding">
<scTable
ref="table"
:apiObj="apiObj"
row-key="id"
@selection-change="selectionChange"
stripe
@resetQuery="resetQuery"
>
<el-table-column label="#" type="index" width="50"></el-table-column>
<el-table-column label="名称" prop="name" width="200"></el-table-column>
<el-table-column label="标识" prop="code" 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)"
>编辑</el-button
>
</el-button-group>
</template>
</el-table-column>
</scTable>
</el-main>
<save-dialog
v-if="dialog.save"
ref="saveDialog"
@success="handleSaveSuccess"
@closed="dialog.save = false"
></save-dialog>
</el-container>
</template>
<script>
import saveDialog from "./oplcate_form.vue";
export default {
name: "opl",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
permission: false,
},
apiObj: this.$API.opm.oplcate.list,
query: {},
selection: [],
search: {
keyword: null,
},
oplcateList: {},
};
},
mounted() {
this.getoplcate();
},
methods: {
//
getoplcate() {
this.$API.opm.oplcate.list.req({ page: 0 }).then((res) => {
this.oplcateList = res;
console.log(res);
});
},
//
addFire(id) {
this.$router.push({
name: "fire",
params: { operationid: this.$route.params.id, oplId: id },
});
},
//
table_edit(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("edit").setData(row);
});
},
//
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//
permission() {
this.dialog.permission = true;
this.$nextTick(() => {
this.$refs.permissionDialog.open();
});
},
//
async table_del(row) {
var reqData = { id: row.id };
var res = await this.$API.demo.post.post(reqData);
if (res.code == 200) {
this.$refs.table.refresh();
this.$message.success("删除成功");
} else {
this.$alert(res.message, "提示", { type: "error" });
}
},
//
async batch_del() {
this.$confirm(
`确定删除选中的 ${this.selection.length} 项吗?如果删除项中含有子集将会被一并删除`,
"提示",
{
type: "warning",
}
)
.then(() => {
const loading = this.$loading();
this.$refs.table.refresh();
loading.close();
this.$message.success("操作成功");
})
.catch(() => {});
},
//
selectionChange(selection) {
this.selection = selection;
},
//
changeSwitch(val, row) {
row.status = row.status == "1" ? "0" : "1";
row.$switch_status = true;
setTimeout(() => {
delete row.$switch_status;
row.status = val;
this.$message.success("操作成功");
}, 500);
},
//
upsearch() {},
//ID
filterTree(id) {
var target = null;
function filter(tree) {
tree.forEach((item) => {
if (item.id == id) {
target = item;
}
if (item.children) {
filter(item.children);
}
});
}
filter(this.$refs.table.tableData);
return target;
},
//
handleSaveSuccess(data, mode) {
if (mode == "add") {
this.$refs.table.refresh();
} else if (mode == "edit") {
this.$refs.table.refresh();
}
},
resetQuery() {
this.query = {};
},
},
};
</script>