From ddfd2c45dea517f5330a2da02bba253479fe0fe0 Mon Sep 17 00:00:00 2001 From: zhangxiao <898441624@qq.com> Date: 星期五, 23 八月 2024 19:24:06 +0800 Subject: [PATCH] fix: 权限 --- src/views/dmx/knowledgeLib/addKnow.vue | 124 +++++++++++++++++++++------------------- 1 files changed, 65 insertions(+), 59 deletions(-) diff --git a/src/views/dmx/knowledgeLib/addKnow.vue b/src/views/dmx/knowledgeLib/addKnow.vue index 1146c01..be82a80 100644 --- a/src/views/dmx/knowledgeLib/addKnow.vue +++ b/src/views/dmx/knowledgeLib/addKnow.vue @@ -1,19 +1,32 @@ - <template> - <a-button type="primary" @click="handleClick" style="margin-left: 10px"> + <a-button + v-hasPermi="'/kb/create'" + type="primary" + @click="handleClick" + style="margin-left: 10px" + > <template #icon> <icon-plus /> </template> </a-button> - <a-modal v-model:visible="visible" title="鍒涘缓鐭ヨ瘑搴�" @before-open="handleOpened" @cancel="handleCancel" :footer="false" title-align="start"> - <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit" > + <a-modal + v-model:visible="visible" + title="鍒涘缓鐭ヨ瘑搴�" + @before-open="handleOpened" + @cancel="handleCancel" + :footer="false" + title-align="start" + > + <a-form ref="formRef" :rules="rules" :model="form" @submit="handleSubmit"> <a-form-item field="name" label="鍚嶇О"> - <a-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�"/> + <a-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" /> </a-form-item> <a-form-item> - <div style="width: 100%;text-align: right"> + <div style="width: 100%; text-align: right"> <a-button @click="visible = false">鍙栨秷</a-button> - <a-button style="margin-left: 10px" type="primary" html-type="submit">纭畾</a-button> + <a-button style="margin-left: 10px" type="primary" html-type="submit" + >纭畾</a-button + > </div> </a-form-item> </a-form> @@ -21,71 +34,64 @@ </template> <script lang="ts" setup> -import { onMounted ,onBeforeMount, reactive, ref } from "vue"; -import { kbcreate } from "@/api/kbList"; -import { Message } from '@arco-design/web-vue'; + import { onMounted, onBeforeMount, reactive, ref } from 'vue'; + import { kbcreate } from '@/api/kbList'; + import { Message } from '@arco-design/web-vue'; -const visible = ref(false); -const form = reactive({ - name: '',// 鐢ㄦ埛鍚� -}); -const formRef = ref(null); + const visible = ref(false); + const form = reactive({ + name: '', // 鐢ㄦ埛鍚� + }); + const formRef = ref(null); -const rules = { - name: [ - { - required: true, - message:'鍚嶇О涓嶅厑璁镐负绌�', - }, - ], -} + const rules = { + name: [ + { + required: true, + message: '鍚嶇О涓嶅厑璁镐负绌�', + }, + ], + }; + const emit = defineEmits(['getknowledge', 'getKbdetail']); -const emit = defineEmits(['getknowledge','getKbdetail']) - -const handleSubmit = async({values, errors}) => { - if(errors) return; + const handleSubmit = async ({ values, errors }) => { + if (errors) return; let data = await kbcreate({ name: values.name, - }) - if(data.code == 0){ + }); + if (data.code == 0) { visible.value = false; Message.success('鍒涘缓鎴愬姛'); // emit('getKbdetail',data.data.kb_id); - emit("getknowledge",data.data.kb_id); + emit('getknowledge', data.data.kb_id); } -} + }; -const handleClick = () => { - visible.value = true; -}; -const handleBeforeOk = (done) => { - formRef.value.validate().then(res => { - console.log('form:', form) + const handleClick = () => { + visible.value = true; + }; + const handleBeforeOk = (done) => { + formRef.value.validate().then((res) => { + console.log('form:', form); if (!form.name) { - done(false) - }else { + done(false); + } else { console.log('璇锋眰鏁版嵁'); - } - }) -}; -const handleCancel = () => { - visible.value = false; -} + }); + }; + const handleCancel = () => { + visible.value = false; + }; -const handleOpened =(el) => { - Object.assign(form,{ - name: '',// 鐢ㄦ埛鍚� - }); - formRef.value.resetFields(); -} + const handleOpened = (el) => { + Object.assign(form, { + name: '', // 鐢ㄦ埛鍚� + }); + formRef.value.resetFields(); + }; -onBeforeMount(()=>{ - -}) -onMounted(()=>{ - - -}) -</script> \ No newline at end of file + onBeforeMount(() => {}); + onMounted(() => {}); +</script> -- Gitblit v1.8.0