diff --git a/vue-fastapi-backend/module_admin/dao/datastd_dao.py b/vue-fastapi-backend/module_admin/dao/datastd_dao.py
index e408483..1cb41f2 100644
--- a/vue-fastapi-backend/module_admin/dao/datastd_dao.py
+++ b/vue-fastapi-backend/module_admin/dao/datastd_dao.py
@@ -110,7 +110,7 @@ class DataStdDao:
col = (
await db.execute(
select(DataStdCode)
- .where(DataStdCode.Id == Id)
+ .where(DataStdCode.id == Id)
)
).scalars().first()
return col
@@ -120,7 +120,7 @@ class DataStdDao:
col = (
await db.execute(
select(DataStdCodeItem)
- .where(DataStdCodeItem.Id == Id)
+ .where(DataStdCodeItem.id == Id)
)
).scalars().first()
return col
diff --git a/vue-fastapi-backend/module_admin/entity/vo/datastd_vo.py b/vue-fastapi-backend/module_admin/entity/vo/datastd_vo.py
index 625440d..08dd635 100644
--- a/vue-fastapi-backend/module_admin/entity/vo/datastd_vo.py
+++ b/vue-fastapi-backend/module_admin/entity/vo/datastd_vo.py
@@ -28,7 +28,7 @@ class DataStdCodeModel(BaseModel):
code_type: Optional[str] = None
code_status: Optional[str] = None
sys_name: Optional[str] = None
- sys_id: Optional[str] = None
+ sys_id: Optional[int] = None
class DataStdCodeItemModel(BaseModel):
"""
diff --git a/vue-fastapi-backend/module_admin/service/datastd_service.py b/vue-fastapi-backend/module_admin/service/datastd_service.py
index 2227339..8d29c71 100644
--- a/vue-fastapi-backend/module_admin/service/datastd_service.py
+++ b/vue-fastapi-backend/module_admin/service/datastd_service.py
@@ -87,6 +87,7 @@ class DataStdService:
# 创建新的 page_object 实例,避免修改原始对象
new_page_object = DataStdCodeModel(**page_object.model_dump(by_alias=True))
new_page_object.id = str(uuid.uuid4())
+ new_page_object.code_status="0"
# 调用 DAO 方法插入数据
await DataStdDao.add_std_code(query_db, new_page_object)
await query_db.commit()
diff --git a/vue-fastapi-frontend/src/views/datastd/stdcode/codeItem.vue b/vue-fastapi-frontend/src/views/datastd/stdcode/codeItem.vue
new file mode 100644
index 0000000..feb80cc
--- /dev/null
+++ b/vue-fastapi-frontend/src/views/datastd/stdcode/codeItem.vue
@@ -0,0 +1,290 @@
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.codeName }}
+
+
+
+
+
+
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+ 查看关系
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 确定
+
+
+
+
+
+
+
+
diff --git a/vue-fastapi-frontend/src/views/datastd/stdcode/index.vue b/vue-fastapi-frontend/src/views/datastd/stdcode/index.vue
index 44d0fbb..8927a6d 100644
--- a/vue-fastapi-frontend/src/views/datastd/stdcode/index.vue
+++ b/vue-fastapi-frontend/src/views/datastd/stdcode/index.vue
@@ -83,15 +83,52 @@
+
-
+
+
+
+ {{ scope.row.codeName }}
+
+
+
-
+
+
+
+
+
+
+ 查看
+
+
+
+
+
+
+ 查看关系
+
-
-
@@ -108,32 +145,59 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
取消
确定
+
+
+
+
+
+ 取消
+ 确定
+
+
@@ -141,10 +205,12 @@
import { ref, reactive, onMounted, toRefs } from 'vue';
import { listStdCode, addStdCode, getStdCode, updateStdCode, deleteStdCode } from "@/api/datastd/stdcode"; // 更新为新的接口
import { datasourcetree } from "@/api/meta/metatask";
+import { ElLink } from 'element-plus';
+import CodeItem from './codeItem.vue'; // 引入第二个页面组件
const { proxy } = getCurrentInstance();
-const { metasecurity_ctr } = proxy.useDict("metasecurity_ctr");
+const { std_code_status,std_code_appr } = proxy.useDict("std_code_status","std_code_appr");
const queryParams = ref({
codeNum: '',
@@ -156,36 +222,51 @@ const queryParams = ref({
pageSize: 10
});
const single = ref(true);
+const showSys = ref(false);
const multiple = ref(true);
const dbResoursName = ref(undefined);
const defaultProps = {
children: "children",
label: "name"
};
+// 用于第二个对话框
+const dialogVisible2 = ref(false);
+const dialogTitle2 = ref('标准代码');
+const selectedRow = ref(null); // 传递给 codeItem 组件的数据
+const formData = ref({}); // 用于传递表单数据给 codeItem
+const handlePagination = (pageNum, pageSize) => {
+ queryParams.value.pageNum = pageNum;
+ queryParams.value.pageSize = pageSize;
+ handleQuery();
+};
const filterNode = (value, data) => {
if (!value) return true;
return data.name.indexOf(value) !== -1;
};
const handleNodeClick = (data) => {
- if (data.id === 99999) {
- queryParams.value.dbRID = "";
- } else {
- queryParams.value.dbRID = data.id;
+ if(data==9999){
+ queryParams.value.sysId =undefined;
+
+ }else{
+ queryParams.value.sysId = data.id;
+
}
+
handleQuery();
};
const dbResourceOptions = ref(undefined);
const form = ref({
- colId: '',
+ id: '',
codeNum: '',
codeName: '',
- codeType: '',
+ codeType: 'company',
codeStatus: '',
sysName: '',
- sysId: ''
+ sysId: undefined
});
const ids = ref([]);
+const codeNums = ref([]);
// 获取数据列表
const getList = async () => {
@@ -195,18 +276,48 @@ const getList = async () => {
total.value = response.total;
loading.value = false;
};
+// 点击代码名称,弹出第二个对话框并传递数据
+const handleCodeClick = (row) => {
+ selectedRow.value = row; // 保存选中的行数据
+ formData.value = { ...row }; // 复制选中的行数据
+ dialogVisible2.value = true; // 打开第二个对话框
+};
function handleSelectionChange(selection) {
- ids.value = selection.map(item => item.colId);
- single.value = ids.value.length === 1;
- multiple.value = ids.value.length > 0;
+ 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;
}
+function changeCodeType(data){
+ if(data != "company"){
+ showSys.value=true
+ form.value.sysName=""
+ form.value.sysId=undefined
+ } else {
+ showSys.value=false
+ form.value.sysName="公司级"
+ form.value.sysId=10000
+ }
+
+}
const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
+function dataChange(data) {
+// 从 dbResourceOldList 中查找对应的 name
+const selectedItem = dbResourceOldList.value.find(item => item.id === data);
+if (selectedItem) {
+// 如果找到对应的项,将 name 赋值给 form.value.dbRName
+form.value.sysName = selectedItem.name;
+} else {
+// 如果未找到,清空 form.value.dbRName
+form.value.sysName = '';
+}
+}
const resetQuery = () => {
queryParams.value = {
codeNum: '',
@@ -223,7 +334,7 @@ const resetQuery = () => {
const handleAdd = () => {
dialogTitle.value = "新增标准代码";
form.value = {
- colId: '',
+ id: '',
codeNum: '',
codeName: '',
codeType: '',
@@ -236,17 +347,28 @@ const handleAdd = () => {
const handleEdit = (row) => {
dialogTitle.value = "编辑标准代码";
- getStdCode(row.colId).then(response => {
- form.value = response;
+ getStdCode(row.id).then(response => {
+ form.value = response.data;
+ if(form.value.codeType=="sys")
+ {
+ showSys.value=true
+ } else{
+ showSys.value=false
+
+ }
dialogVisible.value = true;
});
};
const handleRemove = (row) => {
- const idsToDelete = row ? [row.colId] : ids.value;
- deleteStdCode(idsToDelete).then(() => {
+ 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 deleteStdCode(idsToDelete.toString());
+ }).then(() => {
handleQuery();
- });
+ proxy.$modal.msgSuccess("删除成功");
+ }).catch(() => {});
};
const handleSave = () => {
@@ -255,7 +377,7 @@ const handleSave = () => {
return;
}
- const saveAction = form.value.colId ? updateStdCode : addStdCode;
+ const saveAction = form.value.id ? updateStdCode : addStdCode;
saveAction(form.value).then(() => {
dialogVisible.value = false;
handleQuery();