diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/list.vue index 1fd3072d8..cf2f19074 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/list.vue @@ -1,344 +1,300 @@ - - - - - - + }, + + // 拉取列表 + async fetchList() { + if (this.page > this.total) { return } + + const result = await this.HTTP_GET( + '/LogisticsManagement/ADR_Record/pagelist', + { + // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序) + // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序 + pagination: { rows: 10, page: this.page, sidx: 'ID', 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 = '') { + 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 'delete': + if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) { + return + } + + this.HTTP_POST('/LogisticsManagement/ADR_Record/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') + + default: return value === null || value === undefined ? '' : value + } + } + + } +} + + + +@import '~@/common/css/customlist.less'; + \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/single.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/single.vue index 5deb7cc31..552f99003 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/single.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/LogisticsManagement/ADR_Record/single.vue @@ -1,267 +1,208 @@ - - - - - - - + } + }, + + // 获取表单值 + getValue(path) { + return get(this.current, path) + }, + + // 设置表单值 + setValue(path, val) { + set(this.current, path, val) + } + } +} + \ No newline at end of file