mirror of
https://gitee.com/orangeform/orange-admin.git
synced 2026-01-17 10:36:31 +08:00
commit:同步2.3版本
This commit is contained in:
@@ -216,7 +216,7 @@ const SysOnlineRuleType = new DictionaryBase('验证规则类型', [
|
||||
symbol: 'MOBILE'
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
id: 100,
|
||||
name: '自定义验证',
|
||||
symbol: 'CUSTOM'
|
||||
}
|
||||
@@ -381,6 +381,11 @@ const SysCustomWidgetOperationType = new DictionaryBase('操作类型', [
|
||||
name: '导出',
|
||||
symbol: 'EXPORT'
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
name: '批量删除',
|
||||
symbol: 'BATCH_DELETE'
|
||||
},
|
||||
{
|
||||
id: 20,
|
||||
name: '自定义操作',
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<div class="header-menu" style="flex-grow: 1;">
|
||||
<el-dropdown trigger="click" style="margin-right: 10px;" @command="handleMessage">
|
||||
<el-badge is-dot :hidden="(getMessageCount || {}).totalCount == null || (getMessageCount || {}).totalCount <= 0"
|
||||
style="height: 180x; line-height: 18px; cursor: pointer;">
|
||||
style="height: 18px; line-height: 18px; cursor: pointer;">
|
||||
<i class="el-icon-bell" style="font-size: 18px;" />
|
||||
</el-badge>
|
||||
<el-dropdown-menu slot="dropdown" style="min-width: 130px;">
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
v-for="operation in getTableOperation(false)" :key="operation.id"
|
||||
:plain="operation.plain"
|
||||
:type="operation.btnType"
|
||||
@click.stop="onOperationClick(operation)">
|
||||
@click.stop="onOperationClick(operation)"
|
||||
>
|
||||
{{operation.name}}
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -22,7 +23,8 @@
|
||||
:style="{height: (widgetConfig.tableInfo.height != null && widgetConfig.tableInfo.height !== '') ? widgetConfig.tableInfo.height + 'px' : undefined}"
|
||||
:height="(widgetConfig.tableInfo.height != null && widgetConfig.tableInfo.height !== '') ? widgetConfig.tableInfo.height + 'px' : undefined"
|
||||
:data="tableWidget.dataList" :row-key="primaryColumnName"
|
||||
@sort-change="tableWidget.onSortChange">
|
||||
@sort-change="tableWidget.onSortChange" @selection-change="onTableSelectionChange">
|
||||
<el-table-column v-if="hasBatchDelete" header-align="center" align="center" type="selection" width="55px" />
|
||||
<el-table-column label="序号" header-align="center" align="center" type="index" width="55px" :index="tableWidget.getTableIndex" />
|
||||
<template v-for="tableColumn in widgetConfig.tableColumnList">
|
||||
<!-- Boolean类型的字段,使用el-tag去显示 -->
|
||||
@@ -187,10 +189,14 @@ export default {
|
||||
false,
|
||||
this.widgetConfig.tableInfo.orderFieldName,
|
||||
this.widgetConfig.tableInfo.ascending
|
||||
)
|
||||
),
|
||||
selectRows: []
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onTableSelectionChange (values) {
|
||||
this.selectRows = values;
|
||||
},
|
||||
onViewWorkOrder (row) {
|
||||
this.$emit('viewWOrkOrder', row, this.widgetConfig);
|
||||
},
|
||||
@@ -206,6 +212,39 @@ export default {
|
||||
getTableWidget () {
|
||||
return this.tableWidget;
|
||||
},
|
||||
batchDelete () {
|
||||
if (!Array.isArray(this.selectRows) || this.selectRows.length <= 0) {
|
||||
this.$message.error('请选择要删除的数据!');
|
||||
return;
|
||||
}
|
||||
this.$confirm('是否删除选中数据?').then(res => {
|
||||
if (this.formType === this.SysOnlineFormType.FLOW) { // 工作流表单页面批量删除
|
||||
let selectIdList = this.selectRows.map(item => item.__cascade_add_id__);
|
||||
this.tableWidget.dataList = this.tableWidget.dataList.filter(item => {
|
||||
return selectIdList.indexOf(item.__cascade_add_id__) === -1;
|
||||
});
|
||||
} else {
|
||||
let params = {
|
||||
datasourceId: this.widgetConfig.datasource.datasourceId,
|
||||
relationId: this.widgetConfig.relation ? this.widgetConfig.relation.relationId : undefined,
|
||||
dataIdList: this.selectRows.map(item => {
|
||||
return item[this.primaryColumnName];
|
||||
})
|
||||
}
|
||||
|
||||
let httpCall;
|
||||
if (params.relationId) {
|
||||
httpCall = this.doUrl('/admin/online/onlineOperation/deleteBatchOneToManyRelation/' + this.widgetConfig.datasource.variableName, 'post', params);
|
||||
} else {
|
||||
httpCall = this.doUrl('/admin/online/onlineOperation/deleteBatchDatasource/' + this.widgetConfig.datasource.variableName, 'post', params);
|
||||
}
|
||||
httpCall.then(res => {
|
||||
this.tableWidget.refreshTable();
|
||||
}).catch(e => {
|
||||
});
|
||||
}
|
||||
}).catch(e => {});
|
||||
},
|
||||
setTableWidget (tableWidget) {
|
||||
// 如果正在读取数据,等待读取完毕再刷新
|
||||
let timer = setInterval(() => {
|
||||
@@ -219,7 +258,43 @@ export default {
|
||||
}, 30);
|
||||
},
|
||||
onOperationClick (operation, row) {
|
||||
this.$emit('operationClick', operation, row, this.widgetConfig);
|
||||
if (operation.type === this.SysCustomWidgetOperationType.BATCH_DELETE) {
|
||||
this.batchDelete();
|
||||
} else if (operation.type === this.SysCustomWidgetOperationType.EXPORT) {
|
||||
this.export(operation);
|
||||
} else {
|
||||
this.$emit('operationClick', operation, row, this.widgetConfig);
|
||||
}
|
||||
},
|
||||
export (operation) {
|
||||
this.$confirm('是否导出表格数据?').then(res => {
|
||||
if (this.formType === this.SysOnlineFormType.FLOW) {
|
||||
this.$message.error('工作流不支持导出!');
|
||||
} else {
|
||||
let queryParams = this.getTableQueryParams ? this.getTableQueryParams(this.widgetConfig) : undefined;
|
||||
|
||||
let params = {
|
||||
datasourceId: this.widgetConfig.datasource.datasourceId,
|
||||
relationId: this.widgetConfig.relation ? this.widgetConfig.relation.relationId : undefined,
|
||||
filterDtoList: queryParams,
|
||||
exportInfoList: (operation.exportColumnList || []).sort((val1, val2) => {
|
||||
return val1.showOrder - val2.showOrder;
|
||||
})
|
||||
}
|
||||
console.log(params);
|
||||
let httpCall;
|
||||
if (params.relationId) {
|
||||
httpCall = this.download('/admin/online/onlineOperation/exportByOneToManyRelationId/' + this.widgetConfig.datasource.variableName, params, this.widgetConfig.showName + '.xls');
|
||||
} else {
|
||||
httpCall = this.download('/admin/online/onlineOperation/exportByDatasourceId/' + this.widgetConfig.datasource.variableName, params, this.widgetConfig.showName + '.xls');
|
||||
}
|
||||
httpCall.then(res => {
|
||||
this.$message.success('导出成功!');
|
||||
}).catch(e => {
|
||||
this.$message.error(e);
|
||||
});
|
||||
}
|
||||
}).catch(e => {});
|
||||
},
|
||||
loadTableDictValue (tableData) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -496,6 +571,14 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
hasBatchDelete () {
|
||||
for (let i = 0; i < this.widgetConfig.operationList.length; i++) {
|
||||
if (this.widgetConfig.operationList[i].type === this.SysCustomWidgetOperationType.BATCH_DELETE && this.widgetConfig.operationList[i].enabled) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
buildFlowParam () {
|
||||
let flowParam = {};
|
||||
if (this.flowData) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-if="!formData.rowOperation">
|
||||
<el-form-item label="操作名称" prop="btnType">
|
||||
<el-form-item label="按钮类型" prop="btnType">
|
||||
<el-select v-model="formData.btnType">
|
||||
<el-option label="primary" value="primary" />
|
||||
<el-option label="success" value="success" />
|
||||
@@ -42,6 +42,35 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" v-show="formData.type === SysCustomWidgetOperationType.EXPORT" style="margin-bottom: 20px;">
|
||||
<el-table ref="expoerColumnTable" :data="tableColumnTree" row-key="id" header-cell-class-name="table-header-gray" height="400px"
|
||||
:default-expand-all="true" @selection-change="onExportColumnChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55px" :selectable="(row) => row.isColumn">
|
||||
<template slot="header">
|
||||
<span>AAA</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" width="55px" />
|
||||
<el-table-column label="导出字段" prop="variableName">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.variableName}}</span>
|
||||
<el-tag style="margin-left: 10px;" size="mini" type="danger" v-if="scope.row.aggregationColumnId">聚合字段</el-tag>
|
||||
<el-tag style="margin-left: 10px;" size="mini" type="success" v-if="scope.row.isTable && scope.row.relationType != null">一对一关联</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示名称" prop="showName" width="250px">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-if="scope.row.isColumn" size="mini" :disabled="!exportColumnIsSelected(scope.row)" v-model="scope.row.showName" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="显示顺序" width="150px">
|
||||
<template slot-scope="scope">
|
||||
<el-input-number v-if="scope.row.isColumn" size="mini" :disabled="!exportColumnIsSelected(scope.row)" v-model="scope.row.showOrder" controls-position="right" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-row class="no-scroll flex-box" type="flex" justify="end">
|
||||
<el-button type="primary" :size="defaultFormItemSize" :plain="true"
|
||||
@@ -60,7 +89,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
import { findItemFromList } from '@/utils';
|
||||
export default {
|
||||
props: {
|
||||
rowData: {
|
||||
@@ -69,6 +98,9 @@ export default {
|
||||
formList: {
|
||||
type: Array,
|
||||
required: true
|
||||
},
|
||||
tableList: {
|
||||
type: Array
|
||||
}
|
||||
},
|
||||
data () {
|
||||
@@ -82,8 +114,11 @@ export default {
|
||||
builtin: false,
|
||||
rowOperation: true,
|
||||
btnClass: 'table-btn primary',
|
||||
formId: undefined
|
||||
formId: undefined,
|
||||
exportColumnList: []
|
||||
},
|
||||
tableColumnTree: [],
|
||||
exportColumn: [],
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: '操作按钮名称不能为空', trigger: 'blur' }
|
||||
@@ -94,6 +129,19 @@ export default {
|
||||
methods: {
|
||||
onCancel (isSuccess) {
|
||||
if (this.observer != null) {
|
||||
if (this.formData.type === this.SysCustomWidgetOperationType.EXPORT) {
|
||||
this.formData.exportColumnList = (this.exportColumn || []).map(column => {
|
||||
return column ? {
|
||||
tableId: column.table.tableId,
|
||||
columnId: column.columnId,
|
||||
virtualColumnId: column.aggregationColumnId,
|
||||
showName: column.showName,
|
||||
showOrder: column.showOrder
|
||||
} : undefined;
|
||||
});
|
||||
} else {
|
||||
this.formData.exportColumnList = [];
|
||||
}
|
||||
this.observer.cancel(isSuccess, this.formData);
|
||||
}
|
||||
},
|
||||
@@ -102,6 +150,46 @@ export default {
|
||||
if (!valid) return;
|
||||
this.onCancel(true);
|
||||
});
|
||||
},
|
||||
onExportColumnChange (value) {
|
||||
this.exportColumn = value;
|
||||
},
|
||||
exportColumnIsSelected (row) {
|
||||
if (Array.isArray(this.exportColumn)) {
|
||||
return this.exportColumn.indexOf(row) !== -1;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getTableColumnTree () {
|
||||
this.tableColumnTree = [];
|
||||
let selectedRows = [];
|
||||
if (Array.isArray(this.tableList)) {
|
||||
this.tableColumnTree = this.tableList.map(item => {
|
||||
return {
|
||||
variableName: item.tableName,
|
||||
id: item.tableId,
|
||||
isTable: true,
|
||||
relationType: item.relationType,
|
||||
children: (item.columnList || []).map(column => {
|
||||
let columnInfo = findItemFromList(this.formData.exportColumnList, column.aggregationColumnId, 'virtualColumnId');
|
||||
if (columnInfo == null) columnInfo = findItemFromList(this.formData.exportColumnList, column.columnId, 'columnId');
|
||||
let temp = {
|
||||
...column,
|
||||
id: column.aggregationColumnId || column.columnId,
|
||||
table: item,
|
||||
variableName: column.columnName,
|
||||
showName: (columnInfo || {}).showName || column.columnComment,
|
||||
showOrder: (columnInfo || {}).showOrder || 0,
|
||||
isColumn: true
|
||||
};
|
||||
if (columnInfo != null) selectedRows.push(temp);
|
||||
return temp;
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
return selectedRows;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -116,10 +204,19 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.exportColumn = [];
|
||||
if (this.rowData != null) {
|
||||
this.formData = {
|
||||
...this.rowData
|
||||
}
|
||||
if (this.formData.type === this.SysCustomWidgetOperationType.EXPORT) {
|
||||
let selectedRows = this.getTableColumnTree();
|
||||
this.$nextTick(() => {
|
||||
selectedRows.forEach(row => {
|
||||
this.$refs.expoerColumnTable.toggleRowSelection(row);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,8 +487,10 @@
|
||||
<el-input-number v-model="currentWidgetItem.tableInfo.optionColumnWidth" placeholder="请输入表格高度,单位px" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24" style="border-top: 1px solid #EBEEF5;">
|
||||
<el-table :data="currentWidgetItem.operationList" :show-header="false">
|
||||
<el-col v-if="formConfig.formType !== this.SysOnlineFormType.WORK_ORDER"
|
||||
:span="24" style="border-top: 1px solid #EBEEF5;"
|
||||
>
|
||||
<el-table :data="getCurrentWidgetOperationList" :show-header="false">
|
||||
<el-table-column label="操作" width="45px">
|
||||
<template slot-scope="scope">
|
||||
<el-button class="table-btn delete" type="text" icon="el-icon-remove-outline"
|
||||
@@ -503,7 +505,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="是否启动" prop="enabled" width="70px">
|
||||
<template slot-scope="scope">
|
||||
<el-switch v-model="scope.row.enabled" />
|
||||
<el-switch v-model="scope.row.enabled" @change="onTableOperationEnableChange(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作类型" prop="type" width="90px">
|
||||
@@ -973,12 +975,23 @@ export default {
|
||||
});
|
||||
}).catch(e => {});
|
||||
},
|
||||
onTableOperationEnableChange (row) {
|
||||
let operation = findItemFromList(this.currentWidgetItem.operationList, row.type, 'type');
|
||||
this.currentWidgetItem.operationList = this.currentWidgetItem.operationList.map(item => {
|
||||
return (item.id === row.id) ? row : item;
|
||||
});
|
||||
if (operation == null) {
|
||||
this.currentWidgetItem.operationList.unshift(row);
|
||||
}
|
||||
},
|
||||
onAddTableOperation (operation) {
|
||||
this.$dialog.show(operation ? '编辑操作' : '新建操作', EditWidgetTableOperation, {
|
||||
area: '600px'
|
||||
area: '900px',
|
||||
offset: '100px'
|
||||
}, {
|
||||
rowData: operation,
|
||||
formList: this.formList.filter(item => item.formId !== this.form.formId)
|
||||
formList: this.formList.filter(item => item.formId !== this.form.formId),
|
||||
tableList: this.getWidgetColumnTableList(this.currentWidgetItem.table)
|
||||
}).then(res => {
|
||||
if (operation == null) {
|
||||
let maxId = 0;
|
||||
@@ -1384,6 +1397,30 @@ export default {
|
||||
getMasterTable () {
|
||||
return this.tableList[0];
|
||||
},
|
||||
getCurrentWidgetOperationList () {
|
||||
if (this.currentWidgetItem == null) return [];
|
||||
// 非内置操作
|
||||
let otherOperation = (this.currentWidgetItem.operationList || []).filter(item => {
|
||||
let operation = findItemFromList(defaultWidgetAttributes.table.operationList, item.type, 'type');
|
||||
return operation == null;
|
||||
}).map(item => {
|
||||
return {
|
||||
...item
|
||||
}
|
||||
});
|
||||
// 内置操作
|
||||
let operationList = (defaultWidgetAttributes.table.operationList || []).filter(item => {
|
||||
return this.formConfig.formType === this.SysOnlineFormType.FLOW ? item.type !== this.SysCustomWidgetOperationType.EXPORT : true;
|
||||
}).map(item => {
|
||||
let operation = findItemFromList(this.currentWidgetItem.operationList, item.type, 'type');
|
||||
if (operation == null) operation = item;
|
||||
operation.id = item.id;
|
||||
return {
|
||||
...operation
|
||||
}
|
||||
});
|
||||
return operationList.concat(otherOperation);
|
||||
},
|
||||
getFormParameterList () {
|
||||
if (this.getMasterTable != null) {
|
||||
return this.getMasterTable.columnList.filter(item => {
|
||||
|
||||
@@ -133,20 +133,28 @@ const defaultWidgetAttributes = {
|
||||
titleColor: '#409EFF',
|
||||
tableColumnList: [],
|
||||
operationList: [
|
||||
/**
|
||||
* 暂时去掉导出操作,等支持后再开启
|
||||
{
|
||||
id: 0,
|
||||
type: SysCustomWidgetOperationType.EXPORT,
|
||||
name: '导出',
|
||||
enabled: true,
|
||||
enabled: false,
|
||||
builtin: true,
|
||||
rowOperation: false,
|
||||
btnType: 'primary',
|
||||
plain: true,
|
||||
formId: undefined
|
||||
},
|
||||
*/
|
||||
{
|
||||
id: 4,
|
||||
type: SysCustomWidgetOperationType.BATCH_DELETE,
|
||||
name: '批量删除',
|
||||
enabled: false,
|
||||
builtin: true,
|
||||
rowOperation: false,
|
||||
btnType: 'danger',
|
||||
plain: true,
|
||||
formId: undefined
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
type: SysCustomWidgetOperationType.ADD,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<el-form ref="dictData" :model="formData" class="full-width-input" :rules="rules" style="width: 100%;"
|
||||
label-width="100px" :size="defaultFormItemSize" label-position="right" @submit.native.prevent>
|
||||
<el-form-item label="字典键类型">
|
||||
<el-radio-group v-model="formData.type">
|
||||
<el-radio-group v-model="formData.type" :disabled="value != null">
|
||||
<el-radio-button label="Integer">整数</el-radio-button>
|
||||
<el-radio-button label="String">字符串</el-radio-button>
|
||||
</el-radio-group>
|
||||
@@ -66,6 +66,8 @@ export default {
|
||||
onSubmit () {
|
||||
this.$refs.dictData.validate(valid => {
|
||||
if (!valid) return;
|
||||
if (this.formData.type === 'Integer') this.formData.id = Number.parseInt(this.formData.id);
|
||||
if (this.formData.type === 'String') this.formData.id = this.formData.id.toString();
|
||||
this.$emit('save', this.formData, this.value);
|
||||
this.isShow = false;
|
||||
});
|
||||
|
||||
@@ -5,7 +5,12 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="关联名称" prop="relationName">
|
||||
<el-input class="input-item" v-model="formData.relationName" />
|
||||
<el-input class="input-item" v-model="formData.relationName" :clearable="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="关联标识" prop="variableName">
|
||||
<el-input class="input-item" v-model="formData.variableName" :clearable="true" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
@@ -51,7 +56,8 @@
|
||||
<el-form-item label="从表关联字段" prop="slaveColumnId">
|
||||
<el-select class="input-item" v-model="formData.slaveColumnId" :clearable="true" filterable
|
||||
placeholder="关联从表" :loading="slaveColumnIdWidget.loading"
|
||||
@visible-change="slaveColumnIdWidget.onVisibleChange">
|
||||
@visible-change="slaveColumnIdWidget.onVisibleChange"
|
||||
>
|
||||
<el-option v-for="item in slaveColumnIdWidget.dropdownList" :key="item.columnId" :value="item.columnId" :label="item.columnName">
|
||||
<span>{{item.columnName}}</span>
|
||||
</el-option>
|
||||
@@ -135,6 +141,9 @@ export default {
|
||||
rules: {
|
||||
relationName: [
|
||||
{required: true, message: '请输入关联名称', trigger: 'blur'}
|
||||
],
|
||||
variableName: [
|
||||
{required: true, message: '请输入关联标识', trigger: 'blur'}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -148,11 +157,6 @@ export default {
|
||||
onSubmit () {
|
||||
this.$refs.formEditOnlinePageDatasourceRelation.validate((valid) => {
|
||||
if (!valid) return;
|
||||
let masterColumn = findItemFromList(this.masterColumnIdWidget.dropdownList, this.formData.masterColumnId, 'columnId');
|
||||
let slaveTable = findItemFromList(this.slaveTableIdWidget.dropdownList, this.formData.slaveTableId, 'id');
|
||||
let slaveColumn = findItemFromList(this.slaveColumnIdWidget.dropdownList, this.formData.slaveColumnId, 'columnId');
|
||||
if (!this.isEdit) this.formData.variableName = masterColumn.columnName + '_' + slaveTable.name + '_' + slaveColumn.columnName + 'Relation';
|
||||
|
||||
let params = {
|
||||
onlineDatasourceRelationDto: {
|
||||
datasourceId: this.datasource.datasourceId,
|
||||
@@ -326,6 +330,19 @@ export default {
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
},
|
||||
buildRelationVariableName () {
|
||||
console.log(this.formData.variableName);
|
||||
if (this.formData.variableName == null || this.formData.variableName === '') {
|
||||
let masterColumn = findItemFromList(this.masterColumnIdWidget.dropdownList, this.formData.masterColumnId, 'columnId');
|
||||
let slaveTable = findItemFromList(this.slaveTableIdWidget.dropdownList, this.formData.slaveTableId, 'id');
|
||||
let slaveColumn = findItemFromList(this.slaveColumnIdWidget.dropdownList, this.formData.slaveColumnId, 'columnId');
|
||||
console.log(masterColumn, slaveTable, slaveColumn);
|
||||
if (masterColumn && slaveTable && slaveColumn) {
|
||||
this.formData.variableName = masterColumn.columnName + '_' + slaveTable.name + '_' + slaveColumn.columnName;
|
||||
console.log(this.formData.variableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -336,6 +353,14 @@ export default {
|
||||
return this.datasource.validTableList;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'formData.slaveColumnId': {
|
||||
handler (newValue) {
|
||||
console.log(newValue);
|
||||
this.buildRelationVariableName();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
if (this.isEdit) {
|
||||
OnlineDatasourceRelationController.view(this, {
|
||||
|
||||
@@ -367,7 +367,7 @@ const OnlineFormMixins = {
|
||||
}
|
||||
break;
|
||||
case this.SysOnlineRuleType.CUSTOM:
|
||||
return { type: 'string', pattern: new RegExp(rule.data.pattern), message: rule.data.message, trigger: 'blur' };
|
||||
return { type: 'string', pattern: new RegExp(rule.onlineRule.pattern), message: rule.data.message, trigger: 'blur' };
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -119,7 +119,13 @@ export default {
|
||||
}
|
||||
},
|
||||
onTableOperationClick (operation, row, widget) {
|
||||
this.handlerOperation(operation, row, widget);
|
||||
if (operation.type === this.SysCustomWidgetOperationType.BATCH_DELETE) {
|
||||
this.$refs[this.formConfig.formQueryTable.variableName].batchDelete();
|
||||
} else if (operation.type === this.SysCustomWidgetOperationType.EXPORT) {
|
||||
this.$refs[this.formConfig.formQueryTable.variableName].export(operation);
|
||||
} else {
|
||||
this.handlerOperation(operation, row, widget);
|
||||
}
|
||||
},
|
||||
onResume () {
|
||||
let key = this.$route.fullPath;
|
||||
|
||||
@@ -168,13 +168,11 @@ export default {
|
||||
if (!valid) return reject();
|
||||
let tempObj = {};
|
||||
let that = this;
|
||||
let oneToOneRelationObj = {};
|
||||
let hasMasterData = false;
|
||||
function getFlowWidgetData (widget) {
|
||||
if (widget == null || widget.readOnly || widget.disabled) return;
|
||||
if (widget.relation == null) {
|
||||
if (tempObj.masterData == null) tempObj.masterData = {};
|
||||
tempObj.masterData[widget.column.columnName] = that.formData[that.getWidgetFieldName(widget)];
|
||||
tempObj.masterData.__maasterTable__ = widget.table;
|
||||
} else {
|
||||
if (widget.relation != null) {
|
||||
if (tempObj.slaveData == null) tempObj.slaveData = {};
|
||||
if (widget.widgetType === that.SysCustomWidgetType.Table) {
|
||||
let tableData = that.getRelationTableData(widget);
|
||||
@@ -182,13 +180,10 @@ export default {
|
||||
tempObj.slaveData[widget.relation.relationId] = tableData;
|
||||
}
|
||||
} else {
|
||||
let value = that.formData[that.getWidgetFieldName(widget)];
|
||||
if (value != null && widget.column != null) {
|
||||
if (tempObj.slaveData[widget.relation.relationId] == null) tempObj.slaveData[widget.relation.relationId] = {};
|
||||
tempObj.slaveData[widget.relation.relationId][widget.column.columnName] = value;
|
||||
if (tempObj.slaveData[widget.relation.relationId]['__slaveWidget__'] == null) tempObj.slaveData[widget.relation.relationId]['__slaveWidget__'] = widget;
|
||||
}
|
||||
oneToOneRelationObj[widget.relation.relationId] = widget.relation;
|
||||
}
|
||||
} else {
|
||||
hasMasterData = true;
|
||||
}
|
||||
|
||||
if (Array.isArray(widget.childWidgetList)) {
|
||||
@@ -197,44 +192,30 @@ export default {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 一对多关联数据
|
||||
if (Array.isArray(this.formConfig.formWidgetList)) {
|
||||
this.formConfig.formWidgetList.forEach(widget => {
|
||||
getFlowWidgetData(widget);
|
||||
});
|
||||
}
|
||||
|
||||
if (tempObj.masterData != null && tempObj.masterData.__maasterTable__ != null) {
|
||||
let primaryColumn = null;
|
||||
if (Array.isArray(tempObj.masterData.__maasterTable__.columnList)) {
|
||||
primaryColumn = tempObj.masterData.__maasterTable__.columnList.filter(column => {
|
||||
return column.primaryKey;
|
||||
})[0];
|
||||
}
|
||||
if (primaryColumn != null && this.formData[primaryColumn.columnName] != null) {
|
||||
tempObj.masterData[primaryColumn.columnName] = this.formData[primaryColumn.columnName];
|
||||
}
|
||||
delete tempObj.masterData.__maasterTable__;
|
||||
}
|
||||
|
||||
if (tempObj.slaveData != null) {
|
||||
Object.keys(tempObj.slaveData).map(key => {
|
||||
let slaveObj = tempObj.slaveData[key];
|
||||
let primaryColumn = null;
|
||||
if (slaveObj != null && slaveObj.__slaveWidget__ != null && slaveObj.__slaveWidget__.table != null) {
|
||||
if (Array.isArray(slaveObj.__slaveWidget__.table.columnList)) {
|
||||
primaryColumn = slaveObj.__slaveWidget__.table.columnList.filter(column => {
|
||||
return column.primaryKey;
|
||||
})[0];
|
||||
}
|
||||
let widget = slaveObj.__slaveWidget__;
|
||||
if (primaryColumn != null && this.formData[widget.relation.variableName + '__' + (widget.column || {}).columnName] != null) {
|
||||
slaveObj[primaryColumn.columnName] = this.formData[widget.relation.variableName + '__' + (widget.column || {}).columnName]
|
||||
}
|
||||
delete slaveObj.__slaveWidget__;
|
||||
}
|
||||
// 主表数据
|
||||
if (hasMasterData && this.masterTable) {
|
||||
this.masterTable.columnList.forEach(column => {
|
||||
if (tempObj.masterData == null) tempObj.masterData = {};
|
||||
tempObj.masterData[column.columnName] = this.formData[column.columnName];
|
||||
});
|
||||
}
|
||||
// 一对一关联数据
|
||||
Object.keys(oneToOneRelationObj).forEach(relationId => {
|
||||
let relation = oneToOneRelationObj[relationId];
|
||||
if (relation && relation.slaveTable && Array.isArray(relation.slaveTable.columnList)) {
|
||||
relation.slaveTable.columnList.forEach(column => {
|
||||
let value = that.formData[relation.variableName + '__' + (column || {}).columnName];
|
||||
if (tempObj.slaveData[relationId] == null) tempObj.slaveData[relationId] = {};
|
||||
tempObj.slaveData[relationId][column.columnName] = value;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
resolve(tempObj);
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<el-col :span="12">
|
||||
<el-form-item label="上级菜单">
|
||||
<el-cascader :options="menuTree" v-model="parentMenuPath" :props="menuProps" placeholder="选择父菜单"
|
||||
:disabled="!canEditParent || isEdit" :clearable="true" :change-on-select="true" :size="defaultFormItemSize"
|
||||
:clearable="true" :change-on-select="true" :size="defaultFormItemSize"
|
||||
@change="onParentMenuChange" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -180,12 +180,13 @@ export default {
|
||||
}
|
||||
},
|
||||
onParentMenuChange (value, isInit) {
|
||||
if (!isInit) this.formData.menuType = undefined;
|
||||
this.parentMenuType = undefined;
|
||||
if (Array.isArray(value) && value.length > 0) {
|
||||
let node = findTreeNode(this.menuTree, value[value.length - 1], 'menuId');
|
||||
if (node) this.parentMenuType = node.menuType;
|
||||
}
|
||||
// 父菜单切换后判断可用菜单类型是否改变,如果改变则清空
|
||||
if (!isInit && this.getValidMenuType.map(item => item.id).indexOf(this.formData.menuType) === -1) this.formData.menuType = undefined;
|
||||
},
|
||||
onCancel (isSuccess) {
|
||||
if (this.observer != null) {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<el-row type="flex" justify="space-between" style="margin-bottom: 15px;">
|
||||
<el-radio-group size="small" v-model="currentPage" style="min-width: 350px;">
|
||||
<el-radio-group size="small" v-model="currentPage" style="min-width: 400px;">
|
||||
<el-radio-button label="formInfo">表单信息</el-radio-button>
|
||||
<el-radio-button v-if="processInstanceId == null || isRuntime || isRuntime === 'true'" label="copyInfo">抄送设置</el-radio-button>
|
||||
<el-radio-button v-if="processInstanceId != null" label="flowProcess">流程图</el-radio-button>
|
||||
|
||||
@@ -180,7 +180,7 @@ export default {
|
||||
this.getMasterData(operation.type, (res || {}).assignee).then(formData => {
|
||||
FlowOperationController.startAndTakeUserTask(this, {
|
||||
processDefinitionKey: this.processDefinitionKey,
|
||||
masterData: formData.masterData,
|
||||
masterData: formData.masterData || {},
|
||||
slaveData: formData.slaveData,
|
||||
taskVariableData: formData.taskVariableData,
|
||||
flowTaskCommentDto: {
|
||||
|
||||
Reference in New Issue
Block a user