9/20
This commit is contained in:
@@ -47,9 +47,9 @@
|
||||
></el-switch>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="添加人" prop="createByName" width="120" />
|
||||
<el-table-column align="center" label="添加时间" prop="createTime" width="120" />
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作" width="300">
|
||||
<el-table-column align="center" label="添加人" prop="createByName" width="150" />
|
||||
<el-table-column align="center" label="添加时间" prop="createTime" width="180" />
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
|
||||
<template #default="scope">
|
||||
<el-button v-has-permi="['inspection:item:edit']" link type="primary" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||
<el-button v-has-permi="['inspection:item:remove']" link type="primary" @click="handleDelete(scope.row)">删除</el-button>
|
||||
@@ -63,14 +63,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" name="Item" setup>
|
||||
import { listItem, delItem, addItem, updateItem, updateItemStatus } from '@/api/system/InspectionItem/index';
|
||||
import { listItem, delItem, updateItemStatus } from '@/api/system/InspectionItem';
|
||||
import { ItemVO, ItemQuery, ItemForm } from '@/api/system/InspectionItem/type';
|
||||
import { checkPermi } from '@/utils/permission';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const itemList = ref<ItemVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
@@ -79,12 +78,6 @@ const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const itemFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ItemForm = {
|
||||
id: undefined,
|
||||
@@ -123,7 +116,7 @@ const data = reactive<PageData<ItemForm, ItemQuery>>({
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
const { queryParams } = toRefs(data);
|
||||
|
||||
/** 查询巡检项目列表 */
|
||||
const getList = async () => {
|
||||
@@ -138,18 +131,6 @@ const getList = async () => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 取消按钮 */
|
||||
const cancel = () => {
|
||||
reset();
|
||||
dialog.visible = false;
|
||||
};
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = { ...initFormData };
|
||||
itemFormRef.value?.resetFields();
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
@@ -179,7 +160,7 @@ const handleAdd = () => {
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: ItemVO) => {
|
||||
const handleUpdate = (row?: ItemVO) => {
|
||||
const _ids = row?.id || ids.value[0];
|
||||
router.push({
|
||||
path: '/inspection/editItem',
|
||||
@@ -204,23 +185,6 @@ const handleChange = (value: string, id: string) => {
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
itemFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateItem(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addItem(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ItemVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
@@ -230,17 +194,6 @@ const handleDelete = async (row?: ItemVO) => {
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'system/item/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`item_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user