| | |
| | | <template><div>123</div></template> |
| | | <template> |
| | | <AHMContainer type="card"> |
| | | <template #aside> |
| | | <!-- ç®å½æ --> |
| | | <LeftTreeByMgr |
| | | v-loading="treeLoading" |
| | | ref="leftTreeRef" |
| | | :treedata="listTreeData" |
| | | title-name="ç±»ç®ç®¡ç" |
| | | :show-more-operate="true" |
| | | :show-add="true" |
| | | :folderIcon="() => false" |
| | | :current-node-key="currentListID" |
| | | :expand-on-click-node="false" |
| | | :default-expand-all="true" |
| | | :tooltip="(_, data) => data.Code" |
| | | @click="handleClickNode" |
| | | :customDropdown="true" |
| | | @tree-add="openOperateFormulaGroupDialog" |
| | | > |
| | | <template #customDropdown="{ data, node }"> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item> |
| | | <el-button |
| | | @click.stop="() => openOperateFormulaGroupDialog(data)" |
| | | link |
| | | type="primary" |
| | | icon="ele-Edit" |
| | | style="cursor: pointer" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item> |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | @click.stop="() => deleteCurrentFormulaGroup(data)" |
| | | icon="ele-Delete" |
| | | style="cursor: pointer" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item> |
| | | <el-button @click.stop="() => openParentDlg(data)" link type="primary" icon="ele-Menu" style="cursor: pointer"> |
| | | ç¶çº§ |
| | | </el-button> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | | </LeftTreeByMgr> |
| | | </template> |
| | | <template #header> |
| | | <!-- æ¥è¯¢ãéç½®ãæåºãå¢å 表å --> |
| | | <el-form :inline="true" :model="formulaQueryParams"> |
| | | <el-form-item label="åç§°" prop="Name"> |
| | | <el-input v-model="formulaQueryParams.Name" style="width: 226.4px" placeholder="æä»¶åç§°" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item prop="Code"> |
| | | <el-select v-model="formulaQueryParams.Code" autocomplete="off" style="width: 226.4px" clearable> |
| | | <el-option v-for="item in Object.keys(analyzeMap)" :key="item" :value="parseInt(item)" :label="analyzeMap[item]"> |
| | | </el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <script setup lang="ts"></script> |
| | | <style scoped lang="scss"></style> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="ele-Search"> æ¥è¯¢ </el-button> |
| | | <el-button icon="ele-Refresh">éç½® </el-button> |
| | | <el-button icon="ele-Plus" @click="openOperateFormulaDialog()"> 导å
¥æ°æ® </el-button> |
| | | </el-form-item> |
| | | </el-form></template |
| | | > |
| | | <template #main |
| | | ><!-- æ°æ®å±ç¤ºè¡¨æ ¼ --> |
| | | <div class="flex-auto flex-column h-full"> |
| | | <el-table |
| | | v-loading="formulaTableLoading" |
| | | ref="draggableFormulaTableRef" |
| | | border |
| | | row-key="ID" |
| | | class="flex-auto" |
| | | :row-class-name="isFormulaTableDrag ? 'cursor-move' : 'cursor-pointer'" |
| | | :cell-style="{ textAlign: 'center' }" |
| | | :header-cell-style="{ textAlign: 'center' }" |
| | | :data="categoryTableData" |
| | | highlight-current-row |
| | | > |
| | | <el-table-column prop="Name" width="220" label="æä»¶åç§°" fixed="left" show-overflow-tooltip /> |
| | | <el-table-column prop="Code" width="300" label="æä»¶æ ¼å¼" show-overflow-tooltip /> |
| | | <el-table-column prop="FormatType" label="æä»¶å¤§å°" width="120" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column prop="MeasureTypes" width="120" label="ç¶æ" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column prop="CronTypes" label="ä¸ä¼ æ¶é´" show-overflow-tooltip> </el-table-column> |
| | | <el-table-column label="æä½" width="220" fixed="right" show-overflow-tooltip> |
| | | <template #default="scope"> |
| | | <el-button icon="ele-Edit" size="small" text type="primary" @click="openOperateFormulaDialog(scope.row)"> |
| | | 详æ
</el-button |
| | | > |
| | | <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentFormulaRow(scope.row)"> |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <div class="flex-0"> |
| | | <el-pagination |
| | | v-model:currentPage="state.tableParams.PageIndex" |
| | | v-model:page-size="state.tableParams.PageSize" |
| | | :total="state.tableTotal" |
| | | :page-sizes="[10, 20, 50, 100]" |
| | | background |
| | | @size-change="handleSizeChange" |
| | | style="margin-bottom: 20px" |
| | | @current-change="handleCurrentChange" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | <!-- å¢å ãä¿®æ¹æ°æ®å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | :destroy-on-close="true" |
| | | v-model="formulaGroupDialogIsShow" |
| | | width="400" |
| | | :close-on-click-modal="false" |
| | | @closed="closeFormulaGroupDialog" |
| | | > |
| | | <template #header> |
| | | <div style="color: #fff"> |
| | | <SvgIcon |
| | | :name="formulaGroupDialogHeaderIcon" |
| | | :size="16" |
| | | style="margin-right: 3px; display: inline; vertical-align: middle" |
| | | /> |
| | | <span> {{ formulaGroupDialogTitle }} </span> |
| | | </div> |
| | | </template> |
| | | |
| | | <el-form |
| | | :model="formulaGroupDialogFormValue" |
| | | ref="formulaGroupDialogFormRef" |
| | | :rules="formulaGroupDialogFormRules" |
| | | label-width="55" |
| | | > |
| | | <el-form-item label="ç¶çº§" v-if="!isEditFormulaGroupDialog" prop="ParentID"> |
| | | <el-tree-select |
| | | default-expand-all |
| | | filterable |
| | | style="width: 100%" |
| | | v-model="formulaGroupDialogFormValue.ParentID" |
| | | :props="{ |
| | | id: 'ID', |
| | | label: 'Name', |
| | | children: 'Children', |
| | | }" |
| | | :data="listTreeData" |
| | | node-key="ID" |
| | | :clearable="true" |
| | | :accordion="true" |
| | | :expandNode="false" |
| | | :check-strictly="true" |
| | | placeholder="è¯·éæ©ç¶çº§" |
| | | > |
| | | </el-tree-select> |
| | | </el-form-item> |
| | | <el-form-item label="åç§°" prop="Name"> |
| | | <el-input placeholder="请è¾å
¥åç§°" v-model="formulaGroupDialogFormValue.Name"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="ç¼ç " prop="Code"> |
| | | <el-input placeholder="请è¾å
¥ç¼ç " v-model="formulaGroupDialogFormValue.Code"></el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="说æ" prop="Description"> |
| | | <el-input placeholder="请è¾å
¥è¯´æ" v-model="formulaGroupDialogFormValue.Description" type="textarea" :rows="3" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div> |
| | | <el-button @click="closeFormulaGroupDialog">å æ¶</el-button> |
| | | <el-button type="primary" @click="submitFormulaGroupFormValue">ç¡® å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- å¢å ãä¿®æ¹æ°æ®å¯¹è¯æ¡ --> |
| | | <el-dialog |
| | | :destroy-on-close="true" |
| | | v-model="formulaDialogIsShow" |
| | | width="530" |
| | | :close-on-click-modal="false" |
| | | @closed="closeFormulaDialog" |
| | | > |
| | | <template #header> |
| | | <div style="color: #fff"> |
| | | <SvgIcon :name="formulaDialogHeaderIcon" :size="16" style="margin-right: 3px; display: inline; vertical-align: middle" /> |
| | | <span> {{ formulaDialogTitle }} </span> |
| | | </div> |
| | | </template> |
| | | |
| | | <el-form :model="formulaDialogFormValue" ref="formulaDialogFormRef" :rules="formulaDialogFormRules" label-width="78"> |
| | | <el-form-item label="åç§°" prop="Name"> |
| | | <el-input placeholder="请è¾å
¥åç§°" v-model="formulaDialogFormValue.Name"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="ç¼ç " prop="Code"> |
| | | <el-input placeholder="请è¾å
¥å¯ä¸ç¼ç " v-model="formulaDialogFormValue.Code"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="说æ" prop="Description"> |
| | | <el-input placeholder="请è¾å
¥è¯´æ" v-model="formulaDialogFormValue.Description" type="textarea" :rows="3" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div> |
| | | <el-button @click="closeFormulaDialog">å æ¶</el-button> |
| | | <el-button type="primary" @click="submitFormulaFormValue">ç¡® å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | <el-dialog |
| | | :destroy-on-close="true" |
| | | v-model="updateModuleDlgIsShow" |
| | | width="400" |
| | | :close-on-click-modal="false" |
| | | @closed="closeUpdateModuleDlg" |
| | | > |
| | | <template #header> |
| | | <div style="color: #fff"> |
| | | <span> {{ updateModuleTitle }} </span> |
| | | </div> |
| | | </template> |
| | | |
| | | <el-form :model="updateModuleFormValue" ref="updateModuleFormRef" :rules="updateModuleFormRules" label-width="60"> |
| | | <el-form-item label="åç»" prop="GroupID"> |
| | | <el-tree-select |
| | | filterable |
| | | class="w100" |
| | | v-model="updateModuleFormValue.GroupID" |
| | | :props="{ |
| | | id: 'ID', |
| | | label: 'Name', |
| | | children: 'Children', |
| | | }" |
| | | :data="updateModuleOptions" |
| | | node-key="ID" |
| | | :clearable="true" |
| | | :accordion="false" |
| | | :expandNode="false" |
| | | :check-strictly="true" |
| | | > |
| | | </el-tree-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <div> |
| | | <el-button @click="closeUpdateModuleDlg">å æ¶</el-button> |
| | | <el-button type="primary" @click="submitUpdateModule">ç¡® å®</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </AHMContainer> |
| | | </template> |
| | | |
| | | <script setup lang="ts"> |
| | | import type { AxiosRequestConfig, AxiosResponse } from 'axios'; |
| | | import type { FormInstance, FormRules } from 'element-plus'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import type { PropType } from 'vue'; |
| | | import { computed, nextTick, onMounted, reactive, ref } from 'vue'; |
| | | import AHMContainer from '/@/components/layout/AHMContainer.vue'; |
| | | import LeftTreeByMgr from '/@/components/tree/leftTreeByMgr.vue'; |
| | | import { deepClone } from '/@/utils/other'; |
| | | import { convertListToTree } from '/@/utils/util'; |
| | | import { analyzeMap } from '/@/views/types/catalog/index'; |
| | | const props = defineProps({ |
| | | request: { |
| | | type: Function as PropType<(config: AxiosRequestConfig<any>) => Promise<AxiosResponse<any, any>>>, |
| | | }, |
| | | }); |
| | | const state = reactive({ |
| | | tableParams: { |
| | | PageIndex: 1, |
| | | PageSize: 10, |
| | | }, |
| | | tableTotal: 0, |
| | | }); |
| | | //#region ====================== å·¦ä¾§æ æ°æ®ï¼tree init ====================== |
| | | const leftTreeRef = ref(null); |
| | | const treeLoading = ref(false); |
| | | const listTreeData = ref([]); |
| | | const currentTreeNode = ref(null); |
| | | const currentListID = computed(() => currentTreeNode.value?.ID); |
| | | const handleClickNode = (data) => { |
| | | nextTick(() => { |
| | | leftTreeRef.value?.treeRef.setCurrentKey(data.ID); |
| | | }); |
| | | currentTreeNode.value = data; |
| | | getCategoryTableData(); |
| | | }; |
| | | const getListTreeData = async (selectFirst = false) => { |
| | | return; |
| | | treeLoading.value = true; |
| | | const res = await GetAll(props.request).finally(() => { |
| | | treeLoading.value = false; |
| | | }); |
| | | if (res?.Code === 0) { |
| | | const resData = (res.Data || []) as []; |
| | | listTreeData.value = convertListToTree(resData); |
| | | if (selectFirst) { |
| | | const firstListTreeNode = listTreeData.value[0]; |
| | | if (firstListTreeNode) { |
| | | handleClickNode(firstListTreeNode); |
| | | } else { |
| | | categoryTableData.value = []; |
| | | } |
| | | } else { |
| | | currentTreeNode.value && handleClickNode(currentTreeNode.value); |
| | | } |
| | | } else { |
| | | ElMessage.error('è·åå
¬å¼ç»å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | }; |
| | | //#endregion |
| | | //#region ====================== è·åãå é¤è¡¨æ ¼æ°æ® ====================== |
| | | const formulaTableLoading = ref(false); |
| | | const categoryTableData = ref([]); |
| | | const isFormulaTableDrag = ref(false); |
| | | const getCategoryTableData = async () => { |
| | | formulaTableLoading.value = true; |
| | | const res = await GetByGroupID({ GroupID: currentListID.value }, props.request).finally(() => { |
| | | formulaTableLoading.value = false; |
| | | }); |
| | | if (res?.Code === 0) { |
| | | const resData = (res.Data || []) as []; |
| | | categoryTableData.value = resData; |
| | | } else { |
| | | ElMessage.error('è·åå
¬å¼å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | }; |
| | | const deleteCurrentFormulaRow = (row: any) => { |
| | | ElMessageBox.confirm(`ç¡®å®å é¤å
¬å¼ï¼ã${row.Name}ã?`, 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }).then(async () => { |
| | | const res = await TableDelete( |
| | | { |
| | | ID: row.ID, |
| | | }, |
| | | props.request |
| | | ); |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | ElMessage.success('å é¤å
¬å¼æå'); |
| | | getCategoryTableData(); |
| | | } else { |
| | | ElMessage.error('å é¤å
¬å¼å¤±è´¥'); |
| | | } |
| | | } else { |
| | | ElMessage.error('å é¤å
¬å¼å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | }); |
| | | }; |
| | | //æ°æ®å表页é¢å页 |
| | | |
| | | const handleSizeChange = (val) => { |
| | | state.tableParams.PageSize = val; |
| | | getCategoryTableData(); |
| | | }; |
| | | const handleCurrentChange = (val) => { |
| | | state.tableParams.PageIndex = val; |
| | | getCategoryTableData(); |
| | | }; |
| | | //#endregion |
| | | |
| | | //#endregion |
| | | |
| | | //#region ====================== æç´¢è¡¨æ ¼ï¼å¯¹è¡¨æ ¼æåº ====================== |
| | | const formulaQueryParams = ref({ |
| | | Name: '', |
| | | Code: '', |
| | | }); |
| | | //#endregion |
| | | |
| | | //#region ====================== å¢å ãä¿®æ¹è¡¨æ ¼è®°å½æä½, dialog init====================== |
| | | const isEditFormulaDialog = ref(false); |
| | | const formulaDialogTitle = computed(() => { |
| | | return isEditFormulaDialog.value ? 'ä¿®æ¹å
¬å¼' : 'æ·»å å
¬å¼'; |
| | | }); |
| | | const formulaDialogHeaderIcon = computed(() => { |
| | | return isEditFormulaDialog.value ? 'ele-Edit' : 'ele-Plus'; |
| | | }); |
| | | const formulaDialogFormValue = ref(null); |
| | | const formulaDialogIsShow = ref(false); |
| | | const formulaDialogFormRef = ref<FormInstance>(null); |
| | | const formulaInitialCode = ref(''); |
| | | |
| | | const formulaDialogFormRules = ref<FormRules>({ |
| | | Name: [{ required: true, message: '请è¾å
¥åç§°', trigger: 'blur' }], |
| | | FormatType: [{ required: true, message: 'è¯·éæ©è¿åç±»å', trigger: 'change' }], |
| | | }); |
| | | const openOperateFormulaDialog = (row?) => { |
| | | if (row) { |
| | | isEditFormulaDialog.value = true; |
| | | const { ID, Name, FormatType, MeasureTypes, CronTypes, SourceTypes, Code, Description } = row; |
| | | formulaInitialCode.value = Code; |
| | | formulaDialogFormValue.value = deepClone({ ID, Name, FormatType, MeasureTypes, CronTypes, SourceTypes, Code, Description }); |
| | | } else { |
| | | isEditFormulaDialog.value = false; |
| | | formulaInitialCode.value = ''; |
| | | |
| | | formulaDialogFormValue.value = { |
| | | GroupID: currentListID.value, |
| | | FormatType: null, |
| | | MeasureTypes: [], |
| | | CronTypes: [], |
| | | SourceTypes: [], |
| | | Name: '', |
| | | Code: '', |
| | | Description: '', |
| | | }; |
| | | } |
| | | formulaDialogIsShow.value = true; |
| | | }; |
| | | |
| | | const closeFormulaDialog = () => { |
| | | formulaDialogIsShow.value = false; |
| | | formulaDialogFormRef.value.clearValidate(); |
| | | }; |
| | | |
| | | const submitFormulaFormValue = async () => { |
| | | const valid = await formulaDialogFormRef.value.validate().catch(() => {}); |
| | | if (!valid) return; |
| | | |
| | | if (isEditFormulaDialog.value) { |
| | | const res = await TableUpdate(formulaDialogFormValue.value, props.request); |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | getCategoryTableData(); |
| | | closeFormulaDialog(); |
| | | ElMessage.success('ä¿®æ¹å
¬å¼æå'); |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å
¬å¼å¤±è´¥'); |
| | | } |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å
¬å¼å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | } else { |
| | | const res = await TableInsert(formulaDialogFormValue.value, props.request); |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | getCategoryTableData(); |
| | | closeFormulaDialog(); |
| | | ElMessage.success('æ·»å å
¬å¼æå'); |
| | | } else { |
| | | ElMessage.error('æ·»å å
¬å¼å¤±è´¥'); |
| | | } |
| | | } else { |
| | | ElMessage.error('æ·»å å
¬å¼å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | } |
| | | }; |
| | | //#endregion |
| | | |
| | | //#region ====================== å é¤å·¦ä¾§æ å
¬å¼ç»æ°æ® ====================== |
| | | |
| | | const deleteCurrentFormulaGroup = (row: any) => { |
| | | ElMessageBox.confirm(`ç¡®å®å é¤å
¬å¼ç»ï¼ã${row.Name}ã?`, 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning', |
| | | }).then(async () => { |
| | | const res = await DeleteGroupGetByID( |
| | | { |
| | | ID: row.ID, |
| | | }, |
| | | props.request |
| | | ); |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | ElMessage.success('å é¤å
¬å¼ç»æå'); |
| | | getListTreeData(true); |
| | | } else { |
| | | ElMessage.error('å é¤å
¬å¼ç»å¤±è´¥'); |
| | | } |
| | | } else { |
| | | ElMessage.error('å é¤å
¬å¼ç»å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | }); |
| | | }; |
| | | //#endregion |
| | | |
| | | //#region ====================== å¢å ãå é¤å
¬å¼ç»æä½, dialog init====================== |
| | | const isEditFormulaGroupDialog = ref(false); |
| | | const formulaGroupDialogTitle = computed(() => { |
| | | return isEditFormulaGroupDialog.value ? 'ä¿®æ¹å
¬å¼ç»' : 'æ·»å å
¬å¼ç»'; |
| | | }); |
| | | const formulaGroupDialogHeaderIcon = computed(() => { |
| | | return isEditFormulaGroupDialog.value ? 'ele-Edit' : 'ele-Plus'; |
| | | }); |
| | | const formulaGroupDialogFormValue = ref(null); |
| | | const formulaGroupDialogIsShow = ref(false); |
| | | |
| | | const formulaGroupDialogFormRef = ref<FormInstance>(null); |
| | | |
| | | const formulaGroupDialogFormRules = ref<FormRules>({ |
| | | Name: [{ required: true, message: '请è¾å
¥åç§°', trigger: 'blur' }], |
| | | }); |
| | | const openOperateFormulaGroupDialog = (data?) => { |
| | | if (data) { |
| | | isEditFormulaGroupDialog.value = true; |
| | | const { ID, Name, Code, Description } = data; |
| | | formulaGroupDialogFormValue.value = deepClone({ ID, Name, Code, Description }); |
| | | } else { |
| | | isEditFormulaGroupDialog.value = false; |
| | | formulaGroupDialogFormValue.value = { Name: '', ParentID: '', Code: '', Description: '' }; |
| | | } |
| | | formulaGroupDialogIsShow.value = true; |
| | | }; |
| | | |
| | | const closeFormulaGroupDialog = () => { |
| | | formulaGroupDialogIsShow.value = false; |
| | | formulaGroupDialogFormRef.value.clearValidate(); |
| | | }; |
| | | |
| | | const submitFormulaGroupFormValue = async () => { |
| | | const valid = await formulaGroupDialogFormRef.value.validate().catch(() => {}); |
| | | if (!valid) return; |
| | | |
| | | if (isEditFormulaGroupDialog.value) { |
| | | const res = await UpdateGroupGetByID(formulaGroupDialogFormValue.value, props.request); |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | getListTreeData(); |
| | | closeFormulaGroupDialog(); |
| | | ElMessage.success('ä¿®æ¹å
¬å¼ç»æå'); |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å
¬å¼ç»å¤±è´¥'); |
| | | } |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å
¬å¼ç»å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | } else { |
| | | const res = await InsertGroup( |
| | | { ...formulaGroupDialogFormValue.value, ParentID: formulaGroupDialogFormValue.value.ParentID || '0' }, |
| | | props.request |
| | | ); |
| | | if (res?.Code === 0) { |
| | | if (res.Data) { |
| | | getListTreeData(); |
| | | closeFormulaGroupDialog(); |
| | | ElMessage.success('æ·»å å
¬å¼ç»æå'); |
| | | } else { |
| | | ElMessage.error('æ·»å å
¬å¼ç»å¤±è´¥'); |
| | | } |
| | | } else { |
| | | ElMessage.error('æ·»å å
¬å¼ç»å¤±è´¥' + (res?.Message ? `ï¼${JSON.stringify(res.Message)}` : '')); |
| | | } |
| | | } |
| | | }; |
| | | //#endregion |
| | | |
| | | //#region ====================== ä¿®æ¹ç¶çº§ ====================== |
| | | const parentDlgIsShow = ref(false); |
| | | const parentDlgMapRow = ref(null); |
| | | const openParentDlg = (row?) => { |
| | | parentDlgMapRow.value = row; |
| | | parentDlgIsShow.value = true; |
| | | }; |
| | | const submitParentForm = (res) => { |
| | | getListTreeData(); |
| | | }; |
| | | //#endregion |
| | | |
| | | //#region ====================== updateModuleDlg ====================== |
| | | const updateModuleDlgIsShow = ref(false); |
| | | const updateModuleMapRow = ref(null); |
| | | const updateModuleFormRef = ref(null); |
| | | const updateModuleTitle = computed(() => `ã${updateModuleMapRow.value?.Name}ãââ ä¿®æ¹æå±åç»`); |
| | | const updateModuleFormRules = ref<FormRules>({ |
| | | GroupID: [{ required: true, message: 'è¯·éæ©åç»', trigger: 'change' }], |
| | | }); |
| | | |
| | | const updateModuleOptions = computed(() => { |
| | | return listTreeData.value; |
| | | }); |
| | | const updateModuleFormValue = ref(null); |
| | | |
| | | const closeUpdateModuleDlg = () => { |
| | | updateModuleDlgIsShow.value = false; |
| | | updateModuleFormRef.value.clearValidate(); |
| | | }; |
| | | |
| | | const submitUpdateModule = async () => { |
| | | const valid = await updateModuleFormRef.value.validate().catch(() => {}); |
| | | if (!valid) return; |
| | | if (updateModuleFormValue.value.GroupID === currentListID.value) { |
| | | ElMessage.info('æªä¿®æ¹'); |
| | | return; |
| | | } |
| | | const res = await UpdateFormulaGroupID(updateModuleFormValue.value); |
| | | |
| | | if (res?.Data) { |
| | | ElMessage.success('ä¿®æ¹æåï¼'); |
| | | getCategoryTableData(); |
| | | closeUpdateModuleDlg(); |
| | | } else { |
| | | ElMessage.error('ä¿®æ¹å¤±è´¥'); |
| | | } |
| | | }; |
| | | |
| | | //#endregion |
| | | |
| | | //#region ====================== æè½½æ¶è·ååå§æ°æ® ====================== |
| | | onMounted(() => { |
| | | getListTreeData(true); |
| | | }); |
| | | //#endregion |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | :deep(.el-card__body) { |
| | | padding-bottom: unset; |
| | | } |
| | | </style> |