Browse Source

会议管理以及流程外上传组件问题

长阳分支推送专用
杨晓琪 2 years ago
parent
commit
b45423529b
3 changed files with 138 additions and 60 deletions
  1. +80
    -28
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js
  2. +18
    -14
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingManagement/list.vue
  3. +40
    -18
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingManagement/single.vue

+ 80
- 28
Learun.Framework.Ultimate V7/LearunApp-2.2.0/common/custompage.js View File

@@ -1,3 +1,4 @@
import { conforms, reject } from 'lodash'
import get from 'lodash/get'
import omit from 'lodash/omit'
import moment from 'moment'
@@ -30,12 +31,13 @@ export default {
methods: {
// 获取表单默认值
async getDefaultForm() {
const result = {}
for (const [tableName, tableItem] of Object.entries(this.scheme)) {
const itemData = {}
for (const [fieldName, scheme] of Object.entries(tableItem)) {
if (fieldName !== '__GIRDTABLE__') {
itemData[fieldName] = await this.getDefaultValue(`${tableName}.${fieldName}`, scheme)
itemData[fieldName] = await this.getDefaultValue(`${tableName}.${fieldName}`, scheme,tableName,fieldName)
}
}
result[tableName] = '__GIRDTABLE__' in tableItem ? [itemData] : itemData
@@ -45,7 +47,7 @@ export default {
},

// 获取单条表单项的默认值
async getDefaultValue(path, schemeItem) {
async getDefaultValue(path, schemeItem,tableName,fieldName) {
switch (schemeItem.type) {
case 'keyValue':
return this.processId
@@ -91,6 +93,19 @@ export default {
return result || ''

case 'upload':
let folderIds = {}
let getstData = uni.getStorageSync('folderIds');
if(getstData){
folderIds = JSON.parse(getstData)
}
if(folderIds[tableName]){
folderIds[tableName][fieldName] = ''
}else{
let obj = {}
obj[fieldName] = ''
folderIds[tableName] = obj
}
uni.setStorageSync('folderIds',JSON.stringify(folderIds));
return []

case 'guid':
@@ -103,6 +118,7 @@ export default {

// 验证表单项输入是否正确,返回一个包含所有错误信息的数组
verifyForm() {
console.log(this.scheme)
const result = []
Object.entries(this.scheme).forEach(([tableName, tableItem]) => {
if ('__GIRDTABLE__' in tableItem) {
@@ -149,7 +165,7 @@ export default {
const tableObj = {}
for (const [fieldName, scheme] of Object.entries(tableItem)) {
if (fieldName === '__GIRDTABLE__') { continue }
tableObj[fieldName] = await this.convertToPostData(scheme, tableValue[fieldName])
tableObj[fieldName] = await this.convertToPostData(scheme, tableValue[fieldName],tableName,fieldName)
}
tableArray.push(tableObj)
}
@@ -159,7 +175,7 @@ export default {
// 主表
const strEntity = {}
for (const [fieldName, scheme] of Object.entries(tableItem)) {
strEntity[fieldName] = await this.convertToPostData(scheme, this.current[tableName][fieldName])
strEntity[fieldName] = await this.convertToPostData(scheme, this.current[tableName][fieldName],tableName,fieldName)
}
result['strEntity'] = JSON.stringify(strEntity)
}
@@ -171,9 +187,17 @@ export default {

return result
},
newguid() {
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0,
v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
},

// 将单项表单数据转为 post 数据(提交时使用)
async convertToPostData(scheme, val) {
async convertToPostData(scheme, val,tableName,fieldName) {
switch (scheme.type) {
case 'checkbox':
return val ? val.join(',') : ''
@@ -191,37 +215,51 @@ export default {
return val ? moment(val).format('YYYY-MM-DD HH:mm') : ''

case 'upload':
// const uploadUid = []
// for (const entity of val) {
// if (entity.uid) {
// uploadUid.push(entity.uid)
// continue
// } else {
// const fileId = await this.HTTP_UPLOAD(entity)
// if (fileId) {
// uploadUid.push(fileId)
// }
// }
// }
// return uploadUid.join(',')
// let uploadUid = []
// console.log(val)
// for (const entity of val) {
// if (entity.uid) {
// uploadUid.push(entity.uid)
// continue
// } else {
// const fileId = await this.HTTP_UPLOAD(entity)
// console.log(fileId)
// if (fileId) {
// uploadUid.push(fileId)
// }
// }
// }
// console.log(uploadUid.join(','))
// reject()
// return uploadUid.join(',')
var uploadUid = '';
let folderIds = uni.getStorageSync('folderIds');
if(folderIds){
folderIds = JSON.parse(folderIds)
if(folderIds[tableName]&&folderIds[tableName][fieldName]){
uploadUid = folderIds[tableName][fieldName]
}
}
if(!uploadUid){
uploadUid = this.newguid()
}
for (const item of val) {
if (item.uid) {
uploadUid = item.uid
// uploadUid = item.uid
continue
}
const fileId = await this.HTTP_UPLOAD(item.path || item, undefined, guid || '')
const fileId = await this.HTTP_UPLOAD(item.path || item, undefined, uploadUid)
if (fileId) {
uploadUid = fileId;
}
}
return uploadUid;

default:
@@ -243,13 +281,13 @@ export default {
for (const [fieldName, scheme] of Object.entries(schemeItem)) {
if (fieldName === '__GIRDTABLE__') { continue }
const dataSource = get(this.dataSource, `${tableName}.${fieldName}`)
tableValue[fieldName] = await this.convertToFormValue(scheme, tableValue[fieldName], dataSource)
tableValue[fieldName] = await this.convertToFormValue(scheme, tableValue[fieldName], dataSource,tableName,fieldName)
}
}
} else {
for (const [fieldName, scheme] of Object.entries(schemeItem)) {
const dataSource = get(this.dataSource, `${tableName}.${fieldName}`)
data[tableName][fieldName] = await this.convertToFormValue(scheme, data[tableName][fieldName], dataSource)
data[tableName][fieldName] = await this.convertToFormValue(scheme, data[tableName][fieldName], dataSource,tableName,fieldName)
}
}
}
@@ -258,7 +296,7 @@ export default {
},

// 将单项表单数据格式化(拉取时使用)
async convertToFormValue(scheme, val, dataSource) {
async convertToFormValue(scheme, val, dataSource,tableName,fieldName) {
switch (scheme.type) {
case 'upload':
// if (!val) { return [] }
@@ -277,6 +315,20 @@ export default {
// fileList.push({ path, type: fileType, uid, size: fileSize, name:fileName })
// }
// return fileList
let folderIds = {}
let getstData = uni.getStorageSync('folderIds');
if(getstData){
folderIds = JSON.parse(getstData)
}
if(folderIds[tableName]){
folderIds[tableName][fieldName] = val
}else{
let obj = {}
obj[fieldName] = val
folderIds[tableName] = obj
}
uni.setStorageSync('folderIds',JSON.stringify(folderIds));
if (!val) {
return []
}


+ 18
- 14
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingManagement/list.vue View File

@@ -1,4 +1,4 @@
<template>
<template>
<view class="page">
<!-- 主列表页 -->
<view
@@ -51,19 +51,19 @@
{{ displayListItem(item, "RecordPerson") }}
</view>

<view class="customlist-item-field">
<!-- <view class="customlist-item-field">
<text class="customlist-item-field-title">会议内容:</text>
{{ displayListItem(item, "Content") }}
</view>
</view> -->

<view class="customlist-item-field">
<!-- <view class="customlist-item-field">
<text class="customlist-item-field-title">附件上传:</text>
{{ displayListItem(item, "Files") }}
</view>
</view> -->

<!-- showButton
buttonText="会议纪要" -->
<l-customlist-action
showButton
buttonText="会议纪要"
@join="action('join', item.Id)"
showEdit
@edit="action('edit', item.Id)"
@@ -204,7 +204,11 @@ export default {
);

// 拉取加载列表和数据源
await Promise.all([() => {}]);
await Promise.all([
this.FETCH_DATASOURCE('ConferenceRoom').then(result => {
this.dataSource.MeetingPlace = result.data.map(t => ({ text: t.name, value: t.id }))
}),
]);
await this.fetchList();
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData);
@@ -212,7 +216,7 @@ export default {
},

// 拉取列表
async fetchList() {
async fetchList(isConcat=true) {
if (this.page > this.total) {
return;
}
@@ -222,7 +226,7 @@ export default {
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: "Id", sord: "DESC" },
pagination: { rows: 10, page: this.page, sidx: "CreateTime", sord: "DESC" },
queryJson: JSON.stringify(this.searchData),
},
"加载数据时出错"
@@ -234,7 +238,7 @@ export default {

this.total = result.total;
this.page = result.page + 1;
this.list = this.list.concat(result.rows);
this.list = isConcat?this.list.concat(result.rows):result.rows;

this.tips = `已加载 ${Math.min(result.page, result.total)} / ${
result.total
@@ -244,12 +248,12 @@ export default {
},

// 刷新清空列表
async refreshList() {
async refreshList(isConcat=true) {
this.page = 1;
this.total = 2;
this.list = [];

await this.fetchList();
await this.fetchList(isConcat);
},

// 列表下拉
@@ -273,7 +277,7 @@ export default {
);

this.searchData = result;
await this.refreshList();
await this.refreshList(false);
},

// 点击「清空查询条件」按钮


+ 40
- 18
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingManagement/single.vue View File

@@ -26,13 +26,39 @@
:disabled="!edit"
title="结束时间"
/>
<l-organize-picker
@input="setValue('MeetingManagement.CreateUser', $event)"
:value="getValue('MeetingManagement.CreateUser')"
:readonly="!edit"
type="user"
title="申请人"
/>
<l-input
@input="setValue('MeetingManagement.Linkman', $event)"
:value="getValue('MeetingManagement.Linkman')"
:readonly="!edit"
title="联系人"
/>
<l-input
@input="setValue('MeetingManagement.LinkPhone', $event)"
:value="getValue('MeetingManagement.LinkPhone')"
:readonly="!edit"
title="联系方式"
/>
<l-organize-picker
@input="setValue('MeetingManagement.InternalParticipants', $event)"
:value="getValue('MeetingManagement.InternalParticipants')"
:readonly="!edit"
type="user"
title="参会人员"
multiple
/>
<l-organize-picker
@input="setValue('MeetingManagement.RecordPerson', $event)"
:value="getValue('MeetingManagement.RecordPerson')"
:readonly="!edit"
type="user"
title="会议记录者"
multiple
/>
<l-textarea
@input="setValue('MeetingManagement.Content', $event)"
@@ -47,18 +73,11 @@
:number="9"
title="附件上传"
/>
<l-organize-picker
@input="setValue('MeetingManagement.CreateUser', $event)"
:value="getValue('MeetingManagement.CreateUser')"
:readonly="!edit"
type="user"
title="申请人"
/>
</view>

<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
提交保存
保存草稿
</l-button>
<l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
编辑本页
@@ -115,14 +134,17 @@ export default {
// 表单项数据结构
scheme: {
MeetingManagement: {
MeetingTitle: { type: 'text', title: '会议主题' },
MeetingPlace: { type: 'select', title: '会议地点', dataSource: '0' },
BeginTime: { type: 'datetime', title: '开始时间', dateformat: '0' },
EndTime: { type: 'datetime', title: '结束时间', dateformat: '0' },
MeetingTitle: { type: 'text', title: '会议主题' ,verify:"NotNull"},
MeetingPlace: { type: 'select', title: '会议地点', dataSource: '0',verify:"NotNull" },
BeginTime: { type: 'datetime', title: '开始时间', dateformat: '0',verify:"NotNull" },
EndTime: { type: 'datetime', title: '结束时间', dateformat: '0',verify:"NotNull" },
InternalParticipants: { type: 'organize', title: '参会人员', dataType: 'user',verify:"NotNull" },
RecordPerson: { type: 'organize', title: '会议记录者', dataType: 'user' },
Content: { type: 'texteditor', title: '会议内容' },
Content: { type: 'texteditor', title: '会议内容',verify:"NotNull" },
Linkman: { type: 'text', title: '联系人',verify:"NotNull" },
LinkPhone: { type: 'text', title: '联系方式',verify:"Mobile" },
Files: { type: 'upload', title: '附件上传' },
CreateUser: { type: 'organize', title: '申请人', dataType: 'user' },
CreateUser: { type: 'organize', title: '申请人', dataType: 'user',verify:"NotNull" },
},

},
@@ -152,9 +174,9 @@ export default {

// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
() => {}
this.FETCH_DATASOURCE('ConferenceRoom').then(result => {
this.dataSource.MeetingManagement.MeetingPlace = result.data.map(t => ({ text: t.name, value: t.id }))
}),
])
await this.fetchForm()



Loading…
Cancel
Save