瀏覽代碼

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

长阳分支推送专用
杨晓琪 2 年之前
父節點
當前提交
b45423529b
共有 3 個檔案被更改,包括 138 行新增60 行删除
  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 查看文件

@@ -1,3 +1,4 @@
import { conforms, reject } from 'lodash'
import get from 'lodash/get' import get from 'lodash/get'
import omit from 'lodash/omit' import omit from 'lodash/omit'
import moment from 'moment' import moment from 'moment'
@@ -30,12 +31,13 @@ export default {
methods: { methods: {
// 获取表单默认值 // 获取表单默认值
async getDefaultForm() { async getDefaultForm() {
const result = {} const result = {}
for (const [tableName, tableItem] of Object.entries(this.scheme)) { for (const [tableName, tableItem] of Object.entries(this.scheme)) {
const itemData = {} const itemData = {}
for (const [fieldName, scheme] of Object.entries(tableItem)) { for (const [fieldName, scheme] of Object.entries(tableItem)) {
if (fieldName !== '__GIRDTABLE__') { 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 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) { switch (schemeItem.type) {
case 'keyValue': case 'keyValue':
return this.processId return this.processId
@@ -91,6 +93,19 @@ export default {
return result || '' return result || ''


case 'upload': 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 [] return []


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


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


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


case 'upload': 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 = ''; 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) { for (const item of val) {
if (item.uid) { if (item.uid) {
uploadUid = item.uid
// uploadUid = item.uid
continue 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) { if (fileId) {
uploadUid = fileId; uploadUid = fileId;
} }
} }
return uploadUid; return uploadUid;


default: default:
@@ -243,13 +281,13 @@ export default {
for (const [fieldName, scheme] of Object.entries(schemeItem)) { for (const [fieldName, scheme] of Object.entries(schemeItem)) {
if (fieldName === '__GIRDTABLE__') { continue } if (fieldName === '__GIRDTABLE__') { continue }
const dataSource = get(this.dataSource, `${tableName}.${fieldName}`) 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 { } else {
for (const [fieldName, scheme] of Object.entries(schemeItem)) { for (const [fieldName, scheme] of Object.entries(schemeItem)) {
const dataSource = get(this.dataSource, `${tableName}.${fieldName}`) 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) { switch (scheme.type) {
case 'upload': case 'upload':
// if (!val) { return [] } // if (!val) { return [] }
@@ -277,6 +315,20 @@ export default {
// fileList.push({ path, type: fileType, uid, size: fileSize, name:fileName }) // fileList.push({ path, type: fileType, uid, size: fileSize, name:fileName })
// } // }
// return fileList // 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) { if (!val) {
return [] return []
} }


+ 18
- 14
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/PersonnelManagement/MeetingManagement/list.vue 查看文件

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


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


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


<!-- showButton
buttonText="会议纪要" -->
<l-customlist-action <l-customlist-action
showButton
buttonText="会议纪要"
@join="action('join', item.Id)" @join="action('join', item.Id)"
showEdit showEdit
@edit="action('edit', item.Id)" @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(); await this.fetchList();
// 初始化查询条件 // 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData); this.defaultQueryData = this.COPY(this.queryData);
@@ -212,7 +216,7 @@ export default {
}, },


// 拉取列表 // 拉取列表
async fetchList() {
async fetchList(isConcat=true) {
if (this.page > this.total) { if (this.page > this.total) {
return; return;
} }
@@ -222,7 +226,7 @@ export default {
{ {
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) // 这里 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), queryJson: JSON.stringify(this.searchData),
}, },
"加载数据时出错" "加载数据时出错"
@@ -234,7 +238,7 @@ export default {


this.total = result.total; this.total = result.total;
this.page = result.page + 1; 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)} / ${ this.tips = `已加载 ${Math.min(result.page, result.total)} / ${
result.total result.total
@@ -244,12 +248,12 @@ export default {
}, },


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


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


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


this.searchData = result; 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 查看文件

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


<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;"> <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 v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
提交保存
保存草稿
</l-button> </l-button>
<l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block> <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: { scheme: {
MeetingManagement: { 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' }, 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: '附件上传' }, 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([ 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() await this.fetchForm()




Loading…
取消
儲存