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

ibizdev提交

上级 35b39874
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
"file-saver": "^2.0.2", "file-saver": "^2.0.2",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"interactjs": "^1.9.4", "interactjs": "^1.9.4",
"moment": "^2.24.0",
"path-to-regexp": "^6.1.0", "path-to-regexp": "^6.1.0",
"qs": "^6.9.1", "qs": "^6.9.1",
"rxjs": "^6.5.4", "rxjs": "^6.5.4",
......
...@@ -66,6 +66,7 @@ import AppColumnLink from './components/app-column-link/app-column-link.vue' ...@@ -66,6 +66,7 @@ import AppColumnLink from './components/app-column-link/app-column-link.vue'
import AppDataUploadView from './components/app-data-upload/app-data-upload.vue' import AppDataUploadView from './components/app-data-upload/app-data-upload.vue'
import DropDownListDynamic from './components/dropdown-list-dynamic/dropdown-list-dynamic.vue' import DropDownListDynamic from './components/dropdown-list-dynamic/dropdown-list-dynamic.vue'
import AppImagePreview from './components/app-image-preview/app-image-preview.vue' import AppImagePreview from './components/app-image-preview/app-image-preview.vue'
import AppFormatData from './components/app-format-data/app-format-data.vue'
// 全局挂载UI实体服务注册中心 // 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister; window['uiServiceRegister'] = uiServiceRegister;
...@@ -141,5 +142,6 @@ export const AppComponents = { ...@@ -141,5 +142,6 @@ export const AppComponents = {
v.component('app-data-upload', AppDataUploadView); v.component('app-data-upload', AppDataUploadView);
v.component('dropdown-list-dynamic', DropDownListDynamic); v.component('dropdown-list-dynamic', DropDownListDynamic);
v.component('app-image-preview', AppImagePreview); v.component('app-image-preview', AppImagePreview);
v.component('app-format-data', AppFormatData);
}, },
}; };
\ No newline at end of file
.app-format-data{
display: inline-block;
}
\ No newline at end of file
<template>
<span class="app-format-data">
{{getcurValue()}}
</span>
</template>
<script lang = 'ts'>
import { Component, Vue, Prop } from 'vue-property-decorator';
import moment from "moment";
@Component({})
export default class AppFormatData extends Vue {
/**
* 格式化正则
*
* @type {string}
* @memberof AppFormatData
*/
@Prop({default:'YYYY-MM-DD HH:mm:ss'}) public format?:string;
/**
* 传入数据
*
* @type {*}
* @memberof AppFormatData
*/
@Prop() public data!:any;
/**
* 显示值
*
* @memberof AppFormatData
*/
getcurValue(){
return moment(this.data).format(this.format);
}
}
</script>
<style lang="less">
@import './app-format-data.less';
</style>
\ No newline at end of file
<template> <template>
<radio-group class="app-radio-group" v-model="selectArray" > <radio-group class="app-radio-group" v-model="value" >
<radio v-for="(_item,index) in items" :key = "index" :label="_item.value" :disabled="isDisabled || _item.disabled"> <radio v-for="(_item,index) in items" :key = "index" :label="_item.value" :disabled="isDisabled || _item.disabled">
<span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+_item.value) : _item.text}}</span> <span>{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+_item.value) : _item.text}}</span>
</radio> </radio>
...@@ -25,39 +25,41 @@ export default class AppRadioGroup extends Vue { ...@@ -25,39 +25,41 @@ export default class AppRadioGroup extends Vue {
* @type {*} * @type {*}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
@Model('change') value?: any; @Model('change') item?: any;
/** /**
* 代码表标识 * 获取值
* *
* @type {string}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
@Prop() public tag?: string; get value() {
return this.item;
}
/** /**
* 代码表类型 * 设置值
* *
* @type {string}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
@Prop() public codelistType?: string; set value(val: any) {
this.$emit('change', val);
}
/** /**
* 代码表值分隔符 * 代码表标识
* *
* @type {string} * @type {string}
* @memberof AppRadioGroup * @memberof AppRadioGroup
*/ */
@Prop({default:';'}) public valueSeparator?: string; @Prop() public tag?: string;
/** /**
* 模式(数字或者字符串) * 代码表类型
* *
* @type {*} * @type {string}
* @memberof AppCheckBox * @memberof AppRadioGroup
*/ */
@Prop({default:'str'}) mode: any; @Prop() public codelistType?: string;
/** /**
* 是否禁用 * 是否禁用
...@@ -113,59 +115,6 @@ export default class AppRadioGroup extends Vue { ...@@ -113,59 +115,6 @@ export default class AppRadioGroup extends Vue {
}) })
} }
} }
/**
* 选中数组
*
* @memberof AppRadioGroup
*/
get selectArray() {
if (this.value) {
if (Object.is(this.mode, 'num') && this.items) {
let selectsArray: Array<any> = [];
let num: number = parseInt(this.value, 10);
this.items.forEach((item: any) => {
if ((num & item.value) == item.value) {
selectsArray.push(item.value);
}
});
return selectsArray;
} else if (Object.is(this.mode, 'str')) {
if (this.value !== '') {
return this.value.split(this.valueSeparator);
}
}
} else {
return [];
}
}
/**
* 设置选中
*
* @memberof AppRadioGroup
*/
set selectArray(val: any) {
let value: null | string | number = null;
if (Object.is(this.mode, 'num')) {
let temp: number = 0;
val.forEach((item: any) => {
temp = temp | parseInt(item, 10);
});
value = temp;
} else if (Object.is(this.mode, 'str')) {
let _datas: string[] = [];
this.items.forEach((item: any) => {
const index = val.findIndex((_key: any) => Object.is(item.value, _key));
if (index === -1) {
return;
}
_datas.push(item.value);
});
value = _datas.join(this.valueSeparator);
}
this.$emit('change', value);
}
} }
</script> </script>
<style lang="less"> <style lang="less">
......
.app-span{
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
overflow: hidden;
}
<template> <template>
<codelist v-if="tag" :tag="tag" :value="value" :codelistType="codelistType" :renderMode="renderMode" :valueSeparator="valueSeparator" :textSeparator="textSeparator"></codelist> <codelist v-if="tag" :tag="tag" :value="value" :codelistType="codelistType" :renderMode="renderMode" :valueSeparator="valueSeparator" :textSeparator="textSeparator"></codelist>
<span v-else >{{text}}</span> <span class="app-span" v-else >{{text}}</span>
</template> </template>
<script lang="ts"> <script lang="ts">
...@@ -39,7 +39,7 @@ export default class DropDownList extends Vue { ...@@ -39,7 +39,7 @@ export default class DropDownList extends Vue {
* @type {boolean} * @type {boolean}
* @memberof SelectPicker * @memberof SelectPicker
*/ */
@Prop() public renderMode?: string; @Prop({default:"STR"}) public renderMode?: string;
/** /**
* 文本分隔符 * 文本分隔符
...@@ -92,12 +92,12 @@ export default class DropDownList extends Vue { ...@@ -92,12 +92,12 @@ export default class DropDownList extends Vue {
} }
/** /**
* 加载代码表 * 处理数据
* *
* @memberof AppSpan * @memberof AppSpan
*/ */
public load(){ public load(){
if(this.tag){ if(!this.value || this.tag){
return; //代码表走codelist组件 return; //代码表走codelist组件
} else if(Object.is(this.editorType,'PICTURE') || Object.is(this.editorType,'PICTURE_ONE') || Object.is(this.editorType,'FILEUPLOADER')){ } else if(Object.is(this.editorType,'PICTURE') || Object.is(this.editorType,'PICTURE_ONE') || Object.is(this.editorType,'FILEUPLOADER')){
let files: any[] = JSON.parse(this.value); let files: any[] = JSON.parse(this.value);
......
...@@ -54,7 +54,7 @@ export default class CodeList extends Vue { ...@@ -54,7 +54,7 @@ export default class CodeList extends Vue {
* @type {boolean} * @type {boolean}
* @memberof SelectPicker * @memberof SelectPicker
*/ */
@Prop() public renderMode?: string; @Prop({default:"STR"}) public renderMode?: string;
/** /**
* 文本分隔符 * 文本分隔符
...@@ -213,5 +213,10 @@ export default class CodeList extends Vue { ...@@ -213,5 +213,10 @@ export default class CodeList extends Vue {
</script> </script>
<style lang='less'> <style lang='less'>
.codelist {
white-space: nowrap;
text-overflow: ellipsis;
word-break: break-all;
overflow: hidden;
}
</style> </style>
\ No newline at end of file
...@@ -156,7 +156,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -156,7 +156,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 获取多项数据 * 获取多项数据
* *
* @returns {any[]} * @returns {any[]}
* @memberof Default * @memberof DefaultBase
*/ */
public getDatas(): any[] { public getDatas(): any[] {
return [this.data]; return [this.data];
...@@ -166,49 +166,25 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -166,49 +166,25 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 获取单项树 * 获取单项树
* *
* @returns {*} * @returns {*}
* @memberof Default * @memberof DefaultBase
*/ */
public getData(): any { public getData(): any {
return this.data; return this.data;
} }
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Default
*/
@Prop({ default: false }) protected autosave?: boolean;
/** /**
* 显示处理提示 * 显示处理提示
* *
* @type {boolean} * @type {boolean}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop({ default: true }) protected showBusyIndicator?: boolean; @Prop({ default: true }) protected showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof Default
*/
@Prop() protected updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Default
*/
@Prop() protected removeAction!: string;
/** /**
* 部件行为--loaddraft * 部件行为--loaddraft
* *
* @type {string} * @type {string}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop() protected loaddraftAction!: string; @Prop() protected loaddraftAction!: string;
...@@ -216,31 +192,15 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -216,31 +192,15 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 部件行为--load * 部件行为--load
* *
* @type {string} * @type {string}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop() protected loadAction!: string; @Prop() protected loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Default
*/
@Prop() protected createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Default
*/
@Prop() protected searchAction!: string;
/** /**
* 视图标识 * 视图标识
* *
* @type {string} * @type {string}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop() protected viewtag!: string; @Prop() protected viewtag!: string;
...@@ -248,7 +208,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -248,7 +208,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 表单状态 * 表单状态
* *
* @type {Subject<any>} * @type {Subject<any>}
* @memberof Default * @memberof DefaultBase
*/ */
protected formState: Subject<any> = new Subject(); protected formState: Subject<any> = new Subject();
...@@ -256,7 +216,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -256,7 +216,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 忽略表单项值变化 * 忽略表单项值变化
* *
* @type {boolean} * @type {boolean}
* @memberof Default * @memberof DefaultBase
*/ */
protected ignorefieldvaluechange: boolean = false; protected ignorefieldvaluechange: boolean = false;
...@@ -265,7 +225,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -265,7 +225,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @type {Subject<any>} * @type {Subject<any>}
* @memberof Default * @memberof DefaultBase
*/ */
private dataChang: Subject<any> = new Subject(); private dataChang: Subject<any> = new Subject();
...@@ -274,7 +234,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -274,7 +234,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @type {(Subscription | undefined)} * @type {(Subscription | undefined)}
* @memberof Default * @memberof DefaultBase
*/ */
private dataChangEvent: Subscription | undefined; private dataChangEvent: Subscription | undefined;
...@@ -283,7 +243,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -283,7 +243,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
private oldData: any = {}; private oldData: any = {};
...@@ -291,7 +251,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -291,7 +251,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 表单数据对象 * 表单数据对象
* *
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected data: any = { protected data: any = {
n_ibzdictitemname_like: null, n_ibzdictitemname_like: null,
...@@ -302,7 +262,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -302,7 +262,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 属性值规则 * 属性值规则
* *
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected rules: any = { protected rules: any = {
n_ibzdictitemname_like: [ n_ibzdictitemname_like: [
...@@ -323,7 +283,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -323,7 +283,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 详情模型集合 * 详情模型集合
* *
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected detailsModel: any = { protected detailsModel: any = {
formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this }) formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
...@@ -339,7 +299,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -339,7 +299,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @param {*} newVal * @param {*} newVal
* @param {*} oldVal * @param {*} oldVal
* @memberof Default * @memberof DefaultBase
*/ */
@Watch('data.n_ibzdictitemname_like') @Watch('data.n_ibzdictitemname_like')
onN_ibzdictitemname_likeChange(newVal: any, oldVal: any) { onN_ibzdictitemname_likeChange(newVal: any, oldVal: any) {
...@@ -351,7 +311,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -351,7 +311,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @param {*} newVal * @param {*} newVal
* @param {*} oldVal * @param {*} oldVal
* @memberof Default * @memberof DefaultBase
*/ */
@Watch('data.n_dictitemval_like') @Watch('data.n_dictitemval_like')
onN_dictitemval_likeChange(newVal: any, oldVal: any) { onN_dictitemval_likeChange(newVal: any, oldVal: any) {
...@@ -364,7 +324,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -364,7 +324,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Default * @memberof DefaultBase
*/ */
private resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
} }
...@@ -374,7 +334,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -374,7 +334,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Default * @memberof DefaultBase
*/ */
private formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
...@@ -389,7 +349,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -389,7 +349,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* @private * @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
private formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) { if (this.ignorefieldvaluechange) {
...@@ -405,7 +365,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -405,7 +365,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {*} [data={}] * @param {*} [data={}]
* @memberof Default * @memberof DefaultBase
*/ */
private onFormLoad(data: any = {}): void { private onFormLoad(data: any = {}): void {
this.setFormEnableCond(data); this.setFormEnableCond(data);
...@@ -417,7 +377,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -417,7 +377,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 值填充 * 值填充
* *
* @param {*} [_datas={}] * @param {*} [_datas={}]
* @memberof Default * @memberof DefaultBase
*/ */
protected fillForm(_datas: any = {}): void { protected fillForm(_datas: any = {}): void {
this.ignorefieldvaluechange = true; this.ignorefieldvaluechange = true;
...@@ -436,7 +396,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -436,7 +396,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @protected * @protected
* @param {*} data * @param {*} data
* @memberof Default * @memberof DefaultBase
*/ */
protected setFormEnableCond(data: any): void { protected setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => { Object.values(this.detailsModel).forEach((detail: any) => {
...@@ -452,7 +412,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -452,7 +412,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 重置草稿表单状态 * 重置草稿表单状态
* *
* @private * @private
* @memberof Default * @memberof DefaultBase
*/ */
private resetDraftFormStates(): void { private resetDraftFormStates(): void {
const form: any = this.$refs.form; const form: any = this.$refs.form;
...@@ -464,7 +424,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -464,7 +424,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* 重置校验结果 * 重置校验结果
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected resetValidates(): void { protected resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => { Object.values(this.detailsModel).forEach((detail: any) => {
...@@ -480,7 +440,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -480,7 +440,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 填充校验结果 (后台) * 填充校验结果 (后台)
* *
* @param {any[]} fieldErrors * @param {any[]} fieldErrors
* @memberof Default * @memberof DefaultBase
*/ */
protected fillValidates(fieldErrors: any[]): void { protected fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => { fieldErrors.forEach((error: any) => {
...@@ -498,7 +458,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -498,7 +458,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 表单校验状态 * 表单校验状态
* *
* @returns {boolean} * @returns {boolean}
* @memberof Default * @memberof DefaultBase
*/ */
protected formValidateStatus(): boolean { protected formValidateStatus(): boolean {
const form: any = this.$refs.searchform; const form: any = this.$refs.searchform;
...@@ -513,7 +473,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -513,7 +473,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 获取全部值 * 获取全部值
* *
* @returns {*} * @returns {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected getValues(): any { protected getValues(): any {
return this.data; return this.data;
...@@ -524,7 +484,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -524,7 +484,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @param {{ name: string, value: any }} $event * @param {{ name: string, value: any }} $event
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected onFormItemValueChange($event: { name: string, value: any }): void { protected onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) { if (!$event) {
...@@ -542,7 +502,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -542,7 +502,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* @param {string} name * @param {string} name
* @param {*} value * @param {*} value
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected setDataItemValue(name: string, value: any): void { protected setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) { if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
...@@ -560,7 +520,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -560,7 +520,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 分组界面行为事件 * 分组界面行为事件
* *
* @param {*} $event * @param {*} $event
* @memberof Default * @memberof DefaultBase
*/ */
protected groupUIActionClick($event: any): void { protected groupUIActionClick($event: any): void {
if (!$event) { if (!$event) {
...@@ -572,7 +532,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -572,7 +532,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* Vue声明周期(处理组件的输入属性) * Vue声明周期(处理组件的输入属性)
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected created(): void { protected created(): void {
this.afterCreated(); this.afterCreated();
...@@ -581,7 +541,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -581,7 +541,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* 执行created后的逻辑 * 执行created后的逻辑
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected afterCreated(){ protected afterCreated(){
if (this.viewState) { if (this.viewState) {
...@@ -598,26 +558,14 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -598,26 +558,14 @@ export default class DefaultBase extends Vue implements ControlInterface {
if (Object.is('loaddraft', action)) { if (Object.is('loaddraft', action)) {
this.loadDraft(data); this.loadDraft(data);
} }
if (Object.is('save', action)) {
this.save(data);
}
}); });
} }
this.dataChang
.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe((data: any) => {
if (this.autosave) {
this.autoSave();
}
});
} }
/** /**
* vue 生命周期 * vue 生命周期
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected destroyed() { protected destroyed() {
this.afterDestroy(); this.afterDestroy();
...@@ -626,7 +574,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -626,7 +574,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* 执行destroyed后的逻辑 * 执行destroyed后的逻辑
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected afterDestroy() { protected afterDestroy() {
if (this.viewStateEvent) { if (this.viewStateEvent) {
...@@ -637,42 +585,12 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -637,42 +585,12 @@ export default class DefaultBase extends Vue implements ControlInterface {
} }
} }
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Default
*/
protected copy(arg: any = {}): void {
this.loadDraft(arg);
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Default
*/
protected refresh(args: any[]): void {
let arg: any = {};
if (this.data.srfkey && !Object.is(this.data.srfkey, '')) {
Object.assign(arg, { srfkey: this.data.srfkey });
this.load(arg);
return;
}
if (this.data.srfkeys && !Object.is(this.data.srfkeys, '')) {
Object.assign(arg, { srfkey: this.data.srfkeys });
this.load(arg);
return;
}
}
/** /**
* 自动加载 * 自动加载
* *
* @param {*} [arg={}] * @param {*} [arg={}]
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected autoLoad(arg: any = {}): void { protected autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) { if (arg.srfkey && !Object.is(arg.srfkey, '')) {
...@@ -693,7 +611,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -693,7 +611,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {*} [opt={}] * @param {*} [opt={}]
* @memberof Default * @memberof DefaultBase
*/ */
private load(opt: any = {}): void { private load(opt: any = {}): void {
if(!this.loadAction){ if(!this.loadAction){
...@@ -730,9 +648,9 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -730,9 +648,9 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 加载草稿 * 加载草稿
* *
* @param {*} [opt={}] * @param {*} [opt={}]
* @memberof Default * @memberof DefaultBase
*/ */
protected loadDraft(opt: any = {}): void { protected loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){ if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图搜索表单loaddraftAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'IBZDictItemGridView视图搜索表单loaddraftAction参数未配置' });
return; return;
...@@ -751,10 +669,6 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -751,10 +669,6 @@ export default class DefaultBase extends Vue implements ControlInterface {
const data = response.data; const data = response.data;
this.resetDraftFormStates(); this.resetDraftFormStates();
this.onFormLoad(data); this.onFormLoad(data);
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
setTimeout(() => { setTimeout(() => {
const form: any = this.$refs.form; const form: any = this.$refs.form;
if (form) { if (form) {
...@@ -765,50 +679,14 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -765,50 +679,14 @@ export default class DefaultBase extends Vue implements ControlInterface {
}); });
} }
}); });
}).catch((response: any) => { if(Object.is(mode,'RESET')){
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof Default
*/
protected autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) { if (!this.formValidateStatus()) {
return; return;
} }
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action,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;
} }
this.$emit('load', data);
const data = response.data;
this.onFormLoad(data);
this.$emit('save', data);
this.$nextTick(() => { this.$nextTick(() => {
this.formState.next({ type: 'save', data: data }); this.formState.next({ type: 'load', data: data });
}); });
}).catch((response: any) => { }).catch((response: any) => {
if (response && response.status === 401) { if (response && response.status === 401) {
...@@ -818,62 +696,10 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -818,62 +696,10 @@ export default class DefaultBase extends Vue implements ControlInterface {
this.$Notice.error({ title: '错误', desc: '系统异常' }); this.$Notice.error({ title: '错误', desc: '系统异常' });
return; return;
} }
});
}
/** const { data: _data } = response;
* 保存 this.$Notice.error({ title: _data.title, desc: _data.message });
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @returns {Promise<any>}
* @memberof Default
*/
protected async save(opt: any = {}, showResultInfo?: boolean): Promise<any> {
showResultInfo = showResultInfo === undefined ? true : false;
if (!this.formValidateStatus()) {
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
this.onFormLoad(data);
this.$emit('save', data);
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;保存成功!' });
}
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);
}); });
})
} }
/** /**
...@@ -884,7 +710,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -884,7 +710,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* @param {string[]} updateDetails 更新项 * @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态 * @param {boolean} [showloading] 是否显示加载状态
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void { protected updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
...@@ -894,28 +720,34 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -894,28 +720,34 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 回车事件 * 回车事件
* *
* @param {*} $event * @param {*} $event
* @memberof Default * @memberof DefaultBase
*/ */
protected onEnter($event: any): void { protected onEnter($event: any): void {
if (!this.formValidateStatus()) {
return;
}
this.$emit('load', this.data); this.$emit('load', this.data);
} }
/** /**
* 搜索 * 搜索
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected onSearch() { protected onSearch() {
if (!this.formValidateStatus()) {
return;
}
this.$emit('load', this.data); this.$emit('load', this.data);
} }
/** /**
* 重置 * 重置
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected onReset() { protected onReset() {
this.loadDraft(); this.loadDraft({},'RESET');
} }
} }
</script> </script>
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
<template v-if="getColumnState('updatedate')"> <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'"> <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}"> <template v-slot="{row,column}">
<span>{{row.updatedate}}</span> <app-format-data format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :data="row.updatedate"></app-format-data>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
......
...@@ -156,7 +156,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -156,7 +156,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 获取多项数据 * 获取多项数据
* *
* @returns {any[]} * @returns {any[]}
* @memberof Default * @memberof DefaultBase
*/ */
public getDatas(): any[] { public getDatas(): any[] {
return [this.data]; return [this.data];
...@@ -166,49 +166,25 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -166,49 +166,25 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 获取单项树 * 获取单项树
* *
* @returns {*} * @returns {*}
* @memberof Default * @memberof DefaultBase
*/ */
public getData(): any { public getData(): any {
return this.data; return this.data;
} }
/**
* 是否默认保存
*
* @type {boolean}
* @memberof Default
*/
@Prop({ default: false }) protected autosave?: boolean;
/** /**
* 显示处理提示 * 显示处理提示
* *
* @type {boolean} * @type {boolean}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop({ default: true }) protected showBusyIndicator?: boolean; @Prop({ default: true }) protected showBusyIndicator?: boolean;
/**
* 部件行为--update
*
* @type {string}
* @memberof Default
*/
@Prop() protected updateAction!: string;
/**
* 部件行为--remove
*
* @type {string}
* @memberof Default
*/
@Prop() protected removeAction!: string;
/** /**
* 部件行为--loaddraft * 部件行为--loaddraft
* *
* @type {string} * @type {string}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop() protected loaddraftAction!: string; @Prop() protected loaddraftAction!: string;
...@@ -216,31 +192,15 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -216,31 +192,15 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 部件行为--load * 部件行为--load
* *
* @type {string} * @type {string}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop() protected loadAction!: string; @Prop() protected loadAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Default
*/
@Prop() protected createAction!: string;
/**
* 部件行为--create
*
* @type {string}
* @memberof Default
*/
@Prop() protected searchAction!: string;
/** /**
* 视图标识 * 视图标识
* *
* @type {string} * @type {string}
* @memberof Default * @memberof DefaultBase
*/ */
@Prop() protected viewtag!: string; @Prop() protected viewtag!: string;
...@@ -248,7 +208,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -248,7 +208,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 表单状态 * 表单状态
* *
* @type {Subject<any>} * @type {Subject<any>}
* @memberof Default * @memberof DefaultBase
*/ */
protected formState: Subject<any> = new Subject(); protected formState: Subject<any> = new Subject();
...@@ -256,7 +216,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -256,7 +216,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 忽略表单项值变化 * 忽略表单项值变化
* *
* @type {boolean} * @type {boolean}
* @memberof Default * @memberof DefaultBase
*/ */
protected ignorefieldvaluechange: boolean = false; protected ignorefieldvaluechange: boolean = false;
...@@ -265,7 +225,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -265,7 +225,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @type {Subject<any>} * @type {Subject<any>}
* @memberof Default * @memberof DefaultBase
*/ */
private dataChang: Subject<any> = new Subject(); private dataChang: Subject<any> = new Subject();
...@@ -274,7 +234,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -274,7 +234,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @type {(Subscription | undefined)} * @type {(Subscription | undefined)}
* @memberof Default * @memberof DefaultBase
*/ */
private dataChangEvent: Subscription | undefined; private dataChangEvent: Subscription | undefined;
...@@ -283,7 +243,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -283,7 +243,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
private oldData: any = {}; private oldData: any = {};
...@@ -291,7 +251,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -291,7 +251,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 表单数据对象 * 表单数据对象
* *
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected data: any = { protected data: any = {
n_ibzdictid_like: null, n_ibzdictid_like: null,
...@@ -302,7 +262,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -302,7 +262,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 属性值规则 * 属性值规则
* *
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected rules: any = { protected rules: any = {
n_ibzdictid_like: [ n_ibzdictid_like: [
...@@ -323,7 +283,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -323,7 +283,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 详情模型集合 * 详情模型集合
* *
* @type {*} * @type {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected detailsModel: any = { protected detailsModel: any = {
formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this }) formpage1: new FormPageModel({ caption: '常规条件', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
...@@ -339,7 +299,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -339,7 +299,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @param {*} newVal * @param {*} newVal
* @param {*} oldVal * @param {*} oldVal
* @memberof Default * @memberof DefaultBase
*/ */
@Watch('data.n_ibzdictid_like') @Watch('data.n_ibzdictid_like')
onN_ibzdictid_likeChange(newVal: any, oldVal: any) { onN_ibzdictid_likeChange(newVal: any, oldVal: any) {
...@@ -351,7 +311,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -351,7 +311,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @param {*} newVal * @param {*} newVal
* @param {*} oldVal * @param {*} oldVal
* @memberof Default * @memberof DefaultBase
*/ */
@Watch('data.n_ibzdictname_like') @Watch('data.n_ibzdictname_like')
onN_ibzdictname_likeChange(newVal: any, oldVal: any) { onN_ibzdictname_likeChange(newVal: any, oldVal: any) {
...@@ -364,7 +324,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -364,7 +324,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Default * @memberof DefaultBase
*/ */
private resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
} }
...@@ -374,7 +334,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -374,7 +334,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof Default * @memberof DefaultBase
*/ */
private formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
...@@ -389,7 +349,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -389,7 +349,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* @private * @private
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal } * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
private formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void { private formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) { if (this.ignorefieldvaluechange) {
...@@ -405,7 +365,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -405,7 +365,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {*} [data={}] * @param {*} [data={}]
* @memberof Default * @memberof DefaultBase
*/ */
private onFormLoad(data: any = {}): void { private onFormLoad(data: any = {}): void {
this.setFormEnableCond(data); this.setFormEnableCond(data);
...@@ -417,7 +377,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -417,7 +377,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 值填充 * 值填充
* *
* @param {*} [_datas={}] * @param {*} [_datas={}]
* @memberof Default * @memberof DefaultBase
*/ */
protected fillForm(_datas: any = {}): void { protected fillForm(_datas: any = {}): void {
this.ignorefieldvaluechange = true; this.ignorefieldvaluechange = true;
...@@ -436,7 +396,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -436,7 +396,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @protected * @protected
* @param {*} data * @param {*} data
* @memberof Default * @memberof DefaultBase
*/ */
protected setFormEnableCond(data: any): void { protected setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => { Object.values(this.detailsModel).forEach((detail: any) => {
...@@ -452,7 +412,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -452,7 +412,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 重置草稿表单状态 * 重置草稿表单状态
* *
* @private * @private
* @memberof Default * @memberof DefaultBase
*/ */
private resetDraftFormStates(): void { private resetDraftFormStates(): void {
const form: any = this.$refs.form; const form: any = this.$refs.form;
...@@ -464,7 +424,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -464,7 +424,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* 重置校验结果 * 重置校验结果
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected resetValidates(): void { protected resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => { Object.values(this.detailsModel).forEach((detail: any) => {
...@@ -480,7 +440,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -480,7 +440,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 填充校验结果 (后台) * 填充校验结果 (后台)
* *
* @param {any[]} fieldErrors * @param {any[]} fieldErrors
* @memberof Default * @memberof DefaultBase
*/ */
protected fillValidates(fieldErrors: any[]): void { protected fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => { fieldErrors.forEach((error: any) => {
...@@ -498,7 +458,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -498,7 +458,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 表单校验状态 * 表单校验状态
* *
* @returns {boolean} * @returns {boolean}
* @memberof Default * @memberof DefaultBase
*/ */
protected formValidateStatus(): boolean { protected formValidateStatus(): boolean {
const form: any = this.$refs.searchform; const form: any = this.$refs.searchform;
...@@ -513,7 +473,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -513,7 +473,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 获取全部值 * 获取全部值
* *
* @returns {*} * @returns {*}
* @memberof Default * @memberof DefaultBase
*/ */
protected getValues(): any { protected getValues(): any {
return this.data; return this.data;
...@@ -524,7 +484,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -524,7 +484,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @param {{ name: string, value: any }} $event * @param {{ name: string, value: any }} $event
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected onFormItemValueChange($event: { name: string, value: any }): void { protected onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) { if (!$event) {
...@@ -542,7 +502,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -542,7 +502,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* @param {string} name * @param {string} name
* @param {*} value * @param {*} value
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected setDataItemValue(name: string, value: any): void { protected setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) { if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
...@@ -560,7 +520,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -560,7 +520,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 分组界面行为事件 * 分组界面行为事件
* *
* @param {*} $event * @param {*} $event
* @memberof Default * @memberof DefaultBase
*/ */
protected groupUIActionClick($event: any): void { protected groupUIActionClick($event: any): void {
if (!$event) { if (!$event) {
...@@ -572,7 +532,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -572,7 +532,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* Vue声明周期(处理组件的输入属性) * Vue声明周期(处理组件的输入属性)
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected created(): void { protected created(): void {
this.afterCreated(); this.afterCreated();
...@@ -581,7 +541,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -581,7 +541,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* 执行created后的逻辑 * 执行created后的逻辑
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected afterCreated(){ protected afterCreated(){
if (this.viewState) { if (this.viewState) {
...@@ -598,26 +558,14 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -598,26 +558,14 @@ export default class DefaultBase extends Vue implements ControlInterface {
if (Object.is('loaddraft', action)) { if (Object.is('loaddraft', action)) {
this.loadDraft(data); this.loadDraft(data);
} }
if (Object.is('save', action)) {
this.save(data);
}
}); });
} }
this.dataChang
.pipe(
debounceTime(300),
distinctUntilChanged()
).subscribe((data: any) => {
if (this.autosave) {
this.autoSave();
}
});
} }
/** /**
* vue 生命周期 * vue 生命周期
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected destroyed() { protected destroyed() {
this.afterDestroy(); this.afterDestroy();
...@@ -626,7 +574,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -626,7 +574,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
/** /**
* 执行destroyed后的逻辑 * 执行destroyed后的逻辑
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected afterDestroy() { protected afterDestroy() {
if (this.viewStateEvent) { if (this.viewStateEvent) {
...@@ -637,42 +585,12 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -637,42 +585,12 @@ export default class DefaultBase extends Vue implements ControlInterface {
} }
} }
/**
* 拷贝内容
*
* @param {*} [arg={}]
* @memberof @memberof Default
*/
protected copy(arg: any = {}): void {
this.loadDraft(arg);
}
/**
* 部件刷新
*
* @param {any[]} args
* @memberof Default
*/
protected refresh(args: any[]): void {
let arg: any = {};
if (this.data.srfkey && !Object.is(this.data.srfkey, '')) {
Object.assign(arg, { srfkey: this.data.srfkey });
this.load(arg);
return;
}
if (this.data.srfkeys && !Object.is(this.data.srfkeys, '')) {
Object.assign(arg, { srfkey: this.data.srfkeys });
this.load(arg);
return;
}
}
/** /**
* 自动加载 * 自动加载
* *
* @param {*} [arg={}] * @param {*} [arg={}]
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected autoLoad(arg: any = {}): void { protected autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) { if (arg.srfkey && !Object.is(arg.srfkey, '')) {
...@@ -693,7 +611,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -693,7 +611,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* *
* @private * @private
* @param {*} [opt={}] * @param {*} [opt={}]
* @memberof Default * @memberof DefaultBase
*/ */
private load(opt: any = {}): void { private load(opt: any = {}): void {
if(!this.loadAction){ if(!this.loadAction){
...@@ -730,9 +648,9 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -730,9 +648,9 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 加载草稿 * 加载草稿
* *
* @param {*} [opt={}] * @param {*} [opt={}]
* @memberof Default * @memberof DefaultBase
*/ */
protected loadDraft(opt: any = {}): void { protected loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){ if(!this.loaddraftAction){
this.$Notice.error({ title: '错误', desc: 'IBZDictGridView视图搜索表单loaddraftAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'IBZDictGridView视图搜索表单loaddraftAction参数未配置' });
return; return;
...@@ -751,10 +669,6 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -751,10 +669,6 @@ export default class DefaultBase extends Vue implements ControlInterface {
const data = response.data; const data = response.data;
this.resetDraftFormStates(); this.resetDraftFormStates();
this.onFormLoad(data); this.onFormLoad(data);
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
setTimeout(() => { setTimeout(() => {
const form: any = this.$refs.form; const form: any = this.$refs.form;
if (form) { if (form) {
...@@ -765,50 +679,14 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -765,50 +679,14 @@ export default class DefaultBase extends Vue implements ControlInterface {
}); });
} }
}); });
}).catch((response: any) => { if(Object.is(mode,'RESET')){
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: '错误', desc: '系统异常' });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 自动保存
*
* @param {*} [opt={}]
* @memberof Default
*/
protected autoSave(opt: any = {}): void {
if (!this.formValidateStatus()) { if (!this.formValidateStatus()) {
return; return;
} }
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action,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;
} }
this.$emit('load', data);
const data = response.data;
this.onFormLoad(data);
this.$emit('save', data);
this.$nextTick(() => { this.$nextTick(() => {
this.formState.next({ type: 'save', data: data }); this.formState.next({ type: 'load', data: data });
}); });
}).catch((response: any) => { }).catch((response: any) => {
if (response && response.status === 401) { if (response && response.status === 401) {
...@@ -818,62 +696,10 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -818,62 +696,10 @@ export default class DefaultBase extends Vue implements ControlInterface {
this.$Notice.error({ title: '错误', desc: '系统异常' }); this.$Notice.error({ title: '错误', desc: '系统异常' });
return; return;
} }
});
}
/** const { data: _data } = response;
* 保存 this.$Notice.error({ title: _data.title, desc: _data.message });
*
* @param {*} [opt={}]
* @param {boolean} [showResultInfo]
* @returns {Promise<any>}
* @memberof Default
*/
protected async save(opt: any = {}, showResultInfo?: boolean): Promise<any> {
showResultInfo = showResultInfo === undefined ? true : false;
if (!this.formValidateStatus()) {
this.$Notice.error({ title: '错误', desc: '值规则校验异常' });
return;
}
const arg: any = { ...opt };
const data = this.getValues();
Object.assign(arg, data);
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
Object.assign(arg,{viewparams:this.viewparams});
const post: Promise<any> = this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
return new Promise((resolve: any, reject: any) => {
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: '错误', desc: response.errorMessage });
}
return;
}
const data = response.data;
this.onFormLoad(data);
this.$emit('save', data);
this.$nextTick(() => {
this.formState.next({ type: 'save', data: data });
});
if (showResultInfo) {
this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;保存成功!' });
}
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);
}); });
})
} }
/** /**
...@@ -884,7 +710,7 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -884,7 +710,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
* @param {string[]} updateDetails 更新项 * @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态 * @param {boolean} [showloading] 是否显示加载状态
* @returns {void} * @returns {void}
* @memberof Default * @memberof DefaultBase
*/ */
protected updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void { protected updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
...@@ -894,28 +720,34 @@ export default class DefaultBase extends Vue implements ControlInterface { ...@@ -894,28 +720,34 @@ export default class DefaultBase extends Vue implements ControlInterface {
* 回车事件 * 回车事件
* *
* @param {*} $event * @param {*} $event
* @memberof Default * @memberof DefaultBase
*/ */
protected onEnter($event: any): void { protected onEnter($event: any): void {
if (!this.formValidateStatus()) {
return;
}
this.$emit('load', this.data); this.$emit('load', this.data);
} }
/** /**
* 搜索 * 搜索
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected onSearch() { protected onSearch() {
if (!this.formValidateStatus()) {
return;
}
this.$emit('load', this.data); this.$emit('load', this.data);
} }
/** /**
* 重置 * 重置
* *
* @memberof Default * @memberof DefaultBase
*/ */
protected onReset() { protected onReset() {
this.loadDraft(); this.loadDraft({},'RESET');
} }
} }
</script> </script>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<template v-if="getColumnState('updatedate')"> <template v-if="getColumnState('updatedate')">
<el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('ibzdict.main_grid.columns.updatedate')" :width="250" :align="'left'" :sortable="'custom'"> <el-table-column show-overflow-tooltip :prop="'updatedate'" :label="$t('ibzdict.main_grid.columns.updatedate')" :width="250" :align="'left'" :sortable="'custom'">
<template v-slot="{row,column}"> <template v-slot="{row,column}">
<span>{{row.updatedate}}</span> <app-format-data format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :data="row.updatedate"></app-format-data>
</template> </template>
</el-table-column> </el-table-column>
</template> </template>
......
...@@ -6965,7 +6965,7 @@ mockjs@^1.1.0: ...@@ -6965,7 +6965,7 @@ mockjs@^1.1.0:
dependencies: dependencies:
commander "*" commander "*"
moment@2.24.0: moment@2.24.0, moment@^2.24.0:
version "2.24.0" version "2.24.0"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
......
...@@ -23,13 +23,17 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -23,13 +23,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IIBZDictItemService extends IService<IBZDictItem>{ public interface IIBZDictItemService extends IService<IBZDictItem>{
IBZDictItem get(String itemId) ; IBZDictItem get(String key) ;
IBZDictItem get(IBZDictItem iBZDictItem) ; IBZDictItem getDraft(IBZDictItem et) ;
IBZDictItem getDraft(IBZDictItem iBZDictItem) ; boolean save(IBZDictItem et) ;
boolean checkKey(IBZDictItem iBZDictItem) ; void saveBatch(List<IBZDictItem> list, int batchSize) ;
boolean remove(String itemId) ; boolean checkKey(IBZDictItem et) ;
boolean create(IBZDictItem iBZDictItem) ; boolean Remove(String key) ;
boolean update(IBZDictItem iBZDictItem) ; void removeBatch(Collection<String> idList, int batchSize) ;
boolean create(IBZDictItem et) ;
void createBatch(List<IBZDictItem> list, int batchSize) ;
boolean update(IBZDictItem et) ;
void updateBatch(List<IBZDictItem> list, int batchSize) ;
Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) ; Page<IBZDictItem> searchDefault(IBZDictItemSearchContext context) ;
} }
......
...@@ -23,13 +23,17 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -23,13 +23,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface IIBZDictService extends IService<IBZDict>{ public interface IIBZDictService extends IService<IBZDict>{
IBZDict get(String dictId) ; IBZDict get(String key) ;
IBZDict get(IBZDict iBZDict) ; boolean create(IBZDict et) ;
boolean create(IBZDict iBZDict) ; void createBatch(List<IBZDict> list, int batchSize) ;
boolean checkKey(IBZDict iBZDict) ; boolean checkKey(IBZDict et) ;
IBZDict getDraft(IBZDict iBZDict) ; IBZDict getDraft(IBZDict et) ;
boolean update(IBZDict iBZDict) ; boolean update(IBZDict et) ;
boolean remove(String dictId) ; void updateBatch(List<IBZDict> list, int batchSize) ;
boolean Remove(String key) ;
void removeBatch(Collection<String> idList, int batchSize) ;
boolean save(IBZDict et) ;
void saveBatch(List<IBZDict> list, int batchSize) ;
Page<IBZDict> searchDefault(IBZDictSearchContext context) ; Page<IBZDict> searchDefault(IBZDictSearchContext context) ;
} }
......
...@@ -44,25 +44,24 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi ...@@ -44,25 +44,24 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
@Override @Override
@Transactional @Transactional
public IBZDictItem get(String itemid) { public IBZDictItem get(String key) {
IBZDictItem ibzdictitem = getById(itemid); IBZDictItem et = getById(key);
return ibzdictitem; if(et==null)
{
et=new IBZDictItem();
et.setItemid(key);
} }
return et;
@Override
@Transactional
public IBZDictItem get(IBZDictItem ibzdictitem) {
return null ;
} }
@Override @Override
public IBZDictItem getDraft(IBZDictItem ibzdictitem) { public IBZDictItem getDraft(IBZDictItem et) {
return ibzdictitem; return et;
} }
@Override @Override
public boolean checkKey(IBZDictItem ibzdictitem) { public boolean checkKey(IBZDictItem et) {
return true; return true;
} }
@Override @Override
...@@ -75,17 +74,17 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi ...@@ -75,17 +74,17 @@ public class IBZDictItemServiceImpl extends ServiceImpl<IBZDictItemMapper, IBZDi
} }
@Override @Override
@Transactional @Transactional
public boolean create(IBZDictItem ibzdictitem) { public boolean create(IBZDictItem et) {
boolean bOk = false ; boolean ret = this.retBool(this.baseMapper.insert(et));
bOk = save(ibzdictitem); if(!ret) return ret;
return bOk ; return ret ;
} }
@Override @Override
@Transactional @Transactional
public boolean update(IBZDictItem ibzdictitem) { public boolean update(IBZDictItem et) {
boolean bOk = false ; boolean bOk = false ;
bOk = update(ibzdictitem, (Wrapper)ibzdictitem.getUpdateWrapper(true).eq("ibzdictitemid",ibzdictitem.getItemId())); bOk = update(et, (Wrapper)et.getUpdateWrapper(true).eq("ibzdictitemid",et.getItemId()));
return bOk ; return bOk ;
} }
......
...@@ -44,39 +44,47 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl ...@@ -44,39 +44,47 @@ public class IBZDictServiceImpl extends ServiceImpl<IBZDictMapper, IBZDict> impl
@Override @Override
@Transactional @Transactional
public IBZDict get(String dictid) { public IBZDict get(String key) {
IBZDict ibzdict = getById(dictid); IBZDict et = getById(key);
return ibzdict; if(et==null)
{
et=new IBZDict();
et.setDictid(key);
} }
return et;
@Override
@Transactional
public IBZDict get(IBZDict ibzdict) {
return null ;
} }
@Override @Override
@Transactional @Transactional
public boolean create(IBZDict ibzdict) { public boolean create(IBZDict et) {
boolean bOk = false ; boolean ret = this.retBool(this.baseMapper.insert(et));
bOk = save(ibzdict); if(!ret) return ret;
return bOk ; //嵌套[字典项目]
if(et.getItems()!=null){
for (cn.ibizlab.core.dict.domain.IBZDictItem sub: et.getItems()) {
sub.setDictid(et.getDictid())
}
if(et.getItems().size()>0)
ibzdictitemService.createBatch(sub,500) ;
et.setItems(null);
}
return ret ;
} }
@Override @Override
public boolean checkKey(IBZDict ibzdict) { public boolean checkKey(IBZDict et) {
return true; return true;
} }
@Override @Override
public IBZDict getDraft(IBZDict ibzdict) { public IBZDict getDraft(IBZDict et) {
return ibzdict; return et;
} }
@Override @Override
@Transactional @Transactional
public boolean update(IBZDict ibzdict) { public boolean update(IBZDict et) {
boolean bOk = false ; boolean bOk = false ;
bOk = update(ibzdict, (Wrapper)ibzdict.getUpdateWrapper(true).eq("ibzdictid",ibzdict.getDictId())); bOk = update(et, (Wrapper)et.getUpdateWrapper(true).eq("ibzdictid",et.getDictId()));
return bOk ; return bOk ;
} }
@Override @Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册