修改模板
This commit is contained in:
@@ -15,10 +15,11 @@ export function addObj(obj) {
|
||||
})
|
||||
}
|
||||
|
||||
export function delObj(id) {
|
||||
export function delObj(id, mode) {
|
||||
return axios({
|
||||
url: '/gen/template/directory-entry/' + id,
|
||||
method: 'delete'
|
||||
method: 'delete',
|
||||
params: { mode: mode }
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ import {
|
||||
Dropdown,
|
||||
message,
|
||||
Breadcrumb,
|
||||
Modal
|
||||
Modal,
|
||||
Radio
|
||||
} from 'ant-design-vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
@@ -44,6 +45,7 @@ Vue.use(Result)
|
||||
Vue.use(Dropdown)
|
||||
Vue.use(Breadcrumb)
|
||||
Vue.use(Modal)
|
||||
Vue.use(Radio)
|
||||
Vue.prototype.$message = message
|
||||
|
||||
Vue.prototype.FORM_ACTION = {
|
||||
|
||||
@@ -37,7 +37,7 @@ export default {
|
||||
buildUpdatedForm(record, argument) {
|
||||
let that = this
|
||||
that.formAction = that.FORM_ACTION.UPDATE
|
||||
record = that.echoDataProcess(record)
|
||||
that.echoDataProcess(record)
|
||||
// 延迟加载 避免隐藏展示元素时出现的bug
|
||||
setTimeout(() => {
|
||||
// 获取仅展示元素
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-row :gutter="10">
|
||||
<a-col class="gutter-row" :span="9">
|
||||
<a-col class="gutter-row treesetting-row" :span="9">
|
||||
<a-directory-tree
|
||||
v-model="checkedKeys"
|
||||
:expanded-keys="expandedKeys"
|
||||
@@ -18,18 +18,15 @@
|
||||
>
|
||||
</a-directory-tree>
|
||||
<a-menu :style="menuStyle" v-if="menuVisible">
|
||||
<a-menu-item key="1">
|
||||
<a-icon type="edit" />
|
||||
重命名
|
||||
</a-menu-item>
|
||||
<a-menu-item key="2">
|
||||
<a-menu-item key="1" :style="menuItemStyle" @click="renameModel"> <a-icon type="edit" />重命名 </a-menu-item>
|
||||
<a-menu-item key="2" :style="menuItemStyle" @click="removeTree">
|
||||
<a-icon type="delete" />
|
||||
删除
|
||||
</a-menu-item>
|
||||
<a-menu-item key="3">
|
||||
<!-- <a-menu-item key="3" :style="menuItemStyle">
|
||||
<a-icon type="form" />
|
||||
编辑
|
||||
</a-menu-item>
|
||||
</a-menu-item>-->
|
||||
</a-menu>
|
||||
</a-col>
|
||||
<a-col class="gutter-row" :span="15">
|
||||
@@ -61,6 +58,8 @@
|
||||
</a-form>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<rename-model ref="renameModel"></rename-model>
|
||||
<remove-model ref="removeModel"></remove-model>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -76,12 +75,13 @@ import 'codemirror/lib/codemirror.css'
|
||||
import 'codemirror/theme/dracula.css'
|
||||
import 'codemirror/mode/velocity/velocity.js'
|
||||
//import { TablePageMixin } from '@/mixins'
|
||||
|
||||
import renameModel from './TemplateGroupRenameModel.vue'
|
||||
import removeModel from './TemplateGroupRemoveTree.vue'
|
||||
export default {
|
||||
name: 'TemplateDirectoryEntryPage',
|
||||
//mixins: [TablePageMixin],
|
||||
mixins: [FormMixin],
|
||||
components: { codemirror },
|
||||
components: { codemirror, renameModel, removeModel },
|
||||
data() {
|
||||
return {
|
||||
delObj: delObj,
|
||||
@@ -89,9 +89,22 @@ export default {
|
||||
autoExpandParent: true,
|
||||
checkedKeys: [],
|
||||
selectedKeys: [],
|
||||
selectTitle: '',
|
||||
dataRef: null,
|
||||
treeData: [],
|
||||
menuVisible: false,
|
||||
menuItemStyle: {
|
||||
height: '31px',
|
||||
lineHeight: '31px',
|
||||
fontSize: '13px',
|
||||
marginBottom: '0'
|
||||
},
|
||||
menuStyle: {
|
||||
boxShadow: '0 2px 4px rgba(0, 0, 0, 0.12), 0 0 2px rgba(0, 0, 0, 0.04)',
|
||||
borderRadius: '2px',
|
||||
fontFamily: 'arial',
|
||||
zIndex: 999,
|
||||
padding: '2px 0 8px 0',
|
||||
position: 'fixed',
|
||||
top: '0',
|
||||
left: '0',
|
||||
@@ -131,7 +144,9 @@ export default {
|
||||
},
|
||||
onRightClick(e) {
|
||||
const event = e.event
|
||||
this.dataRef = e.node.dataRef
|
||||
this.selectedKeys = [e.node.dataRef.id]
|
||||
this.selectTitle = e.node.dataRef.title
|
||||
this.menuStyle.top = event.clientY + 'px'
|
||||
this.menuStyle.left = event.clientX + 'px'
|
||||
this.menuVisible = true
|
||||
@@ -198,6 +213,13 @@ export default {
|
||||
},
|
||||
backToPage(needRefresh) {
|
||||
this.$emit('backToPage', needRefresh)
|
||||
},
|
||||
renameModel() {
|
||||
this.$refs.renameModel.update({ title: this.selectTitle, id: this.selectedKeys[0] })
|
||||
},
|
||||
removeTree() {
|
||||
/*删除树节点*/
|
||||
this.$refs.removeModel.update(this.dataRef)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,4 +228,26 @@ export default {
|
||||
.ant-form-item {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
.treesetting-row {
|
||||
overflow: auto;
|
||||
height: 540px;
|
||||
border: none;
|
||||
}
|
||||
.treesetting-row::-webkit-scrollbar {
|
||||
/*滚动条整体样式*/
|
||||
width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
|
||||
height: 1px;
|
||||
}
|
||||
.treesetting-row::-webkit-scrollbar-thumb {
|
||||
/*滚动条里面小方块*/
|
||||
border-radius: 8px;
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
background: #969696;
|
||||
}
|
||||
.treesetting-row::-webkit-scrollbar-track {
|
||||
/*滚动条里面轨道*/
|
||||
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 8px;
|
||||
background: #ededed;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<a-modal title="节点删除" :visible="visible" :confirm-loading="confirmLoading" @ok="handleOk" @cancel="handleClose">
|
||||
<a-form :form="form" @submit="handleOk">
|
||||
<a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="删除">
|
||||
<a-radio-group v-decorator="['mode', { initialValue: 1, rules: [{ required: true, message: '必填内容' }] }]">
|
||||
<a-radio :value="1">
|
||||
删除本身(子节点向上移动)
|
||||
</a-radio>
|
||||
<a-radio :value="2">
|
||||
删除所有
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FormModalMixin } from '@/mixins'
|
||||
import { delObj } from '@/api/gen/templatedirectoryentry'
|
||||
export default {
|
||||
name: 'TemplatePropertyPage',
|
||||
mixins: [FormModalMixin],
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
confirmLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
echoDataProcess(data) {
|
||||
this.id = data.id
|
||||
},
|
||||
handleOk() {
|
||||
// 钩子函数 处理提交之前处理的事件
|
||||
if (!this.form.getFieldValue('title')) {
|
||||
return
|
||||
}
|
||||
delObj(this.id, this.form.getFieldValue('mode'))
|
||||
.then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg)
|
||||
this.submitSuccess(res)
|
||||
this.$parent.pageLoad()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error(error.response.data.msg)
|
||||
})
|
||||
.finally(() => {
|
||||
this.submitLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<a-modal title="重命名" :visible="visible" :confirm-loading="confirmLoading" @ok="handleOk" @cancel="handleClose">
|
||||
<a-form :form="form" @submit="handleOk">
|
||||
<a-form-item :label-col="labelCol" :wrapper-col="wrapperCol" label="文件名">
|
||||
<a-input
|
||||
v-decorator="['title', { rules: [{ required: true, message: '重命名文件名不能为空' }] }]"
|
||||
placeholder="请输入你的重命名文件名"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FormModalMixin } from '@/mixins'
|
||||
import { rename } from '@/api/gen/templatedirectoryentry'
|
||||
export default {
|
||||
name: 'TemplatePropertyPage',
|
||||
mixins: [FormModalMixin],
|
||||
data() {
|
||||
return {
|
||||
id: '',
|
||||
rename: rename,
|
||||
confirmLoading: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
echoDataProcess(data) {
|
||||
this.id = data.id
|
||||
},
|
||||
handleOk() {
|
||||
// 钩子函数 处理提交之前处理的事件
|
||||
if (!this.form.getFieldValue('title')) {
|
||||
return
|
||||
}
|
||||
rename(this.id, this.form.getFieldValue('title'))
|
||||
.then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$message.success(res.msg)
|
||||
this.submitSuccess(res)
|
||||
this.$parent.pageLoad()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$message.error(error.response.data.msg)
|
||||
})
|
||||
.finally(() => {
|
||||
this.submitLoading = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,5 +1,5 @@
|
||||
const SERVER_URL = 'http://ballcat-admin:7777'
|
||||
|
||||
/*const SERVER_URL = 'http://ballcat-admin:7777'*/
|
||||
const SERVER_URL = 'http://192.168.1.253:7777'
|
||||
const vueConfig = {
|
||||
css: {
|
||||
loaderOptions: {
|
||||
|
||||
Reference in New Issue
Block a user