Browse Source

app2.0:增加投诉中心,投诉管理,投诉回复;app:修改投诉管理;

yanshi
dyy 2 years ago
parent
commit
0f1c619164
10 changed files with 1847 additions and 3 deletions
  1. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/Sys_SendComplaint/Assign/form/form.html
  2. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/Sys_SendComplaint/Assign/form/form.js
  3. +45
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  4. +321
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveComplaint/list.vue
  5. +219
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveComplaint/single.vue
  6. +316
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/Assign/list.vue
  7. +215
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/Assign/single.vue
  8. +401
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/list.vue
  9. +93
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/reply.vue
  10. +234
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/single.vue

+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/Sys_SendComplaint/Assign/form/form.html View File

@@ -17,6 +17,6 @@
<div class="lr-form-row " data-table="Sys_SendComplaint">
<font face="宋体">*</font>
<label>接收人</label>
<div id="ReceiverUserId" isvalid="yes" checkexpession="NotNull" errormsg="接收人" ></div>
<div id="ReceiverId" isvalid="yes" checkexpession="NotNull" errormsg="接收人" ></div>
</div>
</div>

+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Mobile/www/pages/EducationalAdministration/Sys_SendComplaint/Assign/form/form.js View File

@@ -93,7 +93,7 @@
return false;
}
var formData = $page.find('.lr-form-container').lrformGet();
formData.Receiver = $page.find("#ReceiverUserId").find("div").text();
formData.Receiver = $page.find("#ReceiverId").find("div").text();
var _postData = {}
_postData.keyValue = keyValue;
_postData.strEntity = JSON.stringify(formData);
@@ -145,7 +145,7 @@
}
},
bind: function ($page, param) {
$page.find('#ReceiverUserId').lrselect({
$page.find('#ReceiverId').lrselect({
type: 'user',
needPre: false
});


+ 45
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json View File

@@ -1073,6 +1073,51 @@
"style": {
"navigationBarTitleText": "详情"
}
},
//投诉中心
{
"path": "pages/EducationalAdministration/Sys_SendComplaint/list",
"style": {
"navigationBarTitleText": "投诉中心"
}
},
{
"path": "pages/EducationalAdministration/Sys_SendComplaint/single",
"style": {
"navigationBarTitleText": "详情"
}
},
{
"path": "pages/EducationalAdministration/Sys_SendComplaint/reply",
"style": {
"navigationBarTitleText": "回复情况"
}
},
//投诉管理
{
"path": "pages/EducationalAdministration/Sys_SendComplaint/Assign/list",
"style": {
"navigationBarTitleText": "投诉管理"
}
},
{
"path": "pages/EducationalAdministration/Sys_SendComplaint/Assign/single",
"style": {
"navigationBarTitleText": "详情"
}
},
//投诉回复
{
"path": "pages/EducationalAdministration/Sys_ReceiveComplaint/list",
"style": {
"navigationBarTitleText": "投诉回复"
}
},
{
"path": "pages/EducationalAdministration/Sys_ReceiveComplaint/single",
"style": {
"navigationBarTitleText": "详情"
}
}


+ 321
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveComplaint/list.vue View File

@@ -0,0 +1,321 @@
<template>
<view class="page">
<!-- 主列表页 -->
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
<!-- 顶部条目/分页信息栏 -->
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
<!-- 滚动列表,跨端支持上拉/下拉 -->
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
<l-customlist :tips="loadState" showTips>
<!-- 单条记录 -->
<view class="customlist-item" v-for="item of list" :key="item.SComplaintId">
<view class="customlist-item-field">
<text class="customlist-item-field-title">投诉编号:</text>
{{ displayListItem(item, 'ComplaintCode') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">主题:</text>
{{ displayListItem(item, 'Title') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">指派人:</text>
{{ displayListItem(item, 'Sender') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">指派时间:</text>
{{ displayListItem(item, 'SendTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">回复状态:</text>
{{ item.ReplyFlag == 1 ? "已回复" : "未回复" }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">回复时间:</text>
{{ displayListItem(item, 'ReplyTime') }}
</view>
<l-customlist-action showDelete @delete="action('delete',item.RComplaintId,item)" showEdit @edit="action('edit', item.RComplaintId,item)" @view="action('view', item.RComplaintId,item)" />
</view>
</l-customlist>
</l-scroll-list>
</view>
<!-- 关闭侧边抽屉按钮 -->
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
<l-icon type="pullright" color="blue" />
</view>
<!-- 侧边栏,用于设置查询条件 -->
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
<view v-if="ready" class="padding">
<!-- <l-customlist-sidepage-datefilter
v-model="dateRange"
@change="searchChange"
title="按时间日期查询: "
ref="datefilter"
class="margin-bottom"
/> -->
<l-input
v-model="queryData.Title"
@change="searchChange"
title="主题"
placeholder="按主题查询"
/>
<!-- 重置查询条件按钮 -->
<view class="padding-tb">
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:投诉中心
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_ReceiveComplaint/list", "style": { "navigationBarTitleText": "表单列表页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import moment from 'moment'
import get from 'lodash/get'
import set from 'lodash/set'
import pickBy from 'lodash/pickBy'
import mapValues from 'lodash/mapValues'
export default {
data() {
return {
// 数据项的数据类型、结构
scheme: {
ComplaintCode: { type: 'text' },
Title: { type: 'text' },
Sender: { type: 'text' },
SendTime: { type: 'datetime', dateformat: '1' },
ReplyFlag: { type: 'text' },
ReplyTime: { type: 'datetime', dateformat: '1' },
},
// 查询条件
searchData: {},
defaultQueryData: {},
queryData: {
Title:'',
},
// 数据源
dataSource: {
},
// 时间查询参数
dateRange: null,
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('EducationalAdministrationSys_ReceiveComplaint-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('EducationalAdministrationSys_ReceiveComplaint-list-change', this.refreshList)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList() {
if (this.page > this.total) { return }
this.searchData.ReceiverId=this.GET_GLOBAL('loginUser').userId
const result = await this.HTTP_GET(
'learun/adms/EducationalAdministration/Sys_ReceiveComplaint/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'SendTime desc', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = this.list.concat(result.rows)
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList() {
this.page = 1
this.total = 2
this.list = []
await this.fetchList()
},
// 列表下拉
pullDown() {
this.refreshList().then(() => {
this.$refs.list.stopPullDown()
})
},
// 设置搜索条件
async searchChange() {
const result = {}
// 时间查询相关参数
if (this.dateRange) {
result.StartTime = this.dateRange.start
result.EndTime = this.dateRange.end
}
// 将其他查询项添加到查询 JSON 中
const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
this.searchData = result
await this.refreshList()
},
// 点击「清空查询条件」按钮
reset() {
// this.$refs.datefilter.changeDateRange('all')
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '',item) {
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}&replyFlag=${item.ReplyFlag}`)
return
case 'edit':
this.NAV_TO(`./single?type=edit&id=${id}&replyFlag=${item.ReplyFlag}`)
return
case 'delete':
if (item.ReplyFlag !== 1) {
this.TOAST("当前投诉意见未回复,无法删除!");
return;
}
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
return
}
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_ReceiveComplaint/delete', id, '删除失败').then(success => {
if(!success) { return }
this.TOAST('删除成功', 'success')
this.refreshList()
})
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
const value = item[field]
switch (fieldItem.type) {
case 'currentInfo':
case 'organize':
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
case 'radio':
case 'select':
const selectItem = this.dataSource[field].find(t => t.value === String(value))
return get(selectItem, 'text', '')
case 'checkbox':
if (!value || value.split(',').length <= 0) { return '' }
const checkboxItems = value.split(',')
return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
case 'datetime':
if (!value) { return '' }
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm:ss')
default: return value === null || value === undefined ? '' : value
}
}
}
}
</script>
<style lang="less" scoped>
@import '~@/common/css/sidepage.less';
@import '~@/common/css/customlist.less';

.customlist-banner-action {
margin-top: 20rpx;
text-align: right;

.customlist-banner-action-btn {
display: inline-block;
padding: 4px 6px;
margin: 0 3px;
border-radius: 3px;
text-align: center;
}
}
</style>

+ 219
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_ReceiveComplaint/single.vue View File

@@ -0,0 +1,219 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('Sys_ReceiveComplaint.Title', $event)"
:value="getValue('Sys_ReceiveComplaint.Title')"
disabled="disabled"
title="主题"
/>
<l-textarea
@input="setValue('Sys_ReceiveComplaint.Contents', $event)"
:value="getValue('Sys_ReceiveComplaint.Contents')"
disabled="disabled"
title="投诉意见"
/>
<l-textarea
@input="setValue('Sys_ReceiveComplaint.ReplyContents', $event)"
:value="getValue('Sys_ReceiveComplaint.ReplyContents')"
:readonly="!edit"
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>
编辑本页
</l-button>
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
取消编辑
</l-button>
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
删除
</l-button>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:校长信箱
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_ReceiveComplaint/single", "style": { "navigationBarTitleText": "表单详情页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
export default {
mixins: [customPageMixins],
data() {
return {
// 页面相关参数
id: null,
replyFlag:null,
mode: null,
edit: null,
ready: false,
// 表单数据
current: {},
origin: {},
// 表单项数据结构
scheme: {
Sys_ReceiveComplaint: {
Title: { type: 'text', title: '主题',verify:'NotNull' },
Contents: { type: 'textarea', title: '投诉意见',verify:'NotNull' },
ReplyContents: { type: 'textarea', title: '回复内容',verify:'NotNull' },
},
},
// 数据源
dataSource: {
Sys_ReceiveComplaint: {
},
}
}
},
async onLoad({ type, id ,replyFlag}) {
await this.init(type, id,replyFlag)
},
methods: {
// 页面初始化
async init(type, id,replyFlag) {
this.LOADING('加载数据中...')
this.id = id
this.replyFlag=replyFlag
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
} else {
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/Sys_ReceiveComplaint/form', this.id)
this.origin = await this.formatFormData(result)
}
this.current = this.COPY(this.origin)
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'edit':
if(this.replyFlag !== '0'){
this.TOAST("当前投诉意见已回复!");
return
}
this.edit = true
break
case 'reset':
this.current = this.COPY(this.origin)
this.edit = false
break
case 'save':
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_ReceiveComplaint/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationSys_ReceiveComplaint-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break
case 'delete':
if (this.replyFlag !== '1') {
this.TOAST("当前投诉意见未回复,无法删除!");
return;
}
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
return
}
this.LOADING('提交删除中...')
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_ReceiveComplaint/delete', this.id, '删除失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationSys_ReceiveComplaint-list-change')
this.NAV_BACK()
this.this.TOAST('删除成功', 'success')
})
break
default: break
}
},
// 获取表单值
getValue(path) {
return get(this.current, path)
},
// 设置表单值
setValue(path, val) {
set(this.current, path, val)
}
}
}
</script>

+ 316
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/Assign/list.vue View File

@@ -0,0 +1,316 @@
<template>
<view class="page">
<!-- 主列表页 -->
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
<!-- 顶部条目/分页信息栏 -->
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
<!-- 滚动列表,跨端支持上拉/下拉 -->
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
<l-customlist :tips="loadState" showTips>
<!-- 单条记录 -->
<view class="customlist-item" v-for="item of list" :key="item.SComplaintId">
<view class="customlist-item-field">
<text class="customlist-item-field-title">投诉编号:</text>
{{ displayListItem(item, 'ComplaintCode') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">主题:</text>
{{ displayListItem(item, 'Title') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">投诉人:</text>
{{ displayListItem(item, 'CreateUserName') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">指派状态:</text>
{{ item.AssignFlag == 1 ? "已指派" : "未指派" }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">指派时间:</text>
{{ displayListItem(item, 'AssignTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">接收人:</text>
{{ displayListItem(item, 'Receiver') }}
</view>
<l-customlist-action showEdit @edit="action('edit', item.SComplaintId,item)" @view="action('view', item.SComplaintId,item)" />
</view>
</l-customlist>
</l-scroll-list>
</view>
<!-- 关闭侧边抽屉按钮 -->
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
<l-icon type="pullright" color="blue" />
</view>
<!-- 侧边栏,用于设置查询条件 -->
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
<view v-if="ready" class="padding">
<!-- <l-customlist-sidepage-datefilter
v-model="dateRange"
@change="searchChange"
title="按时间日期查询: "
ref="datefilter"
class="margin-bottom"
/> -->
<l-input
v-model="queryData.Title"
@change="searchChange"
title="主题"
placeholder="按主题查询"
/>
<l-input
v-model="queryData.ComplaintCode"
@change="searchChange"
title="投诉编号"
placeholder="按投诉编号查询"
/>
<!-- 重置查询条件按钮 -->
<view class="padding-tb">
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:投诉中心
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_SendComplaint/Assign/list", "style": { "navigationBarTitleText": "表单列表页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import moment from 'moment'
import get from 'lodash/get'
import set from 'lodash/set'
import pickBy from 'lodash/pickBy'
import mapValues from 'lodash/mapValues'
export default {
data() {
return {
// 数据项的数据类型、结构
scheme: {
ComplaintCode: { type: 'text' },
Title: { type: 'text' },
CreateUserName: { type: 'text' },
AssignFlag: { type: 'text' },
AssignTime: { type: 'datetime', dateformat: '1' },
Receiver: { type: 'text' },
},
// 查询条件
searchData: {},
defaultQueryData: {},
queryData: {
Title:'',
ComplaintCode:''
},
// 数据源
dataSource: {
},
// 时间查询参数
dateRange: null,
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('EducationalAdministrationSys_SendComplaintAssign-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('EducationalAdministrationSys_SendComplaintAssign-list-change', this.refreshList)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList() {
if (this.page > this.total) { return }
this.searchData.SendFlag='1'
const result = await this.HTTP_GET(
'learun/adms/EducationalAdministration/Sys_SendComplaint/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'SendTime desc', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = this.list.concat(result.rows)
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList() {
this.page = 1
this.total = 2
this.list = []
await this.fetchList()
},
// 列表下拉
pullDown() {
this.refreshList().then(() => {
this.$refs.list.stopPullDown()
})
},
// 设置搜索条件
async searchChange() {
const result = {}
// 时间查询相关参数
if (this.dateRange) {
result.StartTime = this.dateRange.start
result.EndTime = this.dateRange.end
}
// 将其他查询项添加到查询 JSON 中
const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
this.searchData = result
await this.refreshList()
},
// 点击「清空查询条件」按钮
reset() {
// this.$refs.datefilter.changeDateRange('all')
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '',item) {
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}&assignFlag=${item.AssignFlag}`)
return
case 'edit':
if (item.AssignFlag !== 0) {
this.TOAST("当前投诉意见已指派!");
return;
}
this.NAV_TO(`./single?type=edit&id=${id}&assignFlag=${item.AssignFlag}`)
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
const value = item[field]
switch (fieldItem.type) {
case 'currentInfo':
case 'organize':
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
case 'radio':
case 'select':
const selectItem = this.dataSource[field].find(t => t.value === String(value))
return get(selectItem, 'text', '')
case 'checkbox':
if (!value || value.split(',').length <= 0) { return '' }
const checkboxItems = value.split(',')
return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
case 'datetime':
if (!value) { return '' }
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm:ss')
default: return value === null || value === undefined ? '' : value
}
}
}
}
</script>
<style lang="less" scoped>
@import '~@/common/css/sidepage.less';
@import '~@/common/css/customlist.less';

.customlist-banner-action {
margin-top: 20rpx;
text-align: right;

.customlist-banner-action-btn {
display: inline-block;
padding: 4px 6px;
margin: 0 3px;
border-radius: 3px;
text-align: center;
}
}
</style>

+ 215
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/Assign/single.vue View File

@@ -0,0 +1,215 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('Sys_SendComplaint.ComplaintCode', $event)"
:value="getValue('Sys_SendComplaint.ComplaintCode')"
disabled="disabled"
title="投诉编号"
/>
<l-input
@input="setValue('Sys_SendComplaint.Title', $event)"
:value="getValue('Sys_SendComplaint.Title')"
disabled="disabled"
title="主题"
/>
<l-textarea
@input="setValue('Sys_SendComplaint.Contents', $event)"
:value="getValue('Sys_SendComplaint.Contents')"
disabled="disabled"
title="投诉意见"
/>
<l-organize-picker
@input="setValue('Sys_SendComplaint.ReceiverId', $event)"
:value="getValue('Sys_SendComplaint.ReceiverId')"
: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>
编辑本页
</l-button>
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
取消编辑
</l-button>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:校长信箱
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_SendComplaint/Assign/single", "style": { "navigationBarTitleText": "表单详情页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
export default {
mixins: [customPageMixins],
data() {
return {
// 页面相关参数
id: null,
assignFlag:null,
mode: null,
edit: null,
ready: false,
// 表单数据
current: {},
origin: {},
// 表单项数据结构
scheme: {
Sys_SendComplaint: {
ComplaintCode: { type: 'text', title: '投诉编号',verify:'NotNull' },
Title: { type: 'text', title: '主题',verify:'NotNull' },
Contents: { type: 'textarea', title: '投诉意见',verify:'NotNull' },
ReceiverId: { type: 'organize', title: '接收人', dataType: 'user',verify:'NotNull' },
},
},
// 数据源
dataSource: {
Sys_SendComplaint: {
},
}
}
},
async onLoad({ type, id ,assignFlag}) {
await this.init(type, id,assignFlag)
},
methods: {
// 页面初始化
async init(type, id,assignFlag) {
this.LOADING('加载数据中...')
this.id = id
this.assignFlag=assignFlag
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
} else {
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/Sys_SendComplaint/form', this.id)
this.origin = await this.formatFormData(result)
}
this.current = this.COPY(this.origin)
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'edit':
if(this.assignFlag !== '0'){
this.TOAST("当前投诉意见已指派!");
return
}
this.edit = true
break
case 'reset':
this.current = this.COPY(this.origin)
this.edit = false
break
case 'save':
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
const strEntity = JSON.parse(postData.strEntity)
const Receiver = get(this.GET_GLOBAL(this.scheme.Sys_SendComplaint.ReceiverId.dataType), `${strEntity.ReceiverId}.name`, '')
strEntity.Receiver=Receiver
postData.strEntity=JSON.stringify(strEntity)
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_SendComplaint/saveAssign', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationSys_SendComplaintAssign-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break
default: break
}
},
// 获取表单值
getValue(path) {
return get(this.current, path)
},
// 设置表单值
setValue(path, val) {
set(this.current, path, val)
} ,
//生成随机数
getCode () {
var a = parseInt(Math.random() * (10000 - 1000 + 1) + 1000);
var now = new Date();
var b = now.getFullYear() + "" + ((now.getMonth() + 1) < 10 ? ("0" + (now.getMonth() + 1)) : (now.getMonth() + 1)) + "" + (now.getDate() < 10 ? ("0" + now.getDate()) : now.getDate()) + "" + (now.getHours() < 10 ? ("0" + now.getHours()) : now.getHours()) + "" + (now.getMinutes() < 10 ? ("0" + now.getMinutes()) : now.getMinutes()) + "" + (now.getSeconds() < 10 ? ("0" + now.getSeconds) : now.getSeconds());
return b + a;
}
}
}
</script>

+ 401
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/list.vue View File

@@ -0,0 +1,401 @@
<template>
<view class="page">
<!-- 主列表页 -->
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
<!-- 顶部条目/分页信息栏 -->
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
<!-- 滚动列表,跨端支持上拉/下拉 -->
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
<l-customlist :tips="loadState" showTips>
<!-- 单条记录 -->
<view class="customlist-item" v-for="item of list" :key="item.SComplaintId">
<view class="customlist-item-field">
<text class="customlist-item-field-title">投诉编号:</text>
{{ displayListItem(item, 'ComplaintCode') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">主题:</text>
{{ displayListItem(item, 'Title') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">提交状态:</text>
{{ item.SendFlag== 1 ? "已提交" : "草稿" }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">提交时间:</text>
{{ displayListItem(item, 'SendTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">回复状态:</text>
{{ item.ReplyFlag == 1 ? "已回复" : "未回复" }}
</view>
<view class="customlist-banner-action">
<view
@click="action('reply',item.SComplaintId,item)"
class="customlist-banner-action-btn line-green text-sm"
style="border: currentColor 1px solid"
>
回复情况
</view>
<view
@click="action('submit',item.SComplaintId,item)"
class="customlist-banner-action-btn line-yellow text-sm"
style="border: currentColor 1px solid"
>
<l-icon type="check" />
提交
</view>
<view
@click="action('delete',item.SComplaintId,item)"
class="customlist-banner-action-btn line-red text-sm"
style="border: currentColor 1px solid"
>
<l-icon type="delete" />
删除
</view>
<view
@click="action('edit', item.SComplaintId,item)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid"
>
<l-icon type="edit" />
编辑
</view>
<view
@click="action('view', item.SComplaintId,item)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid; min-width: 160rpx"
>
查看
<l-icon type="right" />
</view>
</view>
</view>
</l-customlist>
</l-scroll-list>
</view>
<!-- 关闭侧边抽屉按钮 -->
<view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
<l-icon type="pullright" color="blue" />
</view>
<!-- 侧边栏,用于设置查询条件 -->
<scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
<view v-if="ready" class="padding">
<!-- <l-customlist-sidepage-datefilter
v-model="dateRange"
@change="searchChange"
title="按时间日期查询: "
ref="datefilter"
class="margin-bottom"
/> -->
<l-input
v-model="queryData.Title"
@change="searchChange"
title="主题"
placeholder="按主题查询"
/>
<l-input
v-model="queryData.ComplaintCode"
@change="searchChange"
title="投诉编号"
placeholder="按投诉编号查询"
/>
<!-- 重置查询条件按钮 -->
<view class="padding-tb">
<l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
</view>
</view>
</scroll-view>
<l-customlist-add v-if="!sideOpen" @click="action('add')" />
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:投诉中心
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_SendComplaint/list", "style": { "navigationBarTitleText": "表单列表页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import moment from 'moment'
import get from 'lodash/get'
import set from 'lodash/set'
import pickBy from 'lodash/pickBy'
import mapValues from 'lodash/mapValues'
export default {
data() {
return {
// 数据项的数据类型、结构
scheme: {
ComplaintCode: { type: 'text' },
Title: { type: 'text' },
SendFlag: { type: 'text' },
SendTime: { type: 'datetime', dateformat: '1' },
ReplyFlag: { type: 'text' },
},
// 查询条件
searchData: {},
defaultQueryData: {},
queryData: {
Title:'',
ComplaintCode:''
},
// 数据源
dataSource: {
},
// 时间查询参数
dateRange: null,
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('EducationalAdministrationSys_SendComplaint-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('EducationalAdministrationSys_SendComplaint-list-change', this.refreshList)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList() {
if (this.page > this.total) { return }
this.searchData.CreateUserId=this.GET_GLOBAL('loginUser').userId
const result = await this.HTTP_GET(
'learun/adms/EducationalAdministration/Sys_SendComplaint/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'SendTime desc', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = this.list.concat(result.rows)
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList() {
this.page = 1
this.total = 2
this.list = []
await this.fetchList()
},
// 列表下拉
pullDown() {
this.refreshList().then(() => {
this.$refs.list.stopPullDown()
})
},
// 设置搜索条件
async searchChange() {
const result = {}
// 时间查询相关参数
if (this.dateRange) {
result.StartTime = this.dateRange.start
result.EndTime = this.dateRange.end
}
// 将其他查询项添加到查询 JSON 中
const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
this.searchData = result
await this.refreshList()
},
// 点击「清空查询条件」按钮
reset() {
// this.$refs.datefilter.changeDateRange('all')
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '',item) {
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}&sendFlag=${item.SendFlag}`)
return
case 'add':
this.NAV_TO('./single?type=create')
return
case 'edit':
if (item.SendFlag !== 0) {
this.TOAST("当前投诉意见已提交,无法编辑!");
return;
}
this.NAV_TO(`./single?type=edit&id=${id}&sendFlag=${item.SendFlag}`)
return
case 'delete':
if (item.SendFlag !== 0) {
this.TOAST("当前投诉意见已提交,无法删除!");
return;
}
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
return
}
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_SendComplaint/delete', id, '删除失败').then(success => {
if(!success) { return }
this.TOAST('删除成功', 'success')
this.refreshList()
})
return
case 'submit':
if (item.SendFlag !== 0) {
this.TOAST("当前投诉意见已提交!");
return;
}
if (!(await this.CONFIRM('提交项目', '确定要提交该项吗?', true))) {
return
}
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_SendComplaint/submit', id, '提交失败').then(success => {
if(!success) { return }
this.TOAST('提交成功', 'success')
this.refreshList()
})
return
case 'reply':
if (item.SendFlag !== 1) {
this.TOAST("当前投诉意见未提交,请先提交!");
return;
}
if (item.ReplyFlag !== 1) {
this.TOAST("当前投诉意见未回复!");
return;
}
this.NAV_TO(`./reply?id=${id}`)
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
const value = item[field]
switch (fieldItem.type) {
case 'currentInfo':
case 'organize':
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
case 'radio':
case 'select':
const selectItem = this.dataSource[field].find(t => t.value === String(value))
return get(selectItem, 'text', '')
case 'checkbox':
if (!value || value.split(',').length <= 0) { return '' }
const checkboxItems = value.split(',')
return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
case 'datetime':
if (!value) { return '' }
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm:ss')
default: return value === null || value === undefined ? '' : value
}
}
}
}
</script>
<style lang="less" scoped>
@import '~@/common/css/sidepage.less';
@import '~@/common/css/customlist.less';

.customlist-banner-action {
margin-top: 20rpx;
text-align: right;

.customlist-banner-action-btn {
display: inline-block;
padding: 4px 6px;
margin: 0 3px;
border-radius: 3px;
text-align: center;
}
}
</style>

+ 93
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/reply.vue View File

@@ -0,0 +1,93 @@
<template>
<view class="page">
<view v-if="ready">
<view v-for="(item,index) in replyArr" :key="item.RComplaintId">
<l-textarea title="回复内容" readonly="readonly" :value="item.ReplyContents"></l-textarea>
</view>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:校长信箱
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_SendComplaint/reply", "style": { "navigationBarTitleText": "表单详情页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
export default {
mixins: [customPageMixins],
data() {
return {
// 页面相关参数
id: null,
replyArr:[],
ready: false,
// 表单数据
current: {},
origin: {},
// 表单项数据结构
scheme: { },
// 数据源
dataSource: { }
}
},
async onLoad({ id}) {
await this.init(id)
},
methods: {
// 页面初始化
async init(id) {
this.LOADING('加载数据中...')
this.id = id
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
await this.HTTP_GET('learun/adms/EducationalAdministration/Sys_SendComplaint/replylist', this.id).then(success=>{
if(success){
for (var id in success){
this.replyArr=success[id];
}
}
})
},
}
}
</script>

+ 234
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EducationalAdministration/Sys_SendComplaint/single.vue View File

@@ -0,0 +1,234 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('Sys_SendComplaint.ComplaintCode', $event)"
:value="getValue('Sys_SendComplaint.ComplaintCode')"
disabled="disabled"
title="投诉编号"
/>
<l-input
@input="setValue('Sys_SendComplaint.Title', $event)"
:value="getValue('Sys_SendComplaint.Title')"
:readonly="!edit"
title="主题"
/>
<l-textarea
@input="setValue('Sys_SendComplaint.Contents', $event)"
:value="getValue('Sys_SendComplaint.Contents')"
:readonly="!edit"
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>
编辑本页
</l-button>
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
取消编辑
</l-button>
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
删除
</l-button>
</view>
</view>
</template>
<script>
/*
* 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
* Copyright (c) 2013-2020 上海力软信息技术有限公司
* 创建人:超级管理员
* 日 期:2020-10-14 12:15
* 描 述:校长信箱
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Sys_SendComplaint/single", "style": { "navigationBarTitleText": "表单详情页" } }
*
* (navigationBarTitleText 字段为本页面的标题文本,可以修改)
* (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
*/
import get from 'lodash/get'
import set from 'lodash/set'
import moment from 'moment'
import customPageMixins from '@/common/custompage.js'
export default {
mixins: [customPageMixins],
data() {
return {
// 页面相关参数
id: null,
sendFlag:null,
mode: null,
edit: null,
ready: false,
// 表单数据
current: {},
origin: {},
// 表单项数据结构
scheme: {
Sys_SendComplaint: {
ComplaintCode: { type: 'text', title: '投诉编号',verify:'NotNull' },
Title: { type: 'text', title: '主题',verify:'NotNull' },
Contents: { type: 'textarea', title: '投诉意见',verify:'NotNull' },
},
},
// 数据源
dataSource: {
Sys_SendComplaint: {
},
}
}
},
async onLoad({ type, id ,sendFlag}) {
await this.init(type, id,sendFlag)
},
methods: {
// 页面初始化
async init(type, id,sendFlag) {
this.LOADING('加载数据中...')
this.id = id
this.sendFlag=sendFlag
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
//获取投诉编号
await this.HTTP_GET('learun/adms/EducationalAdministration/Sys_SendComplaint/complaintCode','').then(success=>{
//console.log(success)
if(success&&success!=''&&success!=undefined){
this.origin.Sys_SendComplaint.ComplaintCode=success;
}else{
this.origin.Sys_SendComplaint.ComplaintCode='TS_'+getCode();
}
})
} else {
const result = await this.HTTP_GET('learun/adms/EducationalAdministration/Sys_SendComplaint/form', this.id)
this.origin = await this.formatFormData(result)
}
this.current = this.COPY(this.origin)
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'edit':
if(this.sendFlag !== '0'){
this.TOAST("当前投诉意见已提交,无法编辑!");
return
}
this.edit = true
break
case 'reset':
this.current = this.COPY(this.origin)
this.edit = false
break
case 'save':
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_SendComplaint/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationSys_SendComplaint-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break
case 'delete':
if(this.sendFlag !== '0'){
this.TOAST("当前投诉意见已提交,无法删除!");
return
}
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
return
}
this.LOADING('提交删除中...')
this.HTTP_POST('learun/adms/EducationalAdministration/Sys_SendComplaint/delete', this.id, '删除失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationSys_SendComplaint-list-change')
this.NAV_BACK()
this.this.TOAST('删除成功', 'success')
})
break
default: break
}
},
// 获取表单值
getValue(path) {
return get(this.current, path)
},
// 设置表单值
setValue(path, val) {
set(this.current, path, val)
} ,
//生成随机数
getCode () {
var a = parseInt(Math.random() * (10000 - 1000 + 1) + 1000);
var now = new Date();
var b = now.getFullYear() + "" + ((now.getMonth() + 1) < 10 ? ("0" + (now.getMonth() + 1)) : (now.getMonth() + 1)) + "" + (now.getDate() < 10 ? ("0" + now.getDate()) : now.getDate()) + "" + (now.getHours() < 10 ? ("0" + now.getHours()) : now.getHours()) + "" + (now.getMinutes() < 10 ? ("0" + now.getMinutes()) : now.getMinutes()) + "" + (now.getSeconds() < 10 ? ("0" + now.getSeconds) : now.getSeconds());
return b + a;
}
}
}
</script>

Loading…
Cancel
Save