目录代码整合
This commit is contained in:
281
packages/work/AppForm/components/Add.vue
Normal file
281
packages/work/AppForm/components/Add.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<ai-detail class="form-add" :class="[currIndex === 1 ? 'form-add__active' : '']">
|
||||
<ai-title title="表单配置" slot="title" isShowBottomBorder isShowBack @onBackClick="cancel(false)"></ai-title>
|
||||
<template #content>
|
||||
<div class="ai-step">
|
||||
<div class="ai-step__item"
|
||||
:class="[currIndex >= index ? 'ai-step__item--active' : '']"
|
||||
v-for="(item, index) in statusList"
|
||||
:key="index">
|
||||
<div class="ai-step__item--icon" v-if="currIndex <= index">
|
||||
<i v-if="currIndex === index"></i>
|
||||
</div>
|
||||
<div class="el-icon-success" v-if="currIndex > index">
|
||||
</div>
|
||||
<span>{{ item }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<basic-info ref="basicInfo" v-model="basicInfo" v-show="currIndex === 0" :dict="dict" :instance="instance"></basic-info>
|
||||
<form-layout :appType="basicInfo.appType" :currIndex="currIndex" class="form-config__wrapper" v-model="tableInfos" ref="form" v-show="currIndex === 1" :dict="dict" :instance="instance"></form-layout>
|
||||
<form-config
|
||||
ref="config"
|
||||
:showListFields="showListFields"
|
||||
:btns="btns"
|
||||
:fuzzyQueryFields="fuzzyQueryFields"
|
||||
:tableInfos="tableInfos"
|
||||
:orderFields="orderFields"
|
||||
v-if="currIndex === 2">
|
||||
</form-config>
|
||||
</template>
|
||||
<template #footer>
|
||||
<el-button @click="cancel">取消</el-button>
|
||||
<el-button @click="back" v-if="currIndex > 0">上一步</el-button>
|
||||
<el-button @click="next" type="primary">{{ currIndex === 2 ? '完成' : '下一步' }}</el-button>
|
||||
</template>
|
||||
</ai-detail>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import BasicInfo from './BasicInfo.vue'
|
||||
import FormLayout from './FormLayout.vue'
|
||||
import FormConfig from './FormConfig.vue'
|
||||
export default {
|
||||
name: 'add',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
params: Object,
|
||||
type: String
|
||||
},
|
||||
|
||||
components: {
|
||||
FormLayout,
|
||||
BasicInfo,
|
||||
FormConfig
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
currIndex: 0,
|
||||
basicInfo: {
|
||||
saasPlatformId: '',
|
||||
menuLeve1Style: '',
|
||||
saasPlatformName: '',
|
||||
menuLevel1Name: '',
|
||||
menuLevel3Name: '',
|
||||
menuLevel2Name: '',
|
||||
appType: ''
|
||||
},
|
||||
orderFields: [],
|
||||
showListFields: [],
|
||||
fuzzyQueryFields: [],
|
||||
btns: [],
|
||||
btnKeys: ['insertEnable', 'importEnable', 'exportEnalbe', 'editEnable', 'deleteEnable', 'batchDelEnable'],
|
||||
configInfo: {
|
||||
btns: [],
|
||||
orderType: '0',
|
||||
fieldName: ''
|
||||
},
|
||||
info: {},
|
||||
tableInfos: [],
|
||||
statusList: ['基础设置', '表单设计', '列表设计']
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
if (this.params.id) {
|
||||
this.getInfo()
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
cancel (isRefresh) {
|
||||
this.$emit('change', {
|
||||
type: 'list',
|
||||
isRefresh: isRefresh ? true : false,
|
||||
isQuote: this.params.isQuote ? true : false
|
||||
})
|
||||
},
|
||||
|
||||
confirm () {
|
||||
|
||||
},
|
||||
|
||||
back () {
|
||||
this.currIndex = this.currIndex - 1
|
||||
},
|
||||
|
||||
confirmBasicInfo () {
|
||||
return this.$refs.basicInfo.validate()
|
||||
},
|
||||
|
||||
getInfo () {
|
||||
this.instance.post(`/app/appapplicationinfo/queryDetailById?id=${this.params.id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.info = res.data
|
||||
this.basicInfo = {
|
||||
saasPlatformId: res.data.saasPlatformId,
|
||||
menuLeve1Style: res.data.menuLeve1Style,
|
||||
saasPlatformName: res.data.saasPlatformName,
|
||||
menuLevel1Name: res.data.menuLevel1Name,
|
||||
menuLevel3Name: res.data.menuLevel3Name,
|
||||
menuLevel2Name: res.data.menuLevel2Name,
|
||||
appType: res.data.appType,
|
||||
corpId: res.data.corpId,
|
||||
corpName: res.data.corpName
|
||||
}
|
||||
this.fuzzyQueryFields = res.data.fuzzyQueryFields
|
||||
this.tableInfos = res.data.tableInfos
|
||||
this.showListFields = res.data.showListFields
|
||||
this.orderFields = res.data.orderFields
|
||||
this.btns = Object.keys(res.data).filter(v => {
|
||||
return this.btnKeys.indexOf(v) > -1 && res.data[v] === '1'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
submit (info) {
|
||||
this.instance.post(`/app/appapplicationinfo/addOrUpdate`, {
|
||||
...this.info,
|
||||
...this.basicInfo,
|
||||
tableInfos: this.tableInfos,
|
||||
...info.btns,
|
||||
id: this.params.id,
|
||||
applicationName: this.basicInfo.menuLevel3Name || this.basicInfo.menuLevel2Name,
|
||||
fuzzyQueryFields: info.fuzzyQueryFields,
|
||||
orderType: info.orderType,
|
||||
orderFields: info.orderFields,
|
||||
showListFields: info.showListFields
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.$message.success(this.params.id ? '编辑成功' : '添加成功')
|
||||
this.cancel(true)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
next () {
|
||||
if (this.currIndex === 0) {
|
||||
if (!this.$refs.basicInfo.validate()) return
|
||||
}
|
||||
|
||||
if (this.currIndex === 1) {
|
||||
this.$refs.form.onConfirm()
|
||||
}
|
||||
|
||||
if (this.currIndex === 2) {
|
||||
const info = this.$refs.config.validate()
|
||||
if (!info) return
|
||||
|
||||
this.submit(info)
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
this.currIndex = this.currIndex + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form-add {
|
||||
&.form-add__active {
|
||||
::v-deep .ai-detail__content--wrapper {
|
||||
max-width: 100%!important;
|
||||
height: 100%!important;
|
||||
background: #F5F6F9;
|
||||
}
|
||||
|
||||
.form-config__wrapper {
|
||||
height: calc(100% - 52px);
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
::v-deep .ai-detail__content {
|
||||
height: calc(100% - 114px)!important;
|
||||
padding: 0!important;
|
||||
overflow: hidden!important;
|
||||
}
|
||||
}
|
||||
|
||||
.ai-step {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 4px;
|
||||
margin-bottom: 24px;
|
||||
|
||||
.ai-step__item {
|
||||
display: flex;
|
||||
position: relative;
|
||||
align-items: center;
|
||||
margin-right: 216px;
|
||||
|
||||
&.ai-step__item--active {
|
||||
span {
|
||||
color: #2266FF;
|
||||
}
|
||||
|
||||
.ai-step__item--icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-color: #2266FF;
|
||||
|
||||
i {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
background: #2266FF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:after {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: -208px;
|
||||
width: 200px;
|
||||
height: 2px;
|
||||
background: #D0D4DC;
|
||||
content: ' ';
|
||||
transform: translateY(-50%);
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
|
||||
&::after {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.ai-step__item--icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: 8px;
|
||||
border-radius: 50%;
|
||||
background: #FFFFFF;
|
||||
border: 2px solid #D0D4DC;
|
||||
}
|
||||
|
||||
.el-icon-success {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font-size: 24px;
|
||||
margin-right: 8px;
|
||||
color: #2266FF;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
span {
|
||||
color: #666666;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
151
packages/work/AppForm/components/BasicInfo.vue
Normal file
151
packages/work/AppForm/components/BasicInfo.vue
Normal file
@@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<div class="basicInfo">
|
||||
<el-form ref="form" :model="form" label-width="110px" label-position="right">
|
||||
<ai-card title="基本信息">
|
||||
<template #content>
|
||||
<div class="ai-form">
|
||||
<el-form-item label="所属平台" prop="saasPlatformId" style="width: 100%;" :rules="[{ required: true, message: '请选择所属平台', trigger: 'change' }]">
|
||||
<el-select
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
placeholder="请选择所属平台"
|
||||
clearable
|
||||
@change="onChange"
|
||||
v-model="form.saasPlatformId">
|
||||
<el-option
|
||||
v-for="(item, index) in sassList"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.saasPlatformId" style="width: 100%;" label="所属企业" prop="corpId" :rules="[{ required: true, message: '请选择所属企业', trigger: 'change' }]">
|
||||
<ai-select
|
||||
v-model="form.corpId"
|
||||
placeholder="请选择所属企业"
|
||||
clearable
|
||||
@change="onCompanyChange"
|
||||
:selectList="companyList">
|
||||
</ai-select>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%;" label="一级菜单名称" prop="menuLevel1Name" :rules="[{ required: true, message: '请输入一级菜单名称', trigger: 'change' }]">
|
||||
<el-input size="small" placeholder="请输入一级菜单名称" :maxlength="8" v-model="form.menuLevel1Name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%;" label="二级菜单名称" prop="menuLevel2Name" :rules="[{ required: true, message: '请输入二级菜单名称', trigger: 'change' }]">
|
||||
<el-input size="small" placeholder="请输入二级菜单名称" :maxlength="8" v-model="form.menuLevel2Name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%;" label="三级菜单名称" prop="menuLevel3Name">
|
||||
<el-input size="small" placeholder="请输入三级菜单名称" :maxlength="8" v-model="form.menuLevel3Name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width: 100%;" label="应用类型" prop="appType">
|
||||
<ai-select
|
||||
v-model="form.appType"
|
||||
placeholder="请选择应用类型"
|
||||
clearable
|
||||
:selectList="dict.getDict('diyAppType')">
|
||||
</ai-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
</ai-card>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'basicInfo',
|
||||
|
||||
model: {
|
||||
prop: 'value',
|
||||
event: 'change',
|
||||
},
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object,
|
||||
value: Object
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
form: {
|
||||
saasPlatformId: '',
|
||||
menuLeve1Style: '',
|
||||
saasPlatformName: '',
|
||||
menuLevel1Name: '',
|
||||
menuLevel2Name: '',
|
||||
menuLevel3Name: '',
|
||||
appType: '',
|
||||
corpId: '',
|
||||
corpName: ''
|
||||
},
|
||||
companyList: [],
|
||||
sassList: []
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
value (v) {
|
||||
this.form = JSON.parse(JSON.stringify(v))
|
||||
if (this.form.saasPlatformId) {
|
||||
this.getCompanyList()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.dict.load('diyAppType')
|
||||
},
|
||||
|
||||
mounted () {
|
||||
this.getSassList()
|
||||
this.form = JSON.parse(JSON.stringify(this.value))
|
||||
},
|
||||
|
||||
methods: {
|
||||
onChange (e) {
|
||||
this.form.saasPlatformName = this.sassList.filter(v => v.id === e)[0].name
|
||||
this.form.saasPlatformId && this.getCompanyList()
|
||||
},
|
||||
|
||||
validate () {
|
||||
let result = false
|
||||
this.$refs.form.validate(valid => {
|
||||
result = valid
|
||||
})
|
||||
this.$emit('change', this.form)
|
||||
return result
|
||||
},
|
||||
|
||||
onCompanyChange (e) {
|
||||
this.form.corpName = this.companyList.filter(v => v.dictValue === e)[0].dictName
|
||||
},
|
||||
|
||||
getCompanyList () {
|
||||
this.instance.post(`/app/appCorp/page?current=1&size=1000&saasId=${this.form.saasPlatformId}`).then(res => {
|
||||
if (res.data.records.length) {
|
||||
this.companyList = res.data.records.map(v => {
|
||||
return {
|
||||
dictValue: v.corpId,
|
||||
dictName: v.name
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getSassList () {
|
||||
this.instance.post(`/app/appSaas/listAll`).then(res => {
|
||||
if (res.data) {
|
||||
this.sassList = res.data
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
</style>
|
||||
244
packages/work/AppForm/components/FormConfig.vue
Normal file
244
packages/work/AppForm/components/FormConfig.vue
Normal file
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="basicInfo">
|
||||
<ai-card title="搜索字段" class="search-wrapper">
|
||||
<template #content>
|
||||
<el-checkbox-group v-model="queryFields">
|
||||
<el-checkbox
|
||||
:label="`${item.fieldDbName}~${item.fieldName}`"
|
||||
v-for="(item, index) in tableInfos"
|
||||
:key="index">
|
||||
{{ item.fieldName }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="表格字段">
|
||||
<template #content>
|
||||
<div class="ai-table">
|
||||
<div class="el-table el-table--border ai-header__border">
|
||||
<el-scrollbar>
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="el-table__body">
|
||||
<draggable element="thead" animation="500" class="el-table__header is-leaf ai-table__header" :sort="true" v-model="showFields">
|
||||
<th v-for="(item, index) in showFields" style="background: #f3f4f5; text-align: center;" class="ai-table__header" :key="index">{{ item.fieldName }}</th>
|
||||
</draggable>
|
||||
<tbody element="tbody">
|
||||
<tr>
|
||||
<td @click="handleShow(index, item.isShow)" v-for="(item, index) in showFields" :key="index">{{ item.isShow ? '已显示' : '已隐藏' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</el-scrollbar>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</ai-card>
|
||||
<ai-card title="排序和操作按钮">
|
||||
<template #content>
|
||||
<el-form ref="form" class="ai-form" :model="form" label-width="110px" label-position="right">
|
||||
<el-form-item label="排序字段" prop="field">
|
||||
<el-select
|
||||
size="small"
|
||||
placeholder="默认按创建时间排序"
|
||||
clearable
|
||||
v-model="form.field">
|
||||
<el-option
|
||||
v-for="(filed, index) in tableInfos"
|
||||
:key="index"
|
||||
:label="filed.fieldName"
|
||||
:value="`${filed.fieldDbName}~${filed.fieldName}`">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序类型" prop="orderType" :rules="[{ required: true, message: '请输入排序类型', trigger: 'change' }]">
|
||||
<el-radio-group v-model="form.orderType">
|
||||
<el-radio label="asc">升序</el-radio>
|
||||
<el-radio label="desc">降序</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="按钮配置" prop="btns" style="width: 100%;" :rules="[{ required: true, message: '请输入按钮配置', trigger: 'change' }]">
|
||||
<el-checkbox-group v-model="form.btns">
|
||||
<el-checkbox label="insertEnable">添加</el-checkbox>
|
||||
<el-checkbox label="importEnable">导入</el-checkbox>
|
||||
<el-checkbox label="exportEnalbe">导出</el-checkbox>
|
||||
<el-checkbox label="editEnable">编辑</el-checkbox>
|
||||
<el-checkbox label="deleteEnable">删除</el-checkbox>
|
||||
<el-checkbox label="batchDelEnable">批量删除</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</template>
|
||||
</ai-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import draggable from 'vuedraggable'
|
||||
export default {
|
||||
name: 'configForm',
|
||||
|
||||
props: {
|
||||
tableInfos: Array,
|
||||
btns: Array,
|
||||
showListFields: Array,
|
||||
orderFields: Array,
|
||||
fuzzyQueryFields: Array
|
||||
},
|
||||
|
||||
components: {
|
||||
draggable
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
queryFields: [],
|
||||
tableData: [{}],
|
||||
btnKeys: ['insertEnable', 'importEnable', 'exportEnalbe', 'editEnable', 'deleteEnable', 'batchDelEnable'],
|
||||
form: {
|
||||
btns: [],
|
||||
orderType: 'asc',
|
||||
field: ''
|
||||
},
|
||||
showFields: []
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
const showIds = this.showListFields.map(v => v.fieldDbName)
|
||||
this.showFields = JSON.parse(JSON.stringify(this.tableInfos)).map(item => {
|
||||
item.isShow = showIds.indexOf(item.fieldDbName) > -1 ? true : false
|
||||
|
||||
return item
|
||||
})
|
||||
|
||||
if (!this.showListFields.length) {
|
||||
this.showFields.map(v => {
|
||||
v.isShow = true
|
||||
return v
|
||||
})
|
||||
}
|
||||
|
||||
this.tableInfos.map(item => {
|
||||
this.tableData[0][item.fieldDbName] = '删除'
|
||||
})
|
||||
|
||||
if (this.btns.length) {
|
||||
this.form.btns = this.btns
|
||||
}
|
||||
|
||||
const tableInfosIds = this.tableInfos.map(v => v.fieldDbName)
|
||||
|
||||
if (this.orderFields.length) {
|
||||
let arr = this.orderFields.filter(v => {
|
||||
return tableInfosIds.indexOf(v.fieldDbName) > -1
|
||||
}).map(item => {
|
||||
return `${item.fieldDbName}~${item.fieldName}`
|
||||
})
|
||||
|
||||
if (arr.length) {
|
||||
this.form.field = arr[0]
|
||||
}
|
||||
}
|
||||
if (this.fuzzyQueryFields.length) {
|
||||
this.queryFields = this.fuzzyQueryFields.filter(v => {
|
||||
return tableInfosIds.indexOf(v.fieldDbName) > -1
|
||||
}).map(item => {
|
||||
return `${item.fieldDbName}~${item.fieldName}`
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
validate () {
|
||||
let result = false
|
||||
this.$refs.form.validate(valid => {
|
||||
result = valid
|
||||
})
|
||||
|
||||
if (!result) {
|
||||
return false
|
||||
}
|
||||
|
||||
const btns = {}
|
||||
this.btnKeys.forEach(item => {
|
||||
btns[item] = this.form.btns.indexOf(item) > -1 ? 1 : 0
|
||||
})
|
||||
|
||||
return {
|
||||
btns,
|
||||
orderFields: [{
|
||||
fieldName: this.form.field.split('~')[1],
|
||||
fieldDbName: this.form.field.split('~')[0],
|
||||
orderType: this.form.orderType
|
||||
}],
|
||||
showListFields: this.showFields.filter(v => v.isShow).map((v, index) => {
|
||||
return {
|
||||
fieldName: v.fieldName,
|
||||
fieldDbName: v.fieldDbName,
|
||||
showListIndex: index
|
||||
}
|
||||
}),
|
||||
fuzzyQueryFields: this.queryFields.map(v => {
|
||||
return {
|
||||
fieldName: v.split('~')[1],
|
||||
fieldDbName: v.split('~')[0]
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
handleShow (index, isShow) {
|
||||
const total = this.showFields.map(v => v.isShow).filter(v => !!v)
|
||||
if (total.length <= 1 && isShow) {
|
||||
return this.$message.error('表格列数不能小于1')
|
||||
}
|
||||
|
||||
this.$set(this.showFields[index], 'isShow', !isShow)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.basicInfo {
|
||||
.search-wrapper {
|
||||
::v-deep .el-checkbox-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.el-checkbox {
|
||||
width: 16.66%;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ai-table {
|
||||
.el-table--border {
|
||||
border: 1px solid #d0d4dc;
|
||||
border-bottom: none;
|
||||
border-right: none;
|
||||
}
|
||||
table {
|
||||
min-width: 100%;
|
||||
}
|
||||
|
||||
th, tr {
|
||||
min-width: 100px;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
tr {
|
||||
td {
|
||||
cursor: pointer;
|
||||
color: #26f;
|
||||
text-align: center;
|
||||
user-select: none;
|
||||
|
||||
&:hover {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
1198
packages/work/AppForm/components/FormLayout.vue
Normal file
1198
packages/work/AppForm/components/FormLayout.vue
Normal file
File diff suppressed because it is too large
Load Diff
182
packages/work/AppForm/components/List.vue
Normal file
182
packages/work/AppForm/components/List.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<ai-list class="appform">
|
||||
<template slot="title">
|
||||
<ai-title title="表单配置" isShowBottomBorder></ai-title>
|
||||
</template>
|
||||
<template slot="content">
|
||||
<ai-search-bar class="search-bar">
|
||||
<template #left>
|
||||
<el-button size="small" type="primary" icon="iconfont iconAdd" @click="toAdd('')">添加</el-button>
|
||||
</template>
|
||||
<template slot="right">
|
||||
<el-input
|
||||
v-model="search.applicationName"
|
||||
size="small"
|
||||
v-throttle="() => {search.current = 1, getList()}"
|
||||
placeholder="请输入菜单名称"
|
||||
clearable
|
||||
@clear="search.current = 1, search.applicationName = '', getList()"
|
||||
suffix-icon="iconfont iconSearch">
|
||||
</el-input>
|
||||
</template>
|
||||
</ai-search-bar>
|
||||
<ai-table
|
||||
:tableData="tableData"
|
||||
:col-configs="colConfigs"
|
||||
:total="total"
|
||||
v-loading="loading"
|
||||
style="margin-top: 6px;"
|
||||
:current.sync="search.current"
|
||||
:size.sync="search.size"
|
||||
@getList="getList">
|
||||
<el-table-column slot="options" width="180px" fixed="right" label="操作" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<div class="table-options">
|
||||
<el-button type="text" @click="push(row.id)" v-if="row.pushStatus === '0'">推送</el-button>
|
||||
<el-button type="text" @click="operate(row.id, row.status)">{{ row.status === '1' ? '停用' : '启用' }}</el-button>
|
||||
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
|
||||
<el-button type="text" @click="remove(row.id)">删除</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</ai-table>
|
||||
</template>
|
||||
</ai-list>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from 'vuex'
|
||||
export default {
|
||||
name: 'List',
|
||||
|
||||
props: {
|
||||
instance: Function,
|
||||
dict: Object
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
search: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
applicationName: ''
|
||||
},
|
||||
loading: false,
|
||||
total: 10,
|
||||
colConfigs: [
|
||||
{ prop: 'saasPlatformName', label: '所属平台' },
|
||||
{ prop: 'menuLevel1Name', label: '一级菜单名称'},
|
||||
{ prop: 'menuLevel2Name', label: '二级菜单名称'},
|
||||
{ prop: 'menuLevel3Name', label: '三级菜单名称'},
|
||||
{ prop: 'createUserName', label: '编辑人' },
|
||||
{ prop: 'createTime', label: '编辑时间' },
|
||||
{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
render (h, {row}) {
|
||||
return h('span',{
|
||||
style: {
|
||||
color: row.status === '1' ? '#2EA222' : '#F46'
|
||||
}
|
||||
}, row.status === '1' ? '启用' : '停用')
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'pushStatus',
|
||||
label: '推送状态',
|
||||
align: 'center',
|
||||
render (h, {row}) {
|
||||
return h('span',{
|
||||
style: {
|
||||
color: row.pushStatus === '1' ? '#2EA222' : '#F46'
|
||||
}
|
||||
}, row.pushStatus === '1' ? '成功' : '失败')
|
||||
}
|
||||
}
|
||||
],
|
||||
tableData: [],
|
||||
ids: ''
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapState(['user'])
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getList () {
|
||||
this.loading = true
|
||||
this.instance.post(`/app/appapplicationinfo/list`, null, {
|
||||
params: {
|
||||
...this.search
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.tableData = res.data.records
|
||||
this.total = res.data.total
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
} else {
|
||||
this.loading = false
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
|
||||
removeAll () {
|
||||
if (!this.ids) return
|
||||
|
||||
this.remove(this.ids)
|
||||
},
|
||||
|
||||
push (id) {
|
||||
this.instance.post(`/app/appapplicationinfo/push?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success(`推送成功`)
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
operate (id, status) {
|
||||
this.instance.post(`/app/appapplicationinfo/enable?id=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success(`${status === '1' ? '停用成功' : '启用成功'}`)
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
remove (id) {
|
||||
this.$confirm('确定删除该数据?').then(() => {
|
||||
this.instance.post(`/app/appapplicationinfo/delete?ids=${id}`).then(res => {
|
||||
if (res.code == 0) {
|
||||
this.$message.success('删除成功!')
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
toAdd(id) {
|
||||
this.$emit('change', {
|
||||
type: 'Add',
|
||||
params: {
|
||||
id: id || ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
272
packages/work/AppForm/components/config.js
Normal file
272
packages/work/AppForm/components/config.js
Normal file
@@ -0,0 +1,272 @@
|
||||
export const components = [
|
||||
{
|
||||
type: 'info',
|
||||
tips: '(不能重复添加同一元素)',
|
||||
label: '信息',
|
||||
children: [
|
||||
{
|
||||
type: 'name',
|
||||
fieldName: '姓名',
|
||||
fieldTips: '请输入姓名',
|
||||
fixedLabel: '姓名',
|
||||
disable: '0',
|
||||
grid: 0.5,
|
||||
defaultValue: '',
|
||||
icon: 'icontext_box',
|
||||
mustFill: '1',
|
||||
maxLength: 20
|
||||
},
|
||||
{
|
||||
type: 'idNumber',
|
||||
fieldName: '身份证号',
|
||||
fixedLabel: '身份证号',
|
||||
fieldTips: '请输入身份证号',
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxLength: 20,
|
||||
disable: '0',
|
||||
grid: 0.5
|
||||
},
|
||||
{
|
||||
type: 'phone',
|
||||
fieldName: '联系方式',
|
||||
fixedLabel: '联系方式',
|
||||
fieldTips: '请输入联系方式',
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxLength: 20,
|
||||
disable: '0',
|
||||
grid: 0.5
|
||||
},
|
||||
{
|
||||
type: 'area',
|
||||
fieldName: '地区',
|
||||
fixedLabel: '地区',
|
||||
fieldTips: '请选择地区',
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
areaPattern: '',
|
||||
disable: '0',
|
||||
grid: 0.5
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'options',
|
||||
tips: '(可重复添加)',
|
||||
label: '选项',
|
||||
children: [
|
||||
{
|
||||
type: 'radio',
|
||||
fieldName: '单选',
|
||||
fixedLabel: '单选',
|
||||
fieldTips: '请选择',
|
||||
grid: 0.5,
|
||||
icon: 'iconradio',
|
||||
mustFill: '1',
|
||||
disable: '0',
|
||||
defaultValue: '',
|
||||
options: [
|
||||
{
|
||||
label: '选项1',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: '选项2',
|
||||
value: ''
|
||||
}
|
||||
],
|
||||
title: ''
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
fieldName: '多选',
|
||||
fixedLabel: '多选',
|
||||
fieldTips: '请选择',
|
||||
icon: 'iconcheck_box',
|
||||
mustFill: '1',
|
||||
grid: 0.5,
|
||||
disable: '0',
|
||||
defaultValue: [],
|
||||
options: [
|
||||
{
|
||||
label: '选项1',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: '选项2',
|
||||
value: ''
|
||||
}
|
||||
],
|
||||
title: ''
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
fieldName: '单下拉框',
|
||||
fixedLabel: '单下拉框',
|
||||
grid: 0.5,
|
||||
fieldTips: '请选择',
|
||||
icon: 'iconSelect',
|
||||
mustFill: '1',
|
||||
defaultValue: '',
|
||||
disable: '0',
|
||||
options: [
|
||||
{
|
||||
label: '选项1',
|
||||
value: ''
|
||||
},
|
||||
{
|
||||
label: '选项2',
|
||||
value: ''
|
||||
}
|
||||
],
|
||||
title: ''
|
||||
},
|
||||
{
|
||||
type: 'onOff',
|
||||
fieldName: '开关',
|
||||
fixedLabel: '开关',
|
||||
grid: 0.5,
|
||||
fieldTips: '请选择开关',
|
||||
icon: 'iconSelect',
|
||||
mustFill: '1',
|
||||
defaultValue: '0',
|
||||
disable: '0',
|
||||
title: ''
|
||||
},
|
||||
{
|
||||
type: 'date',
|
||||
fieldName: '日期',
|
||||
fixedLabel: '日期',
|
||||
grid: 0.5,
|
||||
datetimePattern: 'yyyy-MM-dd',
|
||||
fieldTips: '请选择日期',
|
||||
icon: 'iconSelect',
|
||||
mustFill: '1',
|
||||
disable: '0',
|
||||
title: ''
|
||||
},
|
||||
{
|
||||
type: 'time',
|
||||
fieldName: '时间',
|
||||
fixedLabel: '时间',
|
||||
grid: 0.5,
|
||||
datetimePattern: 'HH:mm:ss',
|
||||
fieldTips: '请选择时间',
|
||||
icon: 'iconSelect',
|
||||
mustFill: '1',
|
||||
disable: '0',
|
||||
title: ''
|
||||
},
|
||||
{
|
||||
type: 'datetime',
|
||||
fieldName: '日期时间',
|
||||
fixedLabel: '日期时间',
|
||||
grid: 0.5,
|
||||
datetimePattern: 'yyyy-MM-dd HH:mm:ss',
|
||||
fieldTips: '请选择日期时间',
|
||||
icon: 'iconSelect',
|
||||
mustFill: '1',
|
||||
disable: '0',
|
||||
title: ''
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
tips: '(可重复添加)',
|
||||
label: '填空',
|
||||
children: [
|
||||
{
|
||||
type: 'input',
|
||||
fieldName: '单行填空',
|
||||
fieldTips: '请输入',
|
||||
fixedLabel: '单行填空',
|
||||
disable: '0',
|
||||
grid: 0.5,
|
||||
defaultValue: '',
|
||||
icon: 'icontext_box',
|
||||
mustFill: '1',
|
||||
maxLength: 50
|
||||
},
|
||||
{
|
||||
type: 'textarea',
|
||||
fieldName: '多行填空',
|
||||
fixedLabel: '多行填空',
|
||||
fieldTips: '请输入',
|
||||
lineNumber: 4,
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxLength: 500,
|
||||
disable: '0',
|
||||
grid: 1
|
||||
},
|
||||
{
|
||||
type: 'number',
|
||||
fieldName: '数字输入',
|
||||
fixedLabel: '数字输入',
|
||||
fieldTips: '请输入数字',
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxValue: 10000,
|
||||
decimalPlaces: 0,
|
||||
minValue: 0,
|
||||
maxLength: 500,
|
||||
disable: '0',
|
||||
grid: 0.5
|
||||
},
|
||||
{
|
||||
type: 'rtf',
|
||||
fieldName: '富文本',
|
||||
fixedLabel: '富文本',
|
||||
fieldTips: '请输入',
|
||||
defaultValue: '',
|
||||
icon: 'icontext_area',
|
||||
mustFill: '1',
|
||||
maxLength: 5000,
|
||||
disable: '0',
|
||||
grid: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'annex',
|
||||
tips: '(可重复添加)',
|
||||
label: '附件',
|
||||
children: [
|
||||
{
|
||||
type: 'upload',
|
||||
fieldTips: '请上传',
|
||||
fieldName: '上传附件',
|
||||
fixedLabel: '上传附件',
|
||||
disable: '0',
|
||||
fileChoseSize: 10,
|
||||
fileMaxCount: 9,
|
||||
defaultValue: '',
|
||||
icon: 'iconpic',
|
||||
mustFill: '1',
|
||||
grid: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
type: 'layout',
|
||||
tips: '(可重复添加)',
|
||||
label: '分组',
|
||||
children: [
|
||||
{
|
||||
type: 'group',
|
||||
fieldName: '卡片',
|
||||
fixedLabel: '卡片',
|
||||
icon: 'iconpic',
|
||||
groupName: '分组标题',
|
||||
column: []
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
Reference in New Issue
Block a user