Browse Source

app 教师报修

塔里木分支
yxq 1 year ago
parent
commit
2044bae2e1
10 changed files with 3389 additions and 0 deletions
  1. +211
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file2.vue
  2. +59
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  3. +333
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/handle/list.vue
  4. +399
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/handle/single.vue
  5. +406
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/list.vue
  6. +429
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/single.vue
  7. +333
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/handle/list.vue
  8. +402
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/handle/single.vue
  9. +393
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/list.vue
  10. +424
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/single.vue

+ 211
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/components/upload-file2.vue View File

@@ -0,0 +1,211 @@
<template>
<view>
<view class="cu-form-group" style="border-bottom: none; padding-bottom: 0;">
<view class="title">
<text v-if="required" class="lr-required">*</text>
{{ title || '' }}
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view v-for="(item, index) in imgList" @tap="viewImg(item)" :key="index" class="bg-img">
<image v-if="showfile()&&item&&(typeof item == 'string'||isImage(item.type))" :src="item.url?CONFIG('webHost') + item.url:item" mode="aspectFill">
</image>
<l-icon v-if="showfile()&&!isImage(item.type)" type="text" />
<text class="file-name">{{item.name}}</text>
<view v-if="!readonly" @tap.stop="delImg(index)" class="cu-tag bg-red"
style="width: 18px; height: 18px; font-size: 24px">
<l-icon type="close" style="width: 18px; height: 18px; font-size: 12px" />
</view>
</view>
<view v-if="!readonly && imgList.length < Number(number)" @click="chooseFile" class="solids">
<l-icon type="file" />
</view>
</view>
</view>
</view>

</template>

<script>
/**
* 附件上传组件
* 使用相机拍摄 和 从相册选图
*
* 注意:可以选择图片;如果选择文档的话则是从手机的‘文件管理’里面去选择,有可能会找不到文档;
*/
export default {

props: {
number: {
default: 1
},
readonly: {},
value: {
default: () => []
},
folderId: {},
title: {},
required: {}
},

data() {
return {
isShow: false,
imgList: [],
}
},

methods: {
chooseFile() {
uni.chooseImage({
count: Number(this.number),
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success: ({ tempFilePaths,tempFiles }) => {
this.chooseChangeback(tempFilePaths,tempFiles)
}
})
},
delImg(index) {
this.CONFIRM("", "是否确认删除?", true).then(res => {
if(!res)return
this.LOADING('正在删除…');
const newList = JSON.parse(JSON.stringify(this.imgList));
this.HTTP_POST('learun/adms/annexes/wxdelete', this.imgList[index].id, "文件删除失败").then((data) => {
this.HIDE_LOADING();
if (data) {
newList.splice(index, 1);
this.imgList = newList

this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change");
this.$emit("del");
}
})
})

},
showfile() {
return true;
},

async chooseChangeback(tempFilePaths, tempFiles) {
let uploadImageRes = await this.uploadImage(tempFilePaths[0], tempFiles[0] ? tempFiles[0].name : "")
let newList = this.imgList || []
if (uploadImageRes) {
//请求‘获取附件列表’接口
let data = await this.FETCH_FILEList(uploadImageRes);
if(data){
newList = data.map(t=>({
id: t.F_Id,
name: t.F_FileName,
url: t.F_FilePath.substring(t.F_FilePath.indexOf('Resource')),
type: t.F_FileType,
folderid:t.F_FolderId,
}))
}
}

this.imgList = newList

this.$emit("update:value", newList);
this.$emit("input", newList);
this.$emit("change", newList);
},

uploadImage(url, name) {
if (!url) return
// 文件上传
return new Promise(async (reslove, reject) => {
this.LOADING('正在上传…');
let params = name ? {
folderId: this.folderId,
name
} : {
folderId: this.folderId
}
this.HTTP_UPLOAD2('learun/adms/annexes/wxuploadinsingle', url, params).then((data) => {
this.HIDE_LOADING();
if (data) {
reslove(data)
} else {
reject('上传失败!')
}
})
})

},
validate(array) {
// let type = array.every(item=>{
// return item.type && item.type.substring(0,6) == "image/"
// })
// if(!type){
// this.TOAST('文件类型错误');
// return false
// }
let size = array.every(item => {
return item.size && item.size <= 200 * 1024 * 1024
})
if (!size) {
this.TOAST('文件大小不得超过200M');
return false
}
return true
},

isImage(type) {
if (type && type.length) {
return ["png", "jpg"].includes(type.substring(type.length - 3, type.length))
} else {
return false
}
},

viewImg(item) {
if (!this.isImage(item.type)) {
window.location.href = this.CONFIG("webHost") + item.url
} else {
uni.previewImage({
urls: [this.CONFIG('webHost') + item.url],
current: this.CONFIG('webHost') + item.url
});
}
},
},
created() {
// console.log(this.value)
this.imgList = JSON.parse(JSON.stringify(this.value.map(item => {
return {
id: item.F_Id,
name: item.F_FileName,
url: item.F_FilePath.substring(item.F_FilePath.indexOf('Resource')),
type: item.F_FileType,
folderid:item.F_FolderId,
}
})))
this.$nextTick(() => {
this.isShow = true
})
}
};
</script>

<style scoped>
.file-name {
position: absolute;
bottom: 0;
width: 100%;
color: #606266;
font-size: 12px;
text-align: center;
background-color: rgba(255, 255, 255, 0.6);

text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
</style>

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

@@ -1182,11 +1182,70 @@
"style": {
"navigationBarTitleText": "考试安排"
}
},
// 教师报修
{
"path": "pages/LogisticsManagement/RepairReportTeacher/list",
"style": {
"navigationBarTitleText": "教师报修"
}
},
// 教师报修详情
{
"path": "pages/LogisticsManagement/RepairReportTeacher/single",
"style": {
"navigationBarTitleText": "详情"
}
},
// 教师报修处理
{
"path": "pages/LogisticsManagement/RepairReportTeacher/handle/list",
"style": {
"navigationBarTitleText": "教师报修处理"
}
},
// 教师报修处理详情
{
"path": "pages/LogisticsManagement/RepairReportTeacher/handle/single",
"style": {
"navigationBarTitleText": "教师报修处理详情"
}
},
// 学生报修
{
"path": "pages/LogisticsManagement/RepairReportStudent/list",
"style": {
"navigationBarTitleText": "学生报修"
}
},
// 学生报修详情
{
"path": "pages/LogisticsManagement/RepairReportStudent/single",
"style": {
"navigationBarTitleText": "详情"
}
},
// 学生报修处理
{
"path": "pages/LogisticsManagement/RepairReportStudent/handle/list",
"style": {
"navigationBarTitleText": "学生报修处理"
}
},
// 学生报修处理详情
{
"path": "pages/LogisticsManagement/RepairReportStudent/handle/single",
"style": {
"navigationBarTitleText": "学生报修处理详情"
}
}

],


+ 333
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/handle/list.vue View File

@@ -0,0 +1,333 @@
<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,index) of list" :key="item.ID">
<view class="customlist-item-field">
<text class="customlist-item-field-title">订单编号:</text>
{{ displayListItem(item, 'OrderNumber') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">提交日期:</text>
{{ displayListItem(item, 'CreateTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">报修人姓名:</text>
{{ displayListItem(item, 'CreatorName') }}
</view>
<!-- <view class="customlist-item-field">
<text class="customlist-item-field-title">所在部门:</text>
{{ displayListItem(item, 'DeptName') }}
</view> -->
<view class="customlist-item-field statusbox">
<text class="customlist-item-field-title">状态:</text>
<view class="statuscontent" :class="[item.Status === 0
? 'infos'
: item.Status === 1
? 'reds'
: item.Status === 2
? 'oranges'
: 'greens'
]">
{{ displayListItem(item, 'Status') }}
</view>
</view>
<view class="customlist-banner-action">
<view v-if="item.Status != '0'" @click="action('view', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="search" />
查看
</view>
<view v-if="item.Status == '1'" @click="action('edit', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="edit" />
维修处理
</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.keyword" @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-16 15:39
* 描 述:工作日志
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Journal/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: {
OrderNumber: { type: 'text' },
CreateTime: { type: 'text'},
CreatorName: { type: 'text'},
DeptNo: { type: 'text' },
DeptName: { type: 'text' },
ServiceType: { type: 'text' },
Status:{ type: 'select' }
},
// 查询条件
searchData: {
Status:'1,2,3'
},
defaultQueryData: {},
queryData: {
},
// 时间查询参数
dateRange: null,
// 数据源
dataSource: {
Status: [{text:'草稿',value:'0'},{text:'待维修',value:'1'},{text:'已处理',value:'2'},{text:'结束报修',value:'3'}],
CheckStatus:[{text:'草稿',value:'0'},{text:'审核中',value:'1'},{text:'审核通过',value:'2'}]
},
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('LogisticsManagementRepairReportStudenthandle-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('LogisticsManagementRepairReportStudenthandle-list-change', this.reset)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList(isConcat = true) {
if (this.page > this.total) { return }
const result = await this.HTTP_GET(
'learun/adms/repairreportStudent/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'CreateTime', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = isConcat ? this.list.concat(result.rows) : result.rows;
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList(isConcat = true) {
this.page = 1
this.total = 2
this.list = []
await this.fetchList(isConcat)
},
// 列表下拉
pullDown() {
this.refreshList().then(() => {
this.$refs.list.stopPullDown()
})
},
// 设置搜索条件
async searchChange() {
const result = {
Status:'1,2,3'
}
// 时间查询相关参数
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(false)
},
// 点击「清空查询条件」按钮
reset() {
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '') {
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}`)
return
case 'edit':
this.NAV_TO(`./single?type=edit&id=${id}`)
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
// console.log(fieldItem)
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')
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;
}
}
.statusbox {
.statuscontent {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 14rpx;
}
.infos {
background: #777777;
color: #fff;
}
.reds {
background: #D9534F;
color: #fff;
}
.oranges {
background: #F0AD4E;
color: #fff;
}
.greens {
background: #5CB85C;
color: #fff;
}
}
</style>

+ 399
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/handle/single.vue View File

@@ -0,0 +1,399 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('RepairReportStudenthandle.CreatorName', $event)"
:value="getValue('RepairReportStudenthandle.CreatorName')"
:disabled="!add"
title="报修人姓名"
/>
<l-input
@input="setValue('RepairReportStudenthandle.StuNo', $event)"
:value="getValue('RepairReportStudenthandle.StuNo')"
disabled
title="学号"
/>
<l-select
@input="setValue('RepairReportStudenthandle.DeptNo', $event)"
:value="getValue('RepairReportStudenthandle.DeptNo')"
disabled
:range="dataSource.RepairReportStudenthandle.DeptNo"
@change="deptChange($event)"
title="系部"
/>
<l-select
@input="setValue('RepairReportStudenthandle.MajorNo', $event)"
:value="getValue('RepairReportStudenthandle.MajorNo')"
disabled
:range="dataSource.RepairReportStudenthandle.MajorNo"
@change="deptChange($event)"
title="专业"
/>
<l-select
@input="setValue('RepairReportStudenthandle.TeachClassNo', $event)"
:value="getValue('RepairReportStudenthandle.TeachClassNo')"
disabled
:range="dataSource.RepairReportStudenthandle.TeachClassNo"
@change="deptChange($event)"
title="班级"
/>
<l-input
@input="setValue('RepairReportStudenthandle.Contact', $event)"
:value="getValue('RepairReportStudenthandle.Contact')"
:disabled="!add"
title="联系电话"
/>
<l-input
@input="setValue('RepairReportStudenthandle.Address', $event)"
:value="getValue('RepairReportStudenthandle.Address')"
:disabled="!add"
title="报修地址"
/>
<l-select
@input="setValue('RepairReportStudenthandle.ServiceType', $event)"
:value="getValue('RepairReportStudenthandle.ServiceType')"
:disabled="!add"
:range="dataSource.RepairReportStudenthandle.ServiceType"
title="报修类型"
required
/>
<l-textarea
@input="setValue('RepairReportStudenthandle.Remark', $event)"
:value="getValue('RepairReportStudenthandle.Remark')"
:readonly="!add"
title="故障描述"
/>
<!-- <l-upload-file
@input="setValue('RepairReportTeacher.FilePath', $event)"
:value="getValue('RepairReportTeacher.FilePath')"
tableName="RepairReportTeacher"
fieldName="FilePath"
title="故障图片"
:number="9"
:readonly="!edit"
/> -->
<l-input
@input="setValue('RepairReportStudenthandle.FilePath', $event)"
:value="getValue('RepairReportStudenthandle.FilePath')"
:disabled="!add"
:readonly="!add"
v-show="false"
title="故障图片"
/>
<uploadFile :number="5" :folderId="folderId" :value="fileList" :readonly="!add" :title="fileTitle" :required="false"></uploadFile>
<!-- <l-upload-file
@input="setValue('StuInfoBasic.Photo', $event)"
:value="getValue('StuInfoBasic.Photo')"
:readonly="!edit"
:number="3"
title="照片"
/> -->
<l-textarea
@input="setValue('RepairReportStudenthandle.LeaveMsg', $event)"
:value="getValue('RepairReportStudenthandle.LeaveMsg')"
:readonly="!add"
title="给维修人留言"
/>
</view>
<view class="maintenancetitle">
维修处理信息
</view>
<view class="">
<l-date-picker
@input="setValue('RepairReportStudenthandle.RepairTime', $event)"
:value="getValue('RepairReportStudenthandle.RepairTime')"
:disabled="!edit"
title="处理日期"
/>
<l-textarea
@input="setValue('RepairReportStudenthandle.Reason', $event)"
:value="getValue('RepairReportStudenthandle.Reason')"
:readonly="!edit"
title="故障原因"
/>
<l-textarea
@input="setValue('RepairReportStudenthandle.Material', $event)"
:value="getValue('RepairReportStudenthandle.Material')"
:readonly="!edit"
title="耗材信息"
/>
<l-input
@input="setValue('RepairReportStudenthandle.RepairImg', $event)"
:value="getValue('RepairReportStudenthandle.RepairImg')"
disabled="disabled"
v-show="false"
title="维修图片"
/>
<uploadFile :number="5" :folderId="folderId2" :value="fileList2" :readonly="!edit" :title="fileTitle2" :required="false"></uploadFile>
</view>
<view class="maintenancetitle" v-if="mode=='evaluate' || mode=='view'">
评价
</view>
<view class="" v-if="mode=='evaluate' || mode=='view'">
<l-textarea
@input="setValue('RepairReportStudenthandle.Evaluate', $event)"
:value="getValue('RepairReportStudenthandle.Evaluate')"
:readonly="mode=='view'"
title="评价"
/>
</view>
<view v-if="ready && current.RepairReportStudenthandle && current.RepairReportStudenthandle.status != '1'" 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-20 09:25
* 描 述:活动安排
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/PersonnelManagement/BookBorrow/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'
import uploadFile from '@/components/upload-file2.vue'
export default {
mixins: [customPageMixins],
components:{
uploadFile,
},
data() {
return {
// 页面相关参数
id: null,
mode: null,
add: null,
edit: null,
ready: false,
// 表单数据
current: {},
origin: {},
fileList:[],//附件列表
folderId:null,//附件随机文件夹id
fileTitle:'故障图片',//附件label值
fileList2:[],//附件列表
folderId2:null,//附件随机文件夹id
fileTitle2:'维修图片',//附件label值
// 表单项数据结构
scheme: {
RepairReportStudenthandle: {
Creator: {},
CreatorName: { type:'text', title: '报修人姓名' },
StuNo: { type:'text', title: '学号' },
DeptNo: { type:'select', title: '系部' },
DeptName: {},
MajorNo: { type:'select', title: '专业' },
TeachClassNo: { type:'select', title: '班级' },
Contact: { type:'text', title: '联系电话' },
Address: { type:'text', title: '报修地址' },
ServiceType: { type: 'select', title: '报修类型', itemCode: 'repairtype', dataSource: '0' },
Remark: { type:'text', title: '故障描述' },
// FilePath: { type: 'upload', title: '故障图片' },
LeaveMsg: { type:'text', title: '给维修人留言' },
FilePath: { type: "text", title: "故障图片" },
RepairTime:{ type: 'datetime', title: '处理日期', dateformat: '0' },
Reason: { type:'text', title: '故障原因' },
Material: { type:'text', title: '耗材信息' },
RepairImg: { type: "text", title: "维修图片" },

},
},
// 数据源
dataSource: {
RepairReportStudenthandle: {
ServiceType: Object.values(this.GET_GLOBAL('dataDictionary').repairtype).map(t => ({ value: t.value, text: t.text })), //报修类型
DeptNo: [],
MajorNo: [],
TeachClassNo: [],
},
}
}
},
async onLoad({ type, id }) {
// console.log(this.GET_GLOBAL('dataDictionary').repairtype,77)
await this.init(type, id)
},
methods: {
// 页面初始化
async init(type, id) {
this.LOADING('加载数据中...')
this.folderId=this.GUID();
this.folderId2=this.GUID();
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
this.dataSource.RepairReportStudenthandle.DeptNo = result.data.sort((a,b)=>{return a.deptsort-b.deptsort}).map(t => ({ text: t.deptname, value: t.deptno }))
}),
this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
this.dataSource.RepairReportStudenthandle.MajorNo = result.data.sort((a,b)=>{return a.majorno-b.majorno}).map(t => ({ text: t.majorname, value: t.majorno }))
}),
this.FETCH_DATASOURCE('bjsj').then(result => {
this.dataSource.RepairReportStudenthandle.TeachClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
}),
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
let userInfo = this.GET_GLOBAL('loginUser');
let deptName = this.dataSource.RepairReportStudent.DeptNo.find(item => item.value == userInfo.departmentId).text;
// console.log(this.origin,11)
// console.log(userInfo,22)
this.origin.RepairReportStudent.CreatorName = userInfo.realName;
this.origin.RepairReportStudent.DeptNo = userInfo.departmentId;
this.origin.RepairReportStudent.DeptName = deptName
this.origin.RepairReportStudent.StuNo = userInfo.account;
this.origin.RepairReportStudent.Contact = userInfo.mobile;
this.origin.RepairReportStudent.Creator = userInfo.userId;
const result = await this.HTTP_GET('Learun/adms/EducationalAdministration/StuInfoBasic/stuinfo', userInfo.account)
this.origin.RepairReportStudent.MajorNo = result.MajorNo;
this.origin.RepairReportStudent.TeachClassNo = result.ClassNo;
// console.log(this.origin,55)
} else {
const result = await this.HTTP_GET('learun/adms/repairreportStudent/form', this.id)
// this.origin = await this.formatFormData(result)
this.origin = await this.formatFormData({RepairReportStudenthandle:{...result.RepairReport_Student,Status:'2'}})
}
this.current = this.COPY(this.origin)
// console.log(RepairReportTeacher.FilePath,98)
if (this.getValue('RepairReportStudenthandle.FilePath') == ""||this.getValue('RepairReportStudenthandle.FilePath') == undefined ||this.getValue('RepairReportStudenthandle.FilePath') == null) {
this.setValue('RepairReportStudenthandle.FilePath',this.folderId);
// console.log('附件值赋值后:'+this.getValue('RepairReportStudenthandle.FilePath'));
}else{
this.folderId=this.getValue('RepairReportStudenthandle.FilePath');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList = await this.FETCH_FILEList(this.getValue('RepairReportStudenthandle.FilePath'));
// console.log(this.fileList,888)
}
if (this.getValue('RepairReportStudenthandle.RepairImg') == ""||this.getValue('RepairReportStudenthandle.RepairImg') == undefined ||this.getValue('RepairReportStudenthandle.RepairImg') == null) {
this.setValue('RepairReportStudenthandle.RepairImg',this.folderId2);
// console.log('附件值赋值后:'+this.getValue('RepairReportStudenthandle.RepairImg'));
}else{
this.folderId2=this.getValue('RepairReportStudenthandle.RepairImg');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList2 = await this.FETCH_FILEList(this.getValue('RepairReportStudenthandle.RepairImg'));
// console.log(this.fileList2,888)
}
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
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)
let strEntity = JSON.parse(postData.strEntity)
strEntity.ID = this.origin.RepairReportStudenthandle.ID
strEntity.OrderNumber = this.origin.RepairReportStudenthandle.OrderNumber
strEntity.CreateTime = this.origin.RepairReportStudenthandle.CreateTime
strEntity.Status = this.origin.RepairReportStudenthandle.Status
postData.strEntity = JSON.stringify(strEntity)
this.HTTP_POST('learun/adms/repairreportStudent/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('LogisticsManagementRepairReportStudenthandle-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)
},
}
}
</script>
<style lang="less" scoped>
.maintenancetitle {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background: #0C86D8;
color: #fff;
}
</style>

+ 406
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/list.vue View File

@@ -0,0 +1,406 @@
<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,index) of list" :key="item.ID">
<view class="customlist-item-field">
<text class="customlist-item-field-title">订单编号:</text>
{{ displayListItem(item, 'OrderNumber') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">提交日期:</text>
{{ displayListItem(item, 'CreateTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">报修人姓名:</text>
{{ displayListItem(item, 'CreatorName') }}
</view>
<!-- <view class="customlist-item-field">
<text class="customlist-item-field-title">所在部门:</text>
{{ displayListItem(item, 'DeptName') }}
</view> -->
<view class="customlist-item-field statusbox">
<text class="customlist-item-field-title">状态:</text>
<view class="statuscontent" :class="[item.Status === 0
? 'infos'
: item.Status === 1
? 'reds'
: item.Status === 2
? 'oranges'
: 'greens'
]">
{{ displayListItem(item, 'Status') }}
</view>
</view>
<view class="customlist-banner-action">
<view
v-if="item.Status == '0'"
@click="action('submit', item.ID)"
class="customlist-banner-action-btn line-red text-sm"
style="border: currentColor 1px solid">
<l-icon type="top" />
提交
</view>
<view
v-if="item.Status == '0'"
@click="action('delete', item.ID)"
class="customlist-banner-action-btn line-red text-sm"
style="border: currentColor 1px solid">
<l-icon type="delete" />
删除
</view>
<view
v-if="item.Status == '0'"
@click="action('edit', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="edit" />
编辑
</view>
<view v-if="item.Status != '0'" @click="action('view', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="search" />
查看
</view>
<view v-if="item.Status == '2'" @click="action('evaluate', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="edit" />
评价
</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.keyword" @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-16 15:39
* 描 述:工作日志
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Journal/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: {
OrderNumber: { type: 'text' },
CreateTime: { type: 'text'},
CreatorName: { type: 'text'},
DeptNo: { type: 'text' },
DeptName: { type: 'text' },
ServiceType: { type: 'text' },
Status:{ type: 'select' }
},
// 查询条件
searchData: {},
defaultQueryData: {},
queryData: {
},
// 时间查询参数
dateRange: null,
// 数据源
dataSource: {
Status: [{text:'草稿',value:'0'},{text:'待维修',value:'1'},{text:'已处理',value:'2'},{text:'结束报修',value:'3'}],
CheckStatus:[{text:'草稿',value:'0'},{text:'审核中',value:'1'},{text:'审核通过',value:'2'}]
},
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('LogisticsManagementRepairReportStudent-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('LogisticsManagementRepairReportStudent-list-change', this.reset)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList(isConcat = true) {
if (this.page > this.total) { return }
const result = await this.HTTP_GET(
'learun/adms/repairreportStudent/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'CreateTime', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = isConcat ? this.list.concat(result.rows) : result.rows;
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList(isConcat = true) {
this.page = 1
this.total = 2
this.list = []
await this.fetchList(isConcat)
},
// 列表下拉
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(false)
},
// 点击「清空查询条件」按钮
reset() {
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '') {
let userInfo = this.GET_GLOBAL('loginUser');
const result = await this.HTTP_GET('Learun/adms/EducationalAdministration/StuInfoBasic/stuinfo', userInfo.account)
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}`)
return
case 'add':
if (!result) {
this.TOAST('学生不存在', 'error')
return
}
this.NAV_TO('./single?type=create')
return
case 'edit':
if (!result) {
this.TOAST('学生不存在', 'error')
return
}
this.NAV_TO(`./single?type=edit&id=${id}`)
return
case 'submit':
if (!(await this.CONFIRM('提交项目', '是否确认提交该项?', true))) {
return
}
this.HTTP_POST('learun/adms/repairreportStudent/submit', id , '提交失败').then(
success => {
if (!success) {
return
}
this.TOAST('提交成功', 'success')
this.refreshList()
})
return
case 'delete':
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
return
}
this.HTTP_POST('learun/adms/repairreportStudent/delete', id, '删除失败').then(
success => {
if (!success) {
return
}
this.TOAST('删除成功', 'success')
this.refreshList()
})
return
case 'evaluate':
this.NAV_TO(`./single?type=evaluate&id=${id}`)
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
// console.log(fieldItem)
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')
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;
}
}
.statusbox {
.statuscontent {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 14rpx;
}
.infos {
background: #777777;
color: #fff;
}
.reds {
background: #D9534F;
color: #fff;
}
.oranges {
background: #F0AD4E;
color: #fff;
}
.greens {
background: #5CB85C;
color: #fff;
}
}

</style>

+ 429
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportStudent/single.vue View File

@@ -0,0 +1,429 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('RepairReportStudent.CreatorName', $event)"
:value="getValue('RepairReportStudent.CreatorName')"
disabled
title="报修人姓名"
/>
<l-input
@input="setValue('RepairReportStudent.StuNo', $event)"
:value="getValue('RepairReportStudent.StuNo')"
disabled
title="学号"
/>
<l-select
@input="setValue('RepairReportStudent.DeptNo', $event)"
:value="getValue('RepairReportStudent.DeptNo')"
disabled
:range="dataSource.RepairReportStudent.DeptNo"
@change="deptChange($event)"
title="系部"
/>
<l-select
@input="setValue('RepairReportStudent.MajorNo', $event)"
:value="getValue('RepairReportStudent.MajorNo')"
disabled
:range="dataSource.RepairReportStudent.MajorNo"
@change="deptChange($event)"
title="专业"
/>
<l-select
@input="setValue('RepairReportStudent.TeachClassNo', $event)"
:value="getValue('RepairReportStudent.TeachClassNo')"
disabled
:range="dataSource.RepairReportStudent.TeachClassNo"
@change="deptChange($event)"
title="班级"
/>
<l-input
@input="setValue('RepairReportStudent.Contact', $event)"
:value="getValue('RepairReportStudent.Contact')"
disabled
title="联系电话"
/>
<l-input
@input="setValue('RepairReportStudent.Address', $event)"
:value="getValue('RepairReportStudent.Address')"
:disabled="!edit"
title="报修地址"
/>
<l-select
@input="setValue('RepairReportStudent.ServiceType', $event)"
:value="getValue('RepairReportStudent.ServiceType')"
:disabled="!edit"
:range="dataSource.RepairReportStudent.ServiceType"
title="报修类型"
required
/>
<l-textarea
@input="setValue('RepairReportStudent.Remark', $event)"
:value="getValue('RepairReportStudent.Remark')"
:readonly="!edit"
title="故障描述"
/>
<!-- <l-upload-file
@input="setValue('RepairReportStudent.FilePath', $event)"
:value="getValue('RepairReportStudent.FilePath')"
tableName="RepairReportStudent"
fieldName="FilePath"
title="故障图片"
:number="9"
:readonly="!edit"
/> -->
<l-input
@input="setValue('RepairReportStudent.FilePath', $event)"
:value="getValue('RepairReportStudent.FilePath')"
disabled="disabled"
v-show="false"
title="故障图片"
/>
<uploadFile :number="5" :folderId="folderId" :value="fileList" :readonly="!edit" :title="fileTitle" :required="false"></uploadFile>
<!-- <l-upload-file
@input="setValue('StuInfoBasic.Photo', $event)"
:value="getValue('StuInfoBasic.Photo')"
:readonly="!edit"
:number="3"
title="照片"
/> -->
<l-textarea
@input="setValue('RepairReportStudent.LeaveMsg', $event)"
:value="getValue('RepairReportStudent.LeaveMsg')"
:readonly="!edit"
title="给维修人留言"
/>
</view>
<view class="maintenancetitle" v-if="!edit">
维修处理信息
</view>
<view v-if="!edit">
<l-date-picker
@input="setValue('RepairReportStudent.RepairTime', $event)"
:value="getValue('RepairReportStudent.RepairTime')"
disabled
title="处理日期"
/>
<l-textarea
@input="setValue('RepairReportStudent.Reason', $event)"
:value="getValue('RepairReportStudent.Reason')"
readonly
title="故障原因"
/>
<l-textarea
@input="setValue('RepairReportStudent.Material', $event)"
:value="getValue('RepairReportStudent.Material')"
readonly
title="耗材信息"
/>
<l-input
@input="setValue('RepairReportStudent.RepairImg', $event)"
:value="getValue('RepairReportStudent.RepairImg')"
disabled
v-show="false"
title="维修图片"
/>
<uploadFile :number="5" :folderId="folderId2" :value="fileList2" readonly :title="fileTitle2" :required="false"></uploadFile>
</view>
<view class="maintenancetitle" v-if="mode=='evaluate' || mode=='view'">
评价
</view>
<view class="" v-if="mode=='evaluate' || mode=='view'">
<l-textarea
@input="setValue('RepairReportStudent.Evaluate', $event)"
:value="getValue('RepairReportStudent.Evaluate')"
:readonly="mode=='view'"
title="评价"
/>
</view>
<view v-if="ready && current.RepairReportStudent && current.RepairReportStudent.status != '1'" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button v-if="edit || mode=='evaluate'" @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-20 09:25
* 描 述:活动安排
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/PersonnelManagement/BookBorrow/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'
import uploadFile from '@/components/upload-file2.vue'
export default {
mixins: [customPageMixins],
components:{
uploadFile,
},
data() {
return {
// 页面相关参数
id: null,
mode: null,
edit: null,
evaluate: null,
ready: false,
// 表单数据
current: {},
origin: {},
fileList:[],//附件列表
folderId:null,//附件随机文件夹id
fileTitle:'故障图片',//附件label值
fileList2:[],//附件列表
folderId2:null,//附件随机文件夹id
fileTitle2:'维修图片',//附件label值
// 表单项数据结构
scheme: {
RepairReportStudent: {
Creator: {},
CreatorName: { type:'text', title: '报修人姓名' },
StuNo: { type:'text', title: '学号' },
DeptNo: { type:'select', title: '系部' },
DeptName: {},
MajorNo: { type:'select', title: '专业' },
TeachClassNo: { type:'select', title: '班级' },
Contact: { type:'text', title: '联系电话' },
Address: { type:'text', title: '报修地址' },
ServiceType: { type: 'select', title: '报修类型', itemCode: 'repairtype', dataSource: '0' },
Remark: { type:'text', title: '故障描述' },
// FilePath: { type: 'upload', title: '故障图片' },
LeaveMsg: { type:'text', title: '给维修人留言' },
FilePath: { type: "text", title: "附件上传" },
RepairTime:{ type: 'datetime', title: '处理日期', dateformat: '0' },
Reason: { type:'text', title: '故障原因' },
Material: { type:'text', title: '耗材信息' },
RepairImg: { type: "text", title: "维修图片" },
Evaluate: { type:'text', title: '评价' },
},
},
// 数据源
dataSource: {
RepairReportStudent: {
ServiceType: Object.values(this.GET_GLOBAL('dataDictionary').repairtype).map(t => ({ value: t.value, text: t.text })), //报修类型
DeptNo: [],
MajorNo: [],
TeachClassNo: [],
},
}
}
},
async onLoad({ type, id }) {
// console.log(this.GET_GLOBAL('dataDictionary').repairtype,77)
await this.init(type, id)
},
methods: {
// 页面初始化
async init(type, id) {
this.LOADING('加载数据中...')
this.folderId=this.GUID();
this.folderId2=this.GUID();
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
// this.FETCH_DATASOURCE('classdata').then(result => {
// console.log(result,66)
// this.dataSource.RepairReportStudent.DeptNo = result.data.map(t => ({ text: t.name, value: t.id }))
// }),
this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
this.dataSource.RepairReportStudent.DeptNo = result.data.sort((a,b)=>{return a.deptsort-b.deptsort}).map(t => ({ text: t.deptname, value: t.deptno }))
}),
this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
this.dataSource.RepairReportStudent.MajorNo = result.data.sort((a,b)=>{return a.majorno-b.majorno}).map(t => ({ text: t.majorname, value: t.majorno }))
}),
this.FETCH_DATASOURCE('bjsj').then(result => {
this.dataSource.RepairReportStudent.TeachClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
}),
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
let userInfo = this.GET_GLOBAL('loginUser');
const result = await this.HTTP_GET('Learun/adms/EducationalAdministration/StuInfoBasic/stuinfo', userInfo.account)
let deptName = this.dataSource.RepairReportStudent.DeptNo.find(item => item.value == result.DeptNo).text;
this.origin.RepairReportStudent.CreatorName = userInfo.realName;
this.origin.RepairReportStudent.StuNo = userInfo.account;
this.origin.RepairReportStudent.DeptNo = result.DeptNo;
this.origin.RepairReportStudent.DeptName = deptName
this.origin.RepairReportStudent.Contact = userInfo.mobile;
this.origin.RepairReportStudent.Creator = userInfo.userId;
this.origin.RepairReportStudent.MajorNo = result.MajorNo;
this.origin.RepairReportStudent.TeachClassNo = result.ClassNo;

} else if(this.mode === 'evaluate') {
const result = await this.HTTP_GET('learun/adms/repairreportStudent/form', this.id)
// this.origin = await this.formatFormData(result)
this.origin = await this.formatFormData({RepairReportStudent:{...result.RepairReport_Student,Status:'3'}})
} else {
const result = await this.HTTP_GET('learun/adms/repairreportStudent/form', this.id)
// this.origin = await this.formatFormData(result)
this.origin = await this.formatFormData({RepairReportStudent:{...result.RepairReport_Student}})
}
this.current = this.COPY(this.origin)
// console.log(RepairReportStudent.FilePath,98)
if (this.getValue('RepairReportStudent.FilePath') == ""||this.getValue('RepairReportStudent.FilePath') == undefined ||this.getValue('RepairReportStudent.FilePath') == null) {
this.setValue('RepairReportStudent.FilePath',this.folderId);
// console.log('附件值赋值后:'+this.getValue('RepairReportStudent.FilePath'));
}else{
this.folderId=this.getValue('RepairReportStudent.FilePath');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList = await this.FETCH_FILEList(this.getValue('RepairReportStudent.FilePath'));
}
if (this.getValue('RepairReportStudent.RepairImg') == ""||this.getValue('RepairReportStudent.RepairImg') == undefined ||this.getValue('RepairReportStudent.RepairImg') == null) {
this.setValue('RepairReportStudent.RepairImg',this.folderId2);
// console.log('附件值赋值后:'+this.getValue('RepairReportStudenthandle.RepairImg'));
}else{
this.folderId2=this.getValue('RepairReportStudent.RepairImg');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList2 = await this.FETCH_FILEList(this.getValue('RepairReportStudent.RepairImg'));
}
},

// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'save':
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!this.getValue('RepairReportStudent.ServiceType')) {
this.CONFIRM('报修类型不能为空')
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
let strEntity = JSON.parse(postData.strEntity)
if(this.mode == 'create') {
delete strEntity.RepairTime
delete strEntity.Reason
delete strEntity.Material
delete strEntity.RepairImg
delete strEntity.Evaluate
postData.strEntity = JSON.stringify(strEntity)
}else if(this.mode == 'edit') {
// strEntity.ID = this.origin.RepairReportStudent.ID
strEntity.OrderNumber = this.origin.RepairReportStudent.OrderNumber
strEntity.CreateTime = this.origin.RepairReportStudent.CreateTime
delete strEntity.RepairTime
delete strEntity.Reason
delete strEntity.Material
delete strEntity.RepairImg
delete strEntity.Evaluate
postData.strEntity = JSON.stringify(strEntity)
}else if(this.mode === 'evaluate') {
strEntity.ID = this.origin.RepairReportStudent.ID
strEntity.OrderNumber = this.origin.RepairReportStudent.OrderNumber
strEntity.CreateTime = this.origin.RepairReportStudent.CreateTime
strEntity.Status = this.origin.RepairReportStudent.Status
postData.strEntity = JSON.stringify(strEntity)
}
this.HTTP_POST('learun/adms/repairreportStudent/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('LogisticsManagementRepairReportStudent-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)
},
}
}
</script>
<style lang="less" scoped>
.maintenancetitle {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background: #0C86D8;
color: #fff;
}
</style>

+ 333
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/handle/list.vue View File

@@ -0,0 +1,333 @@
<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,index) of list" :key="item.ID">
<view class="customlist-item-field">
<text class="customlist-item-field-title">订单编号:</text>
{{ displayListItem(item, 'OrderNumber') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">提交日期:</text>
{{ displayListItem(item, 'CreateTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">报修人姓名:</text>
{{ displayListItem(item, 'CreatorName') }}
</view>
<!-- <view class="customlist-item-field">
<text class="customlist-item-field-title">所在部门:</text>
{{ displayListItem(item, 'DeptName') }}
</view> -->
<view class="customlist-item-field statusbox">
<text class="customlist-item-field-title">状态:</text>
<view class="statuscontent" :class="[item.Status === 0
? 'infos'
: item.Status === 1
? 'reds'
: item.Status === 2
? 'oranges'
: 'greens'
]">
{{ displayListItem(item, 'Status') }}
</view>
</view>
<view class="customlist-banner-action">
<view v-if="item.Status != '0'" @click="action('view', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="search" />
查看
</view>
<view v-if="item.Status == '1'" @click="action('edit', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="edit" />
维修处理
</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.keyword" @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-16 15:39
* 描 述:工作日志
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Journal/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: {
OrderNumber: { type: 'text' },
CreateTime: { type: 'text'},
CreatorName: { type: 'text'},
DeptNo: { type: 'text' },
DeptName: { type: 'text' },
ServiceType: { type: 'text' },
Status:{ type: 'select' }
},
// 查询条件
searchData: {
Status:'1'
},
defaultQueryData: {},
queryData: {
},
// 时间查询参数
dateRange: null,
// 数据源
dataSource: {
Status: [{text:'草稿',value:'0'},{text:'待维修',value:'1'},{text:'已处理',value:'2'},{text:'结束报修',value:'3'}],
CheckStatus:[{text:'草稿',value:'0'},{text:'审核中',value:'1'},{text:'审核通过',value:'2'}]
},
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('LogisticsManagementRepairReportTeacherhandle-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('LogisticsManagementRepairReportTeacherhandle-list-change', this.reset)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList(isConcat = true) {
if (this.page > this.total) { return }
const result = await this.HTTP_GET(
'learun/adms/repairreportTeacher/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'CreateTime', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = isConcat ? this.list.concat(result.rows) : result.rows;
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList(isConcat = true) {
this.page = 1
this.total = 2
this.list = []
await this.fetchList(isConcat)
},
// 列表下拉
pullDown() {
this.refreshList().then(() => {
this.$refs.list.stopPullDown()
})
},
// 设置搜索条件
async searchChange() {
const result = {
Status:'1'
}
// 时间查询相关参数
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(false)
},
// 点击「清空查询条件」按钮
reset() {
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '') {
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}`)
return
case 'edit':
this.NAV_TO(`./single?type=edit&id=${id}`)
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
// console.log(fieldItem)
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')
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;
}
}
.statusbox {
.statuscontent {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 14rpx;
}
.infos {
background: #777777;
color: #fff;
}
.reds {
background: #D9534F;
color: #fff;
}
.oranges {
background: #F0AD4E;
color: #fff;
}
.greens {
background: #5CB85C;
color: #fff;
}
}
</style>

+ 402
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/handle/single.vue View File

@@ -0,0 +1,402 @@
<template>
<view class="page">
<view v-if="ready">

<l-input @input="setValue('RepairReportTeacherhandle.CreatorName', $event)"
:value="getValue('RepairReportTeacherhandle.CreatorName')" :disabled="!add" title="报修人姓名" />
<l-input @input="setValue('RepairReportTeacherhandle.TeachNo', $event)"
:value="getValue('RepairReportTeacherhandle.TeachNo')" :disabled="!add" title="教职工编号" />
<l-select @input="setValue('RepairReportTeacherhandle.DeptNo', $event)"
:value="getValue('RepairReportTeacherhandle.DeptNo')" :disabled="!add"
:range="dataSource.RepairReportTeacherhandle.DeptNo" @change="deptChange($event)" title="所在部门" />
<l-input @input="setValue('RepairReportTeacherhandle.Contact', $event)"
:value="getValue('RepairReportTeacherhandle.Contact')" :disabled="!add" title="联系电话" />
<l-input @input="setValue('RepairReportTeacherhandle.Address', $event)"
:value="getValue('RepairReportTeacherhandle.Address')" :disabled="!add" title="报修地址" />
<l-select @input="setValue('RepairReportTeacherhandle.ServiceType', $event)"
:value="getValue('RepairReportTeacherhandle.ServiceType')" :disabled="!add"
:range="dataSource.RepairReportTeacherhandle.ServiceType" title="报修类型" required />
<l-textarea @input="setValue('RepairReportTeacherhandle.Remark', $event)"
:value="getValue('RepairReportTeacherhandle.Remark')" :readonly="!add" title="故障描述" />


<!-- <l-upload-file
@input="setValue('RepairReportTeacher.FilePath', $event)"
:value="getValue('RepairReportTeacher.FilePath')"
tableName="RepairReportTeacher"
fieldName="FilePath"
title="故障图片"
:number="9"
:readonly="!edit"
/> -->
<l-input @input="setValue('RepairReportTeacherhandle.FilePath', $event)"
:value="getValue('RepairReportTeacherhandle.FilePath')" :disabled="!add" :readonly="!add" v-show="false"
title="故障图片" />
<uploadFile :number="5" :folderId="folderId" :value="fileList" :readonly="!add" :title="fileTitle"
:required="false"></uploadFile>
<!-- <l-upload-file
@input="setValue('StuInfoBasic.Photo', $event)"
:value="getValue('StuInfoBasic.Photo')"
:readonly="!edit"
:number="3"
title="照片"
/> -->
<l-textarea @input="setValue('RepairReportTeacherhandle.LeaveMsg', $event)"
:value="getValue('RepairReportTeacherhandle.LeaveMsg')" :readonly="!add" title="给维修人留言" />


</view>
<view class="maintenancetitle">
维修处理信息
</view>
<view class="">
<l-date-picker @input="setValue('RepairReportTeacherhandle.RepairTime', $event)"
:value="getValue('RepairReportTeacherhandle.RepairTime')" :disabled="!edit" title="处理日期" />
<l-textarea @input="setValue('RepairReportTeacherhandle.Reason', $event)"
:value="getValue('RepairReportTeacherhandle.Reason')" :readonly="!edit" title="故障原因" />
<l-textarea @input="setValue('RepairReportTeacherhandle.Material', $event)"
:value="getValue('RepairReportTeacherhandle.Material')" :readonly="!edit" title="耗材信息" />
<l-input @input="setValue('RepairReportTeacherhandle.RepairImg', $event)"
:value="getValue('RepairReportTeacherhandle.RepairImg')" disabled="disabled" v-show="false"
title="维修图片" />
<uploadFile :number="5" :folderId="folderId2" :value="fileList2" :readonly="!edit" :title="fileTitle2"
:required="false"></uploadFile>
</view>
<view class="maintenancetitle" v-if="mode=='evaluate' || mode=='view'">
评价
</view>
<view class="" v-if="mode=='evaluate' || mode=='view'">

<l-textarea @input="setValue('RepairReportTeacher.Evaluate', $event)"
:value="getValue('RepairReportTeacher.Evaluate')" :readonly="mode=='view'" title="评价" />

</view>
<view v-if="ready && current.RepairReportTeacherhandle && current.RepairReportTeacherhandle.status != '1'"
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-20 09:25
* 描 述:活动安排
*/

/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/PersonnelManagement/BookBorrow/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'
import uploadFile from '@/components/upload-file2.vue'

export default {
mixins: [customPageMixins],
components: {
uploadFile,
},
data() {
return {
// 页面相关参数
id: null,
mode: null,
add: null,
edit: null,
ready: false,

// 表单数据
current: {},
origin: {},
fileList: [], //附件列表
folderId: null, //附件随机文件夹id
fileTitle: '故障图片', //附件label值
fileList2: [], //附件列表
folderId2: null, //附件随机文件夹id
fileTitle2: '维修图片', //附件label值
// 表单项数据结构
scheme: {
RepairReportTeacherhandle: {
Creator: {},

CreatorName: {
type: 'text',
title: '报修人姓名'
},
TeachNo: {
type: 'text',
title: '教职工编号'
},

DeptNo: {
type: 'select',
title: '所在部门'
},
DeptName: {},
Contact: {
type: 'text',
title: '联系电话'
},

Address: {
type: 'text',
title: '报修地址'
},
ServiceType: {
type: 'select',
title: '报修类型',
itemCode: 'repairtype',
dataSource: '0'
},
Remark: {
type: 'text',
title: '故障描述'
},
// FilePath: { type: 'upload', title: '故障图片' },
LeaveMsg: {
type: 'text',
title: '给维修人留言'
},
FilePath: {
type: "text",
title: "故障图片"
},

RepairTime: {
type: 'datetime',
title: '处理日期',
dateformat: '0'
},
Reason: {
type: 'text',
title: '故障原因'
},
Material: {
type: 'text',
title: '耗材信息'
},
RepairImg: {
type: "text",
title: "维修图片"
},

},
},
// 数据源
dataSource: {
RepairReportTeacherhandle: {

ServiceType: Object.values(this.GET_GLOBAL('dataDictionary').repairtype).map(t => ({
value: t.value,
text: t.text
})), //报修类型

DeptNo: [],

},

}
}
},

async onLoad({
type,
id
}) {
// console.log(this.GET_GLOBAL('dataDictionary').repairtype,77)
await this.init(type, id)

},

methods: {
// 页面初始化
async init(type, id) {
this.LOADING('加载数据中...')
this.folderId = this.GUID();
this.folderId2 = this.GUID();
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)

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

() => {}
])
await this.fetchForm()

this.ready = true
this.HIDE_LOADING()
},

// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()

let userInfo = this.GET_GLOBAL('loginUser');
let deptName = this.dataSource.RepairReportTeacherhandle.DeptNo.find(item => item.value == userInfo
.departmentId).text;
// console.log(this.origin,11)
// console.log(userInfo,22)
this.origin.RepairReportTeacherhandle.CreatorName = userInfo.realName;
this.origin.RepairReportTeacherhandle.DeptNo = userInfo.departmentId;
this.origin.RepairReportTeacherhandle.DeptName = deptName
this.origin.RepairReportTeacherhandle.TeachNo = userInfo.account;
this.origin.RepairReportTeacherhandle.Contact = userInfo.mobile;
this.origin.RepairReportTeacherhandle.Creator = userInfo.userId;
// console.log(this.origin,55)
} else {
const result = await this.HTTP_GET('learun/adms/repairreportTeacher/form', this.id)
// this.origin = await this.formatFormData(result)
this.origin = await this.formatFormData({
RepairReportTeacherhandle: {
...result.RepairReport_Teacher,
Status: '2'
}
})
}
this.current = this.COPY(this.origin)
// console.log(RepairReportTeacher.FilePath,98)
if (this.getValue('RepairReportTeacherhandle.FilePath') == "" || this.getValue(
'RepairReportTeacherhandle.FilePath') == undefined || this.getValue(
'RepairReportTeacherhandle.FilePath') == null) {
this.setValue('RepairReportTeacherhandle.FilePath', this.folderId);
// console.log('附件值赋值后:'+this.getValue('RepairReportTeacherhandle.FilePath'));
} else {
this.folderId = this.getValue('RepairReportTeacherhandle.FilePath');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList = await this.FETCH_FILEList(this.getValue('RepairReportTeacherhandle.FilePath'));
}
if (this.getValue('RepairReportTeacherhandle.RepairImg') == "" || this.getValue(
'RepairReportTeacherhandle.RepairImg') == undefined || this.getValue(
'RepairReportTeacherhandle.RepairImg') == null) {
this.setValue('RepairReportTeacherhandle.RepairImg', this.folderId2);
// console.log('附件值赋值后:'+this.getValue('RepairReportTeacherhandle.RepairImg'));
} else {
this.folderId2 = this.getValue('RepairReportTeacherhandle.RepairImg');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList2 = await this.FETCH_FILEList(this.getValue('RepairReportTeacherhandle.RepairImg'));
}
},


// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'edit':
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)
let strEntity = JSON.parse(postData.strEntity)
strEntity.ID = this.origin.RepairReportTeacherhandle.ID
strEntity.OrderNumber = this.origin.RepairReportTeacherhandle.OrderNumber
strEntity.CreateTime = this.origin.RepairReportTeacherhandle.CreateTime
strEntity.Status = this.origin.RepairReportTeacherhandle.Status
postData.strEntity = JSON.stringify(strEntity)
this.HTTP_POST('learun/adms/repairreportTeacher/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}

this.EMIT('LogisticsManagementRepairReportTeacherhandle-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break


case 'delete':
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
return
}

this.LOADING('提交删除中...')
this.HTTP_POST('learun/adms/repairreportTeacher/delete', this.id, '删除失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}

this.EMIT('LogisticsManagement-RepairReportTeacher-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>
<style lang="less" scoped>
.maintenancetitle {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background: #0C86D8;
color: #fff;
}
</style>

+ 393
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/list.vue View File

@@ -0,0 +1,393 @@
<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,index) of list" :key="item.ID">
<view class="customlist-item-field">
<text class="customlist-item-field-title">订单编号:</text>
{{ displayListItem(item, 'OrderNumber') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">提交日期:</text>
{{ displayListItem(item, 'CreateTime') }}
</view>
<view class="customlist-item-field">
<text class="customlist-item-field-title">报修人姓名:</text>
{{ displayListItem(item, 'CreatorName') }}
</view>
<!-- <view class="customlist-item-field">
<text class="customlist-item-field-title">所在部门:</text>
{{ displayListItem(item, 'DeptName') }}
</view> -->
<view class="customlist-item-field statusbox">
<text class="customlist-item-field-title">状态:</text>
<view class="statuscontent" :class="[item.Status === 0
? 'infos'
: item.Status === 1
? 'reds'
: item.Status === 2
? 'oranges'
: 'greens'
]">
{{ displayListItem(item, 'Status') }}
</view>
</view>
<view class="customlist-banner-action">
<view
v-if="item.Status == '0'"
@click="action('submit', item.ID)"
class="customlist-banner-action-btn line-red text-sm"
style="border: currentColor 1px solid">
<l-icon type="top" />
提交
</view>
<view
v-if="item.Status == '0'"
@click="action('delete', item.ID)"
class="customlist-banner-action-btn line-red text-sm"
style="border: currentColor 1px solid">
<l-icon type="delete" />
删除
</view>
<view
v-if="item.Status == '0'"
@click="action('edit', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="edit" />
编辑
</view>
<view v-if="item.Status != '0'" @click="action('view', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="search" />
查看
</view>
<view v-if="item.Status == '2'" @click="action('evaluate', item.ID)"
class="customlist-banner-action-btn line-blue text-sm"
style="border: currentColor 1px solid">
<l-icon type="edit" />
评价
</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.keyword" @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-16 15:39
* 描 述:工作日志
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/EducationalAdministration/Journal/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: {
OrderNumber: { type: 'text' },
CreateTime: { type: 'text'},
CreatorName: { type: 'text'},
DeptNo: { type: 'text' },
DeptName: { type: 'text' },
ServiceType: { type: 'text' },
Status:{ type: 'select' }
},
// 查询条件
searchData: {},
defaultQueryData: {},
queryData: {
},
// 时间查询参数
dateRange: null,
// 数据源
dataSource: {
Status: [{text:'草稿',value:'0'},{text:'待维修',value:'1'},{text:'已处理',value:'2'},{text:'结束报修',value:'3'}],
CheckStatus:[{text:'草稿',value:'0'},{text:'审核中',value:'1'},{text:'审核通过',value:'2'}]
},
// 页面相关参数
ready: false,
tips: '加载中...',
loadState: '向下翻以加载更多',
sideOpen: false,
// 列表与分页信息
page: 1,
total: 2,
list: []
}
},
async onLoad() {
await this.init()
},
onUnload() {
this.OFF('LogisticsManagementRepairReportTeacher-list-change')
},
methods: {
// 页面初始化
async init() {
this.ON('LogisticsManagementRepairReportTeacher-list-change', this.reset)
// 拉取加载列表和数据源
await Promise.all([
() => {}
])
await this.fetchList()
// 初始化查询条件
this.defaultQueryData = this.COPY(this.queryData)
this.ready = true
},
// 拉取列表
async fetchList(isConcat = true) {
if (this.page > this.total) { return }
const result = await this.HTTP_GET(
'learun/adms/repairreportTeacher/pagelist',
{
// 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
// 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
pagination: { rows: 10, page: this.page, sidx: 'CreateTime', sord: 'DESC' },
queryJson: JSON.stringify(this.searchData)
},
'加载数据时出错'
)
if (!result) { return }
this.total = result.total
this.page = result.page + 1
this.list = isConcat ? this.list.concat(result.rows) : result.rows;
this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
},
// 刷新清空列表
async refreshList(isConcat = true) {
this.page = 1
this.total = 2
this.list = []
await this.fetchList(isConcat)
},
// 列表下拉
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(false)
},
// 点击「清空查询条件」按钮
reset() {
this.queryData = this.COPY(this.defaultQueryData)
this.searchChange()
},
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, id = '') {
switch (type) {
case 'view':
this.NAV_TO(`./single?type=view&id=${id}`)
return
case 'add':
this.NAV_TO('./single?type=create')
return
case 'edit':
this.NAV_TO(`./single?type=edit&id=${id}`)
return
case 'submit':
if (!(await this.CONFIRM('提交项目', '是否确认提交该项?', true))) {
return
}
this.HTTP_POST('learun/adms/repairreportTeacher/submit', id , '提交失败').then(
success => {
if (!success) {
return
}
this.TOAST('提交成功', 'success')
this.refreshList()
})
return
case 'delete':
if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
return
}
this.HTTP_POST('learun/adms/repairreportTeacher/delete', id, '删除失败').then(
success => {
if (!success) {
return
}
this.TOAST('删除成功', 'success')
this.refreshList()
})
return
case 'evaluate':
this.NAV_TO(`./single?type=evaluate&id=${id}`)
return
default:
return
}
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field]
// console.log(fieldItem)
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')
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;
}
}
.statusbox {
.statuscontent {
display: inline-block;
padding: 2px 8px;
border-radius: 4px;
font-size: 14rpx;
}
.infos {
background: #777777;
color: #fff;
}
.reds {
background: #D9534F;
color: #fff;
}
.oranges {
background: #F0AD4E;
color: #fff;
}
.greens {
background: #5CB85C;
color: #fff;
}
}
</style>

+ 424
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/RepairReportTeacher/single.vue View File

@@ -0,0 +1,424 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('RepairReportTeacher.CreatorName', $event)"
:value="getValue('RepairReportTeacher.CreatorName')"
disabled
title="报修人姓名"
/>
<l-input
@input="setValue('RepairReportTeacher.TeachNo', $event)"
:value="getValue('RepairReportTeacher.TeachNo')"
disabled
title="教职工编号"
/>
<l-select
@input="setValue('RepairReportTeacher.DeptNo', $event)"
:value="getValue('RepairReportTeacher.DeptNo')"
disabled
:range="dataSource.RepairReportTeacher.DeptNo"
@change="deptChange($event)"
title="所在部门"
/>
<l-input
@input="setValue('RepairReportTeacher.Contact', $event)"
:value="getValue('RepairReportTeacher.Contact')"
disabled
title="联系电话"
/>
<l-input
@input="setValue('RepairReportTeacher.Address', $event)"
:value="getValue('RepairReportTeacher.Address')"
:disabled="!edit"
title="报修地址"
/>
<l-select
@input="setValue('RepairReportTeacher.ServiceType', $event)"
:value="getValue('RepairReportTeacher.ServiceType')"
:disabled="!edit"
:range="dataSource.RepairReportTeacher.ServiceType"
title="报修类型"
required
/>
<l-textarea
@input="setValue('RepairReportTeacher.Remark', $event)"
:value="getValue('RepairReportTeacher.Remark')"
:readonly="!edit"
title="故障描述"
/>
<!-- <l-upload-file
@input="setValue('RepairReportTeacher.FilePath', $event)"
:value="getValue('RepairReportTeacher.FilePath')"
tableName="RepairReportTeacher"
fieldName="FilePath"
title="故障图片"
:number="9"
:readonly="!edit"
/> -->
<l-input
@input="setValue('RepairReportTeacher.FilePath', $event)"
:value="getValue('RepairReportTeacher.FilePath')"
disabled="disabled"
v-show="false"
title="故障图片"
/>
<uploadFile :number="5" :folderId="folderId" :value="fileList" :readonly="!edit" :title="fileTitle" :required="false"></uploadFile>
<!-- <l-upload-file
@input="setValue('StuInfoBasic.Photo', $event)"
:value="getValue('StuInfoBasic.Photo')"
:readonly="!edit"
:number="3"
title="照片"
/> -->
<l-textarea
@input="setValue('RepairReportTeacher.LeaveMsg', $event)"
:value="getValue('RepairReportTeacher.LeaveMsg')"
:readonly="!edit"
title="给维修人留言"
/>
</view>
<view class="maintenancetitle" v-if="!edit">
维修处理信息
</view>
<view v-if="!edit">
<l-date-picker
@input="setValue('RepairReportTeacher.RepairTime', $event)"
:value="getValue('RepairReportTeacher.RepairTime')"
disabled
title="处理日期"
/>
<l-textarea
@input="setValue('RepairReportTeacher.Reason', $event)"
:value="getValue('RepairReportTeacher.Reason')"
readonly
title="故障原因"
/>
<l-textarea
@input="setValue('RepairReportTeacher.Material', $event)"
:value="getValue('RepairReportTeacher.Material')"
readonly
title="耗材信息"
/>
<l-input
@input="setValue('RepairReportTeacher.RepairImg', $event)"
:value="getValue('RepairReportTeacher.RepairImg')"
disabled
v-show="false"
title="维修图片"
/>
<uploadFile :number="5" :folderId="folderId2" :value="fileList2" readonly :title="fileTitle2" :required="false"></uploadFile>
</view>
<view class="maintenancetitle" v-if="mode=='evaluate' || mode=='view'">
评价
</view>
<view class="" v-if="mode=='evaluate' || mode=='view'">
<l-textarea
@input="setValue('RepairReportTeacher.Evaluate', $event)"
:value="getValue('RepairReportTeacher.Evaluate')"
:readonly="mode=='view'"
title="评价"
/>
</view>
<view v-if="ready && current.RepairReportTeacher && current.RepairReportTeacher.status != '1'" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button v-if="edit || mode=='evaluate'" @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-20 09:25
* 描 述:活动安排
*/
/**
* 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
* 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
* { "path": "pages/PersonnelManagement/BookBorrow/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'
import uploadFile from '@/components/upload-file2.vue'
export default {
mixins: [customPageMixins],
components:{
uploadFile,
},
data() {
return {
// 页面相关参数
id: null,
mode: null,
edit: null,
evaluate: null,
ready: false,
// 表单数据
current: {},
origin: {},
fileList:[],//附件列表
folderId:null,//附件随机文件夹id
fileTitle:'故障图片',//附件label值
fileList2:[],//附件列表
folderId2:null,//附件随机文件夹id
fileTitle2:'维修图片',//附件label值
// 表单项数据结构
scheme: {
RepairReportTeacher: {
Creator: {},
CreatorName: { type:'text', title: '报修人姓名' },
TeachNo: { type:'text', title: '教职工编号' },
DeptNo: { type:'select', title: '所在部门' },
DeptName: {},
Contact: { type:'text', title: '联系电话' },
Address: { type:'text', title: '报修地址' },
ServiceType: { type: 'select', title: '报修类型', itemCode: 'repairtype', dataSource: '0' },
Remark: { type:'text', title: '故障描述' },
// FilePath: { type: 'upload', title: '故障图片' },
LeaveMsg: { type:'text', title: '给维修人留言' },
FilePath: { type: "text", title: "附件上传" },
RepairTime:{ type: 'datetime', title: '处理日期', dateformat: '0' },
Reason: { type:'text', title: '故障原因' },
Material: { type:'text', title: '耗材信息' },
RepairImg: { type: "text", title: "维修图片" },
Evaluate: { type:'text', title: '评价' },
},
},
// 数据源
dataSource: {
RepairReportTeacher: {
ServiceType: Object.values(this.GET_GLOBAL('dataDictionary').repairtype).map(t => ({ value: t.value, text: t.text })), //报修类型
DeptNo: [],
},
}
}
},
async onLoad({ type, id }) {
// console.log(this.GET_GLOBAL('dataDictionary').repairtype,77)
await this.init(type, id)
},
methods: {
// 页面初始化
async init(type, id) {
this.LOADING('加载数据中...')
this.folderId=this.GUID();
this.folderId2=this.GUID();
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
this.FETCH_DATASOURCE('classdata').then(result => {
this.dataSource.RepairReportTeacher.DeptNo = result.data.map(t => ({ text: t.name, value: t.id }))
}),
() => {}
])
await this.fetchForm()
this.ready = true
this.HIDE_LOADING()
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
let userInfo = this.GET_GLOBAL('loginUser');
let deptName = this.dataSource.RepairReportTeacher.DeptNo.find(item => item.value == userInfo.departmentId).text;
// console.log(this.origin,11)
// console.log(userInfo,22)
this.origin.RepairReportTeacher.CreatorName = userInfo.realName;
this.origin.RepairReportTeacher.DeptNo = userInfo.departmentId;
this.origin.RepairReportTeacher.DeptName = deptName
this.origin.RepairReportTeacher.TeachNo = userInfo.account;
this.origin.RepairReportTeacher.Contact = userInfo.mobile;
this.origin.RepairReportTeacher.Creator = userInfo.userId;
// console.log(this.origin,55)
} else if(this.mode === 'evaluate') {
const result = await this.HTTP_GET('learun/adms/repairreportTeacher/form', this.id)
// this.origin = await this.formatFormData(result)
this.origin = await this.formatFormData({RepairReportTeacher:{...result.RepairReport_Teacher,Status:'3'}})
} else {
const result = await this.HTTP_GET('learun/adms/repairreportTeacher/form', this.id)
// this.origin = await this.formatFormData(result)
this.origin = await this.formatFormData({RepairReportTeacher:{...result.RepairReport_Teacher}})
}
this.current = this.COPY(this.origin)
// console.log(RepairReportTeacher.FilePath,98)
if (this.getValue('RepairReportTeacher.FilePath') == ""||this.getValue('RepairReportTeacher.FilePath') == undefined ||this.getValue('RepairReportTeacher.FilePath') == null) {
this.setValue('RepairReportTeacher.FilePath',this.folderId);
// console.log('附件值赋值后:'+this.getValue('RepairReportTeacher.FilePath'));
}else{
this.folderId=this.getValue('RepairReportTeacher.FilePath');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList = await this.FETCH_FILEList(this.getValue('RepairReportTeacher.FilePath'));
}
if (this.getValue('RepairReportTeacher.RepairImg') == ""||this.getValue('RepairReportTeacher.RepairImg') == undefined ||this.getValue('RepairReportTeacher.RepairImg') == null) {
this.setValue('RepairReportTeacher.RepairImg',this.folderId2);
// console.log('附件值赋值后:'+this.getValue('RepairReportTeacherhandle.RepairImg'));
}else{
this.folderId2=this.getValue('RepairReportTeacher.RepairImg');
// console.log('文件夹id赋值后:'+this.folderId);
//请求‘获取附件列表’接口
this.fileList2 = await this.FETCH_FILEList(this.getValue('RepairReportTeacher.RepairImg'));
}
},

// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
async action(type) {
switch (type) {
case 'edit':
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 (!this.getValue('RepairReportTeacher.ServiceType')) {
this.CONFIRM('报修类型不能为空')
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
let strEntity = JSON.parse(postData.strEntity)
if(this.mode == 'create') {
delete strEntity.RepairTime
delete strEntity.Reason
delete strEntity.Material
delete strEntity.RepairImg
delete strEntity.Evaluate
postData.strEntity = JSON.stringify(strEntity)
}else if(this.mode == 'edit') {
strEntity.ID = this.origin.RepairReportTeacher.ID
strEntity.OrderNumber = this.origin.RepairReportTeacher.OrderNumber
strEntity.CreateTime = this.origin.RepairReportTeacher.CreateTime
delete strEntity.RepairTime
delete strEntity.Reason
delete strEntity.Material
delete strEntity.RepairImg
delete strEntity.Evaluate
postData.strEntity = JSON.stringify(strEntity)
}else if(this.mode === 'evaluate') {
strEntity.ID = this.origin.RepairReportTeacher.ID
strEntity.OrderNumber = this.origin.RepairReportTeacher.OrderNumber
strEntity.CreateTime = this.origin.RepairReportTeacher.CreateTime
strEntity.Status = this.origin.RepairReportTeacher.Status
postData.strEntity = JSON.stringify(strEntity)
}
this.HTTP_POST('learun/adms/repairreportTeacher/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('LogisticsManagementRepairReportTeacher-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break
case 'delete':
if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
return
}
this.LOADING('提交删除中...')
this.HTTP_POST('learun/adms/repairreportTeacher/delete', this.id, '删除失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('LogisticsManagement-RepairReportTeacher-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>
<style lang="less" scoped>
.maintenancetitle {
text-align: center;
height: 80rpx;
line-height: 80rpx;
background: #0C86D8;
color: #fff;
}
</style>

Loading…
Cancel
Save