对比新文件 |
| | |
| | | <template> |
| | | <!-- 搜索工作栏 --> |
| | | <ContentWrap> |
| | | <el-form ref="queryFormRef" :inline="true" :model="queryParams" class="-mb-15px" |
| | | label-width="68px"> |
| | | <el-form-item label="计划编码" prop="itemNo"> |
| | | <el-input v-model="queryParams.itemNo" class="!w-200px" clearable |
| | | placeholder="请输入计划编码" |
| | | @keyup.enter="handleQuery"/> |
| | | </el-form-item> |
| | | <el-form-item label="计划名称" prop="itemName"> |
| | | <el-input v-model="queryParams.itemName" class="!w-200px" clearable |
| | | placeholder="请输入计划名称" |
| | | @keyup.enter="handleQuery"/> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button @click="handleQuery"> |
| | | <Icon class="mr-5px" icon="ep:search"/> |
| | | 搜索 |
| | | </el-button> |
| | | <el-button @click="resetQuery"> |
| | | <Icon class="mr-5px" icon="ep:refresh"/> |
| | | 重置 |
| | | </el-button> |
| | | <el-button |
| | | v-hasPermi="['data:ind-item:create']" |
| | | plain |
| | | type="primary" |
| | | @click="openForm('create')" |
| | | > |
| | | <Icon class="mr-5px" icon="ep:plus"/> |
| | | 新增 |
| | | </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </ContentWrap> |
| | | |
| | | <!-- 列表 --> |
| | | <ContentWrap> |
| | | <el-table v-loading="loading" :data="list"> |
| | | <el-table-column prop="itemNo" label="计划编码" header-align="center" align="center" |
| | | min-width="80"/> |
| | | <el-table-column prop="itemName" label="计划名称" header-align="center" align="center" |
| | | min-width="120"/> |
| | | <el-table-column prop="itemCategoryName" label="计划分类" header-align="center" align="center" |
| | | min-width="100"/> |
| | | <el-table-column prop="timeGranularity" label="时间粒度" header-align="center" align="center" |
| | | min-width="40"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.TIME_GRANULARITY" :value="scope.row.timeGranularity"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | :formatter="dateFormatter" |
| | | align="center" |
| | | label="创建时间" |
| | | prop="createTime" |
| | | width="180"/> |
| | | <el-table-column align="center" label="操作"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | v-hasPermi="['data:ind-item:update']" |
| | | link |
| | | type="primary" |
| | | @click="openForm('update', scope.row.id)"> |
| | | 修改 |
| | | </el-button> |
| | | <el-button link size="mini" type="primary" @click="chartHandle(scope.row)">数据 |
| | | </el-button> |
| | | <el-button |
| | | v-hasPermi="['data:ind-item:delete']" |
| | | link |
| | | type="danger" |
| | | @click="handleDelete(scope.row.id)"> |
| | | 删除 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- 分页 --> |
| | | <Pagination |
| | | v-model:limit="queryParams.pageSize" |
| | | v-model:page="queryParams.pageNo" |
| | | :total="total" |
| | | @pagination="getList" |
| | | /> |
| | | </ContentWrap> |
| | | |
| | | <!-- 表单弹窗:添加/修改 --> |
| | | <ItemForm ref="formRef" @success="getList"/> |
| | | |
| | | <!-- 表单弹窗:计划数据 --> |
| | | <ItemChart ref="chartView"/> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import {DICT_TYPE, getIntDictOptions, getStrDictOptions} from '@/utils/dict' |
| | | import {dateFormatter} from '@/utils/formatTime' |
| | | import ItemForm from './ItemForm.vue' |
| | | import download from '@/utils/download' |
| | | import * as ItemApi from '@/api/data/plan/item' |
| | | import * as CategoryApi from "@/api/data/plan/category"; |
| | | import ItemChart from "./ItemChart.vue"; |
| | | |
| | | defineOptions({name: 'PlanItem'}) |
| | | |
| | | const message = useMessage() // 消息弹窗 |
| | | const {t} = useI18n() // 国际化 |
| | | const dataCategoryList = ref([] as CategoryApi.IndItemCategoryVO[]) |
| | | const loading = ref(true) // 列表的加载中 |
| | | const total = ref(0) // 列表的总页数 |
| | | const list = ref([]) // 字典表格数据 |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | itemNo: '', |
| | | itemName: '', |
| | | itemCategory: '' |
| | | }) |
| | | const queryFormRef = ref() // 搜索的表单 |
| | | const exportLoading = ref(false) // 导出的加载中 |
| | | |
| | | /** 查询字典类型列表 */ |
| | | const getList = async () => { |
| | | loading.value = true |
| | | try { |
| | | const data = await ItemApi.getItemPage(queryParams) |
| | | list.value = data.list |
| | | total.value = data.total |
| | | dataCategoryList.value = await CategoryApi.getCategoryListAllSimple() |
| | | } finally { |
| | | loading.value = false |
| | | } |
| | | } |
| | | |
| | | /** 搜索按钮操作 */ |
| | | const handleQuery = () => { |
| | | queryParams.pageNo = 1 |
| | | getList() |
| | | } |
| | | |
| | | /** 查看数据操作 */ |
| | | const chartView = ref() |
| | | const chartHandle = (raw: object) => { |
| | | chartView.value.open(raw) |
| | | } |
| | | |
| | | /** 重置按钮操作 */ |
| | | const resetQuery = () => { |
| | | queryFormRef.value.resetFields() |
| | | handleQuery() |
| | | } |
| | | |
| | | /** 添加/修改操作 */ |
| | | const formRef = ref() |
| | | const openForm = (type: string, id?: number) => { |
| | | formRef.value.open(type, id) |
| | | } |
| | | |
| | | /** 删除按钮操作 */ |
| | | const handleDelete = async (id: number) => { |
| | | try { |
| | | // 删除的二次确认 |
| | | await message.delConfirm() |
| | | // 发起删除 |
| | | await ItemApi.deleteItem(id) |
| | | message.success(t('common.delSuccess')) |
| | | // 刷新列表 |
| | | await getList() |
| | | } catch { |
| | | } |
| | | } |
| | | |
| | | /** 初始化 **/ |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | </script> |