Browse Source

修改分类

master
siyaqi 3 weeks ago
parent
commit
53b454cd17
  1. 10
      vue-fastapi-backend/module_admin/controller/datastd_controller.py
  2. 17
      vue-fastapi-backend/module_admin/service/datastd_service.py
  3. 10
      vue-fastapi-frontend/src/api/datastd/std.js
  4. 3
      vue-fastapi-frontend/src/views/datastd/main/components/AddEditForm.vue
  5. 71
      vue-fastapi-frontend/src/views/datastd/main/index.vue

10
vue-fastapi-backend/module_admin/controller/datastd_controller.py

@ -457,3 +457,13 @@ async def delete_std_main(
delete_std_main_result = await DataStdService.delete_std_main(query_db, id)
logger.info(delete_std_main_result.message)
return ResponseUtil.success(msg=delete_std_main_result.message)
@datastdController.put('/stdmain/mainonum', dependencies=[Depends(CheckUserInterfaceAuth('datastd:stdmain:main:remove'))])
@Log(title='数据标准', business_type=BusinessType.DELETE)
async def change_std_main_onum(
request: Request,
edit_std_main: DataStdMainModel,
query_db: AsyncSession = Depends(get_db),
):
delete_std_main_result = await DataStdService.change_std_main_onum(query_db, edit_std_main.id,edit_std_main.sys_id)
logger.info(delete_std_main_result.message)
return ResponseUtil.success(msg=delete_std_main_result.message)

17
vue-fastapi-backend/module_admin/service/datastd_service.py

@ -815,5 +815,22 @@ class DataStdService:
except Exception as e:
await query_db.rollback()
raise e
else:
raise ServiceException(message='传入标准ID为空')
@classmethod
async def change_std_main_onum(cls, query_db: AsyncSession, ids: str,onum:int):
if ids:
col_id_list = ids.split(',')
try:
for col_id in col_id_list:
col_info = await cls.get_std_main_by_id(query_db, col_id)
if col_info:
col_info.content_onum=onum
await DataStdDao.update_std_main(query_db,col_info.model_dump(exclude_unset=True) )
await query_db.commit()
return CrudResponseModel(is_success=True, message='修改标准分类成功')
except Exception as e:
await query_db.rollback()
raise e
else:
raise ServiceException(message='传入标准ID为空')

10
vue-fastapi-frontend/src/api/datastd/std.js

@ -232,4 +232,14 @@ export function deleteStdMain(colId) {
}
export function changeStdMainOum(data) {
return request({
url: '/default-api/datastd/stdmain/mainonum' ,
method: 'put',
data: data
})
}

3
vue-fastapi-frontend/src/views/datastd/main/components/AddEditForm.vue

@ -164,7 +164,6 @@ const codeCancel = () => {
codeVisible.value = false;
};
const codeSave = () => {
console.log("sssss")
const child = proxy.$refs.showCodeDialog;
const mapList=child.selections
if(mapList.length!=1){
@ -201,7 +200,6 @@ function dataChange(data) {
}
// props.visible local visible
watch(() => props.visible, (newVal) => {
console.log(props.isShow,"aaaaaaaaaaa")
visible.value = newVal;
formData.value = { ...props.data }
});
@ -241,7 +239,6 @@ const handleSubmit = () => {
const apiCall = props.isEdit ? updateStdMain(formData.value) : addStdMain(formData.value);
apiCall
.then((response) => {
console.log(response.success,"sssssssss")
if (response.success) {
emit('refresh');
handleClose();

71
vue-fastapi-frontend/src/views/datastd/main/index.vue

@ -216,6 +216,17 @@
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="multiple"
@click="treeVisible=true"
v-hasPermi="['meta:metaSecurityCol:remove']"
>标准分类</el-button
>
</el-col>
</el-row>
<!-- 表格展示 -->
<el-table
@ -311,6 +322,39 @@
<code-item-common ref="showCodeDialog" v-if="codeVisible" :codeId="codeId"/>
</el-dialog>
<el-dialog width="600px" append-to-body title="标准分类" v-model="treeVisible">
<el-form label-width="100px" ref="formRef" >
<el-form-item label="标准分类">
<el-tree-select
check-strictly
value-key="contentOnum"
placeholder="请选择标准分类"
:default-expand-all="true"
:clearable="true"
:data="directoryTree"
@node-click="handleTargetCatalogNodeClick"
:check-strictly="false"
:props="{
value: 'contentOnum',
label: 'contentName',
children: 'children',
disabled: (data) => data.children && data.children.length > 0, //
}"
v-model="chooseOnum"
>
</el-tree-select>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="treeVisible=false">取消</el-button>
<el-button type="primary" @click="submitTree"
>确定</el-button
>
</div>
</template>
</el-dialog>
</div>
</template>
@ -322,6 +366,7 @@ import {
delDirectoryAsset,
addDirectoryCollection,
cancelDirectoryCollection,
} from '@/api/datastd/directory'
import auth from '@/plugins/auth'
import FormDialog from './components/FormDialog.vue'
@ -333,6 +378,7 @@ import {
listStdMain,
getStdMain,
deleteStdMain,
changeStdMainOum
} from "@/api/datastd/std"; //
import useUserStore from '@/store/modules/user'
import { nextTick } from 'vue'
@ -343,12 +389,16 @@ const { proxy } = getCurrentInstance()
const { hasPermiOr } = auth
const userStore = useUserStore()
const codeVisible = ref(false);
const treeVisible = ref(false);
const defaultProps = {
children: 'children',
label: 'contentName',
}
const directoryTree = ref([])
const currentNode = ref({})
const handleTargetCatalogNodeClick = (data) => {
chooseOnumNum.value=data.contentOnum
}
const directoryTableData = ref([])
const queryParams = ref({
@ -362,6 +412,8 @@ const single = ref(true);
const multiple = ref(true);
const dialogVisible = ref(false);
const selectedRow = ref(null);
const chooseOnum = ref(null);
const chooseOnumNum = ref(null);
const codeId = ref(null);
const isEdit = ref(false);
const tableData = ref([]);
@ -389,6 +441,20 @@ const handleQuery = () => {
queryParams.value.pageNum = 1;
getList();
};
const submitTree = async () => {
const response = await changeStdMainOum({id:ids.value.toString(),sysId:chooseOnumNum.value});
if (response.success){
treeVisible.value=false
getList();
proxy.$modal.msgSuccess(response.msg);
}else{
proxy.$modal.msgWarning(response.msg);
}
};
const handleSelectionChange = (selection) => {
single.value = selection.length !== 1;
multiple.value = !selection.length;
@ -435,7 +501,6 @@ const handleRemove = (row) => {
const dbResourceOldList = ref([]);
const handleAdd = () => {
console.log("update:visible", 111);
isEdit.value = false;
selectedRow.value = {
stdType: "",
@ -481,7 +546,9 @@ const treeRef = ref(null)
watch(filterText, (val) => {
treeRef.value.filter(val)
})
watch(treeVisible, (val) => {
if(val){ chooseOnum.value=null}
})
const filterNode = (value, data) => {
if (!value) {
return true

Loading…
Cancel
Save