fix: 修复一些TypeScript打包编译报错问题,现版本可成功生产打包
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<el-form
|
<el-form
|
||||||
ref="queryForm"
|
ref="queryFormRef"
|
||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
size="small"
|
size="small"
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
width="600px"
|
width="600px"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
ref="dataForm"
|
ref="dataFormRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
@@ -121,7 +121,6 @@
|
|||||||
<el-form-item label="排序" prop="sort">
|
<el-form-item label="排序" prop="sort">
|
||||||
<el-input v-model="formData.sort"/>
|
<el-input v-model="formData.sort"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<template #footer>
|
<template #footer>
|
||||||
@@ -138,11 +137,12 @@
|
|||||||
import {listBrandsWithPage, getBrandDetail, updateBrand, addBrand, deleteBrands} from '@/api/pms/brand'
|
import {listBrandsWithPage, getBrandDetail, updateBrand, addBrand, deleteBrands} from '@/api/pms/brand'
|
||||||
import SingleUpload from "@/components/Upload/SingleUpload.vue"
|
import SingleUpload from "@/components/Upload/SingleUpload.vue"
|
||||||
import {onMounted, reactive, ref, toRefs, unref} from "vue";
|
import {onMounted, reactive, ref, toRefs, unref} from "vue";
|
||||||
import {ElForm, ElMessage, ElMessageBox} from "element-plus";
|
import {ElForm, ElTable, ElMessage, ElMessageBox} from "element-plus";
|
||||||
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
|
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
|
||||||
|
|
||||||
const dataForm = ref(ElForm) // 属性名必须和元素的ref属性值一致
|
const dataTableRef = ref(ElTable)
|
||||||
const dataTable = ref()
|
const queryFormRef = ref(ElForm) // 属性名必须和元素的ref属性值一致
|
||||||
|
const dataFormRef = ref(ElForm) // 属性名必须和元素的ref属性值一致
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: true,
|
loading: true,
|
||||||
@@ -189,16 +189,14 @@ function handleQuery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
state.queryParams = {
|
const dataTable = unref(dataTableRef)
|
||||||
pageNum: 1,
|
dataTable.resetFields()
|
||||||
pageSize: 10,
|
|
||||||
title: undefined
|
|
||||||
}
|
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRowClick(row: any) {
|
function handleRowClick(row: any) {
|
||||||
dataTable.value.toggleRowSelection(row);
|
const dataTable = unref(dataTableRef)
|
||||||
|
dataTable.toggleRowSelection(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSelectionChange(selection: any) {
|
function handleSelectionChange(selection: any) {
|
||||||
@@ -208,7 +206,6 @@ function handleSelectionChange(selection: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
resetForm()
|
|
||||||
state.dialog = {
|
state.dialog = {
|
||||||
title: '添加品牌',
|
title: '添加品牌',
|
||||||
visible: true
|
visible: true
|
||||||
@@ -216,7 +213,6 @@ function handleAdd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdate(row: any) {
|
function handleUpdate(row: any) {
|
||||||
resetForm()
|
|
||||||
state.dialog = {
|
state.dialog = {
|
||||||
title: '修改品牌',
|
title: '修改品牌',
|
||||||
visible: true,
|
visible: true,
|
||||||
@@ -228,19 +224,21 @@ function handleUpdate(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
const form = unref(dataForm)
|
const dataForm = unref(dataFormRef)
|
||||||
form.validate((valid: any) => {
|
dataForm.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (state.formData.id) {
|
if (state.formData.id) {
|
||||||
updateBrand(state.formData.id as any, state.formData).then(response => {
|
updateBrand(state.formData.id as any, state.formData).then(response => {
|
||||||
ElMessage.success('修改成功')
|
ElMessage.success('修改成功')
|
||||||
state.dialog.visible = false
|
state.dialog.visible = false
|
||||||
|
resetForm()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addBrand(state.formData).then(response => {
|
addBrand(state.formData).then(response => {
|
||||||
ElMessage.success('新增成功')
|
ElMessage.success('新增成功')
|
||||||
state.dialog.visible = false
|
state.dialog.visible = false
|
||||||
|
resetForm()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -248,18 +246,17 @@ function submitForm() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置表单
|
||||||
|
*/
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
state.formData = {
|
const dataForm = unref(dataFormRef)
|
||||||
id: undefined,
|
dataForm.resetFields()
|
||||||
name: undefined,
|
|
||||||
logoUrl: undefined,
|
|
||||||
sort: 1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
resetForm()
|
|
||||||
state.dialog.visible = false
|
state.dialog.visible = false
|
||||||
|
resetForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDelete(row: any) {
|
function handleDelete(row: any) {
|
||||||
@@ -285,5 +282,4 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="component-container">
|
||||||
<el-card class="box-card" shadow="always">
|
<el-card class="box-card" shadow="always">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -158,7 +158,7 @@ function submitForm() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.components-container{
|
.component-container{
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="component-container">
|
||||||
<div class="components-container__main">
|
<div class="component-container__main">
|
||||||
<el-card class="box-card">
|
<el-card class="box-card">
|
||||||
<template #header>
|
<template #header>
|
||||||
<span>商品属性</span>
|
<span>商品属性</span>
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</el-card>
|
</el-card>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="components-container__footer">
|
<div class="component-container__footer">
|
||||||
<el-button @click="handlePrev">上一步,填写商品信息</el-button>
|
<el-button @click="handlePrev">上一步,填写商品信息</el-button>
|
||||||
<el-button type="primary" @click="handleNext">下一步,设置商品库存</el-button>
|
<el-button type="primary" @click="handleNext">下一步,设置商品库存</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -151,7 +151,7 @@ function handleNext() {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.components-container {
|
.component-container {
|
||||||
&__main {
|
&__main {
|
||||||
margin: 20px auto
|
margin: 20px auto
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="component-container">
|
||||||
<div class="components-container__main">
|
<div class="component-container__main">
|
||||||
<el-cascader-panel
|
<el-cascader-panel
|
||||||
ref="categoryRef"
|
ref="categoryRef"
|
||||||
:options="categoryOptions"
|
:options="categoryOptions"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="components-container__footer">
|
<div class="component-container__footer">
|
||||||
<el-button type="primary" @click="handleNext">下一步,填写商品信息</el-button>
|
<el-button type="primary" @click="handleNext">下一步,填写商品信息</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -80,7 +80,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.components-container {
|
.component-container {
|
||||||
&__main {
|
&__main {
|
||||||
margin: 20px auto
|
margin: 20px auto
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="component-container">
|
||||||
<div class="components-container__main">
|
<div class="component-container__main">
|
||||||
<el-form
|
<el-form
|
||||||
ref="dataForm"
|
ref="dataForm"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
:model="modelValue"
|
:model="modelValue"
|
||||||
label-width="120px"
|
label-width="120px"
|
||||||
>
|
>
|
||||||
<el-form-item label="商品名称" prop="name">
|
|
||||||
<el-input style="width: 400px" v-model="modelValue.name"/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="原价" prop="originPrice">
|
|
||||||
<el-input style="width: 400px" v-model="modelValue.originPrice"/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="现价" prop="price">
|
|
||||||
<el-input style="width: 400px" v-model="modelValue.price"/>
|
|
||||||
</el-form-item>
|
|
||||||
|
|
||||||
<el-form-item label="商品品牌" prop="brandId">
|
<el-form-item label="商品品牌" prop="brandId">
|
||||||
<el-select
|
<el-select
|
||||||
v-model="modelValue.brandId"
|
v-model="modelValue.brandId"
|
||||||
@@ -34,16 +22,23 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="商品名称" prop="name">
|
||||||
|
<el-input style="width: 400px" v-model="modelValue.name"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="原价" prop="originPrice">
|
||||||
|
<el-input style="width: 400px" v-model="modelValue.originPrice"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="现价" prop="price">
|
||||||
|
<el-input style="width: 400px" v-model="modelValue.price"/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="商品简介">
|
<el-form-item label="商品简介">
|
||||||
<el-input
|
<el-input type="textarea" v-model="modelValue.description"/>
|
||||||
type="textarea"
|
|
||||||
v-model="modelValue.description"
|
|
||||||
style="width: 400px"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="商品相册">
|
<el-form-item label="商品相册">
|
||||||
|
|
||||||
<el-card v-for="(item,index) in pictures" style="width: 170px;display: inline-block;margin-left: 10px" :body-style="{ padding: '10px' }">
|
<el-card v-for="(item,index) in pictures" style="width: 170px;display: inline-block;margin-left: 10px" :body-style="{ padding: '10px' }">
|
||||||
|
|
||||||
<single-upload v-model="item.url"/>
|
<single-upload v-model="item.url"/>
|
||||||
@@ -62,12 +57,12 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="商品详情" prop="detail">
|
<el-form-item label="商品详情" prop="detail">
|
||||||
<editor v-model="modelValue.detail" ></editor>
|
<editor v-model="modelValue.detail" style="height: 600px"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="components-container__footer">
|
<div class="component-container__footer">
|
||||||
<el-button @click="handlePrev">上一步,选择商品分类</el-button>
|
<el-button @click="handlePrev">上一步,选择商品分类</el-button>
|
||||||
<el-button type="primary" @click="handleNext">下一步,设置商品属性</el-button>
|
<el-button type="primary" @click="handleNext">下一步,设置商品属性</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -178,7 +173,7 @@ onMounted(() => {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.components-container {
|
.component-container {
|
||||||
&__main {
|
&__main {
|
||||||
margin: 20px auto;
|
margin: 20px auto;
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="components-container">
|
<div class="app-container">
|
||||||
|
|
||||||
<el-steps :active="active" process-status="finish" finish-status="success" simple>
|
<el-steps :active="active" process-status="finish" finish-status="success" simple>
|
||||||
<el-step title="选择商品分类"></el-step>
|
<el-step title="选择商品分类"/>
|
||||||
<el-step title="填写商品信息"></el-step>
|
<el-step title="填写商品信息"/>
|
||||||
<el-step title="设置商品属性"></el-step>
|
<el-step title="设置商品属性"/>
|
||||||
<el-step title="设置商品库存"></el-step>
|
<el-step title="设置商品库存"/>
|
||||||
</el-steps>
|
</el-steps>
|
||||||
|
|
||||||
<goods-category
|
<goods-category
|
||||||
@@ -107,8 +106,9 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.form-container {
|
.app-container {
|
||||||
width: 80%;
|
width: 1200px;
|
||||||
margin: 30px auto;
|
margin: 50px auto;
|
||||||
|
border: 1px solid #eee;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="component-container">
|
<div class="component-container">
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<el-form
|
<el-form
|
||||||
ref="queryForm"
|
ref="queryFormRef"
|
||||||
size="mini"
|
size="mini"
|
||||||
:model="queryParams"
|
:model="queryParams"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<el-button type="success" :icon="Plus" @click="handleAdd">新增</el-button>
|
<el-button type="success" :icon="Plus" @click="handleAdd">新增</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item>
|
<el-form-item prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="queryParams.name"
|
v-model="queryParams.name"
|
||||||
placeholder="菜单名称"
|
placeholder="菜单名称"
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
width="750px"
|
width="750px"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
ref="dataForm"
|
ref="dataFormRef"
|
||||||
:model="formData"
|
:model="formData"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
>
|
>
|
||||||
@@ -177,7 +177,9 @@ import IconSelect from '@/components/IconSelect/index.vue';
|
|||||||
const emit = defineEmits(['menuClick'])
|
const emit = defineEmits(['menuClick'])
|
||||||
const showChooseIcon = ref(false);
|
const showChooseIcon = ref(false);
|
||||||
const iconSelectRef = ref(null);
|
const iconSelectRef = ref(null);
|
||||||
const dataForm = ref(ElForm)
|
|
||||||
|
const queryFormRef = ref(ElForm)
|
||||||
|
const dataFormRef = ref(ElForm)
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
loading: true,
|
loading: true,
|
||||||
@@ -250,12 +252,12 @@ async function loadTreeSelectMenuOptions() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置查询
|
||||||
|
*/
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
state.queryParams = {
|
const queryForm = unref(queryFormRef)
|
||||||
pageNum: 1,
|
queryForm.resetFields()
|
||||||
pageSize: 10,
|
|
||||||
name: undefined
|
|
||||||
}
|
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,7 +273,6 @@ function handleRowClick(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleAdd(row: any) {
|
async function handleAdd(row: any) {
|
||||||
resetForm()
|
|
||||||
await loadTreeSelectMenuOptions()
|
await loadTreeSelectMenuOptions()
|
||||||
state.dialog = {
|
state.dialog = {
|
||||||
title: '添加菜单',
|
title: '添加菜单',
|
||||||
@@ -299,7 +300,6 @@ async function handleAdd(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleUpdate(row: any) {
|
async function handleUpdate(row: any) {
|
||||||
resetForm()
|
|
||||||
await loadTreeSelectMenuOptions()
|
await loadTreeSelectMenuOptions()
|
||||||
state.dialog = {
|
state.dialog = {
|
||||||
title: '修改菜单',
|
title: '修改菜单',
|
||||||
@@ -312,8 +312,8 @@ async function handleUpdate(row: any) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
const form = unref(dataForm)
|
const dataForm = unref(dataFormRef)
|
||||||
form.validate((valid: any) => {
|
dataForm.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (state.formData.id) {
|
if (state.formData.id) {
|
||||||
updateMenu(state.formData.id, state.formData).then(response => {
|
updateMenu(state.formData.id, state.formData).then(response => {
|
||||||
@@ -348,23 +348,17 @@ function handleDelete(row: any) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置表单
|
||||||
|
*/
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
state.formData = {
|
const dataForm = unref(dataFormRef)
|
||||||
id: undefined,
|
dataForm.resetFields
|
||||||
parentId: 0,
|
|
||||||
name: undefined,
|
|
||||||
visible: 1,
|
|
||||||
icon: '',
|
|
||||||
sort: 1,
|
|
||||||
component: 'Layout',
|
|
||||||
path: undefined,
|
|
||||||
redirect:''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
resetForm()
|
|
||||||
state.dialog.visible = false
|
state.dialog.visible = false
|
||||||
|
resetForm()
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSelectIcon() {
|
function showSelectIcon() {
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div claas="component-container">
|
||||||
<!-- 搜索表单 -->
|
<!-- 搜索表单 -->
|
||||||
<el-form
|
<el-form
|
||||||
ref="queryForm"
|
ref="queryFormRef"
|
||||||
size="mini"
|
size="mini"
|
||||||
:model="state.queryParams"
|
:model="queryParams"
|
||||||
:inline="true"
|
:inline="true"
|
||||||
>
|
>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="success" :icon="Plus" :disabled="state.single" @click="handleAdd">新增</el-button>
|
<el-button type="success" :icon="Plus" :disabled="!menuId" @click="handleAdd">新增</el-button>
|
||||||
<el-button type="danger" :icon="Delete" :disabled="state.multiple" @click="handleDelete">删除</el-button>
|
<el-button type="danger" :icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item prop="name">
|
||||||
<el-input
|
<el-input
|
||||||
v-model="state.queryParams.name"
|
v-model="queryParams.name"
|
||||||
placeholder="权限名称"
|
placeholder="权限名称"
|
||||||
clearable
|
clearable
|
||||||
@keyup.enter.native="handleQuery"/>
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" :icon="Search" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" :icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
@@ -26,9 +27,8 @@
|
|||||||
|
|
||||||
<!-- 数据表格 -->
|
<!-- 数据表格 -->
|
||||||
<el-table
|
<el-table
|
||||||
ref="dataTable"
|
:data="pageList"
|
||||||
:data="state.pageList"
|
v-loading="loading"
|
||||||
v-loading="state.loading"
|
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
border
|
border
|
||||||
size="mini"
|
size="mini"
|
||||||
@@ -63,64 +63,65 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
|
<!-- 分页工具条 -->
|
||||||
<pagination
|
<pagination
|
||||||
v-show="state.total>0"
|
v-show="total>0"
|
||||||
:total="state.total"
|
:total="total"
|
||||||
:page="state.queryParams.pageNum"
|
:page="queryParams.pageNum"
|
||||||
:limit="state.queryParams.pageSize"
|
:limit="queryParams.pageSize"
|
||||||
@pagination="handleQuery"
|
@pagination="handleQuery"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 表单弹窗 -->
|
<!-- 表单弹窗 -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
:title="state.dialog.title"
|
:title="dialog.title"
|
||||||
v-model="state.dialog.visible"
|
v-model="dialog.visible"
|
||||||
width="700px">
|
width="700px">
|
||||||
<el-form
|
<el-form
|
||||||
ref="dataForm"
|
ref="dataFormRef"
|
||||||
:model="state.formData"
|
:model="formData"
|
||||||
:rules="state.rules"
|
:rules="rules"
|
||||||
label-width="120px">
|
label-width="120px"
|
||||||
|
>
|
||||||
|
|
||||||
<el-form-item label="权限名称" prop="name">
|
<el-form-item label="权限名称" prop="name">
|
||||||
<el-input v-model="state.formData.name" placeholder="请输入权限名称"/>
|
<el-input v-model="formData.name" placeholder="请输入权限名称"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="URL权限标识" prop="urlPerm">
|
<el-form-item label="URL权限标识" prop="urlPerm">
|
||||||
<el-input placeholder="/api/v1/users" v-model="state.urlPerm.requestPath" class="input-with-select">
|
<el-input placeholder="/api/v1/users" v-model="urlPerm.requestPath" class="input-with-select">
|
||||||
|
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="state.urlPerm.serviceName"
|
v-model="urlPerm.serviceName"
|
||||||
style="width: 130px;"
|
style="width: 130px;"
|
||||||
placeholder="所属服务"
|
placeholder="所属服务"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option v-for="item in state.microServiceOptions" :value="item.value" :label="item.name"/>
|
<el-option v-for="item in microServiceOptions" :value="item.value" :label="item.name"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
|
||||||
<el-select
|
<el-select
|
||||||
v-model="state.urlPerm.requestMethod"
|
v-model="urlPerm.requestMethod"
|
||||||
style="width: 120px;margin-left: 20px"
|
style="width: 120px;margin-left: 20px"
|
||||||
slot="prepend"
|
slot="prepend"
|
||||||
placeholder="请求方式"
|
placeholder="请求方式"
|
||||||
clearable
|
clearable
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in state.requestMethodOptions"
|
v-for="item in requestMethodOptions"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
:label="item.name"
|
:label="item.name"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
<el-link v-show="state.urlPerm.requestMethod">
|
<el-link v-show="urlPerm.requestMethod">
|
||||||
{{ state.urlPerm.requestMethod }}:/{{ state.urlPerm.serviceName }}{{ state.urlPerm.requestPath }}
|
{{ urlPerm.requestMethod }}:/{{ urlPerm.serviceName }}{{ urlPerm.requestPath }}
|
||||||
</el-link>
|
</el-link>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="按钮权限标识" prop="btnPerm">
|
<el-form-item label="按钮权限标识" prop="btnPerm">
|
||||||
<el-input v-model="state.formData.btnPerm" placeholder="sys:user:add"/>
|
<el-input v-model="formData.btnPerm" placeholder="sys:user:add"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -142,14 +143,13 @@ import {ElForm, ElMessage, ElMessageBox} from "element-plus"
|
|||||||
|
|
||||||
const {proxy}: any = getCurrentInstance();
|
const {proxy}: any = getCurrentInstance();
|
||||||
|
|
||||||
|
const queryFormRef = ref(ElForm)
|
||||||
|
const dataFormRef = ref(ElForm)
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
menuId: {
|
menuId: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: ''
|
||||||
},
|
|
||||||
menuName: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -196,9 +196,8 @@ const state = reactive({
|
|||||||
{required: true, message: '请选择请求方式', trigger: 'blur'}
|
{required: true, message: '请选择请求方式', trigger: 'blur'}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
microServiceOptions: [],
|
microServiceOptions: [] as Array<any>,
|
||||||
requestMethodOptions: [] as Array<any>,
|
requestMethodOptions: [] as Array<any>,
|
||||||
menuName: undefined,
|
|
||||||
urlPerm: {
|
urlPerm: {
|
||||||
requestMethod: undefined,
|
requestMethod: undefined,
|
||||||
serviceName: undefined,
|
serviceName: undefined,
|
||||||
@@ -206,8 +205,21 @@ const state = reactive({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
toRefs(state)
|
const {
|
||||||
|
loading,
|
||||||
|
ids,
|
||||||
|
single,
|
||||||
|
multiple,
|
||||||
|
pageList,
|
||||||
|
total,
|
||||||
|
dialog,
|
||||||
|
formData,
|
||||||
|
rules,
|
||||||
|
microServiceOptions,
|
||||||
|
requestMethodOptions,
|
||||||
|
urlPerm,
|
||||||
|
queryParams
|
||||||
|
} = toRefs(state)
|
||||||
|
|
||||||
function handleQuery() {
|
function handleQuery() {
|
||||||
if (state.queryParams.menuId) {
|
if (state.queryParams.menuId) {
|
||||||
@@ -227,12 +239,8 @@ function handleQuery() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetQuery() {
|
function resetQuery() {
|
||||||
state.queryParams = {
|
const queryForm = unref(queryFormRef)
|
||||||
pageNum: 1,
|
queryForm.resetFields()
|
||||||
pageSize: 10,
|
|
||||||
menuId: undefined,
|
|
||||||
name: undefined
|
|
||||||
}
|
|
||||||
handleQuery()
|
handleQuery()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,11 +250,10 @@ function handleSelectionChange(selection: any) {
|
|||||||
state.multiple = !selection.length
|
state.multiple = !selection.length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 字典数据准备
|
* 加载字典数据
|
||||||
*/
|
*/
|
||||||
function loadDictData() {
|
function loadDictOptions() {
|
||||||
proxy.$listDictsByCode('micro_service').then((response: any) => {
|
proxy.$listDictsByCode('micro_service').then((response: any) => {
|
||||||
state.microServiceOptions = response.data
|
state.microServiceOptions = response.data
|
||||||
})
|
})
|
||||||
@@ -257,8 +264,7 @@ function loadDictData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleAdd() {
|
function handleAdd() {
|
||||||
resetForm()
|
loadDictOptions()
|
||||||
loadDictData()
|
|
||||||
state.dialog = {
|
state.dialog = {
|
||||||
title: '添加权限',
|
title: '添加权限',
|
||||||
visible: true
|
visible: true
|
||||||
@@ -266,8 +272,7 @@ function handleAdd() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleUpdate(row: any) {
|
function handleUpdate(row: any) {
|
||||||
resetForm()
|
loadDictOptions()
|
||||||
loadDictData()
|
|
||||||
state.dialog = {
|
state.dialog = {
|
||||||
title: '修改权限',
|
title: '修改权限',
|
||||||
visible: true
|
visible: true
|
||||||
@@ -286,11 +291,9 @@ function handleUpdate(row: any) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataForm = ref(ElForm)
|
|
||||||
|
|
||||||
function submitForm() {
|
function submitForm() {
|
||||||
const form = unref(dataForm)
|
const dataForm = unref(dataFormRef)
|
||||||
form.validate((valid: any) => {
|
dataForm.validate((valid: any) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
// 接口权限和按钮权限必填其一
|
// 接口权限和按钮权限必填其一
|
||||||
console.log(state.urlPerm.requestPath, state.formData.btnPerm)
|
console.log(state.urlPerm.requestPath, state.formData.btnPerm)
|
||||||
@@ -298,7 +301,6 @@ function submitForm() {
|
|||||||
ElMessage.warning('请至少填写一种权限')
|
ElMessage.warning('请至少填写一种权限')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果填写了URL权限,完整性校验
|
// 如果填写了URL权限,完整性校验
|
||||||
if (!state.urlPerm.requestPath) {
|
if (!state.urlPerm.requestPath) {
|
||||||
if (!state.urlPerm.requestMethod) {
|
if (!state.urlPerm.requestMethod) {
|
||||||
@@ -317,12 +319,14 @@ function submitForm() {
|
|||||||
updatePerm(state.formData.id, state.formData).then(response => {
|
updatePerm(state.formData.id, state.formData).then(response => {
|
||||||
ElMessage.success('修改成功')
|
ElMessage.success('修改成功')
|
||||||
state.dialog.visible = false
|
state.dialog.visible = false
|
||||||
|
resetForm()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
addPerm(state.formData).then(response => {
|
addPerm(state.formData).then(response => {
|
||||||
ElMessage.success('新增成功')
|
ElMessage.success('新增成功')
|
||||||
state.dialog.visible = false
|
state.dialog.visible = false
|
||||||
|
resetForm()
|
||||||
handleQuery()
|
handleQuery()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -330,14 +334,13 @@ function submitForm() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置表单
|
||||||
|
*/
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
state.formData = {
|
const dataForm = unref(dataFormRef)
|
||||||
id: undefined,
|
dataForm.resetFields()
|
||||||
name: undefined,
|
|
||||||
urlPerm: '',
|
|
||||||
btnPerm: '',
|
|
||||||
menuId: ''
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancel() {
|
function cancel() {
|
||||||
@@ -366,7 +369,7 @@ onMounted(() => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.perm-container {
|
.component-container {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -442,9 +442,9 @@ const state = reactive({
|
|||||||
],
|
],
|
||||||
email: [
|
email: [
|
||||||
{
|
{
|
||||||
type: 'email',
|
pattern: /\w[-\w.+]*@([A-Za-z0-9][-A-Za-z0-9]+\.)+[A-Za-z]{2,14}/,
|
||||||
message: '\'请输入正确的邮箱地址',
|
message: '请输入正确的邮箱地址',
|
||||||
trigger: ['blur', 'change']
|
trigger: 'blur'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
mobile: [
|
mobile: [
|
||||||
|
|||||||
Reference in New Issue
Block a user