<template>
|
<div class="home-container">
|
<div style="height: 100%">
|
<el-row class="homeCard">
|
<div class="basic-line">
|
<span>标准类型:</span>
|
<el-select v-model="tableData.params.searchParams.ruleStandType" clearable filterable class="input-box" placeholder="标准类型">
|
<el-option v-for="item in ruleStandTypeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
</el-select>
|
</div>
|
<div class="basic-line">
|
<span>标题:</span>
|
<el-input v-model.trim="tableData.params.searchParams.title" clearable filterable class="input-box" placeholder="标题"> </el-input>
|
</div>
|
<div style="padding-bottom: 10px">
|
<el-button type="primary" @click="getInspectionTask">查询</el-button>
|
<el-button plain @click="reset">重置</el-button>
|
</div>
|
</el-row>
|
<div class="homeCard">
|
<div class="main-card">
|
<el-row class="cardTop">
|
<el-col :span="24" class="mainCardBtn">
|
<el-button type="primary" size="default" @click="openApproveBasicDialog('新增', {})">新建</el-button>
|
<el-button type="danger" size="default" @click="deleteMoreApproveBasic" plain>批量删除</el-button>
|
</el-col>
|
</el-row>
|
<el-table ref="multipleTableRef" :data="tableData.approveBasicData" style="width: 100%" height="calc(100% - 100px)" :header-cell-style="{ background: '#fafafa' }" @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55" />
|
<el-table-column property="title" label="标题" />
|
<el-table-column property="ruleStandType" label="标准类型">
|
<template slot-scope="scope">
|
<span>
|
{{ parseNumber(scope.row.ruleStandType, '标准类型') }}
|
</span>
|
</template>
|
</el-table-column>
|
<el-table-column property="minVal" label="最低值">
|
<template slot-scope="scope">
|
<span>
|
{{ parseNumber(scope.row.minValMatchPattern, '最低值') }}
|
</span>
|
<span>
|
{{ scope.row.minVal }}
|
</span>
|
</template>
|
</el-table-column>
|
<el-table-column property="maxVal" label="最高值">
|
<template slot-scope="scope">
|
<span>
|
{{ parseNumber(scope.row.maxValMatchPattern, '最高值') }}
|
</span>
|
<span>
|
{{ scope.row.maxVal }}
|
</span>
|
</template>
|
</el-table-column>
|
<el-table-column property="info" label="描述" />
|
<el-table-column prop="createUname" label="创建人" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="gmtCreate" label="创建时间" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="modifiedUname" label="最后修改人" show-overflow-tooltip></el-table-column>
|
<el-table-column prop="gmtModified" label="最后修改时间" show-overflow-tooltip></el-table-column>
|
<el-table-column fixed="right" label="操作" align="center" width="300">
|
<template slot-scope="scope">
|
<el-button link type="primary" size="small" @click="openApproveBasicDialog('查看', scope.row)">查看</el-button>
|
<el-button link type="primary" size="small" @click="openApproveBasicDialog('修改', scope.row)">修改</el-button>
|
<el-button link type="danger" size="small" @click="deleteApproveBasic(scope.row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" :pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="tableData.params.pageIndex" background v-model:page-size="tableData.params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="tableData.total" class="page-position"> </el-pagination>
|
</div>
|
</div>
|
</div>
|
<approve-basic-dialog ref="approveBasicDialogRef" @refreshApproveBasic="getInspectionTask"></approve-basic-dialog>
|
</div>
|
</template>
|
|
<script>
|
import approveBasicDialog from "./components/approveBasicDialog";
|
import {approveBasicApi} from "../../../../api/approveBasic";
|
export default {
|
name: 'index',
|
components: { approveBasicDialog },
|
data(){
|
return{
|
tableData: {
|
approveBasicData: [],
|
total: 0,
|
loading: false,
|
params: {
|
pageIndex: 1,
|
pageSize: 10,
|
searchParams: {
|
ruleStandType: null,
|
title: null
|
}
|
}
|
},
|
ruleStandTypeList: [
|
{ id: 1, name: '可燃气浓度' },
|
{ id: 2, name: '氧气浓度' },
|
{ id: 3, name: '一氧化碳浓度' },
|
{ id: 4, name: '硫化氢浓度' },
|
{ id: 5, name: '温度' },
|
{ id: 6, name: '压力' },
|
{ id: 7, name: '震动' }
|
],
|
typeList: [
|
{ id: 1, name: '大于' },
|
{ id: 2, name: '等于' },
|
{ id: 4, name: '大于等于' }
|
],
|
typeTwoList: [
|
{ id: 3, name: '小于' },
|
{ id: 2, name: '等于' },
|
{ id: 5, name: '小于等于' }
|
],
|
deleteList: {
|
ids: []
|
}
|
}
|
},
|
created() {
|
this.getInspectionTask()
|
},
|
methods:{
|
async getInspectionTask() {
|
let res = await approveBasicApi().getApproveBasicList(this.tableData.params);
|
if (res.data.code === '200') {
|
this.tableData.approveBasicData = res.data.data;
|
this.tableData.total = res.data.total;
|
} else {
|
this.$message({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
},
|
|
parseNumber(value,type) {
|
if (type === '标准类型') {
|
return this.ruleStandTypeList.find((item) => item.id === value).name;
|
} else if (type === '最高值') {
|
return this.typeTwoList.find((item) => item.id == value).name;
|
} else {
|
return this.typeList.find((item) => item.id == value).name;
|
}
|
},
|
|
handleSelectionChange(val) {
|
this.deleteList.ids = val.map((item) => {
|
return item.ruleStandId;
|
});
|
},
|
|
openApproveBasicDialog(type, value) {
|
this.$refs.approveBasicDialogRef.showApproveBasicDialog(type, value);
|
},
|
|
deleteApproveBasic(row) {
|
this.$confirm(`此操作将永久删除该任务:“${row.title}”,是否继续?`, '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(async () => {
|
let res = await approveBasicApi().deleteApproveBasic({ ids: [row.ruleStandId] });
|
if (res.data.code === '200') {
|
this.deleteList.ids = [];
|
this.$message({
|
type: 'success',
|
duration: 2000,
|
message: '删除成功'
|
});
|
await getInspectionTask();
|
} else {
|
this.$message({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
})
|
.catch(() => {});
|
},
|
|
deleteMoreApproveBasic() {
|
this.$confirm(`此操作将永久删除这些标准项,是否继续?`, '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(async () => {
|
let res = await approveBasicApi().deleteApproveBasic(this.deleteList);
|
if (res.data.code === '200') {
|
this.$message({
|
type: 'success',
|
duration: 2000,
|
message: '删除成功'
|
});
|
await this.getInspectionTask();
|
} else {
|
this.$message({
|
type: 'warning',
|
message: res.data.msg
|
});
|
}
|
})
|
.catch(() => {});
|
},
|
onHandleSizeChange(val) {
|
this.tableData.params.pageSize = val;
|
this.getInspectionTask();
|
},
|
// 分页改变
|
onHandleCurrentChange(val) {
|
this.tableData.params.pageIndex = val;
|
this.getInspectionTask();
|
},
|
|
reset() {
|
this.tableData.params = {
|
pageIndex: 1,
|
pageSize: 10,
|
searchParams: {
|
ruleStandType: null,
|
title: null
|
}
|
};
|
},
|
},
|
};
|
</script>
|
|
<style scoped lang="scss">
|
$homeNavLengh: 8;
|
.home-container {
|
height: calc(100vh - 100px);
|
box-sizing: border-box;
|
overflow: hidden;
|
.homeCard {
|
width: 100%;
|
padding: 20px;
|
box-sizing: border-box;
|
background: #fff;
|
border-radius: 4px;
|
|
.main-card {
|
width: 100%;
|
height: 100%;
|
.cardTop {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-bottom: 20px;
|
.mainCardBtn {
|
margin: 0;
|
}
|
}
|
.pageBtn {
|
height: 60px;
|
display: flex;
|
align-items: center;
|
justify-content: right;
|
|
.demo-pagination-block + .demo-pagination-block {
|
margin-top: 10px;
|
}
|
.demo-pagination-block .demonstration {
|
margin-bottom: 16px;
|
}
|
}
|
}
|
&:last-of-type {
|
height: calc(100% - 100px);
|
}
|
}
|
.el-row {
|
display: flex;
|
align-items: center;
|
margin-bottom: 20px;
|
&:last-child {
|
margin-bottom: 0;
|
}
|
.grid-content {
|
align-items: center;
|
min-height: 36px;
|
}
|
|
.topInfo {
|
display: flex;
|
align-items: center;
|
font-size: 16px;
|
font-weight: bold;
|
|
& > div {
|
white-space: nowrap;
|
margin-right: 20px;
|
}
|
}
|
}
|
}
|
.stepItem {
|
width: 100%;
|
display: flex;
|
align-items: flex-start;
|
margin-bottom: 30px;
|
margin-left: 30px;
|
padding-bottom: 30px;
|
border-left: 2px solid #ccc;
|
&:first-of-type {
|
margin-top: 30px;
|
}
|
&:last-of-type {
|
margin-bottom: 0;
|
border-left: none;
|
}
|
.stepNum {
|
width: 30px;
|
height: 30px;
|
border-radius: 15px;
|
box-sizing: border-box;
|
color: #333;
|
border: 1px solid #999;
|
line-height: 28px;
|
text-align: center;
|
margin-right: 10px;
|
margin-left: -16px;
|
margin-top: -30px;
|
}
|
.stepCard {
|
width: 100%;
|
margin-top: -30px;
|
|
.box-card {
|
width: 100%;
|
>>>.el-card__header {
|
padding: 10px 15px;
|
}
|
.card-header {
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
& > div:first-of-type {
|
margin-right: 80px;
|
font-size: 18px;
|
font-weight: bold;
|
}
|
}
|
}
|
}
|
&:hover .card-header {
|
color: #0098f5;
|
}
|
&:hover .stepNum {
|
border: 2px solid #0098f5;
|
color: #0098f5;
|
}
|
}
|
.page-position{
|
float: right;
|
padding-top: 10px;
|
}
|
</style>
|