<template>
|
<el-dialog
|
v-model="dialogVisible"
|
title="选择应急物资"
|
width="900px"
|
draggable
|
:fullscreen="full"
|
>
|
<el-button @click="toggleFullscreen" size="small" class="pot" :icon="FullScreen"></el-button>
|
<el-row>
|
<el-col :span="18">
|
<el-row>
|
<el-form ref="ruleFormRef" :model="ruleForm" :inline="true" status-icon>
|
<el-form-item>
|
<el-input size="default" v-model="listQuery.searchParams.name" placeholder="物资名称" style="max-width: 215px;margin-right: 12px;"/>
|
</el-form-item>
|
<el-form-item>
|
<el-button size="default" type="primary" @click="onSubmit">查询</el-button>
|
<el-button size="default" @click="submitReset">重置</el-button>
|
<el-button size="default" :icon="Delete">清除选择</el-button>
|
</el-form-item>
|
</el-form>
|
</el-row>
|
<el-table :data="tableData" style="width: 100%;margin-top:20px">
|
<el-table-column width="55">
|
<template #default="scope">
|
<el-radio-group v-model="radio1">
|
<el-radio :label="scope.row" @click="radio(scope.row)" size="large">{{ null }}</el-radio>
|
</el-radio-group>
|
</template>
|
</el-table-column>
|
<el-table-column align="center" prop="name" label="物资名称"/>
|
</el-table>
|
<div class="pages">
|
<el-pagination
|
v-model:currentPage="pageIndex"
|
v-model:page-size="pageSize"
|
:page-sizes="[10, 20, 30]"
|
layout="total, sizes, prev, pager, next, jumper"
|
:total="total"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
</el-col>
|
<el-col :span="6">
|
<div v-if="dynamicTags[0] == '' ? false : true">
|
<el-tag
|
v-for="tag in dynamicTags"
|
:key="tag"
|
class="mx-1"
|
style="margin: 5px"
|
closable
|
:disable-transitions="false"
|
@close="handleClose(tag)"
|
>
|
{{ tag.name }}
|
</el-tag>
|
</div>
|
</el-col>
|
</el-row>
|
<template #footer>
|
<span class="dialog-footer">
|
<el-button @click="dialogVisible = false" size="default">关闭</el-button>
|
<el-button type="primary" @click="submitForm" size="default">确定</el-button>
|
</span>
|
</template>
|
</el-dialog>
|
</template>
|
<script lang="ts">
|
import {
|
defineComponent,
|
reactive,
|
ref
|
} from 'vue';
|
import {
|
Delete,
|
FullScreen
|
} from '@element-plus/icons-vue';
|
import { ElMessage } from 'element-plus';
|
import {emergencySuppliesApi} from "/@/api/contingencyManagement/emergencyResources";
|
export default defineComponent({
|
setup(props, { emit }) {
|
const dialogVisible = ref<boolean>(false);
|
const openDailog = () => {
|
dialogVisible.value = true;
|
onSubmit()
|
};
|
// 搜索条件
|
const listQuery = reactive({
|
pageIndex: 1,
|
pageSize: 10,
|
searchParams:{
|
name: '',
|
}
|
});
|
// 定义表格数据
|
const tableData = ref([]);
|
// 列表请求数据
|
const onSubmit = async () => {
|
let res = await emergencySuppliesApi().getEmergencySuppliesList(listQuery);
|
if (res.data.code === '200') {
|
tableData.value = res.data.data;
|
pageIndex.value = res.data.pageIndex;
|
pageSize.value = res.data.pageSize;
|
total.value = res.data.total;
|
} else {
|
ElMessage({
|
showClose: true,
|
type: 'error',
|
message: res.data.msg,
|
});
|
}
|
};
|
// 重置
|
const submitReset = () => {
|
listQuery.searchParams.name = '';
|
onSubmit();
|
};
|
const pageIndex = ref();
|
const pageSize = ref();
|
const total = ref();
|
const handleSizeChange = (val: number) => {
|
listQuery.pageSize = val;
|
};
|
const handleCurrentChange = (val: number) => {
|
listQuery.pageIndex = val;
|
};
|
// 右方点击添加后显示标签
|
const dynamicTags = ref(['']);
|
const handleClose = (tag: string) => {
|
dynamicTags.value.splice(dynamicTags.value.indexOf(tag), 1);
|
radio1.value = '';
|
};
|
const radio1 = ref('');
|
const radio = (event: any) => {
|
dynamicTags.value[0] = event;
|
};
|
//全屏
|
const full = ref(false);
|
const toggleFullscreen = () => {
|
if (full.value == false) {
|
full.value = true;
|
} else {
|
full.value = false;
|
}
|
};
|
const submitForm = () => {
|
let obj = JSON.parse(JSON.stringify(dynamicTags.value));
|
emit('SearchUser', obj[0]);
|
dialogVisible.value = false;
|
};
|
return {
|
dialogVisible,
|
openDailog,
|
listQuery,
|
onSubmit,
|
tableData,
|
submitReset,
|
handleSizeChange,
|
handleCurrentChange,
|
dynamicTags,
|
handleClose,
|
Delete,
|
toggleFullscreen,
|
FullScreen,
|
full,
|
pageIndex,
|
pageSize,
|
radio1,
|
radio,
|
submitForm,
|
total,
|
};
|
},
|
});
|
</script>
|
<style scoped>
|
.el-form--inline .el-form-item{
|
margin-bottom: 0;
|
margin-right: 0;
|
}
|
/*分页*/
|
.pages{
|
margin-top: 15px;
|
}
|
::v-deep .el-pagination .el-pager li {
|
margin: 0 5px;
|
background-color: #f4f4f5;
|
color: #606266;
|
min-width: 30px;
|
border-radius: 2px;
|
}
|
::v-deep .el-pagination .el-pager li.is-active {
|
background-color: #409eff;
|
color: #fff;
|
}
|
::v-deep .el-pagination .btn-prev {
|
margin: 0 5px;
|
background-color: #f4f4f5;
|
color: #606266;
|
min-width: 30px;
|
border-radius: 2px;
|
}
|
::v-deep .el-pagination button:disabled{
|
color: #c0c4cc;
|
}
|
::v-deep .el-pagination .btn-next{
|
margin: 0 5px;
|
background-color: #f4f4f5;
|
color: #606266;
|
min-width: 30px;
|
border-radius: 2px;
|
}
|
</style>
|