提交 60ad20c5 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 f0dc5cd9
import ibzdictitem_en_US from '@locale/lanres/ibzdictitem/ibzdictitem_en_US'; import ibzdictitem_en_US from '@locale/lanres/ibzdict-item/ibzdict-item_en_US';
import ibzdict_en_US from '@locale/lanres/ibzdict/ibzdict_en_US'; import ibzdict_en_US from '@locale/lanres/ibzdict/ibzdict_en_US';
import userCustom_en_US from '@locale/lanres/userCustom/userCustom_en_US'; import userCustom_en_US from '@locale/lanres/userCustom/userCustom_en_US';
import codelist_en_US from '@locale/lanres/codelist/codelist_en_US'; import codelist_en_US from '@locale/lanres/codelist/codelist_en_US';
......
import ibzdictitem_zh_CN from '@locale/lanres/ibzdictitem/ibzdictitem_zh_CN'; import ibzdictitem_zh_CN from '@locale/lanres/ibzdict-item/ibzdict-item_zh_CN';
import ibzdict_zh_CN from '@locale/lanres/ibzdict/ibzdict_zh_CN'; import ibzdict_zh_CN from '@locale/lanres/ibzdict/ibzdict_zh_CN';
import userCustom_zh_CN from '@locale/lanres/userCustom/userCustom_zh_CN'; import userCustom_zh_CN from '@locale/lanres/userCustom/userCustom_zh_CN';
import codelist_zh_CN from '@locale/lanres/codelist/codelist_zh_CN'; import codelist_zh_CN from '@locale/lanres/codelist/codelist_zh_CN';
......
...@@ -7,3 +7,565 @@ const mockDatas: Array<any> = [ ...@@ -7,3 +7,565 @@ const mockDatas: Array<any> = [
]; ];
// Select
mock.onGet(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Select");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/select$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items);
console.groupEnd();
console.groupEnd();
return [status, _items];
});
// Select
mock.onGet(new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Select");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/select$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items);
console.groupEnd();
console.groupEnd();
return [status, _items];
});
// GetDraft
mock.onGet(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// GetDraft
mock.onGet(new RegExp(/^\/ibzdictitems\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Save
mock.onPost(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Save");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Save
mock.onPost(new RegExp(/^\/ibzdictitems\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Save");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['itemid'] == tempValue['itemid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// CheckKey
mock.onPost(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: CheckKey");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// CheckKey
mock.onPost(new RegExp(/^\/ibzdictitems\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: CheckKey");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['itemid'] == tempValue['itemid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Create
mock.onPost(new RegExp(/^\/ibzdictitems\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
});
// Update
mock.onPut(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Update");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Update
mock.onPut(new RegExp(/^\/ibzdictitems\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Update");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['itemid'] == tempValue['itemid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// FetchDefault
mock.onGet(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid'];
let tempValue: any = {};
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/fetchdefault$/).exec(config.url);
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
if (items.length > 0 && paramArray.length > 0) {
paramArray.forEach((paramkey: any) => {
if (tempValue[paramkey] && tempValue[paramkey].indexOf(";") > 0) {
let keysGrounp: Array<any> = tempValue[paramkey].split(new RegExp(/[\;]/));
let tempArray: Array<any> = [];
keysGrounp.forEach((singlekey: any) => {
let _items = items.filter((item: any) => { return item[paramkey] == singlekey });
if(_items.length >0){
tempArray.push(..._items);
}
})
items = tempArray;
} else {
items = items.filter((item: any) => { return item[paramkey] == tempValue[paramkey] });
}
})
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(items);
console.groupEnd();
console.groupEnd();
return [status, items];
});
// FetchDefault
mock.onGet(new RegExp(/^\/ibzdictitems\/fetchdefault$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas);
console.groupEnd();
console.groupEnd();
return [status, mockDatas ? mockDatas : []];
});
// FetchDefault
mock.onGet(new RegExp(/^\/ibzdictitems\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: FetchDefault");
console.table({url:config.url, method: config.method, data:config.data});
if(config.url.includes('page')){
let url = config.url.split('?')[1];
let params = qs.parse(url);
Object.assign(config, params);
}
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
let total = mockDatas.length;
let records: Array<any> = [];
if(!config.page || !config.size){
records = mockDatas;
}else{
if((config.page-1)*config.size < total){
records = mockDatas.slice(config.page,config.size);
}
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(records ? records : []);
console.groupEnd();
console.groupEnd();
return [status, records ? records : []];
});
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// URI参数传递情况未实现
// Get
mock.onGet(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Get
mock.onGet(new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['dictid','itemid'];
const matchArray:any = new RegExp(/^\/ibzdicts\/([a-zA-Z0-9\-\;]{1,35})\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ibzdictitem 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['itemid'];
const matchArray:any = new RegExp(/^\/ibzdictitems\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
let items = mockDatas ? mockDatas : [];
let _items = items.find((item: any) => Object.is(item.itemid, tempValue.itemid));
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(_items?_items:{});
console.groupEnd();
console.groupEnd();
return [status, _items?_items:{}];
});
...@@ -7,5 +7,5 @@ import './login/login'; ...@@ -7,5 +7,5 @@ import './login/login';
import './upload/upload'; import './upload/upload';
// 实体级接口对象 // 实体级接口对象
import './entity/ibzdictitems/ibzdictitems'; import './entity/ibzdict-items/ibzdict-items';
import './entity/ibzdicts/ibzdicts'; import './entity/ibzdicts/ibzdicts';
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator'; import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import IBZDICTITEMService from '@/service/ibzdictitem/ibzdictitem-service'; import IBZDictItemService from '@/service/ibzdict-item/ibzdict-item-service';
import EditViewEngine from '@engine/view/edit-view-engine'; import EditViewEngine from '@engine/view/edit-view-engine';
...@@ -140,10 +140,10 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -140,10 +140,10 @@ export default class IBZDictItemEditViewBase extends Vue {
/** /**
* 实体服务对象 * 实体服务对象
* *
* @type {IBZDICTITEMService} * @type {IBZDictItemService}
* @memberof IBZDictItemEditViewBase * @memberof IBZDictItemEditViewBase
*/ */
protected appEntityService: IBZDICTITEMService = new IBZDICTITEMService; protected appEntityService: IBZDictItemService = new IBZDictItemService;
/** /**
...@@ -652,7 +652,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -652,7 +652,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Save(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Save(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -678,7 +678,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -678,7 +678,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.SaveAndNew(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.SaveAndNew(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -704,7 +704,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -704,7 +704,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.SaveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -730,7 +730,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -730,7 +730,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.RemoveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.RemoveAndExit(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -756,7 +756,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -756,7 +756,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.SaveAndStart(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -782,7 +782,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -782,7 +782,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.ViewWFStep(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -808,7 +808,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -808,7 +808,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.New(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -834,7 +834,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -834,7 +834,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -860,7 +860,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -860,7 +860,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Print(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -886,7 +886,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -886,7 +886,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.FirstRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.FirstRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -912,7 +912,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -912,7 +912,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.PrevRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.PrevRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -938,7 +938,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -938,7 +938,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.NextRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.NextRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -964,7 +964,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -964,7 +964,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.LastRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.LastRecord(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -990,7 +990,7 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -990,7 +990,7 @@ export default class IBZDictItemEditViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Help(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Help(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -1330,6 +1330,33 @@ export default class IBZDictItemEditViewBase extends Vue { ...@@ -1330,6 +1330,33 @@ export default class IBZDictItemEditViewBase extends Vue {
} }
} }
/**
* 销毁视图回调
*
* @memberof IBZDictItemEditViewBase
*/
protected destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZDictItemEditViewBase
*/
protected afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
} }
</script> </script>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
import { Component } from 'vue-property-decorator'; import { Component } from 'vue-property-decorator';
import IBZDictItemEditViewBase from './ibzdict-item-edit-view-base.vue'; import IBZDictItemEditViewBase from './ibzdict-item-edit-view-base.vue';
import view_form from '@widgets/ibzdictitem/main-form/main-form.vue'; import view_form from '@widgets/ibzdict-item/main-form/main-form.vue';
@Component({ @Component({
components: { components: {
view_form, view_form,
......
...@@ -147,7 +147,7 @@ ...@@ -147,7 +147,7 @@
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator'; import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { UIActionTool,Util } from '@/utils'; import { UIActionTool,Util } from '@/utils';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import IBZDICTITEMService from '@/service/ibzdictitem/ibzdictitem-service'; import IBZDictItemService from '@/service/ibzdict-item/ibzdict-item-service';
import GridViewEngine from '@engine/view/grid-view-engine'; import GridViewEngine from '@engine/view/grid-view-engine';
...@@ -162,10 +162,10 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -162,10 +162,10 @@ export default class IBZDictItemGridViewBase extends Vue {
/** /**
* 实体服务对象 * 实体服务对象
* *
* @type {IBZDICTITEMService} * @type {IBZDictItemService}
* @memberof IBZDictItemGridViewBase * @memberof IBZDictItemGridViewBase
*/ */
protected appEntityService: IBZDICTITEMService = new IBZDICTITEMService; protected appEntityService: IBZDictItemService = new IBZDictItemService;
/** /**
...@@ -746,7 +746,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -746,7 +746,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.New(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.New(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -772,7 +772,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -772,7 +772,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Edit(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Edit(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -798,7 +798,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -798,7 +798,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.View(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.View(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -824,7 +824,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -824,7 +824,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Copy(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -850,7 +850,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -850,7 +850,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.ToggleRowEdit(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -876,7 +876,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -876,7 +876,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.NewRow(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.NewRow(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -902,7 +902,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -902,7 +902,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Remove(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Remove(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -928,7 +928,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -928,7 +928,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.ExportExcel(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -954,7 +954,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -954,7 +954,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Print(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Print(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -980,7 +980,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -980,7 +980,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.ExportModel(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.ExportModel(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -1006,7 +1006,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -1006,7 +1006,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Import(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Import(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -1032,7 +1032,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -1032,7 +1032,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.ToggleFilter(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -1058,7 +1058,7 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -1058,7 +1058,7 @@ export default class IBZDictItemGridViewBase extends Vue {
datas = [...xData.getDatas()]; datas = [...xData.getDatas()];
} }
// 界面行为 // 界面行为
this.Help(datas, contextJO,paramJO, $event, xData,this,"IBZDICTITEM"); this.Help(datas, contextJO,paramJO, $event, xData,this,"IBZDictItem");
} }
/** /**
...@@ -1078,9 +1078,11 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -1078,9 +1078,11 @@ export default class IBZDictItemGridViewBase extends Vue {
Object.assign(curViewParam,args[0]); Object.assign(curViewParam,args[0]);
} }
let deResParameters: any[] = []; let deResParameters: any[] = [];
if(curViewParam.ibzdict && true){
deResParameters = [ deResParameters = [
{ pathName: 'ibzdicts', parameterName: 'ibzdict' }, { pathName: 'ibzdicts', parameterName: 'ibzdict' },
]; ]
}
const parameters: any[] = [ const parameters: any[] = [
{ pathName: 'ibzdictitems', parameterName: 'ibzdictitem' }, { pathName: 'ibzdictitems', parameterName: 'ibzdictitem' },
{ pathName: 'editview', parameterName: 'editview' }, { pathName: 'editview', parameterName: 'editview' },
...@@ -1113,9 +1115,11 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -1113,9 +1115,11 @@ export default class IBZDictItemGridViewBase extends Vue {
Object.assign(curViewParam,args[0]); Object.assign(curViewParam,args[0]);
} }
let deResParameters: any[] = []; let deResParameters: any[] = [];
if(curViewParam.ibzdict && true){
deResParameters = [ deResParameters = [
{ pathName: 'ibzdicts', parameterName: 'ibzdict' }, { pathName: 'ibzdicts', parameterName: 'ibzdict' },
]; ]
}
const parameters: any[] = [ const parameters: any[] = [
{ pathName: 'ibzdictitems', parameterName: 'ibzdictitem' }, { pathName: 'ibzdictitems', parameterName: 'ibzdictitem' },
{ pathName: 'editview', parameterName: 'editview' }, { pathName: 'editview', parameterName: 'editview' },
...@@ -1400,6 +1404,33 @@ export default class IBZDictItemGridViewBase extends Vue { ...@@ -1400,6 +1404,33 @@ export default class IBZDictItemGridViewBase extends Vue {
} }
} }
/**
* 销毁视图回调
*
* @memberof IBZDictItemGridViewBase
*/
protected destroyed(){
this.afterDestroyed();
}
/**
* 执行destroyed后的逻辑
*
* @memberof IBZDictItemGridViewBase
*/
protected afterDestroyed(){
if(this.viewDefaultUsage){
let localStoreLength = Object.keys(localStorage);
if(localStoreLength.length > 0){
localStoreLength.forEach((item:string) =>{
if(item.startsWith(this.context.srfsessionid)){
localStorage.removeItem(item);
}
})
}
}
}
/** /**
* 是否单选 * 是否单选
* *
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
import { Component } from 'vue-property-decorator'; import { Component } from 'vue-property-decorator';
import IBZDictItemGridViewBase from './ibzdict-item-grid-view-base.vue'; import IBZDictItemGridViewBase from './ibzdict-item-grid-view-base.vue';
import view_grid from '@widgets/ibzdictitem/main-grid/main-grid.vue'; import view_grid from '@widgets/ibzdict-item/main-grid/main-grid.vue';
import view_searchform from '@widgets/ibzdictitem/default-searchform/default-searchform.vue'; import view_searchform from '@widgets/ibzdict-item/default-searchform/default-searchform.vue';
@Component({ @Component({
components: { components: {
view_grid, view_grid,
......
...@@ -39,7 +39,7 @@ export class EntityServiceRegister { ...@@ -39,7 +39,7 @@ export class EntityServiceRegister {
* @memberof EntityServiceRegister * @memberof EntityServiceRegister
*/ */
protected init(): void { protected init(): void {
this.allEntityService.set('ibzdictitem', () => import('@/service/ibzdictitem/ibzdictitem-service')); this.allEntityService.set('ibzdictitem', () => import('@/service/ibzdict-item/ibzdict-item-service'));
this.allEntityService.set('ibzdict', () => import('@/service/ibzdict/ibzdict-service')); this.allEntityService.set('ibzdict', () => import('@/service/ibzdict/ibzdict-service'));
} }
......
!!!!模版产生代码错误:---- import { Http,Util } from '@/utils';
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? import EntityService from '../entity-service';
----
----
FTL stack trace ("~" means nesting-related): /**
- Failed at: ${item.getKeyPSAppDEField().getCodeNa... [in template "TEMPLCODE_zh_CN" at line 410, column 26] * 字典项目服务对象基类
---- *
\ No newline at end of file * @export
* @class IBZDictItemServiceBase
* @extends {EntityServie}
*/
export default class IBZDictItemServiceBase extends EntityService {
/**
* Creates an instance of IBZDictItemServiceBase.
*
* @param {*} [opts={}]
* @memberof IBZDictItemServiceBase
*/
constructor(opts: any = {}) {
super(opts);
}
/**
* 初始化基础数据
*
* @memberof IBZDictItemServiceBase
*/
public initBasicData(){
this.APPLYDEKEY ='ibzdictitem';
this.APPDEKEY = 'itemid';
this.APPDENAME = 'ibzdictitems';
this.APPDETEXT = 'itemname';
}
// 实体接口
/**
* Select接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async Select(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && context.ibzdictitem){
return Http.getInstance().get(`/ibzdicts/${context.ibzdict}/ibzdictitems/${context.ibzdictitem}/select`,isloading);
}
return Http.getInstance().get(`/ibzdictitems/${context.ibzdictitem}/select`,isloading);
}
/**
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && context.ibzdictitem){
return Http.getInstance().get(`/ibzdicts/${context.ibzdict}/ibzdictitems/${context.ibzdictitem}`,isloading);
}
let res:any = await Http.getInstance().get(`/ibzdictitems/${context.ibzdictitem}`,isloading);
return res;
}
/**
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && true){
return Http.getInstance().get(`/ibzdicts/${context.ibzdict}/ibzdictitems/getdraft`,isloading);
}
let res:any = await Http.getInstance().get(`/ibzdictitems/getdraft`,isloading);
res.data.ibzdictitem = data.ibzdictitem;
return res;
}
/**
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && context.ibzdictitem){
return Http.getInstance().post(`/ibzdicts/${context.ibzdict}/ibzdictitems/${context.ibzdictitem}/save`,data,isloading);
}
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/ibzdictitems/${context.ibzdictitem}/save`,data,isloading);
return res;
}
/**
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && context.ibzdictitem){
return Http.getInstance().post(`/ibzdicts/${context.ibzdict}/ibzdictitems/${context.ibzdictitem}/checkkey`,data,isloading);
}
return Http.getInstance().post(`/ibzdictitems/${context.ibzdictitem}/checkkey`,data,isloading);
}
/**
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && context.ibzdictitem){
return Http.getInstance().delete(`/ibzdicts/${context.ibzdict}/ibzdictitems/${context.ibzdictitem}`,isloading);
}
return Http.getInstance().delete(`/ibzdictitems/${context.ibzdictitem}`,isloading);
}
/**
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && true){
data[this.APPDEKEY] = null;
return Http.getInstance().post(`/ibzdicts/${context.ibzdict}/ibzdictitems`,data,isloading);
}
let masterData:any = {};
Object.assign(data,masterData);
data[this.APPDEKEY] = null;
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/ibzdictitems`,data,isloading);
return res;
}
/**
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && context.ibzdictitem){
return Http.getInstance().put(`/ibzdicts/${context.ibzdict}/ibzdictitems/${context.ibzdictitem}`,data,isloading);
}
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/ibzdictitems/${context.ibzdictitem}`,data,isloading);
return res;
}
/**
* FetchDefault接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof IBZDictItemServiceBase
*/
public async FetchDefault(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.ibzdict && true){
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/ibzdicts/${context.ibzdict}/ibzdictitems/fetchdefault`,tempData,isloading);
}
let tempData:any = JSON.parse(JSON.stringify(data));
return Http.getInstance().get(`/ibzdictitems/fetchdefault`,tempData,isloading);
}
}
\ No newline at end of file
...@@ -39,7 +39,7 @@ export class UIServiceRegister { ...@@ -39,7 +39,7 @@ export class UIServiceRegister {
* @memberof UIServiceRegister * @memberof UIServiceRegister
*/ */
protected init(): void { protected init(): void {
this.allUIService.set('ibzdictitem', () => import('@/uiservice/ibzdictitem/ibzdictitem-ui-service')); this.allUIService.set('ibzdictitem', () => import('@/uiservice/ibzdict-item/ibzdict-item-ui-service'));
this.allUIService.set('ibzdict', () => import('@/uiservice/ibzdict/ibzdict-ui-service')); this.allUIService.set('ibzdict', () => import('@/uiservice/ibzdict/ibzdict-ui-service'));
} }
......
!!!!模版产生代码错误:---- import { Http,Util,Errorlog } from '@/utils';
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? import ControlService from '@/widgets/control-service';
---- import IBZDictItemService from '@/service/ibzdict-item/ibzdict-item-service';
import DefaultModel from './default-searchform-model';
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 334, column 14] /**
---- * Default 部件服务对象
\ No newline at end of file *
* @export
* @class DefaultService
*/
export default class DefaultService extends ControlService {
/**
* 字典项目服务对象
*
* @type {IBZDictItemService}
* @memberof DefaultService
*/
public appEntityService: IBZDictItemService = new IBZDictItemService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof DefaultService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of DefaultService.
*
* @param {*} [opts={}]
* @memberof DefaultService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new DefaultModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof DefaultService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof DefaultService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading);
} else {
result = this.appEntityService.Create(context,data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading);
} else {
result = this.appEntityService.Create(context,data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
Data.itemid = Util.createUUID();
Data.ibzdictitem = Data.itemid;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof DefaultService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof DefaultService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
...@@ -94,6 +94,11 @@ export default class MainModel { ...@@ -94,6 +94,11 @@ export default class MainModel {
prop: 'itemid', prop: 'itemid',
dataType: 'GUID', dataType: 'GUID',
}, },
{
name: 'ibzdictitem',
prop: 'itemid',
dataType: 'FONTKEY',
},
] ]
} }
......
!!!!模版产生代码错误:---- import { Http,Util,Errorlog } from '@/utils';
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? import ControlService from '@/widgets/control-service';
---- import IBZDictItemService from '@/service/ibzdict-item/ibzdict-item-service';
import MainModel from './main-form-model';
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 334, column 14] /**
---- * Main 部件服务对象
\ No newline at end of file *
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 字典项目服务对象
*
* @type {IBZDictItemService}
* @memberof MainService
*/
public appEntityService: IBZDictItemService = new IBZDictItemService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
data = this.handleWFData(data);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading);
} else {
result = this.appEntityService.Create(context,data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading);
} else {
result = this.appEntityService.Create(context,data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
//仿真主键数据
Data.itemid = Util.createUUID();
Data.ibzdictitem = Data.itemid;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof MainService
*/
public handleRequestData(action: string,context:any, data: any = {}){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}
}
});
if(data && data.viewparams){
Object.assign(requestData,data.viewparams);
}
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
}
\ No newline at end of file
!!!!模版产生代码错误:---- <template>
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? <div class='grid' style="height:100%;">
---- <el-table v-if="isDisplay === true"
:default-sort="{ prop: minorSortPSDEF, order: Object.is(minorSortDir, 'ASC') ? 'ascending' : Object.is(minorSortDir, 'DESC') ? 'descending' : '' }"
---- @sort-change="onSortChange($event)"
FTL stack trace ("~" means nesting-related): :border="isDragendCol"
- Failed at: ${ctrl.getPSAppDataEntity().getKeyPSA... [in template "TEMPLCODE_zh_CN" at line 800, column 186] :height="isEnablePagingBar && items.length > 0 ? 'calc(100% - 50px)' : '100%'"
---- :highlight-current-row ="isSingleSelect"
\ No newline at end of file :row-class-name="getRowClassName"
@row-click="rowClick($event)"
@select-all="selectAll($event)"
@select="select($event)"
@row-class-name="onRowClassName($event)"
@row-dblclick="rowDBLClick($event)"
ref='multipleTable' :data="items" :show-header="!isHideHeader">
<template v-if="!isSingleSelect">
<el-table-column type='selection' :width="checkboxColWidth"></el-table-column>
</template>
<template v-if="getColumnState('ibzdictitemname')">
<el-table-column show-overflow-tooltip :prop="'ibzdictitemname'" :label="$t('ibzdictitem.main_grid.columns.ibzdictitemname')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.ibzdictitemname}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('dictitemval')">
<el-table-column show-overflow-tooltip :prop="'dictitemval'" :label="$t('ibzdictitem.main_grid.columns.dictitemval')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.dictitemval}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('pitemval')">
<el-table-column show-overflow-tooltip :prop="'pitemval'" :label="$t('ibzdictitem.main_grid.columns.pitemval')" :width="200" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.pitemval}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('itemfilter')">
<el-table-column show-overflow-tooltip :prop="'itemfilter'" :label="$t('ibzdictitem.main_grid.columns.itemfilter')" :width="100" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.itemfilter}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('itemcls')">
<el-table-column show-overflow-tooltip :prop="'itemcls'" :label="$t('ibzdictitem.main_grid.columns.itemcls')" :width="100" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.itemcls}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('itemicon')">
<el-table-column show-overflow-tooltip :prop="'itemicon'" :label="$t('ibzdictitem.main_grid.columns.itemicon')" :width="100" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.itemicon}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('showorder')">
<el-table-column show-overflow-tooltip :prop="'showorder'" :label="$t('ibzdictitem.main_grid.columns.showorder')" :width="100" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.showorder}}</span>
</template>
</el-table-column>
</template>
<template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('ibzdictitem.main_grid.columns.updatedate')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}">
<span>{{row.updatedate}}</span>
</template>
</el-table-column>
</template>
<template v-if="adaptiveState">
<el-table-column></el-table-column>
</template>
</el-table>
<row class='grid-pagination' v-show="items.length > 0">
<page class='pull-right' @on-change="pageOnChange($event)"
@on-page-size-change="onPageSizeChange($event)"
:transfer="true" :total="totalrow"
show-sizer :current="curPage" :page-size="limit"
:page-size-opts="[10, 20, 30, 40, 50, 60, 70, 80, 90, 100]" show-elevator show-total>
<span>
<span class="page-column">
<poptip transfer placement="top-start">
<i-button icon="md-menu">{{$t('app.gridpage.choicecolumns')}}</i-button>
<div slot="content">
<template v-for="col in allColumns">
<div :key="col.name"><el-checkbox v-model="col.show" @change="onColChange()">{{$t(col.langtag)}}</el-checkbox></div>
</template>
</div>
</poptip>
</span>
<span class="page-button"><i-button icon="md-refresh" :title="$t('app.gridpage.refresh')" @click="pageRefresh()"></i-button></span>&nbsp;
<span>
{{$t('app.gridpage.show')}}&nbsp;
<span>
<template v-if="items.length === 1">
1
</template>
<template v-else>
<span>{{(curPage - 1) * limit + 1}}&nbsp;-&nbsp;{{totalrow > curPage * limit ? curPage * limit : totalrow}}</span>
</template>
</span>&nbsp;
{{$t('app.gridpage.records')}},{{$t('app.gridpage.totle')}}&nbsp;{{totalrow}}&nbsp;{{$t('app.gridpage.records')}}
</span>
</span>
</page>
</row>
</div>
</template>
<script lang='ts'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util } from '@/utils';
import IBZDictItemService from '@/service/ibzdict-item/ibzdict-item-service';
import MainService from './main-grid-service';
import CodeListService from "@service/app/codelist-service";
@Component({
components: {
}
})
export default class MainBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof Main
*/
@Prop() protected name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof Main
*/
@Prop() protected viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof Main
*/
@Prop() protected context: any;
/**
* 视图参数
*
* @type {*}
* @memberof Main
*/
@Prop() protected viewparams: any;
/**
* 视图状态事件
*
* @protected
* @type {(Subscription | undefined)}
* @memberof Main
*/
protected viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof Main
*/
protected getControlType(): string {
return 'GRID'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof Main
*/
protected counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {MainService}
* @memberof Main
*/
protected service: MainService = new MainService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBZDictItemService}
* @memberof Main
*/
protected appEntityService: IBZDictItemService = new IBZDictItemService({ $store: this.$store });
/**
* 关闭视图
*
* @param {any[]} args
* @memberof Main
*/
protected closeView(args: any[]): void {
let _this: any = this;
_this.$emit('closeview', args);
}
/**
* 计数器刷新
*
* @memberof Main
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 代码表服务对象
*
* @type {CodeListService}
* @memberof Main
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof Main
*/
public getDatas(): any[] {
return this.selections;
}
/**
* 获取单项树
*
* @returns {*}
* @memberof Main
*/
public getData(): any {
return this.selections[0];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() protected newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof Main
*/
@Prop() protected opendata: any;
/**
* 显示处理提示
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: true }) protected showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof Main
*/
@Prop() protected updateAction!: string;
/**
* 部件行为--fetch
*
* @type {string}
* @memberof Main
*/
@Prop() protected fetchAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Main
*/
@Prop() protected removeAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof Main
*/
@Prop() protected loadAction!: string;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof Main
*/
@Prop() protected loaddraftAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Main
*/
@Prop() protected createAction!: string;
/**
* 当前页
*
* @type {number}
* @memberof Main
*/
protected curPage: number = 1;
/**
* 数据
*
* @type {any[]}
* @memberof Main
*/
protected items: any[] = [];
/**
* 是否支持分页
*
* @type {boolean}
* @memberof Main
*/
protected isEnablePagingBar: boolean = true;
/**
* 是否禁用排序
*
* @type {boolean}
* @memberof Main
*/
protected isNoSort: boolean = false;
/**
* 排序方向
*
* @type {string}
* @memberof Main
*/
protected minorSortDir: string = '';
/**
* 排序字段
*
* @type {string}
* @memberof Main
*/
protected minorSortPSDEF: string = '';
/**
* 分页条数
*
* @type {number}
* @memberof Main
*/
protected limit: number = 20;
/**
* 是否显示标题
*
* @type {boolean}
* @memberof Main
*/
protected isHideHeader: boolean = false;
/**
* 是否默认选中第一条数据
*
* @type {boolean}
* @memberof Main
*/
@Prop({ default: false }) protected isSelectFirstDefault!: boolean;
/**
* 是否单选
*
* @type {boolean}
* @memberof Main
*/
@Prop() protected isSingleSelect?: boolean;
/**
* 选中数据字符串
*
* @type {string}
* @memberof Main
*/
@Prop() protected selectedData?: string;
/**
* 选中值变化
*
* @param {*} newVal
* @param {*} oldVal
* @memberof MainTree
*/
@Watch('selectedData')
public onValueChange(newVal: any, oldVal: any) {
this.selections = [];
if(this.selectedData){
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(this.selectedData).forEach((selection:any)=>{
let selectedItem = this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
this.rowClick(selectedItem);
}
});
}
}
}
/**
* 表格行数据默认激活模式
* 0 不激活
* 1 单击激活
* 2 双击激活
*
* @type {(number | 0 | 1 | 2)}
* @memberof Main
*/
@Prop({default: 2}) protected gridRowActiveMode!: number;
/**
* 是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
@Prop({default: false}) protected isOpenEdit!: boolean;
/**
* 实际是否开启行编辑
*
* @type {boolean}
* @memberof Main
*/
protected actualIsOpenEdit: boolean = this.isOpenEdit;
/**
* 总条数
*
* @type {number}
* @memberof Main
*/
protected totalrow: number = 0;
/**
* 选中行数据
*
* @type {any[]}
* @memberof Main
*/
protected selections: any[] = [];
/**
* 拦截行选中
*
* @type {boolean}
* @memberof Main
*/
protected stopRowClick: boolean = false;
/**
* 表格是否显示
*
* @type {boolean}
* @memberof Main
*/
protected isDisplay:boolean = true;
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Main
*/
protected refresh(args: any[]): void {
this.load();
}
/**
* 选项框列宽
*
* @type {number}
* @memberof AppIndex
*/
protected checkboxColWidth: number = 80;
/**
* 是否允许拖动列宽
*
* @type {boolean}
* @memberof AppEmbedPicker
*/
protected isDragendCol: boolean = false;
/**
* 所有列成员
*
* @type {any[]}
* @memberof Main
*/
protected allColumns: any[] = [
{
name: 'ibzdictitemname',
label: '栏目显示值',
langtag: 'ibzdictitem.main_grid.columns.ibzdictitemname',
show: true,
util: 'PX'
},
{
name: 'dictitemval',
label: '栏目值',
langtag: 'ibzdictitem.main_grid.columns.dictitemval',
show: true,
util: 'PX'
},
{
name: 'pitemval',
label: '父栏目值',
langtag: 'ibzdictitem.main_grid.columns.pitemval',
show: true,
util: 'PX'
},
{
name: 'itemfilter',
label: '过滤项',
langtag: 'ibzdictitem.main_grid.columns.itemfilter',
show: true,
util: 'PX'
},
{
name: 'itemcls',
label: '栏目样式',
langtag: 'ibzdictitem.main_grid.columns.itemcls',
show: true,
util: 'PX'
},
{
name: 'itemicon',
label: '图标',
langtag: 'ibzdictitem.main_grid.columns.itemicon',
show: true,
util: 'PX'
},
{
name: 'showorder',
label: '排序',
langtag: 'ibzdictitem.main_grid.columns.showorder',
show: true,
util: 'PX'
},
{
name: 'updatedate',
label: '更新时间',
langtag: 'ibzdictitem.main_grid.columns.updatedate',
show: true,
util: 'PX'
},
]
/**
* 属性值规则
*
* @type {*}
* @memberof Main
*/
protected rules: any = {
srfkey: [
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '字典项目标识 值不能为空', trigger: 'change' },
{ required: false, validator: (rule:any, value:any, callback:any) => { return (rule.required && (value === null || value === undefined || value === "")) ? false : true;}, message: '字典项目标识 值不能为空', trigger: 'blur' },
],
}
/**
* 表格数据加载
*
* @param {*} [arg={}]
* @memberof Main
*/
protected load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图表格fetchAction参数未配置' });
return;
}
if(pageReset){
this.curPage = 1;
}
const arg: any = {...opt};
const page: any = {};
if (this.isEnablePagingBar) {
Object.assign(page, { page: this.curPage-1, size: this.limit });
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
Object.assign(arg, page);
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data: any = response.data;
this.totalrow = response.total;
this.items = JSON.parse(JSON.stringify(data));
// 清空selections
this.selections = [];
this.$emit('load', this.items);
// 设置默认选中
let _this = this;
setTimeout(() => {
if(_this.isSelectFirstDefault){
_this.rowClick(_this.items[0]);
}
if(_this.selectedData){
const refs: any = _this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
JSON.parse(_this.selectedData).forEach((selection:any)=>{
let selectedItem = _this.items.find((item:any)=>{
return Object.is(item.srfkey, selection.srfkey);
});
if(selectedItem){
_this.rowClick(selectedItem);
}
});
}
}
}, 300);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '错误', desc: response.errorMessage });
});
}
/**
* 删除
*
* @param {any[]} datas
* @returns {Promise<any>}
* @memberof Main
*/
protected async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图表格removeAction参数未配置' });
return;
}
let _datas:any[] = [];
datas.forEach((record: any, index: number) => {
if (!record.srfkey) {
this.items.some((val: any, num: number) =>{
if(JSON.stringify(val) == JSON.stringify(record)){
this.items.splice(num,1);
return true;
}
});
}else{
_datas.push(datas[index]);
}
});
if (_datas.length === 0) {
return;
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.srfmajortext;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
}
dataInfo += srfmajortext;
} else {
return false;
}
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' 共' + _datas.length + '条数据';
} else {
dataInfo = dataInfo + '...' + ' 共' + _datas.length + '条数据';
}
const removeData = () => {
let keys: any[] = [];
_datas.forEach((data: any) => {
keys.push(data.srfkey);
});
const context:any = JSON.parse(JSON.stringify(this.context));
const post: Promise<any> = this.service.delete(this.removeAction,Object.assign(context,{ ibzdictitem: keys.join(';') }),Object.assign({ itemid: keys.join(';') },{viewparams:this.viewparams}), this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '删除数据失败,' + response.info });
return;
} else {
this.$Notice.success({ title: '', desc: '删除成功!' });
}
//删除items中已删除的项
console.log(this.items);
_datas.forEach((data: any) => {
this.items.some((item:any,index:number)=>{
if(Object.is(item.srfkey,data.srfkey)){
this.items.splice(index,1);
return true;
}
});
});
this.totalrow -= _datas.length;
this.$emit('remove', null);
this.selections = [];
resolve(response);
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
reject(response);
return;
}
reject(response);
});
});
}
dataInfo = dataInfo.replace(/[null]/g, '').replace(/[undefined]/g, '');
this.$Modal.confirm({
title: '警告',
content: '确认要删除 ' + dataInfo + ',删除操作将不可恢复?',
onOk: () => {
removeData();
},
onCancel: () => { }
});
return removeData;
}
/**
* 批量添加
*
* @param {*} [arg={}]
* @memberof Main
*/
protected addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图表格fetchAction参数未配置' });
return;
}
if(!arg){
arg = {};
}
console.error("批量添加未实现");
}
/**
* 数据导出
*
* @param {*} data
* @memberof Main
*/
protected exportExcel(data: any = {}): void {
// 导出Excel
const doExport = async (_data:any) => {
const tHeader: Array<any> = [];
const filterVal: Array<any> = [];
this.allColumns.forEach((item: any) => {
item.show && item.label ? tHeader.push(item.label) : "";
item.show && item.name ? filterVal.push(item.name) : "";
});
const data = await this.formatExcelData(filterVal, _data);
this.$export.exportExcel().then((excel:any)=>{
excel.export_json_to_excel({
header: tHeader, //表头 必填
data, //具体数据 必填
filename: "主实体"+"表", //非必填
autoWidth: true, //非必填
bookType: "xlsx" //非必填
});
});
};
const page: any = {};
// 设置page,size
if (Object.is(data.type, 'maxRowCount')) {
Object.assign(page, { page: 0, size: data.maxRowCount });
} else if (Object.is(data.type, 'activatedPage')) {
try {
doExport(JSON.parse(JSON.stringify(this.items)));
} catch (error) {
console.error(error);
}
return;
}
// 设置排序
if (!this.isNoSort && !Object.is(this.minorSortDir, '') && !Object.is(this.minorSortPSDEF, '')) {
const sort: string = this.minorSortPSDEF+","+this.minorSortDir;
Object.assign(page, { sort: sort });
}
const arg: any = {};
Object.assign(arg, page);
// 获取query,搜索表单,viewparams等父数据
const parentdata: any = {};
this.$emit('beforeload', parentdata);
Object.assign(arg, parentdata);
const post: Promise<any> = this.service.search(this.fetchAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '数据导出失败,' + response.info });
return;
}
try {
doExport(JSON.parse(JSON.stringify(response.data)));
} catch (error) {
console.error(error);
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
this.$Notice.error({ title: '', desc: '数据导出失败' });
});
}
/**
* 导出数据格式化
*
* @param {*} filterVal
* @param {*} jsonData
* @returns {[]}
* @memberof Main
*/
public async formatExcelData(filterVal:any, jsonData:any) {
let codelistColumns:Array<any> = [
];
let _this = this;
for (const codelist of codelistColumns) {
// 动态代码表处理
if (Object.is(codelist.codelistType, "DYNAMIC")) {
let items = await _this.codeListService.getItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
// 静态处理
} else if(Object.is(codelist.codelistType, "STATIC")){
let items = await _this.$store.getters.getCodeListItems(codelist.srfkey);
jsonData.forEach((row:any)=>{
row[codelist.name] = _this.getCodelistValue(items, row[codelist.name], codelist);
});
}
}
return jsonData.map((v:any) => filterVal.map((j:any) => v[j]))
}
/**
* 解析代码表和vlaue,设置items
*
* @private
* @param {any[]} items 代码表数据
* @param {*} value
* @returns {*}
* @memberof Main
*/
private getCodelistValue(items: any[], value: any, codelist: any,){
if(!value){
return this.$t('codelist.'+codelist.srfkey+'.empty');
}
if (items) {
let result:any = [];
if(Object.is(codelist.renderMode,"number")){
items.map((_item: any, index: number)=>{
const nValue = parseInt((value as any), 10);
const codevalue = _item.value;
if((parseInt(codevalue, 10) & nValue) > 0){
result.push(_item);
}
});
} else if(Object.is(codelist.renderMode,"string")){
const arrayValue: Array<any> = (value as any).split(codelist.valueSeparator);
arrayValue.map((value: any, index: number) => {
result.push([]);
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((val:any ,num: number)=>{
const item = this.getItem(items, val, codelist);
if(item){
result[index].push(item);
}
});
});
} else {
let values: any[] = Object.is(this.$util.typeOf(value), 'number') ? [value] : [...(value as any).split(codelist.valueSeparator)];
values.map((value:any ,index: number)=>{
const item = this.getItem(items, value, codelist);
if(item){
result.push(item);
}
});
}
// 设置items
if(result.length != 0){
return result.join(codelist.valueSeparator);
}else{
return value;
}
}
}
/**
* 获取代码项
*
* @private
* @param {any[]} items
* @param {*} value
* @returns {*}
* @memberof Main
*/
private getItem(items: any[], value: any, codelist: any): any {
const arr: Array<any> = items.filter(item => {return item.value == value});
if (arr.length !== 1) {
return undefined;
}
if(Object.is(codelist.codelistType,'STATIC')){
return this.$t('codelist.'+codelist.srfkey+'.'+arr[0].value);
}else{
return arr[0].text;
}
}
/**
* 生命周期
*
* @memberof Main
*/
protected created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof Main
*/
protected afterCreated(){
this.setColState();
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('remove', action)) {
this.remove(data);
}
if (Object.is('save', action)) {
this.save(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof Main
*/
protected destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof Main
*/
protected afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
}
/**
* 获取选中行胡数据
*
* @returns {any[]}
* @memberof Main
*/
protected getSelection(): any[] {
return this.selections;
}
/**
* 行双击事件
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected rowDBLClick($event: any): void {
if (!$event || this.actualIsOpenEdit || Object.is(this.gridRowActiveMode,0)) {
return;
}
this.selections = [];
this.selections.push(JSON.parse(JSON.stringify($event)));
const refs: any = this.$refs;
if (refs.multipleTable) {
refs.multipleTable.clearSelection();
refs.multipleTable.toggleRowSelection($event);
}
this.$emit('rowdblclick', this.selections);
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected select($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 复选框数据全部选中
*
* @param {*} $event
* @memberof Main
*/
protected selectAll($event: any): void {
if (!$event) {
return;
}
this.selections = [];
this.selections = [...JSON.parse(JSON.stringify($event))];
this.$emit('selectionchange', this.selections);
}
/**
* 行单击选中
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected rowClick($event: any, ifAlways: boolean = false): void {
if (!ifAlways && (!$event || this.actualIsOpenEdit)) {
return;
}
if(this.stopRowClick) {
this.stopRowClick = false;
return;
}
if(this.isSingleSelect){
this.selections = [];
}
// 已选中则删除,没选中则添加
let selectIndex = this.selections.findIndex((item:any)=>{
return Object.is(item.ibzdictitem,$event.ibzdictitem);
});
if (Object.is(selectIndex,-1)){
this.selections.push(JSON.parse(JSON.stringify($event)));
} else {
this.selections.splice(selectIndex,1);
}
const refs: any = this.$refs;
if (refs.multipleTable) {
if(this.isSingleSelect){
refs.multipleTable.clearSelection();
refs.multipleTable.setCurrentRow($event);
}else{
refs.multipleTable.toggleRowSelection($event);
}
}
this.$emit('selectionchange', this.selections);
}
/**
* 页面变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected pageOnChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.curPage) {
return;
}
this.curPage = $event;
this.load({});
}
/**
* 分页条数变化
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected onPageSizeChange($event: any): void {
if (!$event) {
return;
}
if ($event === this.limit) {
return;
}
this.limit = $event;
if (this.curPage === 1) {
this.load({});
}
}
/**
* 分页刷新
*
* @memberof Main
*/
protected pageRefresh(): void {
this.load({});
}
/**
* 排序变化
*
* @param {{ column: any, prop: any, order: any }} { column, prop, order }
* @memberof Main
*/
protected onSortChange({ column, prop, order }: { column: any, prop: any, order: any }): void {
const dir = Object.is(order, 'ascending') ? 'asc' : Object.is(order, 'descending') ? 'desc' : '';
if (Object.is(dir, this.minorSortDir) && Object.is(this.minorSortPSDEF, prop)) {
return;
}
this.minorSortDir = dir;
this.minorSortPSDEF = prop ? prop : '';
this.load({});
}
/**
* 表格行选中样式
*
* @param {{ row: any, rowIndex: any }} { row, rowIndex }
* @returns {string}
* @memberof Main
*/
protected onRowClassName({ row, rowIndex }: { row: any, rowIndex: any }): string {
const index = this.selections.findIndex((select: any) => Object.is(select.srfkey, row.srfkey));
return index !== -1 ? 'grid-row-select' : '';
}
/**
* 界面行为
*
* @param {*} row
* @param {*} tag
* @param {*} $event
* @memberof Main
*/
protected uiAction(row: any, tag: any, $event: any) {
this.rowClick(row, true);
}
/**
* 设置列状态
*
* @memberof Main
*/
protected setColState() {
const _data: any = localStorage.getItem('ibzdictitem_main_grid');
if (_data) {
let columns = JSON.parse(_data);
columns.forEach((col: any) => {
let column = this.allColumns.find((item) => Object.is(col.name, item.name));
if (column) {
Object.assign(column, col);
}
});
}
}
/**
* 列变化
*
* @memberof Main
*/
protected onColChange() {
localStorage.setItem('ibzdictitem_main_grid', JSON.stringify(this.allColumns));
}
/**
* 获取列状态
*
* @param {string} name
* @returns {boolean}
* @memberof Main
*/
protected getColumnState(name: string): boolean {
let column = this.allColumns.find((col: any) =>
Object.is(name, col.name)
);
return column.show ? true : false;
}
/**
* 表格列是否自适应布局
*
* @readonly
* @type {boolean}
* @memberof Main
*/
get adaptiveState(): boolean {
return !this.allColumns.find((column: any) => column.show && Object.is(column.util, 'STAR'));
}
/**
* 保存
*
* @param {*} $event
* @returns {void}
* @memberof Main
*/
protected save(args: any[], params?: any, $event?: any, xData?: any): void {
let _this = this;
let promises:any = [];
_this.items.forEach((item:any)=>{
if(!item.rowDataState){
return;
} else if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图表格createAction参数未配置' });
return;
}
Object.assign(item,{viewparams:this.viewparams});
promises.push(this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator));
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图表格updateAction参数未配置' });
return;
}
Object.assign(item,{viewparams:this.viewparams});
if(item.ibzdictitem){
Object.assign(this.context,{ibzdictitem:item.ibzdictitem})
}
promises.push(this.service.add(this.updateAction,JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator));
}
});
Promise.all(promises).then((response: any) => {
this.$emit('save', response);
}).catch((response: any) => {
this.$Notice.error({ title: '错误', desc: '系统异常' });
});
}
/**
* 获取对应行class
*
* @param {*} $args row 行数据,rowIndex 行索引
* @returns {void}
* @memberof Main
*/
protected getRowClassName(args:{row: any,rowIndex: number}){
let isSelected = this.selections.some((item:any)=>{
return Object.is(item.ibzdictitem,args.row.ibzdictitem);
});
return isSelected ? "grid-selected-row" : "";
}
}
</script>
<style lang='less'>
@import './main-grid.less';
</style>
\ No newline at end of file
!!!!模版产生代码错误:---- import { Http,Util,Errorlog } from '@/utils';
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? import ControlService from '@/widgets/control-service';
---- import IBZDictItemService from '@/service/ibzdict-item/ibzdict-item-service';
import MainModel from './main-grid-model';
----
FTL stack trace ("~" means nesting-related):
- Failed at: ${appde.getKeyPSAppDEField().getCodeN... [in template "TEMPLCODE_zh_CN" at line 310, column 14] /**
---- * Main 部件服务对象
\ No newline at end of file *
* @export
* @class MainService
*/
export default class MainService extends ControlService {
/**
* 字典项目服务对象
*
* @type {IBZDictItemService}
* @memberof MainService
*/
public appEntityService: IBZDictItemService = new IBZDictItemService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof MainService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of MainService.
*
* @param {*} [opts={}]
* @memberof MainService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new MainModel();
}
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof MainService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof MainService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
return Promise.reject([])
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Data,Context,isloading);
}else{
result =_appEntityService.Update(Data,Context,isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public get(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:0});
}
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public search(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any) => {
const _appEntityService: any = this.appEntityService;
let result: Promise<any>;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
}else{
result =_appEntityService.FetchDefault(Context,Data, isloading);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public loadDraft(action: string, context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
//仿真主键数据
data.itemid = Util.createUUID();
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
//处理返回数据,补充判断标识
if(response.data){
Object.assign(response.data,{srfuf:'0'});
}
this.handleResponse(action, response);
this.mergeDefaults(response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 合并配置的默认值
* @param {*}
* @memberof MainService
*/
public mergeDefaults(response:any = {}){
if(response.data){
}
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof MainService
*/
@Errorlog
public frontLogic(action:string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data,true);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
}
\ No newline at end of file
...@@ -116,20 +116,5 @@ public class IBZDictDTO extends DTOBase implements Serializable { ...@@ -116,20 +116,5 @@ public class IBZDictDTO extends DTOBase implements Serializable {
} }
} }
/**
* [IBZDICTITEM]
*/
private List<IBZDictItemDTO> ibzdictitems = new ArrayList<IBZDictItemDTO>();
@JsonProperty("ibzdictitems")
public List<IBZDictItemDTO> getIbzdictitems(){
return ibzdictitems ;
}
@JsonProperty("ibzdictitems")
public void setIbzdictitems(List <IBZDictItemDTO> ibzdictitems){
this.ibzdictitems = ibzdictitems ;
}
} }
package cn.ibizlab.service.dictapi.resource;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.core.dict.service.dto.IBZDictItemDTO;
import cn.ibizlab.core.dict.domain.IBZDictItem;
import cn.ibizlab.core.dict.service.IIBZDictItemService;
import cn.ibizlab.core.dict.filter.IBZDictItemSearchContext;
import cn.ibizlab.core.dict.service.mapping.IBZDictItemMapping;
import cn.ibizlab.util.log.IBIZLog;
@Slf4j
@IBIZLog
@Api(tags = {"IBZDictItem" })
@RestController
@RequestMapping("")
public class IBZDictItemResource {
@Autowired
private IIBZDictItemService ibzdictitemService;
@ApiOperation(value = "Get", tags = {"IBZDictItem" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdictitems/{ibzdictitem_id}")
public ResponseEntity<IBZDictItemDTO> get(@PathVariable("ibzdictitem_id") String ibzdictitem_id) {
IBZDictItem domain = ibzdictitemService.get(ibzdictitem_id);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "GetDraft", tags = {"IBZDictItem" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdictitems/getdraft")
@Transactional
public ResponseEntity<IBZDictItemDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(new IBZDictItemDTO());
}
//SAVE
@ApiOperation(value = "Save", tags = {"IBZDictItem" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdictitems/{ibzdictitem_id}/save")
public ResponseEntity<Boolean> save(@RequestBody IBZDictItemDTO ibzdictitemdto) {
IBZDictItem ibzdictitem = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
Boolean b = ibzdictitemService.save(ibzdictitem) ;
return ResponseEntity.status(HttpStatus.OK).body(b);
}
@ApiOperation(value = "CheckKey", tags = {"IBZDictItem" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdictitems/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody IBZDictItemDTO ibzdictitemdto) {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "Remove", tags = {"IBZDictItem" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/dictapi/ibzdictitems/{ibzdictitem_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("ibzdictitem_id") String ibzdictitem_id) {
IBZDictItemDTO ibzdictitemdto = new IBZDictItemDTO();
IBZDictItem domain = new IBZDictItem();
ibzdictitemdto.setItemId(ibzdictitem_id);
domain.setItemId(ibzdictitem_id);
Boolean rst = ibzdictitemService.remove(domain.getItemId());
if(rst){
return ResponseEntity.status(HttpStatus.OK).body(rst);
}else{
return ResponseEntity.status(HttpStatus.OK).body(rst);
}
}
@ApiOperation(value = "Create", tags = {"IBZDictItem" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdictitems")
@Transactional
public ResponseEntity<IBZDictItemDTO> create(@RequestBody IBZDictItemDTO ibzdictitemdto) {
IBZDictItem domain = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
ibzdictitemService.create(domain);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Update", tags = {"IBZDictItem" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/dictapi/ibzdictitems/{ibzdictitem_id}")
@Transactional
public ResponseEntity<IBZDictItemDTO> update(@PathVariable("ibzdictitem_id") String ibzdictitem_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
IBZDictItem domain = IBZDictItemMapping.MAPPER.toDomain(ibzdictitemdto);
domain.setItemId(ibzdictitem_id);
ibzdictitemService.update(domain);
IBZDictItemDTO dto = IBZDictItemMapping.MAPPER.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//9
@ApiOperation(value = "获取DEFAULT", tags = {"IBZDictItem" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/dictapi/ibzdictitems/fetchdefault")
public ResponseEntity<List<IBZDictItemDTO>> fetchDefault(IBZDictItemSearchContext context) {
List<IBZDictItemDTO> list = new ArrayList<IBZDictItemDTO>();
Page<IBZDictItem> domains = ibzdictitemService.searchDefault(context) ;
for(IBZDictItem ibzdictitem : domains.getContent()){
IBZDictItemDTO dto =IBZDictItemMapping.MAPPER.toDto(ibzdictitem);
list.add(dto);
}
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf(context.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
.header("x-total", String.valueOf(domains.getTotalElements()))
.body(list);
}
@ApiOperation(value = "Get", tags = {"IBZDictItem" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}")
public ResponseEntity<IBZDictItemDTO> getByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id) {
IBZDictItemDTO dto = new IBZDictItemDTO();
IBZDictItem domain = ibzdictitemService.get(ibzdictitem_id);
dto.fromDO(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "GetDraft", tags = {"IBZDictItem" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitemitemid}/getdraft")
@Transactional
public ResponseEntity<IBZDictItemDTO> getDraftByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//8
IBZDictItem ibzdictitem = ibzdictitemdto.toDO();
ibzdictitem = ibzdictitemService.getDraft(ibzdictitem) ;
ibzdictitemdto.fromDO(ibzdictitem);
return ResponseEntity.status(HttpStatus.OK).body(ibzdictitemdto);
}
@ApiOperation(value = "Save", tags = {"IBZDictItem" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/save")
public ResponseEntity<Boolean> saveByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//6
IBZDictItem domain = ibzdictitemdto.toDO();
domain.setDictId(ibzdict_id);
Boolean b = ibzdictitemService.save(domain) ;
return ResponseEntity.status(HttpStatus.OK).body(b);
}
@ApiOperation(value = "CheckKey", tags = {"IBZDictItem" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/checkkey")
public ResponseEntity<Boolean> checkKeyByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "Remove", tags = {"IBZDictItem" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}")
@Transactional
public ResponseEntity<Boolean> removeByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id) {
IBZDictItem domain = new IBZDictItem();
domain.setItemId(ibzdictitem_id);
Boolean rst = ibzdictitemService.remove(domain.getItemId());
if(rst){
return ResponseEntity.status(HttpStatus.OK).body(rst);
}else{
return ResponseEntity.status(HttpStatus.OK).body(rst);
}
}
@ApiOperation(value = "Create", tags = {"IBZDictItem" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems")
@Transactional
public ResponseEntity<IBZDictItemDTO> createByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//4
IBZDictItemDTO dto = new IBZDictItemDTO();
IBZDictItem domain = ibzdictitemdto.toDO();
domain.setDictId(ibzdict_id);
ibzdictitemService.create(domain);
dto.fromDO(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "Update", tags = {"IBZDictItem" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}")
@Transactional
public ResponseEntity<IBZDictItemDTO> updateByIBZDict(@PathVariable("ibzdict_id") String ibzdict_id, @PathVariable("ibzdictitem_id") String ibzdictitem_id, @RequestBody IBZDictItemDTO ibzdictitemdto) {
//5
IBZDictItem domain = ibzdictitemdto.toDO();
domain.setDictId(ibzdict_id);
domain.setItemId(ibzdictitem_id);
ibzdictitemService.update(domain);
IBZDictItemDTO dto = new IBZDictItemDTO();
dto.fromDO(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//10
@ApiOperation(value = "获取DEFAULT", tags = {"IBZDictItem" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/fetchdefault")
public ResponseEntity<Page<IBZDictItemDTO>> fetchIBZDictItemDefault(@PathVariable("ibzdict_id") String ibzdict_id,IBZDictItemSearchContext context,Pageable pageable ,ServletRequest request) {
context.setPageable(pageable);
List<IBZDictItemDTO> list = new ArrayList<IBZDictItemDTO>();
context.setN_dictid_eq(ibzdict_id);
Page<IBZDictItem> domains = ibzdictitemService.searchDefault(context) ;
for(IBZDictItem ibzdictitem : domains.getContent()){
IBZDictItemDTO dto = new IBZDictItemDTO();
dto.fromDO(ibzdictitem);
list.add(dto);
}
return ResponseEntity.status(HttpStatus.OK).body(new PageImpl(list,context.getPageable(),domains.getTotalElements()));
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册