189 lines
5.6 KiB
Vue
189 lines
5.6 KiB
Vue
|
|
<template>
|
||
|
|
<div>
|
||
|
|
<div class="titleBox">
|
||
|
|
<!-- 头部 -->
|
||
|
|
<PageTitle title="预警方案">
|
||
|
|
<el-button type="primary" @click="addEdit('add', '')">
|
||
|
|
<el-icon style="vertical-align: middle"> <CirclePlus /> </el-icon>
|
||
|
|
<span style="vertical-align: middle">新增</span>
|
||
|
|
</el-button>
|
||
|
|
<el-button @click="delDictItem(ids)" :disabled="ids.length == 0" typeof="danger">
|
||
|
|
<el-icon style="vertical-align: middle"><Delete /> </el-icon>
|
||
|
|
<span style="vertical-align: middle">批量删除</span>
|
||
|
|
</el-button>
|
||
|
|
<el-button type="primary" @click="goback">
|
||
|
|
<el-icon style="vertical-align: middle"> <Menu /> </el-icon>
|
||
|
|
<span style="vertical-align: middle">返回节假日</span>
|
||
|
|
</el-button>
|
||
|
|
</PageTitle>
|
||
|
|
</div>
|
||
|
|
<!-- 搜索 -->
|
||
|
|
<div ref="searchBox">
|
||
|
|
<Search :searchArr="searchConfiger" @submit="onSearch" />
|
||
|
|
</div>
|
||
|
|
<!-- 表格 -->
|
||
|
|
<div class="tabBox">
|
||
|
|
<MyTable
|
||
|
|
:tableData="pageData.tableData"
|
||
|
|
:tableColumn="pageData.tableColumn"
|
||
|
|
:tableHeight="pageData.tableHeight"
|
||
|
|
:key="pageData.keyCount"
|
||
|
|
:tableConfiger="pageData.tableConfiger"
|
||
|
|
:controlsWidth="pageData.controlsWidth"
|
||
|
|
@chooseData="chooseData"
|
||
|
|
>
|
||
|
|
<template #zldj="{ row }">
|
||
|
|
<dict-tag :options="D_BZ_TYJB" :value="row.zldj" :tag="false" />
|
||
|
|
</template>
|
||
|
|
<template #zllx="{ row }">
|
||
|
|
<dict-tag :options="D_BZ_RGZLLX" :value="row.zllx" :tag="false" />
|
||
|
|
</template>
|
||
|
|
<!-- 操作 -->
|
||
|
|
<template #controls="{ row }">
|
||
|
|
<el-button size="small" @click="addEdit('edit', row.id)">修改</el-button>
|
||
|
|
<el-button size="small" @click="addEdit('detail', row.id)">详情</el-button>
|
||
|
|
<el-button size="small" @click="delDictItem([row.id])">删除</el-button>
|
||
|
|
</template>
|
||
|
|
</MyTable>
|
||
|
|
<Pages
|
||
|
|
@changeNo="changeNo"
|
||
|
|
@changeSize="changeSize"
|
||
|
|
:tableHeight="pageData.tableHeight"
|
||
|
|
:pageConfiger="{
|
||
|
|
...pageData.pageConfiger,
|
||
|
|
total: pageData.total
|
||
|
|
}"
|
||
|
|
></Pages>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
<!-- 编辑详情 -->
|
||
|
|
<EditAddForm ref="addEditDialog" :dic="{D_BZ_RGZLLX,D_BZ_TYJB}" :dataItem="props.dataItem" @updateDate="getData"/>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script setup>
|
||
|
|
import PageTitle from "@/components/aboutTable/PageTitle.vue";
|
||
|
|
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||
|
|
import Pages from "@/components/aboutTable/Pages.vue";
|
||
|
|
import Search from "@/components/aboutTable/Search.vue";
|
||
|
|
import EditAddForm from './components/editAddForm.vue'
|
||
|
|
import { qcckGet, qcckPost ,qcckDelete} from "@/api/qcckApi.js";
|
||
|
|
import { reactive, ref ,defineEmits,onMounted,getCurrentInstance } from 'vue';
|
||
|
|
const { proxy } = getCurrentInstance();
|
||
|
|
const props = defineProps({
|
||
|
|
dataItem:Object
|
||
|
|
})
|
||
|
|
const emits = defineEmits('changeItem')
|
||
|
|
const { D_BZ_RGZLLX ,D_BZ_TYJB} = proxy.$dict("D_BZ_RGZLLX","D_BZ_TYJB");
|
||
|
|
const addEditDialog = ref();
|
||
|
|
const ids = ref([]);//多选
|
||
|
|
const searchBox = ref() //搜索框
|
||
|
|
const searchConfiger = reactive([
|
||
|
|
{ showType: "input", prop: "zlbt", placeholder: "请输入指令标题", label: "指令标题" }
|
||
|
|
])
|
||
|
|
|
||
|
|
const queryFrom = ref({})
|
||
|
|
const pageData = reactive({
|
||
|
|
tableData: [], //表格数据
|
||
|
|
keyCount: 0,
|
||
|
|
tableConfiger: {
|
||
|
|
rowHieght: 61,
|
||
|
|
showSelectType:'checkBox',
|
||
|
|
loading:false
|
||
|
|
},
|
||
|
|
total: 0,
|
||
|
|
pageConfiger: {
|
||
|
|
pageSize: 10,
|
||
|
|
pageNum: 1
|
||
|
|
}, //分页
|
||
|
|
controlsWidth: 210, //操作栏宽度
|
||
|
|
tableColumn: [
|
||
|
|
{ label: "指令标题", prop: "zlbt" },
|
||
|
|
{ label: "指令等级", prop: "zldj", showSolt :true },
|
||
|
|
{ label: "指令类型", prop: "zllx", showSolt :true },
|
||
|
|
{ label: "所属部门", prop: "ssbm" },
|
||
|
|
{ label: "指令内容", prop: "zlnr" },
|
||
|
|
]
|
||
|
|
});
|
||
|
|
onMounted(() => {
|
||
|
|
getData() //获取数据
|
||
|
|
tabHeightFn();
|
||
|
|
proxy.mittBus.on("mittFn", (data) => {
|
||
|
|
pageData.keyCount = data;
|
||
|
|
});
|
||
|
|
});
|
||
|
|
// 搜索
|
||
|
|
const onSearch = (val)=>{
|
||
|
|
for (let key in val) {
|
||
|
|
if(!val[key]) delete val[key];
|
||
|
|
if(val.cz) delete val.cz
|
||
|
|
}
|
||
|
|
queryFrom.value = {...val}
|
||
|
|
pageData.pageConfiger.pageNum = 1
|
||
|
|
getData() //获取数据
|
||
|
|
}
|
||
|
|
// 获取数据
|
||
|
|
const getData = ()=>{
|
||
|
|
let pramas = {
|
||
|
|
pageSize:pageData.pageConfiger.pageSize,
|
||
|
|
pageCurrent:pageData.pageConfiger.pageNum,
|
||
|
|
...queryFrom.value,
|
||
|
|
jjrid:props.dataItem.id
|
||
|
|
}
|
||
|
|
pageData.tableConfiger.loading = true
|
||
|
|
qcckGet(pramas,'/mosty-jmxf/tbyjmb').then(res=>{
|
||
|
|
pageData.tableData = res.records || []
|
||
|
|
pageData.tableConfiger.loading = false
|
||
|
|
pageData.total = res.total
|
||
|
|
}).catch(()=> { pageData.tableConfiger.loading = false })
|
||
|
|
}
|
||
|
|
|
||
|
|
const changeNo = (val) =>{
|
||
|
|
pageData.pageConfiger.pageNum = val;
|
||
|
|
getData()
|
||
|
|
}
|
||
|
|
const changeSize = (val) =>{
|
||
|
|
pageData.pageConfiger.pageSize = val;
|
||
|
|
getData()
|
||
|
|
}
|
||
|
|
|
||
|
|
// 新增
|
||
|
|
const addEdit = (type,id)=>{
|
||
|
|
addEditDialog.value.init(type,id)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 多选
|
||
|
|
const chooseData = (val)=>{
|
||
|
|
if(!val) return false;
|
||
|
|
if(Array.isArray(val)) ids.value = val.map(v=>{ return v.id })
|
||
|
|
}
|
||
|
|
// 批量删除
|
||
|
|
function delDictItem(row) {
|
||
|
|
proxy.$confirm("确定要删除", "警告", {type: "warning"}).then(() => {
|
||
|
|
qcckPost(row,'/mosty-jmxf/tbyjmb/bacth').then(() => {
|
||
|
|
proxy.$message({type: "success", message: "删除成功" });
|
||
|
|
pageData.pageConfiger.pageNum = 1
|
||
|
|
getData();
|
||
|
|
});
|
||
|
|
}).catch(() => {
|
||
|
|
proxy.$message.info("已取消");
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
const goback = (type,row)=>{
|
||
|
|
emits('changeItem',null)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 表格高度计算
|
||
|
|
const tabHeightFn = () => {
|
||
|
|
pageData.tableHeight = window.innerHeight - searchBox.value.offsetHeight - 244;
|
||
|
|
window.onresize = function () { tabHeightFn(); };
|
||
|
|
};
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<style>
|
||
|
|
.el-loading-mask{
|
||
|
|
background: rgba(0,0,0,0.3);
|
||
|
|
}
|
||
|
|
</style>
|