From c635d78b479510ebe2556a420948effcd30a0731 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期六, 21 十二月 2024 18:40:43 +0800 Subject: [PATCH] 新建德森项目分支 --- zy-asrs-admin/src/views/system/menu/edit.vue | 260 ++++++++++++++++++++++++++-------------------------- 1 files changed, 130 insertions(+), 130 deletions(-) diff --git a/zy-asrs-admin/src/views/system/menu/edit.vue b/zy-asrs-admin/src/views/system/menu/edit.vue index 30ae581..895455c 100644 --- a/zy-asrs-admin/src/views/system/menu/edit.vue +++ b/zy-asrs-admin/src/views/system/menu/edit.vue @@ -1,131 +1,131 @@ -<script setup> -import { getCurrentInstance, ref, nextTick } from 'vue'; -import { get, post } from '@/utils/request.js' -import * as Icons from "@ant-design/icons-vue"; -import { formatMessage } from '@/utils/localeUtils.js'; -import { message } from 'ant-design-vue'; -const context = getCurrentInstance()?.appContext.config.globalProperties; -const components = { - ...Icons, -}; - -const submitButton = ref(null); -const isSave = ref(true); -const open = ref(false); -const initFormData = { - name: null -} -let formData = ref(initFormData); -const treeData = ref(null); - -const emit = defineEmits(['tableReload']) - -const handleOk = (e) => { - nextTick(() => { - setTimeout(() => { - submitButton.value.$el.click(); - }, 100); - }); -}; - -const onFinish = values => { - // console.log('Success:', values); - open.value = false; - post(isSave.value ? '/api/menu/save' : '/api/menu/update', formData.value).then((resp) => { - let result = resp.data; - if (result.code === 200) { - message.success(formatMessage('page.update.success', '鏇存柊鎴愬姛')); - } else { - message.error(result.msg); - } - emit('tableReload', 'reload') - }) -}; -const onFinishFailed = errorInfo => { - console.log('Failed:', errorInfo); -}; - -defineExpose({ - open, - formData, - initFormData, - treeData, - isSave, -}) - -</script> - -<script> -export default { - name: '鑿滃崟绠$悊' -} -</script> - -<template> - <div> - <a-modal v-model:open="open" - :title="isSave ? formatMessage('page.add', '娣诲姞') : formatMessage('page.edit', '缂栬緫')" @ok="handleOk" - style="width: 600px;"> - <a-form :model="formData" name="menu" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" - style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" - @finish="onFinish" @finishFailed="onFinishFailed"> - <a-form-item label="涓婄骇鑿滃崟" name="parentId" style="width: 250px;" - :rules="[{ required: true, message: '涓婄骇鑿滃崟涓嶈兘涓虹┖!' }]"> - <a-tree-select v-model:value="formData.parentId" show-search style="width: 100%" - :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" - :placeholder="formatMessage('page.input', '璇疯緭鍏�')" allow-clea tree-data-simple-mode - :tree-data="treeData" tree-node-filter-prop="name" :field-names="{ - children: 'children', - label: 'name', - value: 'id', - }"> - <template #title="{ value: id, name }"> - {{ name }} - </template> - </a-tree-select> - </a-form-item> - <a-form-item label="鑿滃崟鍚嶇О" name="name" style="width: 250px;" - :rules="[{ required: true, message: '鑿滃崟鍚嶇О涓嶈兘涓虹┖!' }]"> - <a-input v-model:value="formData.name" /> - </a-form-item> - <a-form-item label="璺敱鍦板潃" name="route" style="width: 250px;"> - <a-input v-model:value="formData.route" /> - </a-form-item> - <a-form-item label="椤甸潰缁勪欢" name="component" style="width: 250px;"> - <a-input v-model:value="formData.component" /> - </a-form-item> - <a-form-item label="绫诲瀷" name="type" style="width: 250px;" - :rules="[{ required: true, message: '绫诲瀷涓嶈兘涓虹┖!' }]"> - <a-select ref="select" v-model:value="formData.type" :options="[ - { label: '鑿滃崟', value: 0 }, - { label: '鎸夐挳', value: 1 }, - ]"></a-select> - </a-form-item> - <a-form-item v-if="formData.type == 0" label="鑿滃崟鍥炬爣" name="icon" style="width: 250px;"> - <a-input v-model:value="formData.icon" /> - </a-form-item> - <a-form-item v-else label="鏉冮檺" name="icon" style="width: 250px;"> - <a-input v-model:value="formData.authority" /> - </a-form-item> - <a-form-item label="鍥介檯鍖朓D" name="icon" style="width: 250px;"> - <a-input v-model:value="formData.languageId" /> - </a-form-item> - <a-form-item label="鎺掑簭" name="sort" style="width: 250px;"> - <a-input v-model:value="formData.sort" /> - </a-form-item> - <a-form-item label="鐘舵��" name="status" style="width: 250px;"> - <a-select ref="select" v-model:value="formData.status" :options="[ - { label: '绂佺敤', value: 0 }, - { label: '姝e父', value: 1 }, - ]"></a-select> - </a-form-item> - <a-form-item> - <a-button type="primary" html-type="submit" ref="submitButton" - style="visibility: hidden;">Submit</a-button> - </a-form-item> - </a-form> - </a-modal> - </div> -</template> - +<script setup> +import { getCurrentInstance, ref, nextTick } from 'vue'; +import { get, post } from '@/utils/request.js' +import * as Icons from "@ant-design/icons-vue"; +import { formatMessage } from '@/utils/localeUtils.js'; +import { message } from 'ant-design-vue'; +const context = getCurrentInstance()?.appContext.config.globalProperties; +const components = { + ...Icons, +}; + +const submitButton = ref(null); +const isSave = ref(true); +const open = ref(false); +const initFormData = { + name: null +} +let formData = ref(initFormData); +const treeData = ref(null); + +const emit = defineEmits(['tableReload']) + +const handleOk = (e) => { + nextTick(() => { + setTimeout(() => { + submitButton.value.$el.click(); + }, 100); + }); +}; + +const onFinish = values => { + // console.log('Success:', values); + open.value = false; + post(isSave.value ? '/api/menu/save' : '/api/menu/update', formData.value).then((resp) => { + let result = resp.data; + if (result.code === 200) { + message.success(formatMessage('page.update.success', '鏇存柊鎴愬姛')); + } else { + message.error(result.msg); + } + emit('tableReload', 'reload') + }) +}; +const onFinishFailed = errorInfo => { + console.log('Failed:', errorInfo); +}; + +defineExpose({ + open, + formData, + initFormData, + treeData, + isSave, +}) + +</script> + +<script> +export default { + name: '鑿滃崟绠$悊' +} +</script> + +<template> + <div> + <a-modal v-model:open="open" + :title="isSave ? formatMessage('page.add', '娣诲姞') : formatMessage('page.edit', '缂栬緫')" @ok="handleOk" + style="width: 600px;"> + <a-form :model="formData" name="menu" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" + style="display: flex;justify-content: space-between;flex-wrap: wrap;" autocomplete="off" + @finish="onFinish" @finishFailed="onFinishFailed"> + <a-form-item label="涓婄骇鑿滃崟" name="parentId" style="width: 250px;" + :rules="[{ required: true, message: '涓婄骇鑿滃崟涓嶈兘涓虹┖!' }]"> + <a-tree-select v-model:value="formData.parentId" show-search style="width: 100%" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + :placeholder="formatMessage('page.input', '璇疯緭鍏�')" allow-clea tree-data-simple-mode + :tree-data="treeData" tree-node-filter-prop="name" :field-names="{ + children: 'children', + label: 'name', + value: 'id', + }"> + <template #title="{ value: id, name }"> + {{ name }} + </template> + </a-tree-select> + </a-form-item> + <a-form-item label="鑿滃崟鍚嶇О" name="name" style="width: 250px;" + :rules="[{ required: true, message: '鑿滃崟鍚嶇О涓嶈兘涓虹┖!' }]"> + <a-input v-model:value="formData.name" /> + </a-form-item> + <a-form-item label="璺敱鍦板潃" name="route" style="width: 250px;"> + <a-input v-model:value="formData.route" /> + </a-form-item> + <a-form-item label="椤甸潰缁勪欢" name="component" style="width: 250px;"> + <a-input v-model:value="formData.component" /> + </a-form-item> + <a-form-item label="绫诲瀷" name="type" style="width: 250px;" + :rules="[{ required: true, message: '绫诲瀷涓嶈兘涓虹┖!' }]"> + <a-select ref="select" v-model:value="formData.type" :options="[ + { label: '鑿滃崟', value: 0 }, + { label: '鎸夐挳', value: 1 }, + ]"></a-select> + </a-form-item> + <a-form-item v-if="formData.type == 0" label="鑿滃崟鍥炬爣" name="icon" style="width: 250px;"> + <a-input v-model:value="formData.icon" /> + </a-form-item> + <a-form-item v-else label="鏉冮檺" name="icon" style="width: 250px;"> + <a-input v-model:value="formData.authority" /> + </a-form-item> + <a-form-item label="鍥介檯鍖朓D" name="icon" style="width: 250px;"> + <a-input v-model:value="formData.languageId" /> + </a-form-item> + <a-form-item label="鎺掑簭" name="sort" style="width: 250px;"> + <a-input v-model:value="formData.sort" /> + </a-form-item> + <a-form-item label="鐘舵��" name="status" style="width: 250px;"> + <a-select ref="select" v-model:value="formData.status" :options="[ + { label: '绂佺敤', value: 0 }, + { label: '姝e父', value: 1 }, + ]"></a-select> + </a-form-item> + <a-form-item> + <a-button type="primary" html-type="submit" ref="submitButton" + style="visibility: hidden;">Submit</a-button> + </a-form-item> + </a-form> + </a-modal> + </div> +</template> + <style></style> \ No newline at end of file -- Gitblit v1.9.1