- <template>
- <!-- 规划管控制度 -->
- <div class="publicContainer">
- <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
- <el-form-item label="名称:" prop="regulationName">
- <el-input
- v-model="queryParams.regulationName"
- placeholder="请输入关键字"
- clearable
- @keyup.enter="searchData"
- style="width: 240px"
- />
- </el-form-item>
- <el-form-item label="类型:" prop="examineFileType">
- <el-select clearable v-model="queryParams.examineFileType" class="m-2" placeholder="请选择" size="mini">
- <el-option v-for="item in examine_file_type" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
-
- <el-form-item label="发布时间" prop="publishTime">
- <el-date-picker
- style="width: 240px"
- format="YYYY-MM-DD"
- value-format="YYYY-MM-DD"
- v-model="AllData.publishTime"
- type="daterange"
- unlink-panels
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- />
- </el-form-item>
-
- <el-form-item>
- <el-button type="primary" icon="Search" @click="searchData">搜索</el-button>
- <el-button icon="Refresh" @click="resetData">重置</el-button>
- </el-form-item>
- </el-form>
- <!-- 操作栏 -->
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button type="primary" plain icon="Plus" @click="addData" v-hasPermi="['system:post:add']">新增</el-button>
- </el-col>
- <right-toolbar v-model:showSearch="showSearch" @queryTable="getDataList"></right-toolbar>
- </el-row>
- <!-- 表格 -->
- <el-table :data="tableData" v-loading="tableLoading" :max-height="600">
- <el-table-column type="index" width="55" label="序号" />
- <el-table-column label="规划管控制度" prop="regulationName" show-overflow-tooltip />
- <el-table-column label="类型" prop="examineFileType" show-overflow-tooltip>
- <template #default="{ row }">
- <dict-tag :options="examine_file_type" :value="row.examineFileType" />
- </template>
- </el-table-column>
- <el-table-column label="发布时间" prop="publishTime" />
- <el-table-column label="修改时间" prop="updateTime" />
- <el-table-column label="修改人" prop="updateBy" />
- <el-table-column label="附件" prop="fileList" show-overflow-tooltip>
- <template #default="{ row }">
- <span
- style="color: rgb(16, 142, 233)"
- @click="handlePreview(item)"
- v-for="item in row.fileList"
- :key="item.id"
- :title="item.name"
- >
- {{ item.name }}
- </span>
- </template>
- </el-table-column>
- <el-table-column label="操作" show-overflow-tooltip width="250">
- <template #default="{ row }">
- <el-button link icon="View" type="primary" @click="checkDetail(row)">详情</el-button>
- <el-button link icon="Edit" type="warning" @click="editData(row)">修改</el-button>
- <el-button link icon="Delete" type="danger" @click="deleteData(row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 分页 -->
- <pagination
- v-show="total > 0"
- :total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
- @pagination="getDataList"
- />
- <!-- 添加 修改 查看彈框 -->
- <el-dialog :title="dialogTitle" v-model="showDialog" width="70%" :close-on-click-modal="false">
- <el-form ref="ruleForm" :model="formData" :rules="formRules" label-width="auto" :disabled="isDisab">
- <el-row>
- <el-form-item label="规划管控制度:" prop="regulationName" style="width: 45%">
- <el-input v-model="formData.regulationName" placeholder="请输入规划管控制度" clearable />
- </el-form-item>
- <el-form-item label="类型:" prop="examineFileType" style="width: 45%">
- <el-select clearable v-model="formData.examineFileType" class="m-2" placeholder="请选择" size="mini" style="width: 100%">
- <el-option v-for="item in examine_file_type" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="发布时间:" prop="publishTime" style="width: 45%">
- <el-date-picker
- style="width: 100%"
- clearable
- format="YYYY-MM-DD"
- value-format="YYYY-MM-DD"
- v-model="formData.publishTime"
- type="date"
- placeholder="请选择发布时间"
- />
- </el-form-item>
- <el-form-item label="附件:" style="width: 93%" prop="fileList">
- <!-- <el-upload
- v-model:file-list="uploadList"
- class="upload-demo"
- action="/prod-api/system/upload"
- :headers="uploadHeader"
- multiple
- :on-preview="handlePreview"
- >
- <el-button type="primary">选择文件</el-button>
- </el-upload> -->
-
- <ImageFileUpload v-model:saveFileArr="formData.fileSaveRequestList" :listType="'text'" :refType="'ghgkzd'" />
- </el-form-item>
- </el-row>
- </el-form>
- <template #footer>
- <div class="dialog-footer">
- <el-button type="primary" @click="submitForm" v-show="!isDisab">保 存</el-button>
- <el-button @click="cancel">关闭</el-button>
- </div>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup name="planningcontrol">
- import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传
- import { ElMessageBox } from 'element-plus';
- import {
- performanceUserId,
- performanceAdd,
- performanceDelete,
- performancepaging,
- performanceEdit,
- FileSystemList,
- performancedetails,
- } from '@/api/spongePerformance/ManagingPerformance';
- import { getToken } from '@/utils/auth';
- const { proxy } = getCurrentInstance();
- const { examine_file_type, examine_type } = proxy.useDict('examine_file_type', 'examine_type');
- const isDisab = ref(false);
- const showDialog = ref(false);
- const showSearch = ref(true);
- const tableLoading = ref(true);
- const total = ref(0);
- const dialogTitle = ref('');
- const tableData = ref([]);
- const uploadList = ref([]);
- const AllData = reactive({
- publishTime: '',
- formData: {},
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- examineFileType: '',
- regulationName: '',
- examineType: 'ghgkzd',
- },
- formRules: {
- regulationName: [{ required: true, message: '请输入规划管控制度', trigger: 'blur' }],
- publishTime: [{ required: true, message: '请选择发布时间', trigger: 'blur' }],
- },
- });
- const { queryParams, formData, formRules } = toRefs(AllData);
-
- /** 表单重置 */
- function resetForm() {
- formData.value = {
- regulationName: undefined,
- examineFileType: undefined,
- publishTime: undefined,
- fileSaveRequestList: [],
- examineType: 'ghgkzd',
- };
- proxy.resetForm('ruleForm');
- uploadList.value = [];
- }
- /** 新增按钮操作 */
- function addData() {
- resetForm();
- isDisab.value = false;
- showDialog.value = true;
- dialogTitle.value = '新增规划管控制度';
- }
- //搜索
- function searchData() {
- if (AllData.publishTime) {
- queryParams.value.beginTime = AllData.publishTime[0];
- queryParams.value.endTime = AllData.publishTime[1];
- } else {
- queryParams.value.beginTime = '';
- queryParams.value.endTime = '';
- }
- queryParams.value.pageNum = 1;
- getDataList();
- }
- //重置
- function resetData() {
- AllData.publishTime = [];
- proxy.resetForm('queryRef');
- searchData();
- }
- const uploadHeader = ref({
- Authorization: 'Bearer ' + getToken(),
- });
- /** 文件上传 */
- function handlePreview(file) {
- console.log(file);
- return ElMessageBox.confirm(`下载此文件: ${file.name}?`).then(
- () => window.open(file.url),
- () => false
- );
- }
-
- /** 查询列表 */
- const getDataList = async () => {
- tableLoading.value = true;
- /** 查询列表 */
- tableLoading.value = true;
- if (AllData.publishTime) {
- queryParams.value.beginTime = AllData.publishTime[0];
- queryParams.value.endTime = AllData.publishTime[1];
- }
- const res = await performancepaging(queryParams.value);
- tableData.value = res.data;
- total.value = res.total;
- tableLoading.value = false;
- };
- /** 新增弹框 修改弹框 提交按钮 */
- async function submitForm() {
- proxy.$refs['ruleForm'].validate(valid => {
- if (valid) {
- uploadList.value.forEach(element => {
- if (element.hasOwnProperty('response')) {
- element.response.data.refType = 'ghgkzd';
- formData.value.fileSaveRequestList.push(element.response.data);
- } else {
- formData.value.fileSaveRequestList.push(element);
- }
- });
- if (formData.value.id != undefined) {
- performanceEdit(formData.value).then(() => {
- console.log(formData.value, 'formData.value');
- proxy.$modal.msgSuccess('修改成功');
- showDialog.value = false;
- getDataList();
- });
- } else {
- performanceAdd(formData.value).then(() => {
- proxy.$modal.msgSuccess('新增成功');
- showDialog.value = false;
- getDataList();
- });
- }
- }
- });
- }
- //表格修改
- function editData(row) {
- isDisab.value = false;
- showDialog.value = true;
- dialogTitle.value = '修改规划管控制度';
- formData.value = { ...row };
- formData.value.fileSaveRequestList = [];
- formData.value.fileSaveRequestList = row.fileList;
- }
- // 表格删除
- function deleteData(row) {
- proxy.$modal
- .confirm('是否确认删除?')
- .then(async () => {
- const res = await performanceDelete(row.id);
- if (res?.code !== 200) return;
- proxy.$modal.msgSuccess('操作成功!');
- getDataList();
- })
- .catch(() => {});
- }
- //详情按钮
- function checkDetail(row) {
- dialogTitle.value = '查看规划管控制度';
- isDisab.value = true;
- showDialog.value = true;
- formData.value = { ...row };
- formData.value.fileSaveRequestList = [];
- formData.value.fileSaveRequestList = row.fileList;
- }
-
- /** 取消按钮 */
- function cancel() {
- showDialog.value = false;
- resetForm();
- getDataList();
- }
- onMounted(() => {
- getDataList();
- });
- </script>
- <style scoped lang="scss"></style>