5 changed files with 453 additions and 40 deletions
@ -0,0 +1,290 @@ |
|||
<template> |
|||
|
|||
|
|||
<el-form :model="queryParams" ref="queryRef" :inline="true"> |
|||
<el-form-item label="代码值/名称" prop="codeNum"> |
|||
<el-input v-model="queryParams.codeNum" placeholder="请输入标准代码编号" clearable style="width: 220px" /> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button type="primary" @click="handleQuery">搜索</el-button> |
|||
<el-button icon="Refresh" @click="resetQuery">重置</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="handleAdd" |
|||
v-hasPermi="['meta:metaSecurityCol:add']" |
|||
>新增</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="success" |
|||
plain |
|||
icon="Edit" |
|||
:disabled="single" |
|||
@click="handleEdit" |
|||
v-hasPermi="['meta:metaSecurityCol:edit']" |
|||
>修改</el-button> |
|||
</el-col> |
|||
<el-col :span="1.5"> |
|||
<el-button |
|||
type="danger" |
|||
plain |
|||
icon="Delete" |
|||
:disabled="multiple" |
|||
@click="handleRemove" |
|||
v-hasPermi="['meta:metaSecurityCol:remove']" |
|||
>删除</el-button> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
<!-- 表格展示 --> |
|||
<el-table v-loading="loading" :data="tableData" @selection-change="handleSelectionChange"> |
|||
<el-table-column type="selection" width="55" align="center" /> |
|||
|
|||
<el-table-column label="代码归属" align="center" prop="sysName" /> |
|||
<el-table-column label="标准代码编号" align="center" prop="codeNum" /> |
|||
<el-table-column label="标准代码名称" align="center" prop="codeName" > |
|||
<template #default="scope"> |
|||
<el-link |
|||
type="primary" |
|||
:underline="true" |
|||
@click="handleCodeClick(scope.row)" |
|||
style="cursor: pointer" |
|||
> |
|||
{{ scope.row.codeName }} |
|||
</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="代码状态" align="center" prop="codeStatus"> |
|||
<template #default="scope"> |
|||
<dict-tag |
|||
:options="std_code_appr" |
|||
:value="scope.row.codeStatus" |
|||
/> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="引用情况" align="center" > |
|||
<template #default="scope"> |
|||
<el-link |
|||
type="primary" |
|||
:underline="true" |
|||
@click="handleCodeClick(scope.row)" |
|||
style="cursor: pointer" |
|||
> |
|||
查看 |
|||
</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="代码关系" align="center" > |
|||
<template #default="scope"> |
|||
<el-link |
|||
type="primary" |
|||
:underline="true" |
|||
@click="handleCodeClick(scope.row)" |
|||
style="cursor: pointer" |
|||
> |
|||
查看关系 |
|||
</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="操作" align="center" width="180"> |
|||
<template #default="scope"> |
|||
<el-button @click="handleEdit(scope.row)" type="text" icon="Edit" /> |
|||
<el-button @click="handleRemove(scope.row)" type="text" icon="Delete" /> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<!-- 分页 --> |
|||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="handlePagination" /> |
|||
|
|||
|
|||
<!-- 添加或编辑标准代码对话框 --> |
|||
<el-dialog :title="dialogTitle" v-model="dialogVisible" width="600px"> |
|||
<el-form :model="form" ref="formRef" label-width="120px" :rules="formRules"> |
|||
|
|||
|
|||
<el-form-item label="代码值" prop="codeNum"> |
|||
<el-input v-model="form.code_num" placeholder="请输入标准代码编号" /> |
|||
</el-form-item> |
|||
<el-form-item label="代码名称" prop="codeName"> |
|||
<el-input v-model="form.codeName" placeholder="请输入标准代码值" /> |
|||
</el-form-item> |
|||
<el-form-item label="代码含义" prop="codeMean"> |
|||
<el-input v-model="form.codeName" placeholder="请输入标准代码值" /> |
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
<template #footer> |
|||
<el-button @click="handleCancel">取消</el-button> |
|||
<el-button type="primary" @click="handleSave">确定</el-button> |
|||
</template> |
|||
</el-dialog> |
|||
|
|||
</template> |
|||
|
|||
<script setup> |
|||
import { ref, reactive, onMounted, toRefs } from 'vue'; |
|||
import { listStdCodeItem, addStdCodeItem, getStdCodeItem, updateStdCodeItem, deleteStdCodeItem } from "@/api/datastd/stdcode"; // 更新为新的接口 |
|||
import { ElLink } from 'element-plus'; |
|||
|
|||
|
|||
const { proxy } = getCurrentInstance(); |
|||
const { std_code_status,std_code_appr } = proxy.useDict("std_code_status","std_code_appr"); |
|||
const props = defineProps({ |
|||
rowData: { |
|||
type: Object, |
|||
required: true |
|||
} |
|||
}); |
|||
const queryParams = ref({ |
|||
codeNum: '', |
|||
codeName: '', |
|||
codeType: '', |
|||
sysName: '', |
|||
sysId: '', |
|||
pageNum: 1, |
|||
pageSize: 10 |
|||
}); |
|||
const single = ref(true); |
|||
const multiple = ref(true); |
|||
const handlePagination = (pageNum, pageSize) => { |
|||
queryParams.value.pageNum = pageNum; |
|||
queryParams.value.pageSize = pageSize; |
|||
handleQuery(); |
|||
}; |
|||
|
|||
|
|||
|
|||
const form = ref({ |
|||
id: '', |
|||
codeNum: '', |
|||
codeName: '', |
|||
codeType: 'company', |
|||
codeStatus: '' |
|||
|
|||
}); |
|||
const ids = ref([]); |
|||
const codeNums = ref([]); |
|||
|
|||
// 获取数据列表 |
|||
const getList = async () => { |
|||
loading.value = true; |
|||
const response = await listStdCodeItem(queryParams.value); |
|||
tableData.value = response.rows; |
|||
total.value = response.total; |
|||
loading.value = false; |
|||
}; |
|||
const handleCodeClick = (row) => { |
|||
// 你可以在这里处理点击事件,例如跳转到详情页面,弹出对话框等 |
|||
console.log('点击了标准代码名称', row); |
|||
}; |
|||
function handleSelectionChange(selection) { |
|||
ids.value = selection.map(item => item.id); |
|||
codeNums.value = selection.map(item => item.codeNum); |
|||
single.value = ids.value.length !== 1; |
|||
multiple.value = !ids.value.length > 0; |
|||
} |
|||
|
|||
const handleQuery = () => { |
|||
queryParams.value.pageNum = 1; |
|||
getList(); |
|||
}; |
|||
|
|||
const resetQuery = () => { |
|||
queryParams.value = { |
|||
codeNum: '', |
|||
pageNum: 1, |
|||
pageSize: 10 |
|||
}; |
|||
getList(); |
|||
}; |
|||
|
|||
const handleAdd = () => { |
|||
dialogTitle.value = "新增标准代码项"; |
|||
form.value = { |
|||
id: '', |
|||
codeNum: '', |
|||
codeName: '', |
|||
codeMean: '', |
|||
codeStatus: '', |
|||
}; |
|||
dialogVisible.value = true; |
|||
}; |
|||
|
|||
const handleEdit = (row) => { |
|||
dialogTitle.value = "编辑标准代码项"; |
|||
getStdCodeItem(row.id).then(response => { |
|||
form.value = response.data; |
|||
|
|||
dialogVisible.value = true; |
|||
}); |
|||
}; |
|||
|
|||
const handleRemove = (row) => { |
|||
const idsToDelete = row.id ? [row.id] : ids.value; |
|||
const codesToDelete = row.codeNum ? [row.codeNum] : codeNums.value; |
|||
proxy.$modal.confirm('是否确认删除ID为"' + codesToDelete.toString() + '"的数据项?').then(function () { |
|||
return deleteStdCodeItem(idsToDelete.toString()); |
|||
}).then(() => { |
|||
handleQuery(); |
|||
proxy.$modal.msgSuccess("删除成功"); |
|||
}).catch(() => {}); |
|||
}; |
|||
|
|||
const handleSave = () => { |
|||
if (!form.value.codeNum || !form.value.codeName) { |
|||
ElMessage.warning("请填写必填项"); |
|||
return; |
|||
} |
|||
|
|||
const saveAction = form.value.id ? updateStdCodeItem : addStdCodeItem; |
|||
saveAction(form.value).then(() => { |
|||
dialogVisible.value = false; |
|||
handleQuery(); |
|||
}); |
|||
}; |
|||
|
|||
const handleCancel = () => { |
|||
dialogVisible.value = false; |
|||
}; |
|||
const tableData = ref([]); |
|||
const total = ref(0); |
|||
const loading = ref(false); |
|||
const dialogVisible = ref(false); |
|||
const dialogTitle = ref(""); |
|||
const formRules = reactive({ |
|||
codeNum: [{ required: true, message: "请输入代码值", trigger: "blur" }], |
|||
codeName: [{ required: true, message: "请输入代码名称", trigger: "blur" }] |
|||
}); |
|||
onMounted(() => { |
|||
|
|||
getList(); |
|||
}); |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.app-container { |
|||
padding: 20px; |
|||
} |
|||
|
|||
.head-container { |
|||
margin-bottom: 0px; |
|||
} |
|||
|
|||
.custom-tree-node { |
|||
display: flex; |
|||
align-items: center; |
|||
} |
|||
|
|||
.custom-tree-node i { |
|||
margin-right: 8px; |
|||
} |
|||
</style> |
Loading…
Reference in new issue