master
xy 1 year ago
parent 990c7b4ed7
commit 3f591ee8ec

1
.gitignore vendored

@ -14,4 +14,3 @@ tests/**/coverage/
*.ntvs*
*.njsproj
*.sln
/script/

@ -0,0 +1,37 @@
import request from '@/utils/request'
export function index(params,isLoading = true) {
return request({
method: 'get',
url: '/api/admin/<%- data.name %>/index',
params,
isLoading
})
}
export function show(params,isLoading = true) {
return request({
method: 'get',
url: '/api/admin/<%- data.name %>/show',
params,
isLoading
})
}
export function save(data, isLoading = true) {
return request({
method: 'post',
url: '/api/admin/<%- data.name %>/save',
data,
isLoading
})
}
export function destroy(params, isLoading = true) {
return request({
method: 'get',
url: '/api/admin/<%- data.name %>/destroy',
params,
isLoading
})
}

@ -0,0 +1,80 @@
const {compiler, resolveName, ensureDirectoryExistence, writeFile} = require("./utils");
const path = require("path");
const fs = require("fs");
const moment = require('moment');
const { t } = require("./tables")
async function createTable(name, fields, options) {
const fileRes = await compiler("tableTemplate.ejs", {
name: resolveName(name),
originalName: name,
fields,
options
})
ensureDirectoryExistence(path.resolve(__dirname, `../src/views/${resolveName(name)}`))
const filePath = path.resolve(__dirname, `../src/views/${resolveName(name)}`, `${resolveName(name)}.vue`)
await writeFile(filePath, fileRes)
}
async function createDrawer(name, fields, options) {
const fileRes = await compiler("drawerTemplate.ejs", {
name: resolveName(name),
originalName: name,
fields,
options
})
ensureDirectoryExistence(path.resolve(__dirname, `../src/views/${resolveName(name)}`))
ensureDirectoryExistence(path.resolve(__dirname, `../src/views/${resolveName(name)}/components`))
const filePath = path.resolve(__dirname, `../src/views/${resolveName(name)}/components`, `Add${resolveName(name)}.vue`)
await writeFile(filePath, fileRes)
}
async function createDetail(name, fields, options) {
const fileRes = await compiler("showTemplate.ejs", {
name: resolveName(name),
originalName: name,
fields,
options
})
ensureDirectoryExistence(path.resolve(__dirname, `../src/views/${resolveName(name)}`))
ensureDirectoryExistence(path.resolve(__dirname, `../src/views/${resolveName(name)}/components`))
const filePath = path.resolve(__dirname, `../src/views/${resolveName(name)}/components`, `Show${resolveName(name)}.vue`)
await writeFile(filePath, fileRes)
}
async function createApi(name) {
const fileRes = await compiler("apiTemplate.ejs", {
name
})
ensureDirectoryExistence(path.resolve(__dirname, `../src/api/${name}`))
const filePath = path.resolve(__dirname, `../src/api/${name}`, `${name}.js`)
await writeFile(filePath, fileRes)
}
function create(name, fields, options) {
try {
createApi(name)
createTable(name, fields, options)
createDrawer(name, fields, options)
createDetail(name, fields, options)
t[name] = {
fields,
options
}
const textPath = path.resolve(__dirname, './log.txt')
if (!fs.existsSync(textPath)) {
fs.writeFileSync(textPath, '')
}
fs.appendFileSync(textPath, name + '\n', 'utf8')
fs.appendFileSync(textPath, JSON.stringify(fields) + '\n', 'utf8')
fs.appendFileSync(textPath, JSON.stringify(options) + '\n', 'utf8')
fs.appendFileSync(textPath, moment().format('YYYY-MM-DD HH:mm:ss') + '\n', 'utf8')
} catch (err) {
console.error(err)
}
}
module.exports = {
create
}

@ -0,0 +1,297 @@
<% function handleFormName(name) {
if (/-/.test(name)) {
let arrs = name.split("-")
return arrs.reduce((pre, cur, index) => pre + (index === 0 ? cur : (cur.charAt(0).toUpperCase() + cur.slice(1))), '')
} else {
return name
}
} %>
<template>
<div>
<el-drawer
:title="$route.meta.title"
direction="rtl"
size="68%"
:visible.sync="visible"
append-to-body
:before-close="handleClose"
@close="$emit('update:isShow',false)">
<section class="drawer-container">
<el-form class="drawer-container__form" ref="elForm" :model="form" :rules="rules" label-position="top" label-width="120px" size="small">
<div class="form-layout">
<% data.fields.forEach((field, index) => {
switch (field.type) {
case 'input': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<el-input v-model="form['<%- field.name %>']" clearable placeholder="请填写<%- field.label %>" style="width: 100%;"></el-input>
</el-form-item>
<% break
case 'textarea': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<el-input v-model="form['<%- field.name %>']" clearable placeholder="请填写<%- field.label %>" type="textarea" :autosize="{ minRows: 2 }" style="width: 100%;"></el-input>
</el-form-item>
<% break
case 'richtext': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<my-tinymce v-model="form['<%- field.name %>']" clearable placeholder="请填写<%- field.label %>" style="width: 100%;"></my-tinymce>
</el-form-item>
<% break
case 'input-number': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<el-input-number v-model="form['<%- field.name %>']" clearable placeholder="请填写<%- field.label %>" :precision="2" controls-position="right" style="width: 100%;"></el-input-number>
</el-form-item>
<% break
case 'select': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>" clearable>
<el-select v-model="form['<%- field.name %>']" clearable placeholder="请填写<%- field.label %>" <%- field.props?.multiple ? 'multiple' : '' %> style="width: 100%;">
<el-option v-for="(option, optionIndex) in <%- field.optionsFrom ? handleFormName(field.optionsFrom) : JSON.stringify(field.optionsParams).replaceAll('"','\'') %>" :key="optionIndex" :label="option['<%- field.optionProps?.label ?? 'label' %>']" :value="option['<%- field.optionProps?.value ?? 'value' %>']"></el-option>
</el-select>
</el-form-item>
<% break
case 'date': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>" clearable>
<el-date-picker v-model="form['<%- field.name %>']" clearable placeholder="请填写<%- field.label %>" type="<%- field.props.type %>" value-format="<%- field.props.valueFormat ?? 'yyyy-MM-dd' %>" style="width: 100%;"></el-date-picker>
</el-form-item>
<% break
case 'switch': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<el-switch v-model="form['<%- field.name %>']" :active-value="1" :inactive-value="0" active-text="是" inactive-text="否"></el-switch>
</el-form-item>
<% break
case 'tree':
function treeOptions(myfield) {
if (myfield.isOwnOptions) {
if (myfield.optionsHasRoot) {
return `[{ ${myfield.optionProps?.value ?? 'id'}: 0, ${myfield.optionProps?.label ?? 'label'}: '根结点' ,children: tableData }]`
} else {
return 'tableData'
}
} else {
return myfield.optionsFrom ? (myfield.optionsHasRoot ? `[{ ${myfield.optionProps?.value ?? 'id'}: 0, ${myfield.optionProps?.label ?? 'label'}: '根结点' ,children: ${handleFormName(myfield.optionsFrom)} }]` : handleFormName(myfield.optionsFrom)) : myfield.optionsParams
}
} %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<vxe-tree-select v-model="form['<%- field.name %>']" placeholder="请选择<%- field.label %>" :options="<%- treeOptions(field) %>" clearable :multiple="<%- field.props?.multiple ?? false %>" :option-props="{ value: '<%- field.optionProps?.value ?? 'id' %>', label: '<%- field.optionProps?.label ?? 'label' %>' }" style="width: 100%;"></vxe-tree-select>
</el-form-item>
<% break
case 'file': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<el-upload :action="action"
:file-list="form['<%- field.name %>']"
:headers="{ Authorization: `Bearer ${getToken()}`}"
accept="application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
multiple
:limit="<%- field.props.multiple ? 20 : 1 %>"
:before-upload="uploadBefore"
:on-success="(response, file, fileList) => uploadSuccess(response, file, fileList, '<%-field.name%>')"
:on-remove="(file, fileList) => uploadRemove(file, fileList, '<%-field.name%>')"
:on-error="(err, file, fileList) => uploadError(err, file, fileList, '<%-field.name%>')">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">文件不超过{{ formatFileSize(uploadSize) }}</div>
</el-upload>
</el-form-item>
<% }
})%>
</div>
</el-form>
<div class="drawer-container__footer">
<el-button @click="reset">重 置</el-button>
<el-button type="primary" @click="submit" :loading="loading">{{ loading ? '提交中 ...' : '确 定' }}</el-button>
</div>
</section>
</el-drawer>
</div>
</template>
<script>
import { save, show } from "@/api/<%- data.originalName %>/<%- data.originalName %>";
import axios from "axios";
import { getToken } from "@/utils/auth";
import { uploadSize } from "@/settings";
import { formatFileSize } from "@/utils";
export default {
name: "<%- data.name %>Drawer",
props: {
isShow: {
type: Boolean,
default: false,
required: true
},
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
<%- handleFormName(field.optionsFrom) %> : {
type: Array,
default: () => []
},
<% }
if (field.type === 'tree' && !field.optionsFrom) { %>
tableData: {
type: Array,
default: () => []
},
<% }
} %>
},
data() {
return {
uploadSize,
action: process.env.VUE_APP_UPLOAD_API,
loading: false,
visible: false,
form: {
<% for (let index in data.fields){ %>
<%- data.fields[index].name %>: <%- JSON.stringify(data.fields[index].defaultValue) ?? "''" %>,
<% } %>
},
rules: {
<% let rulesFields = data.fields.filter(i => i.hasOwnProperty('rules'))
for (let index in rulesFields){ %>
<%- rulesFields[index].name %>: [
<% rulesFields[index].rules.forEach(rule => {
if (rule.hasOwnProperty('required')) { %>
{
required: true,
message: '<%-rulesFields[index].label%>'+'必填'
},
<% } else if (rule.hasOwnProperty('pattern')) { %>
{
validator: (rule, value, callback) => {
if (<%-rule.pattern%>.test(value)) {
callback()
} else {
callback(new Error('<%-rulesFields[index].label%>'+'验证失败'))
}
},
message: '<%-rulesFields[index].label%>'+'验证失败'
},
<% }
})%>
],
<% } %>
},
}
},
watch: {
isShow(newVal) {
this.visible = newVal
},
visible(newVal) {
this.$emit('update:isShow', newVal)
},
},
methods: {
uploadBefore(file) {
if (file.size > uploadSize) {
this.$message({
type: "warning",
message: `上传图片大小超过${formatFileSize(uploadSize)}`,
});
return false;
}
window.$_uploading = true
},
uploadSuccess(response, file, fileList, fieldName) {
window.$_uploading = false
fileList.forEach((file) => {
if (file.response?.data && !file.response?.code) {
file.response = file.response.data;
}
});
this.form[fieldName] = fileList
},
uploadRemove(file, fileList, fieldName) {
this.form[fieldName] = fileList
},
uploadError(err, file, fileList, fieldName) {
window.$_uploading = false
this.form[fieldName] = fileList
this.$message({
type: "warning",
message: err,
});
},
formatFileSize,
getToken,
handleClose(done) {
this.$confirm('确定关闭窗口?')
.then(_ => {
done();
})
.catch(_ => {});
},
reset() {
this.form = {
<% for (let index in data.fields){ %>
<%- data.fields[index].name %>: <%- JSON.stringify(data.fields[index].defaultValue) ?? "''" %>,
<% } %>
}
this.$refs['elForm'].resetFields()
},
submit() {
if (window.$_uploading) {
this.$message.warning("文件正在上传中")
return
}
<% for (let index in data.fields){
if (data.fields[index].type === 'file') {
if (data.fields[index].props?.multiple) {
%>
this.form['<%- data.fields[index].name %>'] = this.form['<%- data.fields[index].name %>'].map(i => i.response?.id).filter(i => i)
<% } else { %>
this.form['<%- data.fields[index].name %>'] = this.form['<%- data.fields[index].name %>'][0]?.response?.id ?? ''
<% }
}
} %>
this.$refs['elForm'].validate(async valid => {
if (valid) {
this.loading = true
try {
await save(this.form)
this.$message.success('新增成功')
this.$emit('refresh')
this.$emit('update:isShow', false)
this.loading = false
this.reset()
} catch (err) {
this.loading = false
}
}
})
}
}
}
</script>
<style scoped lang="scss">
.span2 {
grid-column: span 2;
}
::v-deep .el-form-item > * {
max-width: 100%;
}
.form-layout {
display: grid;
grid-gap: 2%;
grid-template-columns: repeat(<%- data.options?.columns ?? 2 %>, 1fr);
}
.drawer-container {
height: 100%;
padding: 20px;
display: flex;
flex-direction: column;
&__form {
flex: 1;
overflow-y: scroll;
}
&__footer {
margin-top: 20px;
display: flex;
}
}
</style>

@ -0,0 +1,8 @@
const { t } = require('./tables')
const { create } = require('./create')
// hospital不要改drawer
t['order-refund']
const createName = 'order-refund'
const { fields, options } = t[createName]
create(createName, fields, options)

@ -0,0 +1,320 @@
site
[{"name":"name","label":"名称","type":"input"},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"content","label":"内容","type":"textarea"},{"name":"sort","label":"排序","type":"input-number"}]
undefined
2024-12-27 10:26:02
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","props":{"multiple":true}},{"name":"remark","label":"备注","type":"textarea"}]
{isTree:true}
2024-12-27 10:28:30
site
[{"name":"name","label":"名称","type":"input"},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"content","label":"内容","type":"textarea"},{"name":"sort","label":"排序","type":"input-number"}]
{}
2024-12-27 10:33:26
undefined
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 10:53:13
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 10:54:07
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 10:56:42
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 10:58:06
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:00:33
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:01:39
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:02:06
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:02:56
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:05:43
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:24:12
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:26:28
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:27:03
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","props":{"multiple":false}}]
undefined
2024-12-27 11:29:09
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name"},"props":{"multiple":false}}]
undefined
2024-12-27 11:30:38
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name"},"props":{"multiple":false}}]
undefined
2024-12-27 11:31:14
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name"},"props":{"multiple":false}}]
undefined
2024-12-27 11:35:20
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name"},"props":{"multiple":false}}]
undefined
2024-12-27 11:55:59
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name"},"props":{"multiple":false}}]
undefined
2024-12-27 11:56:34
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 11:59:47
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 13:08:49
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 13:10:03
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 13:10:14
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 14:53:23
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 14:56:00
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 14:59:49
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:00:05
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:02:35
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:03:07
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:03:33
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:04:19
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:10:34
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:45:18
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:47:55
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:54:27
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 15:56:38
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 16:06:47
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 16:08:39
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 16:10:27
site
[{"name":"name","label":"名称","type":"input"},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"content","label":"内容","type":"textarea"},{"name":"sort","label":"排序","type":"input-number"}]
{}
2024-12-27 16:13:55
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 16:15:08
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 16:17:33
site
[{"name":"name","label":"名称","type":"input"},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"content","label":"内容","type":"textarea"},{"name":"sort","label":"排序","type":"input-number"}]
{}
2024-12-27 16:17:46
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 16:17:55
banners
[{"name":"name","label":"标题","type":"input"},{"name":"position","label":"显示位置","type":"select","optionsParams":[{"value":1,"label":"首页"}]},{"name":"jump_type","label":"跳转类型","type":"select","optionsParams":[{"value":1,"label":"小程序"},{"value":2,"label":"h5"}]},{"name":"jump_url","label":"跳转链接","type":"input"},{"name":"sort","label":"排序","type":"input-number"},{"name":"image_id","label":"封面图690*400","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}}]
undefined
2024-12-27 16:18:46
site
[{"name":"name","label":"名称","type":"input"},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"content","label":"内容","type":"textarea"},{"name":"sort","label":"排序","type":"input-number"}]
{}
2024-12-27 16:18:54
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 16:19:06
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"pid","label":"上级栏目","type":"tree","isOwnOptions":true,"optionsHasRoot":true,"optionProps":{"label":"title","value":"id"}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 16:59:15
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"pid","label":"上级栏目","type":"tree","isOwnOptions":true,"optionsHasRoot":true,"optionProps":{"label":"title","value":"id"}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 17:00:05
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"pid","label":"上级栏目","type":"tree","isOwnOptions":true,"optionsHasRoot":true,"optionProps":{"label":"title","value":"id"}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 17:07:25
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":true}},{"name":"pid","label":"上级栏目","type":"tree","isOwnOptions":true,"optionsHasRoot":true,"optionProps":{"label":"title","value":"id"}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 17:19:00
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch"},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}},{"name":"pid","label":"上级栏目","type":"tree","isOwnOptions":true,"optionsHasRoot":true,"optionProps":{"label":"title","value":"id"}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 17:19:52
article-type
[{"name":"title","label":"栏目名称","type":"input"},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"site_id","label":"站点选择","optionsFrom":"site","type":"select","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}},{"name":"pid","label":"上级栏目","type":"tree","isOwnOptions":true,"optionsHasRoot":true,"optionProps":{"label":"title","value":"id"}},{"name":"remark","label":"备注","type":"textarea"}]
{"isTree":true}
2024-12-27 17:22:08
article
undefined
undefined
2024-12-27 17:51:00
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-27 17:52:49
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:20:54
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:29:22
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:30:03
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:30:45
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:34:22
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:35:21
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:36:48
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:37:26
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:37:36
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:37:48
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 14:37:52
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:02:13
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:02:25
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:04:53
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:15:23
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:20:32
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:21:17
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:24:40
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:28:42
article
[{"name":"title","label":"标题","type":"input"},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 15:41:37
article
[{"name":"title","label":"标题","type":"input","rules":[{"required":true}]},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 16:09:11
article
[{"name":"title","label":"标题","type":"input","rules":[{"required":true}]},{"name":"content","label":"内容","type":"richtext"},{"name":"add_time","label":"发布时间","type":"datetime"},{"name":"type_id","label":"栏目选择","type":"tree","optionsFrom":"article-type","isOwnOptions":false,"optionsHasRoot":false,"optionProps":{"label":"title","value":"id"}},{"name":"status","label":"状态","type":"switch","defaultValue":1},{"name":"image_id","label":"标题图片","type":"file","relationName":"image","defaultValue":[],"props":{"multiple":false}}]
undefined
2024-12-30 16:09:42
hospital
[{"name":"name","label":"医院名称","type":"input","rules":[{"required":true}]},{"name":"site_id","label":"站点","type":"select","optionsFrom":"site","optionProps":{"label":"name","value":"id"},"props":{"multiple":false}},{"name":"lat","label":"维度","type":"input"},{"name":"lng","label":"经度","type":"input"},{"name":"good_at","label":"擅长科室","type":"textarea"},{"name":"content","label":"简介","type":"textarea"},{"name":"cover_id","label":"标题图片","type":"file","relationName":"cover","defaultValue":[],"props":{"multiple":false}},{"name":"status","label":"是否显示","type":"switch","defaultValue":1}]
undefined
2024-12-30 16:32:56

@ -0,0 +1,155 @@
<% function handleFormName(name) {
if (/-/.test(name)) {
let arrs = name.split("-")
return arrs.reduce((pre, cur, index) => pre + (index === 0 ? cur : (cur.charAt(0).toUpperCase() + cur.slice(1))), '')
} else {
return name
}
} %>
<template>
<div>
<el-drawer
:title="$route.meta.title"
direction="rtl"
size="68%"
:visible.sync="visible"
append-to-body
@close="$emit('update:isShow',false)">
<section class="drawer-container">
<el-descriptions class="drawer-container__desc" size="small" border ref="elDesc" :column="<%- data.options?.columns ?? 2 %>" direction="vertical" :labelStyle="{ 'font-weight': '500', 'font-size': '15px' }">
<% data.fields.forEach((field, index) => {
switch (field.type) {
case 'input': %>
<el-descriptions-item label="<%- field.label %>">
{{ form['<%- field.name %>'] }}
</el-descriptions-item>
<% break
case 'textarea':
%>
<el-descriptions-item label="<%- field.label %>" span="2">
<div v-html="form['<%- field.name %>']"></div>
</el-descriptions-item>
<% break
case 'richtext':
%>
<el-descriptions-item label="<%- field.label %>" span="2">
{{ form['<%- field.name %>'] }}
</el-descriptions-item>
<% break
case 'input-number':
%>
<el-descriptions-item label="<%- field.label %>">
{{ typeof form['<%- field.name %>'] === 'number' ? form['<%- field.name %>'].toFixed(2) : form['<%- field.name %>'] }}
</el-descriptions-item>
<% break
case 'select':
%>
<el-descriptions-item label="<%- field.label %>">
{{ <%- field.optionsFrom ? handleFormName(field.optionsFrom) : JSON.stringify(field.optionsParams).replaceAll('"','\'') %>.find(i => i['<%- field.optionProps?.value ?? 'value' %>'] === form['<%- field.name %>']) ? <%- field.optionsFrom ? handleFormName(field.optionsFrom) : JSON.stringify(field.optionsParams).replaceAll('"','\'') %>.find(i => i['<%- field.optionProps?.value ?? 'value' %>'] === form['<%- field.name %>'])['<%- field.optionProps?.label ?? 'label' %>'] : '' }}
</el-descriptions-item>
<% break
case 'date':
%>
<el-descriptions-item label="<%- field.label %>">
{{ form['<%- field.name %>'] }}
</el-descriptions-item>
<% break
case 'switch':
%>
<el-descriptions-item label="<%- field.label %>">
{{ form['<%- field.name %>'] ? '是' : '否' }}
</el-descriptions-item>
<% break
case 'file': %>
<el-form-item label="<%- field.label %>" prop="<%- field.name %>">
<el-upload
:file-list="form['<%- field.name %>']"
accept="application/msword,image/jpeg,application/pdf,image/png,application/vnd.ms-powerpoint,text/plain,application/x-zip-compressed,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document">
</el-upload>
</el-form-item>
<% break
}
})%>
</el-descriptions>
</section>
</el-drawer>
</div>
</template>
<script>
import { show } from "@/api/<%- data.originalName %>/<%- data.originalName %>";
export default {
name: "<%- data.name %>Show",
props: {
isShow: {
type: Boolean,
default: false,
required: true
},
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
<%- handleFormName(field.optionsFrom) %> : {
type: Array,
default: () => []
},
<% }
}%>
},
data() {
return {
loading: false,
visible: false,
form: {
<% for (let index in data.fields){ %>
<%- data.fields[index].name %>: <%- JSON.stringify(data.fields[index].defaultValue) ?? "''" %>,
<% } %>
},
}
},
watch: {
isShow(newVal) {
this.visible = newVal
},
visible(newVal) {
this.$emit('update:isShow', newVal)
},
},
methods: {
async getDetail(id) {
try {
const detail = await show({
id
})
for (let key in this.form) {
if (detail.hasOwnProperty(key)) {
this.form[key] = detail[key]
}
}
} catch (err) {
console.error(err)
}
}
}
}
</script>
<style scoped lang="scss">
.span2 {
grid-column: span 2;
}
::v-deep .el-form-item > * {
max-width: 100%;
}
.drawer-container {
height: 100%;
padding: 20px;
display: flex;
flex-direction: column;
& > * {
flex: 1;
}
}
</style>

@ -0,0 +1,603 @@
<% function handleFormName(name) {
if (/-/.test(name)) {
let arrs = name.split("-")
return arrs.reduce((pre, cur, index) => pre + (index === 0 ? cur : (cur.charAt(0).toUpperCase() + cur.slice(1))), '')
} else {
return name
}
} %>
<template>
<div>
<el-card shadow="never" style="margin-top: 20px;">
<template #header>
<slot name="header">
<vxe-toolbar :print="isHasAuth('print')" custom ref="toolbar">
<template #toolSuffix>
<vxe-button style="margin-right: 10px;" v-if="isHasAuth('export')" icon="vxe-icon-download" circle @click="exportMethod"></vxe-button>
</template>
<template #buttons>
<el-button
v-if="isHasAuth('create')"
icon="el-icon-plus"
type="primary"
size="small"
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList"
>搜索</el-button
>
</template>
</vxe-toolbar>
</slot>
</template>
<vxe-table
ref="table"
stripe
style="margin-top: 10px"
:loading="loading"
:height="tableHeight"
keep-source
show-overflow
:menu-config="{
className: 'my-menus',
body: {
options: [
[
{ code: 'copy', name: '复制', prefixConfig: { icon: 'vxe-icon-copy' }, suffixConfig: { content: 'Ctrl+C' } },
{ code: 'remove', name: '删除', prefixConfig: { icon: 'vxe-icon-delete-fill', className: 'color-red' } }
],
]
}
}"
@menu-click="contextMenuClickEvent"
:row-config="{ isCurrent: true, isHover: true }"
:column-config="{ resizable: true }"
:export-config="{}"
:edit-rules="validRules"
:edit-config="{
trigger: 'manual',
mode: 'row',
showStatus: true,
isHover: true,
autoClear: false,
}"
<% if (!!data.options?.isTree) { %>
:tree-config="{
}"
<% } %>
:align="allAlign"
:data="tableData"
>
<vxe-column type="checkbox" width="50" align="center" />
<vxe-column type="seq" width="58" align="center" <% if (!!data.options?.isTree) { %>tree-node<% } %> />
<% for (let index in data.fields) { %>
<% let field = data.fields[index] %>
<% if (!field.hidden) { %>
<% switch (field.type) {
case 'input':
case 'textarea': %>
<vxe-column
header-align="center"
field="<%- field.name %>"
width="<%- field.width || 160 %>"
title="<%- field.label %>"
:edit-render="{ name: 'input', attrs: { type: 'text' } }"
/>
<% break
case 'input-number': %>
<vxe-column
header-align="center"
align="right"
field="<%- field.name %>"
width="<%- field.width || 160 %>"
title="<%- field.label %>"
:edit-render="{ name: 'input', attrs: { type: 'number' } }"
/>
<% break
case 'richtext': %>
<vxe-column
align="center"
header-align="center"
field="<%- field.name %>"
width="<%- field.width || 120 %>"
title="<%- field.label %>"
:edit-render="{}"
>
<template #default="{ row }">
<el-button slot="reference" size="small" type="primary" icon="el-icon-search" @click="$refs['RichTextModal'].open({ text: row['<%- field.name %>'], readonly: true, fieldName: '<%- field.name %>', row })">查看</el-button>
</template>
<template #edit="{ row }">
<el-button slot="reference" size="small" type="primary" icon="el-icon-edit" @click="$refs['RichTextModal'].open({ text: row['<%- field.name %>'], readonly: false, fieldName: '<%- field.name %>', row })">编辑</el-button>
</template>
</vxe-column>
<% break
case 'select': %>
<vxe-column
align="center"
field="<%- field.name %>"
width="<%- field.width || 180 %>"
title="<%- field.label %>"
:edit-render="{ name: 'VxeSelect', options: <%- field.optionsFrom ? field.optionsFrom : JSON.stringify(field.optionsParams).replaceAll('"','\'') %>, props: { multiple: <%- field.props?.multiple ?? false %> }, optionProps: { value: '<%- field.optionProps?.value ?? 'value' %>', label: '<%- field.optionProps?.label ?? 'label' %>' } }"
/>
<% break
case 'date': %>
<vxe-column
align="center"
field="<%- field.name %>"
width="<%- field.width || 180 %>"
title="<%- field.label %>"
:edit-render="{}"
>
<template #edit="{ row }">
<el-date-picker v-model="row['<%- field.name %>']" style="width: 100%;" size="small" type="<%- field.props.type %>" value-format="<%- field.props.valueFormat ?? 'yyyy-MM-dd' %>"></el-date-picker>
</template>
</vxe-column>
<% break
case 'switch': %>
<vxe-column
align="center"
field="<%- field.name %>"
width="<%- field.width || 140 %>"
title="<%- field.label %>"
:edit-render="{ name: 'VxeSelect', options: [{ label: '是', value: 1 },{ label: '否', value: 0 }] }"
/>
<% break
case 'tree':
function treeOptions(myfield) {
if (myfield.isOwnOptions) {
if (myfield.optionsHasRoot) {
return `[{ ${myfield.optionProps?.value ?? 'id'}: 0, ${myfield.optionProps?.label ?? 'label'}: '根结点' ,children: tableData }]`
} else {
return 'tableData'
}
} else {
return myfield.optionsFrom ? (myfield.optionsHasRoot ? `[{ ${myfield.optionProps?.value ?? 'id'}: 0, ${myfield.optionProps?.label ?? 'label'}: '根结点' ,children: ${handleFormName(myfield.optionsFrom)} }]` : handleFormName(myfield.optionsFrom)) : myfield.optionsParams
}
}
%>
<vxe-column
align="center"
field="<%- field.name %>"
width="<%- field.width || 160 %>"
title="<%- field.label %>"
:edit-render="{ name: 'VxeTreeSelect', options: <%- treeOptions(field) %>, props: { multiple: <%- field.props?.multiple ?? false %> }, optionProps: { value: '<%- field.optionProps?.value ?? 'id' %>', label: '<%- field.optionProps?.label ?? 'label' %>' } }"
/>
<% break
case 'file': %>
<vxe-column
field="<%- field.name %>"
min-width="180"
title="<%- field.label %>"
header-align="center"
align="left"
:edit-render="{}"
>
<template #default="{ row }">
<vxe-upload v-model="row['<%- field.relationName ? field.relationName : field.name %>']" name-field="original_name" readonly progress-text="{percent}%" :more-config="{ maxCount: 1, layout: 'horizontal' }" :show-button-text="false" />
</template>
<template #edit="{ row }">
<vxe-upload
name-field="original_name"
v-model="row['<%- field.relationName ? field.relationName : field.name %>']"
progress-text="{percent}%"
:more-config="{ maxCount: 1, layout: 'horizontal' }"
:limit-size="uploadSize / 1024 / 1024"
:show-button-text="false"
:upload-method="({file}) => uploadMethod(file)" />
</template>
</vxe-column>
<% break
}
}
} %>
<vxe-column field="operate" header-align="center" title="操作" min-width="220" fixed="right">
<template #default="{ row }">
<template v-if="isActiveStatus(row)">
<el-button size="small" type="primary" @click="saveRowEvent(row)"
>保存</el-button
>
<el-button
size="small"
type="primary"
plain
@click="cancelRowEvent(row)"
>取消</el-button
>
</template>
<template v-else>
<el-button v-if="isHasAuth('detail')" size="small" type="primary" plain @click="detail(row)"
>查看</el-button
>
<el-button v-if="isHasAuth('edit')" size="small" type="warning" @click="editRowEvent(row)"
>编辑</el-button
>
<el-button
v-if="isHasAuth('delete')"
size="small"
type="danger"
@click="destroyRowEvent(row)"
>删除</el-button
>
</template>
</template>
</vxe-column>
</vxe-table>
<% if (!data.options?.isTree) { %>
<el-pagination
style="margin-top: 10px;display: flex;justify-content: flex-end;"
:current-page.sync="select.page"
:page-sizes="[20, 30, 40, 50]"
:page-size.sync="select.page_size"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="
(e) => {
select.page_size = e;
select.page = 1;
getList();
}
"
@current-change="
(e) => {
select.page = e;
getList();
}
"
/>
<% } %>
</el-card>
<Add<%- data.name %>
ref="Add<%- data.name %>"
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
:<%- field.optionsFrom %>="<%- handleFormName(field.optionsFrom) %>"
<% }
if (field.type === 'tree' && !field.optionsFrom) { %>
:table-data="tableData"
<% }
}%>
:is-show.sync="isShowAdd"
@refresh="getList"
/>
<Show<%- data.name %>
ref="Show<%- data.name %>"
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
:<%- field.optionsFrom %>="<%- handleFormName(field.optionsFrom) %>"
<% }
}%>
:is-show.sync="isShowDetail"
/>
<% if (data.fields.find(field => field.type === 'richtext')) {%>
<rich-text-modal ref="RichTextModal" @confirm="({ row, fieldName, text }) => row[fieldName] = text"></rich-text-modal>
<%}%>
</div>
</template>
<script>
import VxeUI from "vxe-pc-ui";
<% if (data.fields.find(field => field.type === 'richtext')) {%>
import RichTextModal from "@/components/RichTextModal/index.vue";
<%}%>
import { authMixin } from "@/mixin/authMixin"
import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils";
import { download } from "@/utils/downloadRequest";
import { destroy, index, save } from "@/api/<%- data.originalName %>/<%- data.originalName %>";
import Add<%- data.name %> from "./components/Add<%- data.name %>.vue";
import Show<%- data.name %> from "./components/Show<%- data.name %>.vue";
import axios from "axios";
import { getToken } from "@/utils/auth";
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
<%- `import { index as ${handleFormName(field.optionsFrom)}Index } from '@/api/${field.optionsFrom}/${field.optionsFrom}';` %>
<% }
}%>
export default {
name: "<%- data.name %>",
mixins: [authMixin],
components: {
<% if (data.fields.find(field => field.type === 'richtext')) {%>
RichTextModal,
<%}%>
Add<%- data.name %>,
Show<%- data.name %>,
},
data() {
return {
uploadSize,
examineKey: 0,
isShowAdd: false,
isShowDetail: false,
loading: false,
tableHeight: 400,
select: {
page: 1,
page_size: 20,
keyword: '',
show_relation: <%- JSON.stringify(data.fields.filter(i => i.hasOwnProperty('relationName') && i.relationName).map(i => i.relationName)) %>,
<% if (!!data.options?.isTree) { %>is_tree: 1,<% } %>
},
total: 0,
allAlign: null,
tableData: [],
form: {
id: '',
<% for (let index in data.fields){ %>
<%- data.fields[index].name %>: <%- JSON.stringify(data.fields[index].defaultValue) ?? "''" %>,
<% } %>
},
validRules: {
<% let rulesFields = data.fields.filter(i => i.hasOwnProperty('rules'))
for (let index in rulesFields){ %>
<%- rulesFields[index].name %>: [
<% rulesFields[index].rules.forEach(rule => {
if (rule.hasOwnProperty('required')) { %>
{
required: true,
message: '<%-rulesFields[index].label%>'+'必填'
},
<% } else if (rule.hasOwnProperty('pattern')) { %>
{
pattern: <%-rule.pattern%>,
message: '<%-rulesFields[index].label%>'+'验证失败'
},
<% }
})%>
],
<% } %>
},
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
<%- handleFormName(field.optionsFrom) + ": []," %>
<% }
}%>
};
},
computed: {
isActiveStatus() {
return function (row) {
if (this.$refs["table"]) {
return this.$refs["table"].isEditByRow(row);
}
};
},
isHasAuth() {
return function (auth) {
return this.auths_auth_mixin.indexOf(auth) !== -1
}
}
},
created() {
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
<%- `this.get${handleFormName(field.optionsFrom).charAt(0).toUpperCase() + handleFormName(field.optionsFrom).slice(1)}()` %>
<% }
}%>
this.getList();
},
mounted() {
this.bindToolbar()
this.calcTableHeight()
},
methods: {
exportMethod() {
this.$confirm("请选择导出方式", "提示", {
confirmButtonText: "全量导出",
cancelButtonText: "部分导出",
distinguishCancelAndClose: true
}).then(_ => {
download('/api/admin/school/index', 'get', {
...this.select,
page: 1,
page_size: 9999,
is_export: 1,
export_fields: Object.keys(this.form)
})
}).catch(action => {
if (action === 'cancel' && this.$refs['table']) {
this.$refs['table'].openExport()
}
});
},
calcTableHeight() {
let clientHeight = document.documentElement.clientHeight;
let cardTitle = document.querySelector(".el-card__header")?.getBoundingClientRect()?.height;
let search = document.querySelector(".vxe-toolbar")?.getBoundingClientRect()?.height;
let paginationHeight = (document.querySelector(".el-pagination")?.getBoundingClientRect()?.height ?? 0) + 10; //分页的高度
let topHeight = 50; //页面 头部
let padding = 80;
let margin = 20;
this.tableHeight =
clientHeight - cardTitle - search - paginationHeight - topHeight - padding - margin;
},
contextMenuClickEvent ({ menu, row, column }) {
switch (menu.code) {
case 'copy':
// 示例
if (row && column) {
if (VxeUI.clipboard.copy(row[column.field])) {
this.$message.success('已复制到剪贴板!')
}
}
break
case 'remove':
if (row && column) {
this.destroyRowEvent(row)
}
default:
}
},
async detail (row) {
await this.$refs["Show<%- data.name %>"].getDetail(row.id)
this.isShowDetail = true
},
<% for (let index in data.fields) {
let field = data.fields[index]
if (field.optionsFrom) { %>
<%- `async get${handleFormName(field.optionsFrom).charAt(0).toUpperCase() + handleFormName(field.optionsFrom).slice(1)}() {
try {
const res = await ${handleFormName(field.optionsFrom)}Index({
page: 1,
page_size: 999,
${field.type === 'tree' ? 'is_tree: 1,' : ''}
}, false)
this.${handleFormName(field.optionsFrom)} = res${field.type !== 'tree' ? '.data': ''}
} catch(err) {
console.error(err)
}
},` %>
<% }
}%>
uploadMethod(file) {
const formData = new FormData()
formData.append('file', file)
window.$_uploading = true
return axios.post(process.env.VUE_APP_UPLOAD_API, formData, {
headers: {
Authorization: `Bearer ${getToken()}`,
}
}).then((response) => {
window.$_uploading = false
if (response.status === 200 && !response.data.code) {
return {
response: response.data,
name: response.data.original_name,
url: response.data.url
}
} else {
this.$message.error("上传失败")
}
}).catch(_ => {
window.$_uploading = false
})
},
bindToolbar() {
this.$nextTick(() => {
if (this.$refs["table"] && this.$refs["toolbar"]) {
this.$refs["table"].connect(this.$refs["toolbar"]);
}
});
},
editRowEvent(row) {
if (this.$refs["table"]) {
this.$refs["table"].setEditRow(row);
}
},
cancelRowEvent(row) {
if (this.$refs["table"]) {
this.$refs["table"].clearEdit().then(() => {
// 还原行数据
this.$refs["table"].revertData(row);
});
}
},
async getList() {
this.loading = true;
try {
const res = await index(this.select, false);
this.tableData = res<% if (!data.options?.isTree) { %>.data<% } %>;
this.total = res.total;
this.loading = false;
} catch (err) {
console.error(err);
this.loading = false;
}
},
async saveRowEvent(row) {
if (window.$_uploading) {
this.$message.warning("文件正在上传中")
return
}
try {
const errMap = await this.$refs["table"].validate();
if (errMap) {
throw new Error(errMap);
}
await this.$confirm("确认保存?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
});
await this.$refs["table"].clearEdit();
let form = deepCopy(this.form);
for (const key in form) {
form[key] = row[key];
}
<% for (let index in data.fields) {
if (data.fields[index].relationName) {
if (data.fields[index].props?.multiple) {
%>
form['<%- data.fields[index].name %>'] = row['<%- data.fields[index].relationName %>'].map(i => i.response?.id).filter(i => i)
<% } else { %>
form['<%- data.fields[index].name %>'] = row['<%- data.fields[index].relationName %>'][0]?.response?.id ?? ''
<% }
}
} %>
this.loading = true;
await save(form, false);
await this.getList();
this.loading = false;
} catch (err) {
this.loading = false;
}
},
async destroyRowEvent(row) {
try {
await this.$confirm("确认删除?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
});
this.loading = true;
if (row.id) {
await destroy({
id: row.id,
},false);
await this.getList();
} else {
console.log(row);
this.tableData.splice(
this.tableData.findIndex((i) => i._X_ROW_KEY === row._X_ROW_KEY),
1
);
}
this.loading = false;
} catch (err) {
this.loading = false;
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-card__header {
padding: 6px 20px;
}
::v-deep .el-tag + .el-tag {
margin-left: 4px;
}
</style>

@ -0,0 +1,555 @@
const t = {
site: {
fields: [
{ name: 'name', label: '名称', type: 'input' },
{ name: 'status', label: '状态', type: 'switch', defaultValue: 1 },
{ name: 'content', label: '内容', type: 'textarea' },
{ name: 'sort', label: '排序', type: 'input-number' }
],
options: {}
},
'article-type': {
fields: [
{ name: 'title', label: '栏目名称', type: 'input' },
{ name: 'status', label: '状态', type: 'switch', defaultValue: 1 },
{
name: 'site_id',
label: '站点选择',
optionsFrom: 'site',
type: 'select',
optionProps: {
label: 'name',
value: 'id'
},
props: { multiple: false }
},
{
name: 'pid',
label: '上级栏目',
type: 'tree',
isOwnOptions: true,
optionsHasRoot: true,
optionProps: {
label: 'title',
value: 'id'
}
},
{ name: 'remark', label: '备注', type: 'textarea' }
],
options: { isTree: true }
},
banners: {
fields: [
{
name: 'name',
label: '标题',
type: 'input'
},
{
name: 'position',
label: '显示位置',
type: 'select',
optionsParams: [
{
value: 1,
label: '首页'
}
]
},
{
name: 'jump_type',
label: '跳转类型',
type: 'select',
optionsParams: [
{
value: 1,
label: '小程序'
},
{
value: 2,
label: 'h5'
}
]
},
{
name: 'jump_url',
label: '跳转链接',
type: 'input'
},
{ name: 'sort', label: '排序', type: 'input-number' },
{
name: 'image_id',
label: '封面图690*400',
type: 'file',
relationName: 'image',
defaultValue: [],
props: {
multiple: false
}
},
{
name: 'site_id',
label: '站点',
type: 'select',
optionsFrom: 'site',
optionProps: {
label: 'name',
value: 'id'
},
props: {
multiple: false
}
}
]
},
article: {
fields: [
{
name: 'title',
label: '标题',
type: 'input',
rules: [
{ required: true }
]
},
{
name: 'content',
label: '内容',
type: 'richtext'
},
{
name: 'add_time',
label: '发布时间',
type: 'datetime'
},
{
name: 'type_id',
label: '栏目选择',
type: 'tree',
optionsFrom: 'article-type',
isOwnOptions: false,
optionsHasRoot: false,
optionProps: {
label: 'title',
value: 'id'
}
},
{ name: 'status', label: '状态', type: 'switch', defaultValue: 1 },
{
name: 'image_id',
label: '标题图片',
type: 'file',
relationName: 'image',
defaultValue: [],
props: {
multiple: false
}
}
]
},
hospital: {
fields: [
{
name: 'name',
label: '医院名称',
type: 'input',
rules: [
{ required: true }
]
},
{
name: 'site_id',
label: '站点',
type: 'select',
optionsFrom: 'site',
optionProps: {
label: 'name',
value: 'id'
},
props: {
multiple: false
}
},
{
name: 'lat',
label: '维度',
type: 'input'
},
{
name: 'lng',
label: '经度',
type: 'input'
},
{
name: 'good_at',
label: '擅长科室',
type: 'textarea'
},
{
name: 'content',
label: '简介',
type: 'textarea'
},
{
name: 'cover_id',
label: '标题图片',
type: 'file',
relationName: 'cover',
defaultValue: [],
props: {
multiple: false
}
},
{ name: 'status', label: '是否显示', type: 'switch', defaultValue: 1 },
]
},
nurse: {
fields: [
{
name: 'name',
label: '护工姓名',
type: 'input',
rules: [
{ required: true }
]
},
{
name: 'mobile',
label: '手机号',
type: 'input',
rules: [
{ pattern: /(^$)|(^1[3456789]\d{9})|(^(0\d{2,3}(-)*)?\d{7})$/ }
]
},
{
name: 'idcard',
label: '身份证号',
type: 'input',
rules: [
{ pattern: /(^$)|(^([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3})|(^([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx])$/ }
]
},
{
name: 'sex',
label: '性别',
type: 'select',
optionsParams: [
{
value: 1,
label: '男'
},
{
value: 0,
label: '女'
}
]
},
{
name: 'birthday',
label: '生日',
type: 'date',
props: {
type: 'date'
}
},
{
name: 'hometown',
label: '家乡',
type: 'input'
},
{
name: 'address',
label: '地址',
type: 'input'
},
{
name: 'emergency_phone',
label: '紧急联系电话',
type: 'input',
rules: [
{ pattern: /(^$)|(^1[3456789]\d{9})|(^(0\d{2,3}(-)*)?\d{7})$/ }
]
},
{
name: 'work_years',
label: '年限',
type: 'input-number'
},
{
name: 'join_at',
label: '加入时间',
type: 'date',
props: {
type: 'date'
}
},
{
name: 'leave_at',
label: '离职时间',
type: 'date',
props: {
type: 'date'
}
},
{
name: 'username',
label: '用户名',
type: 'input',
rules: [
{ required: true }
]
},
{
name: 'password',
label: '密码',
type: 'input',
rules: [
{ pattern: /(^$)|((?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,20})/ }
]
},
{
name: 'work_status',
label: '工作状态',
type: 'select',
optionsParams: [
{
value: 1,
label: '兼职'
},
{
value: 2,
label: '全职'
}
]
},
{
name: 'status',
label: '状态',
type: 'select',
optionsParams: [
{
value: 0,
label: '请假'
},
{
value: 1,
label: '正常服务'
}
]
},
{ name: 'has_social_insurance', label: '是否有社保', type: 'switch', defaultValue: 1 },
{ name: 'has_qualification', label: '是否有资质', type: 'switch', defaultValue: 1 },
{
name: 'avatar',
label: '头像',
type: 'file',
relationName: 'avatar',
defaultValue: [],
props: {
multiple: false
}
},
]
},
users: {
fields: [
{
name: 'nickname',
label: '昵称',
type: 'input',
},
{
name: 'openid',
label: 'openid',
type: 'input',
},
{
name: 'headimgurl',
label: '头像地址',
type: 'input',
},
{
name: 'mobile',
label: '手机号',
type: 'input',
rules: [
{ required: true },
{ pattern: /(^$)|(^1[3456789]\d{9})|(^(0\d{2,3}(-)*)?\d{7})$/ }
]
},
{
name: 'sex',
label: '性别',
type: 'select',
optionsParams: [
{
value: '1',
label: '男'
},
{
value: '0',
label: '女'
},
{
value: '未知',
label: '未知'
}
]
},
{
name: 'country',
label: '国家',
type: 'input',
},
{
name: 'province',
label: '省份',
type: 'input',
},
{
name: 'city',
label: '城市',
type: 'input',
},
]
},
'product-category': {
fields: [
{ name: 'name', label: '商品分类名称', type: 'input' },
{
name: 'pid',
label: '上级分类',
type: 'tree',
isOwnOptions: true,
optionsHasRoot: true,
optionProps: {
label: 'title',
value: 'id'
}
},
{
name: 'image_id',
label: '封面图片',
type: 'file',
relationName: 'image',
defaultValue: [],
props: {
multiple: false
}
}
],
options: { isTree: true }
},
product: {
fields: [
{
name: 'product_category_id',
label: '分类选择',
type: 'tree',
optionsFrom: 'product-category',
isOwnOptions: false,
optionsHasRoot: false,
optionProps: {
label: 'name',
value: 'id'
}
},
{ name: 'name', label: '商品名称', type: 'input' },
{ name: 'price', label: '商品价格', type: 'input-number' },
{
name: 'image_id',
label: '封面图片',
type: 'file',
relationName: 'image',
defaultValue: [],
props: {
multiple: false
}
},
{ name: 'content', label: '内容', type: 'richtext' },
{
name: 'product_images',
label: '商品轮播图',
type: 'file',
relationName: 'product_image',
defaultValue: [],
props: {
multiple: true
}
},
{ name: 'product_skus', label: '商品', type: 'input', defaultValue: [] },
{ name: 'sort', label: '排序', type: 'input-number' }
]
},
"accompany-order-refund": {
fields: [
{
name: 'status',
label: '状态',
type: 'select',
optionsParams: [
{
value: 0,
label: '未退款'
},
{
value: 1,
label: '退款成功'
},
{
value: 2,
label: '退款失败'
}
]
},
]
},
"product-order": {
"fields": [
{ name: 'express_name', label: '快递名称', type: 'input' },
{ name: 'express_number', label: '快递编号', type: 'input' },
{
name: 'pay_status',
label: '状态',
type: 'select',
optionsParams: [
{
value: 0,
label: '未付款'
},
{
value: 1,
label: '已支付'
}
]
}
]
},
"order-refund": {
"fields": [
{
name: 'status',
label: '状态',
type: 'select',
optionsParams: [
{
value: 0,
label: '未退款'
},
{
value: 1,
label: '退款成功'
},
{
value: 2,
label: '退款失败'
}
]
}
]
}
}
module.exports = {
t
}

@ -0,0 +1,40 @@
const ejs = require('ejs')
const path = require('path')
const fs = require('fs')
const compiler = (template,data) => {
const templatePath = path.resolve(__dirname,`./${template}`)
return new Promise((resolve,reject)=>{
ejs.renderFile(templatePath,{data},(err,result)=>{
if(err){
console.log(err);
reject(err)
return
}
resolve(result)
})
})
}
const writeFile = (path,content) =>{
return fs.promises.writeFile(path,content)
}
const resolveName = name => {
if (/(-|_)/g.test(name)) {
let splitName = name.split(/(-|_)/).filter(i => !/(-|_)/.test(i)).map(i => i.charAt(0).toUpperCase() + i.slice(1))
return splitName.join('')
} else {
return (name.charAt(0).toUpperCase() + name.slice(1))
}
}
const ensureDirectoryExistence = (filePath) => {
if (!fs.existsSync(filePath)) {
fs.mkdirSync(filePath);
}
}
module.exports = {
compiler,writeFile,resolveName,ensureDirectoryExistence
}

@ -1,379 +1,377 @@
<template>
<div>
<el-card shadow="never" style="margin-top: 20px;">
<template #header>
<slot name="header">
<vxe-toolbar ref="toolbar" :export="isHasAuth('export')" :print="isHasAuth('print')" custom>
<template #buttons>
<el-button
v-if="isHasAuth('create')"
icon="el-icon-plus"
type="primary"
size="small"
@click="isShowAdd = true"
>新增</el-button>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList"
>搜索</el-button>
<div>
<el-card shadow="never" style="margin-top: 20px;">
<template #header>
<slot name="header">
<vxe-toolbar :export="isHasAuth('export')" :print="isHasAuth('print')" custom ref="toolbar">
<template #buttons>
<el-button
v-if="isHasAuth('create')"
icon="el-icon-plus"
type="primary"
size="small"
@click="isShowAdd = true"
>新增</el-button
>
<el-button
v-if="isHasAuth('search')"
icon="el-icon-search"
type="primary"
plain
size="small"
@click="getList"
>搜索</el-button
>
</template>
</vxe-toolbar>
</slot>
</template>
</vxe-toolbar>
</slot>
</template>
<vxe-table
ref="table"
stripe
style="margin-top: 10px"
:loading="loading"
:height="tableHeight"
keep-source
show-overflow
:menu-config="{
className: 'my-menus',
body: {
options: [
[
{ code: 'copy', name: '复制', prefixConfig: { icon: 'vxe-icon-copy' }, suffixConfig: { content: 'Ctrl+C' } },
{ code: 'remove', name: '删除', prefixConfig: { icon: 'vxe-icon-delete-fill', className: 'color-red' } }
],
]
}
}"
:row-config="{ isCurrent: true, isHover: true }"
:column-config="{ resizable: true }"
:export-config="{}"
:edit-rules="validRules"
:edit-config="{
<vxe-table
ref="table"
stripe
style="margin-top: 10px"
:loading="loading"
:height="tableHeight"
keep-source
show-overflow
:menu-config="{
className: 'my-menus',
body: {
options: [
[
{ code: 'copy', name: '复制', prefixConfig: { icon: 'vxe-icon-copy' }, suffixConfig: { content: 'Ctrl+C' } },
{ code: 'remove', name: '删除', prefixConfig: { icon: 'vxe-icon-delete-fill', className: 'color-red' } }
],
]
}
}"
@menu-click="contextMenuClickEvent"
:row-config="{ isCurrent: true, isHover: true }"
:column-config="{ resizable: true }"
:export-config="{}"
:edit-rules="validRules"
:edit-config="{
trigger: 'manual',
mode: 'row',
showStatus: true,
isHover: true,
autoClear: false,
}"
:align="allAlign"
:data="tableData"
@menu-click="contextMenuClickEvent"
>
<vxe-column type="seq" width="58" align="center" />
<vxe-column field="no" title="退款编号" width="180" align="center" />
<vxe-column field="order.no" title="订单编号" width="180" align="center" />
<vxe-column
align="center"
field="status"
width="180"
title="状态"
:edit-render="{ name: 'VxeSelect', options: [{'value':0,'label':'未退款'},{'value':1,'label':'退款成功'},{'value':2,'label':'退款失败'}], props: { multiple: false }, optionProps: { value: 'value', label: 'label' } }"
/>
<vxe-column field="created_at" title="创建时间" width="180" align="center" />
<vxe-column field="operate" header-align="center" title="操作" min-width="220">
<template #default="{ row }">
<template v-if="isActiveStatus(row)">
<el-button
size="small"
type="primary"
@click="saveRowEvent(row)"
>保存</el-button>
<el-button
size="small"
type="primary"
plain
@click="cancelRowEvent(row)"
>取消</el-button>
</template>
<template v-else>
<el-button
v-if="isHasAuth('detail')"
size="small"
type="primary"
plain
@click="detail(row)"
>查看</el-button>
<el-button
v-if="isHasAuth('edit')"
size="small"
type="warning"
@click="editRowEvent(row)"
>编辑</el-button>
<el-button
v-if="isHasAuth('delete')"
size="small"
type="danger"
@click="destroyRowEvent(row)"
>删除</el-button>
</template>
</template>
</vxe-column>
</vxe-table>
:align="allAlign"
:data="tableData"
>
<vxe-column type="seq" width="58" align="center" />
<vxe-column
align="center"
field="status"
width="180"
title="状态"
:edit-render="{ name: 'VxeSelect', options: [{'value':0,'label':'未退款'},{'value':1,'label':'退款成功'},{'value':2,'label':'退款失败'}], props: { multiple: false }, optionProps: { value: 'value', label: 'label' } }"
/>
<vxe-column field="operate" header-align="center" title="操作" min-width="220">
<template #default="{ row }">
<template v-if="isActiveStatus(row)">
<el-button size="small" type="primary" @click="saveRowEvent(row)"
>保存</el-button
>
<el-button
size="small"
type="primary"
plain
@click="cancelRowEvent(row)"
>取消</el-button
>
</template>
<template v-else>
<el-button v-if="isHasAuth('detail')" size="small" type="primary" plain @click="detail(row)"
>查看</el-button
>
<el-button v-if="isHasAuth('edit')" size="small" type="warning" @click="editRowEvent(row)"
>编辑</el-button
>
<el-button
v-if="isHasAuth('delete')"
size="small"
type="danger"
@click="destroyRowEvent(row)"
>删除</el-button
>
</template>
</template>
</vxe-column>
</vxe-table>
<el-pagination
style="margin-top: 10px;display: flex;justify-content: flex-end;"
:current-page.sync="select.page"
:page-sizes="[20, 30, 40, 50]"
:page-size.sync="select.page_size"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="
<el-pagination
style="margin-top: 10px;display: flex;justify-content: flex-end;"
:current-page.sync="select.page"
:page-sizes="[20, 30, 40, 50]"
:page-size.sync="select.page_size"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
@size-change="
(e) => {
select.page_size = e;
select.page = 1;
getList();
}
"
@current-change="
@current-change="
(e) => {
select.page = e;
getList();
}
"
/>
/>
</el-card>
</el-card>
<AddOrderRefund
ref="AddOrderRefund"
:is-show.sync="isShowAdd"
@refresh="getList"
/>
<ShowOrderRefund
ref="ShowOrderRefund"
:is-show.sync="isShowDetail"
/>
</div>
<AddOrderRefund
ref="AddOrderRefund"
:is-show.sync="isShowAdd"
@refresh="getList"
/>
<ShowOrderRefund
ref="ShowOrderRefund"
:is-show.sync="isShowDetail"
/>
</div>
</template>
<script>
import VxeUI from 'vxe-pc-ui'
import { authMixin } from '@/mixin/authMixin'
import { uploadSize } from '@/settings'
import { deepCopy } from '@/utils'
import { destroy, index, save } from '@/api/order-refund/order-refund'
import AddOrderRefund from './components/AddOrderRefund.vue'
import ShowOrderRefund from './components/ShowOrderRefund.vue'
import axios from 'axios'
import { getToken } from '@/utils/auth'
export default {
name: 'OrderRefund',
components: {
AddOrderRefund,
ShowOrderRefund
},
mixins: [authMixin],
data() {
return {
uploadSize,
examineKey: 0,
isShowAdd: false,
isShowDetail: false,
loading: false,
tableHeight: 400,
select: {
page: 1,
page_size: 20,
keyword: '',
show_relation: ['order']
import VxeUI from "vxe-pc-ui";
import { authMixin } from "@/mixin/authMixin"
import { uploadSize } from "@/settings";
import { deepCopy } from "@/utils";
import { destroy, index, save } from "@/api/order-refund/order-refund";
import AddOrderRefund from "./components/AddOrderRefund.vue";
import ShowOrderRefund from "./components/ShowOrderRefund.vue";
import axios from "axios";
import { getToken } from "@/utils/auth";
export default {
name: "OrderRefund",
mixins: [authMixin],
components: {
AddOrderRefund,
ShowOrderRefund,
},
data() {
return {
uploadSize,
examineKey: 0,
isShowAdd: false,
isShowDetail: false,
loading: false,
tableHeight: 400,
select: {
page: 1,
page_size: 20,
keyword: '',
show_relation: [],
},
total: 0,
allAlign: null,
tableData: [],
form: {
id: '',
status: '',
},
validRules: {
},
total: 0,
allAlign: null,
tableData: [],
form: {
id: '',
status: ''
};
},
computed: {
isActiveStatus() {
return function (row) {
if (this.$refs["table"]) {
return this.$refs["table"].isEditByRow(row);
}
};
},
validRules: {
}
}
},
computed: {
isActiveStatus() {
return function(row) {
if (this.$refs['table']) {
return this.$refs['table'].isEditByRow(row)
isHasAuth() {
return function (auth) {
return this.auths_auth_mixin.indexOf(auth) !== -1
}
}
},
isHasAuth() {
return function(auth) {
return this.auths_auth_mixin.indexOf(auth) !== -1
}
}
},
created() {
this.getList()
},
mounted() {
this.bindToolbar()
this.calcTableHeight()
},
methods: {
calcTableHeight() {
const clientHeight = document.documentElement.clientHeight
const cardTitle = document.querySelector('.el-card__header')?.getBoundingClientRect()?.height
const search = document.querySelector('.vxe-toolbar')?.getBoundingClientRect()?.height
const paginationHeight = (document.querySelector('.el-pagination')?.getBoundingClientRect()?.height ?? 0) + 10 //
const topHeight = 50 //
const padding = 80
const margin = 20
this.tableHeight =
clientHeight - cardTitle - search - paginationHeight - topHeight - padding - margin
created() {
this.getList();
},
mounted() {
this.bindToolbar()
this.calcTableHeight()
},
contextMenuClickEvent({ menu, row, column }) {
switch (menu.code) {
case 'copy':
//
if (row && column) {
if (VxeUI.clipboard.copy(row[column.field])) {
this.$message.success('已复制到剪贴板!')
methods: {
calcTableHeight() {
let clientHeight = document.documentElement.clientHeight;
let cardTitle = document.querySelector(".el-card__header")?.getBoundingClientRect()?.height;
let search = document.querySelector(".vxe-toolbar")?.getBoundingClientRect()?.height;
let paginationHeight = (document.querySelector(".el-pagination")?.getBoundingClientRect()?.height ?? 0) + 10; //
let topHeight = 50; //
let padding = 80;
let margin = 20;
this.tableHeight =
clientHeight - cardTitle - search - paginationHeight - topHeight - padding - margin;
},
contextMenuClickEvent ({ menu, row, column }) {
switch (menu.code) {
case 'copy':
//
if (row && column) {
if (VxeUI.clipboard.copy(row[column.field])) {
this.$message.success('已复制到剪贴板!')
}
}
break
case 'remove':
if (row && column) {
this.destroyRowEvent(row)
}
default:
}
},
async detail (row) {
await this.$refs["ShowOrderRefund"].getDetail(row.id)
this.isShowDetail = true
},
uploadMethod(file) {
const formData = new FormData()
formData.append('file', file)
window.$_uploading = true
return axios.post(process.env.VUE_APP_UPLOAD_API, formData, {
headers: {
Authorization: `Bearer ${getToken()}`,
}
}).then((response) => {
window.$_uploading = false
if (response.status === 200 && !response.data.code) {
return {
response: response.data,
name: response.data.original_name,
url: response.data.url
}
} else {
this.$message.error("上传失败")
}
break
case 'remove':
if (row && column) {
this.destroyRowEvent(row)
}).catch(_ => {
window.$_uploading = false
})
},
bindToolbar() {
this.$nextTick(() => {
if (this.$refs["table"] && this.$refs["toolbar"]) {
this.$refs["table"].connect(this.$refs["toolbar"]);
}
default:
}
},
async detail(row) {
await this.$refs['ShowOrderRefund'].getDetail(row.id)
this.isShowDetail = true
},
});
},
uploadMethod(file) {
const formData = new FormData()
formData.append('file', file)
window.$_uploading = true
return axios.post(process.env.VUE_APP_UPLOAD_API, formData, {
headers: {
Authorization: `Bearer ${getToken()}`
}
}).then((response) => {
window.$_uploading = false
if (response.status === 200 && !response.data.code) {
return {
response: response.data,
name: response.data.original_name,
url: response.data.url
}
} else {
this.$message.error('上传失败')
editRowEvent(row) {
if (this.$refs["table"]) {
this.$refs["table"].setEditRow(row);
}
}).catch(_ => {
window.$_uploading = false
})
},
bindToolbar() {
this.$nextTick(() => {
if (this.$refs['table'] && this.$refs['toolbar']) {
this.$refs['table'].connect(this.$refs['toolbar'])
},
cancelRowEvent(row) {
if (this.$refs["table"]) {
this.$refs["table"].clearEdit().then(() => {
//
this.$refs["table"].revertData(row);
});
}
})
},
editRowEvent(row) {
if (this.$refs['table']) {
this.$refs['table'].setEditRow(row)
}
},
cancelRowEvent(row) {
if (this.$refs['table']) {
this.$refs['table'].clearEdit().then(() => {
//
this.$refs['table'].revertData(row)
})
}
},
},
async getList() {
this.loading = true
try {
const res = await index(this.select, false)
this.tableData = res.data
this.total = res.total
this.loading = false
} catch (err) {
console.error(err)
this.loading = false
}
},
async getList() {
this.loading = true;
try {
const res = await index(this.select, false);
this.tableData = res.data;
this.total = res.total;
this.loading = false;
} catch (err) {
console.error(err);
this.loading = false;
}
},
async saveRowEvent(row) {
if (window.$_uploading) {
this.$message.warning('文件正在上传中')
return
}
try {
const errMap = await this.$refs['table'].validate()
if (errMap) {
throw new Error(errMap)
async saveRowEvent(row) {
if (window.$_uploading) {
this.$message.warning("文件正在上传中")
return
}
await this.$confirm('确认保存?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消'
})
await this.$refs['table'].clearEdit()
const form = deepCopy(this.form)
for (const key in form) {
form[key] = row[key]
try {
const errMap = await this.$refs["table"].validate();
if (errMap) {
throw new Error(errMap);
}
await this.$confirm("确认保存?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
});
await this.$refs["table"].clearEdit();
let form = deepCopy(this.form);
for (const key in form) {
form[key] = row[key];
}
this.loading = true;
await save(form, false);
await this.getList();
this.loading = false;
} catch (err) {
this.loading = false;
}
this.loading = true
await save(form, false)
await this.getList()
this.loading = false
} catch (err) {
this.loading = false
}
},
async destroyRowEvent(row) {
try {
await this.$confirm('确认删除?', '提示', {
confirmButtonText: '确认',
cancelButtonText: '取消'
})
this.loading = true
if (row.id) {
await destroy({
id: row.id
}, false)
await this.getList()
} else {
console.log(row)
this.tableData.splice(
this.tableData.findIndex((i) => i._X_ROW_KEY === row._X_ROW_KEY),
1
)
},
async destroyRowEvent(row) {
try {
await this.$confirm("确认删除?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
});
this.loading = true;
if (row.id) {
await destroy({
id: row.id,
},false);
await this.getList();
} else {
console.log(row);
this.tableData.splice(
this.tableData.findIndex((i) => i._X_ROW_KEY === row._X_ROW_KEY),
1
);
}
this.loading = false;
} catch (err) {
this.loading = false;
}
this.loading = false
} catch (err) {
this.loading = false
}
}
},
}
}
},
};
</script>
<style scoped lang="scss">

Loading…
Cancel
Save