|
@@ -1,8 +1,56 @@
|
|
|
<template>
|
|
<template>
|
|
|
<el-card shadow="never" class="aui-card--fill">
|
|
<el-card shadow="never" class="aui-card--fill">
|
|
|
<div class="mod-home">
|
|
<div class="mod-home">
|
|
|
- <h3>活动类型</h3>
|
|
|
|
|
|
|
+ <div class="title">活动类型管理</div>
|
|
|
|
|
+ <div class="query adfacjb">
|
|
|
|
|
+ <div class="query-left adfac">
|
|
|
|
|
+ <div class="text">活动类型</div>
|
|
|
|
|
+ <el-input v-model="queryParams.typeName" placeholder="请输入类型名称" @keyup.enter.native="getList"></el-input>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="query-right">
|
|
|
|
|
+ <el-button type="default" @click="handleReset">重置</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="getList">查询</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="add">
|
|
|
|
|
+ <el-button type="primary" @click="handleAdd" v-if="$hasPermission('core:activitytype:save')">新增活动类型</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-table :data="dataList" border cell-class-name="vertical-top-cell" v-loading="loading" empty-text="暂无活动类型" style="margin-top: 12px;">
|
|
|
|
|
+ <el-table-column prop="typeName" label="类型名称"></el-table-column>
|
|
|
|
|
+ <el-table-column prop="typeNo" label="分类编码"></el-table-column>
|
|
|
|
|
+ <el-table-column prop="enable" label="状态">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <div>{{ scope.row.enable?'启用':'停用' }}</div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" width="250">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ <el-button link type="text" @click="handleEdit(scope.row)" v-if="$hasPermission('core:activitytype:update')">编辑</el-button>
|
|
|
|
|
+ <el-button link type="text" @click="handleOpenClose(scope.row,1)" v-if="$hasPermission('core:activitytype:openClose')&&scope.row.enable==0">启用</el-button>
|
|
|
|
|
+ <el-button link type="text" @click="handleOpenClose(scope.row,0)" v-if="$hasPermission('core:activitytype:openClose')&&scope.row.enable==1">停用</el-button>
|
|
|
|
|
+ <el-button link type="text" @click="handleDelete(scope.row)" v-if="$hasPermission('core:activitytype:delete')">删除</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <el-dialog width="800px" :visible.sync="show" :title="title" @close="cancel">
|
|
|
|
|
+ <el-form ref="typeRef" :model="form" :rules="rules" label-width="100px" style="width: 70%;margin: 0 auto;">
|
|
|
|
|
+ <el-form-item label="类型名称" prop="typeName">
|
|
|
|
|
+ <el-input v-model="form.typeName" placeholder="请输入类型名称"></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="分类编码" prop="typeNo">
|
|
|
|
|
+ <el-input v-model="form.typeNo" placeholder="请输入分类编码"></el-input>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="状态" prop="enable">
|
|
|
|
|
+ <el-radio v-model="form.enable" :label="1">启用</el-radio>
|
|
|
|
|
+ <el-radio v-model="form.enable" :label="0">停用</el-radio>
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+ <div class="demo-drawer__footer" style="display: flex;justify-content: end;margin-top: 300px;">
|
|
|
|
|
+ <el-button :loading="buttonLoading" type="primary" @click="submitForm">保 存</el-button>
|
|
|
|
|
+ <el-button @click="cancel" style="margin-right: 5%;">取 消</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -10,15 +58,152 @@
|
|
|
export default {
|
|
export default {
|
|
|
data () {
|
|
data () {
|
|
|
return {
|
|
return {
|
|
|
-
|
|
|
|
|
|
|
+ queryParams: {
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ limit: 10,
|
|
|
|
|
+ typeName: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ dataList: [],
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ show: false,
|
|
|
|
|
+ buttonLoading: false,
|
|
|
|
|
+ title: '新增活动类型',
|
|
|
|
|
+ form: {
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ typeName: '',
|
|
|
|
|
+ typeNo: '',
|
|
|
|
|
+ enable: 1
|
|
|
|
|
+ },
|
|
|
|
|
+ rules: {
|
|
|
|
|
+ typeName: [
|
|
|
|
|
+ { required: true, message: '请输入类型名称', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ typeNo: [
|
|
|
|
|
+ { required: true, message: '请输入分类编码', trigger: 'blur' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ enable: [
|
|
|
|
|
+ { required: true, message: '请选择状态', trigger: 'change' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ mounted () {
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
-
|
|
|
|
|
|
|
+ handleReset () {
|
|
|
|
|
+ this.queryParams = {
|
|
|
|
|
+ page: 1,
|
|
|
|
|
+ limit: 10,
|
|
|
|
|
+ typeName: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ },
|
|
|
|
|
+ handleAdd () {
|
|
|
|
|
+ this.title = '新增活动类型'
|
|
|
|
|
+ this.show = true
|
|
|
|
|
+ },
|
|
|
|
|
+ handleEdit (row) {
|
|
|
|
|
+ this.$http.get('/core/activity/type/' + row.id).then(res => {
|
|
|
|
|
+ if (res.data.code !== 0) return this.$message.error(res.msg)
|
|
|
|
|
+ this.form = { ...this.form, ...res.data.data }
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.title = '编辑活动类型'
|
|
|
|
|
+ this.show = true
|
|
|
|
|
+ this.$refs.typeRef.clearValidate()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ cancel () {
|
|
|
|
|
+ this.show = false
|
|
|
|
|
+ this.form = {
|
|
|
|
|
+ id: '',
|
|
|
|
|
+ typeName: '',
|
|
|
|
|
+ typeNo: '',
|
|
|
|
|
+ enable: 1
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$refs.typeRef.resetFields()
|
|
|
|
|
+ },
|
|
|
|
|
+ getList () {
|
|
|
|
|
+ this.loading = true
|
|
|
|
|
+ this.$http.get('/core/activity/type/page', { params: this.queryParams }).then(res => {
|
|
|
|
|
+ if (res.data.code !== 0) return this.$message.error(res.msg)
|
|
|
|
|
+ this.dataList = res.data.data.list
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ submitForm () {
|
|
|
|
|
+ this.$refs.typeRef.validate((valid) => {
|
|
|
|
|
+ if (valid) {
|
|
|
|
|
+ this.$http[this.form.id ? 'put' : 'post']('/core/activity/type', this.form).then(res => {
|
|
|
|
|
+ if (res.data.code !== 0) {
|
|
|
|
|
+ return this.$message.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$message.success('保存成功')
|
|
|
|
|
+ this.cancel()
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ handleOpenClose (row, enable) {
|
|
|
|
|
+ let dto = JSON.parse(JSON.stringify(row))
|
|
|
|
|
+ dto.enable = enable
|
|
|
|
|
+ this.$http.put('/core/activity/type', dto).then(res => {
|
|
|
|
|
+ if (res.data.code !== 0) return this.$message.error(res.msg)
|
|
|
|
|
+ this.$message.success('操作成功')
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ handleDelete (row) {
|
|
|
|
|
+ this.$confirm(`是否确认删除活动类型【${row.typeName}】?`, '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning'
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.$http.delete('/core/activity/type', { 'data': [row.id] }).then(res => {
|
|
|
|
|
+ if (res.data.code !== 0) return this.$message.error(res.msg)
|
|
|
|
|
+ this.$message.success('删除成功')
|
|
|
|
|
+ this.getList()
|
|
|
|
|
+ })
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ this.$message({
|
|
|
|
|
+ type: 'info',
|
|
|
|
|
+ message: '已取消删除'
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
<style scoped lang="scss">
|
|
|
|
|
+ .title{
|
|
|
|
|
+ font-family: PingFang-SC, PingFang-SC;
|
|
|
|
|
+ font-weight: bold;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ color: #252525;
|
|
|
|
|
+ line-height: 22px;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ .query{
|
|
|
|
|
+ margin-top: 23px;
|
|
|
|
|
+ &-left{
|
|
|
|
|
+ .text{
|
|
|
|
|
+ width: 80px;
|
|
|
|
|
+ font-family: PingFangSC, PingFang SC;
|
|
|
|
|
+ font-weight: 400;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: #393939;
|
|
|
|
|
+ line-height: 20px;
|
|
|
|
|
+ margin-right: 16px;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ .add{
|
|
|
|
|
+ margin-top: 24px;
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|