| | |
| | | </template> |
| | | </LeftTreeByMgr> |
| | | </template> |
| | | |
| | | <template #header> |
| | | <!-- 查询、重置、排序、增加表单 --> |
| | | <el-form :inline="true" :model="formulaQueryParams"> |
| | |
| | | <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-button icon="ele-Plus" @click="importData()"> 导入数据 </el-button> |
| | | </el-form-item> |
| | | </el-form></template |
| | | > |
| | | <template #main |
| | | ><!-- 数据展示表格 --> |
| | | <div class="flex-auto flex-column h-full"> |
| | | <div class="flex-auto flex-column h-full" v-if="state.isShowTrendFun"> |
| | | <el-table |
| | | v-loading="formulaTableLoading" |
| | | ref="draggableFormulaTableRef" |
| | |
| | | <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-Tickets" size="small" text type="primary" @click="openOperateDemoPage(scope.row)"> 详情</el-button> |
| | | <el-button icon="ele-Delete" size="small" text type="danger" @click="deleteCurrentFormulaRow(scope.row)"> |
| | | 删除 |
| | | </el-button> |
| | |
| | | <!-- 增加、修改数据对话框 --> |
| | | <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" |
| | |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import type { PropType } from 'vue'; |
| | | import { computed, nextTick, onMounted, reactive, ref } from 'vue'; |
| | | import { useRouter } from 'vue-router'; |
| | | 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>>>, |
| | |
| | | PageSize: 10, |
| | | }, |
| | | tableTotal: 0, |
| | | isShowTrendFun: true, |
| | | showViewBack: false, |
| | | detailTitle: '', |
| | | }); |
| | | //#region ====================== 左侧树数据,tree init ====================== |
| | | const leftTreeRef = ref(null); |
| | |
| | | //#endregion |
| | | //#region ====================== 获取、删除表格数据 ====================== |
| | | const formulaTableLoading = ref(false); |
| | | const categoryTableData = ref([]); |
| | | const categoryTableData = ref([ |
| | | { |
| | | Name: '测试', |
| | | }, |
| | | ]); |
| | | const isFormulaTableDrag = ref(false); |
| | | const getCategoryTableData = async () => { |
| | | formulaTableLoading.value = true; |
| | |
| | | }); |
| | | //#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; |
| | | //#region ====================== 跳转文档详情页面 init====================== |
| | | const router = useRouter(); |
| | | const openOperateDemoPage = (row: any) => { |
| | | router.push({ |
| | | name: 'GraphDetail', |
| | | params: { |
| | | ID: row.ID, |
| | | }, |
| | | }); |
| | | }; |
| | | |
| | | 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)}` : '')); |
| | | } |
| | | } |
| | | }; |
| | | //导入数据 |
| | | const importData = () => {}; |
| | | //#endregion |
| | | |
| | | //#region ====================== 删除左侧树公式组数据 ====================== |