main-form-base.vue 59.6 KB
Newer Older
ibizdev's avatar
ibizdev committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
<template>
    <i-form :model="this.data" class='app-form' ref='form'  id='form' style="">
    <input style="display:none;" />
    <row >
            
<i-col v-show="detailsModel.orgcode.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='orgcode' :itemRules="this.rules.orgcode" class='' :caption="$t('entities.ibzorganization.main_form.details.orgcode')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgcode.error" :isEmptyCaption="false" labelPos="LEFT">
    <input-box v-model="data.orgcode"  @enter="onEnter($event)"   unit=""  :disabled="detailsModel.orgcode.disabled" type='text'  style=""></input-box>
</app-form-item>

</i-col>
<i-col v-show="detailsModel.orgname.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='orgname' :itemRules="this.rules.orgname" class='' :caption="$t('entities.ibzorganization.main_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT">
    <input-box v-model="data.orgname"  @enter="onEnter($event)"   unit=""  :disabled="detailsModel.orgname.disabled" type='text'  style=""></input-box>
</app-form-item>

</i-col>
<i-col v-show="detailsModel.porgname.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='porgname' :itemRules="this.rules.porgname" class='' :caption="$t('entities.ibzorganization.main_form.details.porgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.porgname.error" :isEmptyCaption="false" labelPos="LEFT">
    <app-picker 
  :formState="formState"
  :data="data"
  :context="context"
  :viewparams="viewparams"
  :itemParam='{ }' 
  :disabled="detailsModel.porgname.disabled"
  name='porgname'
  deMajorField='orgname'
  deKeyField='ibzorganization'
  :service="service"
  :acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
  valueitem='porgid' 
  :value="data.porgname" 
  editortype="" 
  :pickupView="{ viewname: 'ibzorganization-pickup-view', title: $t('entities.ibzorganization.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
  style=""  
  @formitemvaluechange="onFormItemValueChange">
</app-picker>

</app-form-item>

</i-col>
<i-col v-show="detailsModel.orglevel.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='orglevel' :itemRules="this.rules.orglevel" class='' :caption="$t('entities.ibzorganization.main_form.details.orglevel')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orglevel.error" :isEmptyCaption="false" labelPos="LEFT">
    <input-box v-model="data.orglevel"  @enter="onEnter($event)"   unit=""  :disabled="detailsModel.orglevel.disabled" type='number'  style=""></input-box>
</app-form-item>

</i-col>
<i-col v-show="detailsModel.shortname.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='shortname' :itemRules="this.rules.shortname" class='' :caption="$t('entities.ibzorganization.main_form.details.shortname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.shortname.error" :isEmptyCaption="false" labelPos="LEFT">
    <input-box v-model="data.shortname"  @enter="onEnter($event)"   unit=""  :disabled="detailsModel.shortname.disabled" type='text'  style=""></input-box>
</app-form-item>

</i-col>
<i-col v-show="detailsModel.showorder.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='showorder' :itemRules="this.rules.showorder" class='' :caption="$t('entities.ibzorganization.main_form.details.showorder')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.showorder.error" :isEmptyCaption="false" labelPos="LEFT">
    <input-box v-model="data.showorder"  @enter="onEnter($event)"   unit=""  :disabled="detailsModel.showorder.disabled" type='number'  style=""></input-box>
</app-form-item>

</i-col>
<i-col v-show="detailsModel.createdate.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='createdate' :itemRules="this.rules.createdate" class='' :caption="$t('entities.ibzorganization.main_form.details.createdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createdate.error" :isEmptyCaption="false" labelPos="LEFT">
    <app-span   name='createdate'
:value="data.createdate" style=""></app-span>
</app-form-item>

</i-col>
<i-col v-show="detailsModel.updatedate.visible" :style="{}"  :lg="{ span: 24, offset: 0 }">
    <app-form-item name='updatedate' :itemRules="this.rules.updatedate" class='' :caption="$t('entities.ibzorganization.main_form.details.updatedate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updatedate.error" :isEmptyCaption="false" labelPos="LEFT">
    <app-span   name='updatedate'
:value="data.updatedate" style=""></app-span>
</app-form-item>

</i-col>


    </row>
</i-form>
</template>

<script lang='tsx'>
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 IBZOrganizationService from '@/service/ibzorganization/ibzorganization-service';
import MainService from './main-form-service';

import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';


@Component({
    components: {
      
    }
})
export default class MainBase extends Vue implements ControlInterface {

    /**
     * 名称
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
107
    @Prop() public name?: string;
ibizdev's avatar
ibizdev committed
108 109 110 111 112 113 114

    /**
     * 视图通讯对象
     *
     * @type {Subject<ViewState>}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
115
    @Prop() public viewState!: Subject<ViewState>;
ibizdev's avatar
ibizdev committed
116 117 118 119 120 121 122

    /**
     * 应用上下文
     *
     * @type {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
123
    @Prop() public context: any;
ibizdev's avatar
ibizdev committed
124 125 126 127 128 129 130

    /**
     * 视图参数
     *
     * @type {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
131
    @Prop() public viewparams: any;
ibizdev's avatar
ibizdev committed
132 133 134 135

    /**
     * 视图状态事件
     *
ibizdev's avatar
ibizdev committed
136
     * @public
ibizdev's avatar
ibizdev committed
137 138 139
     * @type {(Subscription | undefined)}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
140
    public viewStateEvent: Subscription | undefined;
ibizdev's avatar
ibizdev committed
141 142 143 144 145 146 147

    /**
     * 获取部件类型
     *
     * @returns {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
148
    public getControlType(): string {
ibizdev's avatar
ibizdev committed
149 150 151 152 153 154 155 156 157 158 159
        return 'FORM'
    }



    /**
     * 计数器服务对象集合
     *
     * @type {Array<*>}
     * @memberof Main
     */    
ibizdev's avatar
ibizdev committed
160
    public counterServiceArray:Array<any> = [];
ibizdev's avatar
ibizdev committed
161 162 163 164 165 166 167

    /**
     * 建构部件服务对象
     *
     * @type {MainService}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
168
    public service: MainService = new MainService({ $store: this.$store });
ibizdev's avatar
ibizdev committed
169 170 171 172 173 174 175

    /**
     * 实体服务对象
     *
     * @type {IBZOrganizationService}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
176
    public appEntityService: IBZOrganizationService = new IBZOrganizationService({ $store: this.$store });
ibizdev's avatar
ibizdev committed
177 178 179 180 181 182 183 184 185
    


    /**
     * 关闭视图
     *
     * @param {any} args
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
186
    public closeView(args: any): void {
ibizdev's avatar
ibizdev committed
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234
        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();
                }
            })
        }
    }


    
    /**
     * 获取多项数据
     *
     * @returns {any[]}
     * @memberof Main
     */
    public getDatas(): any[] {
        return [this.data];
    }

    /**
     * 获取单项树
     *
     * @returns {*}
     * @memberof Main
     */
    public getData(): any {
        return this.data;
    }

    /**
     * 是否默认保存
     *
     * @type {boolean}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
235
    @Prop({ default: false }) public autosave?: boolean;
ibizdev's avatar
ibizdev committed
236 237 238 239 240 241 242

    /**
     * 显示处理提示
     *
     * @type {boolean}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
243
    @Prop({ default: true }) public showBusyIndicator?: boolean;
ibizdev's avatar
ibizdev committed
244 245 246 247 248 249 250

    /**
     * 部件行为--submit
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
251
    @Prop() public WFSubmitAction!: string;
ibizdev's avatar
ibizdev committed
252 253 254 255 256 257 258
    
    /**
     * 部件行为--start
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
259
    @Prop() public WFStartAction!: string;
ibizdev's avatar
ibizdev committed
260 261 262 263 264 265 266
    
    /**
     * 部件行为--update
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
267
    @Prop() public updateAction!: string;
ibizdev's avatar
ibizdev committed
268 269 270 271 272 273 274
    
    /**
     * 部件行为--remove
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
275
    @Prop() public removeAction!: string;
ibizdev's avatar
ibizdev committed
276 277 278 279 280 281 282
    
    /**
     * 部件行为--loaddraft
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
283
    @Prop() public loaddraftAction!: string;
ibizdev's avatar
ibizdev committed
284 285 286 287 288 289 290
    
    /**
     * 部件行为--load
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
291
    @Prop() public loadAction!: string;
ibizdev's avatar
ibizdev committed
292 293 294 295 296 297 298
    
    /**
     * 部件行为--create
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
299
    @Prop() public createAction!: string;
ibizdev's avatar
ibizdev committed
300 301 302 303 304 305 306

    /**
     * 部件行为--create
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
307
    @Prop() public searchAction!: string;
ibizdev's avatar
ibizdev committed
308 309 310 311 312 313 314

    /**
     * 视图标识
     *
     * @type {string}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
315
    @Prop() public viewtag!: string;
ibizdev's avatar
ibizdev committed
316 317 318 319 320 321 322

    /**
     * 表单状态
     *
     * @type {Subject<any>}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
323
    public formState: Subject<any> = new Subject();
ibizdev's avatar
ibizdev committed
324 325 326 327 328 329 330

    /**
     * 忽略表单项值变化
     *
     * @type {boolean}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
331
    public ignorefieldvaluechange: boolean = false;
ibizdev's avatar
ibizdev committed
332 333 334 335

    /**
     * 数据变化
     *
ibizdev's avatar
ibizdev committed
336
     * @public
ibizdev's avatar
ibizdev committed
337 338 339
     * @type {Subject<any>}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
340
    public dataChang: Subject<any> = new Subject();
ibizdev's avatar
ibizdev committed
341 342 343 344

    /**
     * 视图状态事件
     *
ibizdev's avatar
ibizdev committed
345
     * @public
ibizdev's avatar
ibizdev committed
346 347 348
     * @type {(Subscription | undefined)}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
349
    public dataChangEvent: Subscription | undefined;
ibizdev's avatar
ibizdev committed
350 351 352 353

    /**
     * 原始数据
     *
ibizdev's avatar
ibizdev committed
354
     * @public
ibizdev's avatar
ibizdev committed
355 356 357
     * @type {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
358
    public oldData: any = {};
ibizdev's avatar
ibizdev committed
359 360 361 362 363 364 365

    /**
     * 表单数据对象
     *
     * @type {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
366
    public data: any = {
ibizdev's avatar
ibizdev committed
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
        srfupdatedate: null,
        srforikey: null,
        srfkey: null,
        srfmajortext: null,
        srftempmode: null,
        srfuf: null,
        srfdeid: null,
        srfsourcekey: null,
        orgid: null,
        orgcode: null,
        orgname: null,
        porgname: null,
        orglevel: null,
        shortname: null,
        showorder: null,
        createdate: null,
        updatedate: null,
        porgid: null,
        ibzorganization:null,
    };

    /**
      * 当前执行的行为逻辑
      *
      * @type {string}
      * @memberof Main
      */
ibizdev's avatar
ibizdev committed
394
    public currentAction: string = "";
ibizdev's avatar
ibizdev committed
395 396 397 398 399 400 401

    /**
      * 关系界面计数器
      *
      * @type {number}
      * @memberof Main
      */
ibizdev's avatar
ibizdev committed
402
    public drcounter: number = 0;
ibizdev's avatar
ibizdev committed
403 404 405 406 407 408 409

    /**
      * 需要等待关系界面保存时,第一次调用save参数的备份
      *
      * @type {number}
      * @memberof Main
      */
ibizdev's avatar
ibizdev committed
410
    public drsaveopt: any = {};
ibizdev's avatar
ibizdev committed
411 412 413 414 415 416 417

    /**
      * 表单保存回调存储对象
      *
      * @type {any}
      * @memberof Main
      */
ibizdev's avatar
ibizdev committed
418
    public saveState:any ;
ibizdev's avatar
ibizdev committed
419 420 421 422 423 424 425

    /**
     * 属性值规则
     *
     * @type {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
426
    public rules: any = {
ibizdev's avatar
ibizdev committed
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
        srfupdatedate: [
            { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '最后修改时间 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '最后修改时间 值不能为空', trigger: 'blur' },
        ],
        srforikey: [
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
        ],
        srfkey: [
            { type: 'string', message: '单位标识 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '单位标识 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '单位标识 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '单位标识 值不能为空', trigger: 'blur' },
        ],
        srfmajortext: [
            { type: 'string', message: '名称 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '名称 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '名称 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '名称 值不能为空', trigger: 'blur' },
        ],
        srftempmode: [
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
        ],
        srfuf: [
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
        ],
        srfdeid: [
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
        ],
        srfsourcekey: [
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: ' 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: ' 值不能为空', trigger: 'blur' },
        ],
        orgid: [
            { type: 'string', message: '单位标识 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '单位标识 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '单位标识 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '单位标识 值不能为空', trigger: 'blur' },
        ],
        orgcode: [
            { type: 'string', message: '单位代码 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '单位代码 值必须为字符串类型', trigger: 'blur' },
            { required: true, type: 'string', message: '单位代码 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '单位代码 值不能为空', trigger: 'blur' },
        ],
        orgname: [
            { type: 'string', message: '名称 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '名称 值必须为字符串类型', trigger: 'blur' },
            { required: true, type: 'string', message: '名称 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '名称 值不能为空', trigger: 'blur' },
        ],
        porgname: [
            { type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'blur' },
        ],
        orglevel: [
            { type: 'number', message: '单位级别 值必须为数值类型', trigger: 'change' },
            { type: 'number', message: '单位级别 值必须为数值类型', trigger: 'blur' },
            { required: false, type: 'number', message: '单位级别 值不能为空', trigger: 'change' },
            { required: false, type: 'number', message: '单位级别 值不能为空', trigger: 'blur' },
        ],
        shortname: [
            { type: 'string', message: '单位简称 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '单位简称 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '单位简称 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '单位简称 值不能为空', trigger: 'blur' },
        ],
        showorder: [
            { type: 'number', message: '排序 值必须为数值类型', trigger: 'change' },
            { type: 'number', message: '排序 值必须为数值类型', trigger: 'blur' },
            { required: false, type: 'number', message: '排序 值不能为空', trigger: 'change' },
            { required: false, type: 'number', message: '排序 值不能为空', trigger: 'blur' },
        ],
        createdate: [
            { type: 'string', message: '创建时间 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '创建时间 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '创建时间 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '创建时间 值不能为空', trigger: 'blur' },
        ],
        updatedate: [
            { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '最后修改时间 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '最后修改时间 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '最后修改时间 值不能为空', trigger: 'blur' },
        ],
        porgid: [
            { type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'change' },
            { type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'blur' },
            { required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'change' },
            { required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'blur' },
        ],
    }

    /**
     * 详情模型集合
     *
     * @type {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
543
    public detailsModel: any = {
ibizdev's avatar
ibizdev committed
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
        formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
, 
        srfupdatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        srfkey: new FormItemModel({ caption: '单位标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
, 
        srfmajortext: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        orgid: new FormItemModel({ caption: '单位标识', detailType: 'FORMITEM', name: 'orgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
, 
        orgcode: new FormItemModel({ caption: '单位代码', detailType: 'FORMITEM', name: 'orgcode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
, 
        orgname: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'orgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        porgname: new FormItemModel({ caption: '上级单位', detailType: 'FORMITEM', name: 'porgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        orglevel: new FormItemModel({ caption: '单位级别', detailType: 'FORMITEM', name: 'orglevel', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        shortname: new FormItemModel({ caption: '单位简称', detailType: 'FORMITEM', name: 'shortname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        showorder: new FormItemModel({ caption: '排序', detailType: 'FORMITEM', name: 'showorder', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        createdate: new FormItemModel({ caption: '创建时间', detailType: 'FORMITEM', name: 'createdate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        updatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'updatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
        porgid: new FormItemModel({ caption: '上级单位', detailType: 'FORMITEM', name: 'porgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
, 
    };

    /**
     * 监控表单属性 srfupdatedate 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srfupdatedate')
    onSrfupdatedateChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srfupdatedate', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srforikey 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srforikey')
    onSrforikeyChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srforikey', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srfkey 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srfkey')
    onSrfkeyChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srfkey', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srfmajortext 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srfmajortext')
    onSrfmajortextChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srfmajortext', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srftempmode 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srftempmode')
    onSrftempmodeChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srftempmode', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srfuf 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srfuf')
    onSrfufChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srfuf', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srfdeid 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srfdeid')
    onSrfdeidChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srfdeid', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 srfsourcekey 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.srfsourcekey')
    onSrfsourcekeyChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'srfsourcekey', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 orgid 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.orgid')
    onOrgidChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'orgid', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 orgcode 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.orgcode')
    onOrgcodeChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'orgcode', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 orgname 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.orgname')
    onOrgnameChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'orgname', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 porgname 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.porgname')
    onPorgnameChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'porgname', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 orglevel 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.orglevel')
    onOrglevelChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'orglevel', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 shortname 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.shortname')
    onShortnameChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'shortname', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 showorder 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.showorder')
    onShoworderChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'showorder', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 createdate 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.createdate')
    onCreatedateChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'createdate', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 updatedate 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.updatedate')
    onUpdatedateChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'updatedate', newVal: newVal, oldVal: oldVal });
    }

    /**
     * 监控表单属性 porgid 值
     *
     * @param {*} newVal
     * @param {*} oldVal
     * @memberof Main
     */
    @Watch('data.porgid')
    onPorgidChange(newVal: any, oldVal: any) {
        this.formDataChange({ name: 'porgid', newVal: newVal, oldVal: oldVal });
    }


    /**
     * 重置表单项值
     *
ibizdev's avatar
ibizdev committed
804
     * @public
ibizdev's avatar
ibizdev committed
805 806 807
     * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
808
    public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
ibizdev's avatar
ibizdev committed
809 810 811 812 813 814 815 816
    }

    /**
      * 置空对象
      *
      * @param {any[]} args
      * @memberof EditForm
      */
ibizdev's avatar
ibizdev committed
817
    public ResetData(_datas:any){
ibizdev's avatar
ibizdev committed
818 819 820 821 822 823 824 825 826 827 828 829
        if(Object.keys(_datas).length >0){
            Object.keys(_datas).forEach((name: string) => {
                if (this.data.hasOwnProperty(name)) {
                    this.data[name] = null;
                }
            });
        }
    }

    /**
     * 表单逻辑
     *
ibizdev's avatar
ibizdev committed
830
     * @public
ibizdev's avatar
ibizdev committed
831 832 833
     * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
834
    public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
ibizdev's avatar
ibizdev committed
835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859
                



















    }

    /**
     * 表单值变化
     *
ibizdev's avatar
ibizdev committed
860
     * @public
ibizdev's avatar
ibizdev committed
861 862 863 864
     * @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
     * @returns {void}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
865
    public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
ibizdev's avatar
ibizdev committed
866 867 868 869 870 871 872 873 874 875 876
        if (this.ignorefieldvaluechange) {
            return;
        }
        this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
        this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
        this.dataChang.next(JSON.stringify(this.data));
    }

    /**
     * 表单加载完成
     *
ibizdev's avatar
ibizdev committed
877
     * @public
ibizdev's avatar
ibizdev committed
878 879 880 881
     * @param {*} [data={}]
     * @param {string} [action]
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
882
    public onFormLoad(data: any = {},action:string): void {
ibizdev's avatar
ibizdev committed
883
        if(Object.is(action,"save") || Object.is(action,"autoSave") || Object.is(action,"submit"))
ibizdev's avatar
ibizdev committed
884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902
        // 更新context的实体主键
        if(data.ibzorganization){
            Object.assign(this.context,{ibzorganization:data.ibzorganization})
        }
        this.setFormEnableCond(data);
        this.fillForm(data,action);
        this.oldData = {};
        Object.assign(this.oldData, JSON.parse(JSON.stringify(this.data)));
        this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: false });
        this.formLogic({ name: '', newVal: null, oldVal: null });
    }

    /**
     * 值填充
     *
     * @param {*} [_datas={}]
     * @param {string} [action]
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
903
    public fillForm(_datas: any = {},action:string): void {
ibizdev's avatar
ibizdev committed
904 905 906 907 908 909 910 911 912
        this.ignorefieldvaluechange = true;
        Object.keys(_datas).forEach((name: string) => {
            if (this.data.hasOwnProperty(name)) {
                this.data[name] = _datas[name];
            }
        });
        if(Object.is(action,'loadDraft')){
            this.createDefault();
        }
ibizdev's avatar
ibizdev committed
913 914 915
        if(Object.is(action,'load')){
            this.updateDefault();
        }
ibizdev's avatar
ibizdev committed
916 917 918 919 920 921 922 923
        this.$nextTick(function () {
            this.ignorefieldvaluechange = false;
        })
    }

    /**
     * 设置表单项是否启用
     *
ibizdev's avatar
ibizdev committed
924
     * @public
ibizdev's avatar
ibizdev committed
925 926 927
     * @param {*} data
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
928
    public setFormEnableCond(data: any): void {
ibizdev's avatar
ibizdev committed
929 930 931 932 933 934 935 936 937 938 939 940
        Object.values(this.detailsModel).forEach((detail: any) => {
            if (!Object.is(detail.detailType, 'FORMITEM')) {
                return;
            }
            const formItem: FormItemModel = detail;
            formItem.setEnableCond(data.srfuf);
        });
    }

    /**
     * 重置草稿表单状态
     *
ibizdev's avatar
ibizdev committed
941
     * @public
ibizdev's avatar
ibizdev committed
942 943
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
944
    public resetDraftFormStates(): void {
ibizdev's avatar
ibizdev committed
945 946 947 948 949 950 951 952 953 954 955
        const form: any = this.$refs.form;
        if (form) {
            form.resetFields();
        }
    }

    /**
     * 重置校验结果
     *
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
956
    public resetValidates(): void {
ibizdev's avatar
ibizdev committed
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
        Object.values(this.detailsModel).forEach((detail: any) => {
            if (!Object.is(detail.detailType, 'FORMITEM')) {
                return;
            }
            const formItem: FormItemModel = detail;
            formItem.setError('');
        });
    }

    /**
     * 填充校验结果 (后台)
     *
     * @param {any[]} fieldErrors
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
972
    public fillValidates(fieldErrors: any[]): void {
ibizdev's avatar
ibizdev committed
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989
        fieldErrors.forEach((error: any) => {
            const formItem: FormItemModel = this.detailsModel[error.field];
            if (!formItem) {
                return;
            }
            this.$nextTick(() => {
                formItem.setError(error.message);
            });
        });
    }

    /**
     * 表单校验状态
     *
     * @returns {boolean} 
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
990
    public formValidateStatus(): boolean {
ibizdev's avatar
ibizdev committed
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004
        const form: any = this.$refs.form;
        let validatestate: boolean = true;
        form.validate((valid: boolean) => {
            validatestate = valid ? true : false;
        });
        return validatestate
    }

    /**
     * 获取全部值
     *
     * @returns {*}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1005
    public getValues(): any {
ibizdev's avatar
ibizdev committed
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
        return this.data;
    }

    /**
     * 表单项值变更
     *
     * @param {{ name: string, value: any }} $event
     * @returns {void}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1016
    public onFormItemValueChange($event: { name: string, value: any }): void {
ibizdev's avatar
ibizdev committed
1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
        if (!$event) {
            return;
        }
        if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
            return;
        }
        this.data[$event.name] = $event.value;
    }

    /**
     * 设置数据项值
     *
     * @param {string} name
     * @param {*} value
     * @returns {void}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1034
    public setDataItemValue(name: string, value: any): void {
ibizdev's avatar
ibizdev committed
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051
        if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
            return;
        }
        if (Object.is(this.data[name], value)) {
            return;
        }
        this.data[name] = value;
    }



    /**
     * 分组界面行为事件
     *
     * @param {*} $event
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1052
    public groupUIActionClick($event: any): void {
ibizdev's avatar
ibizdev committed
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
        if (!$event) {
            return;
        }
        const item:any = $event.item;
    }

    /**
     * Vue声明周期(处理组件的输入属性)
     *
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1064
    public created(): void {
ibizdev's avatar
ibizdev committed
1065 1066 1067 1068 1069 1070 1071 1072
        this.afterCreated();
    }

    /**
     * 执行created后的逻辑
     *
     *  @memberof Main
     */    
ibizdev's avatar
ibizdev committed
1073
    public afterCreated(){
ibizdev's avatar
ibizdev committed
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085
        if (this.viewState) {
            this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
                if (!Object.is(tag, this.name)) {
                    return;
                }
                if (Object.is('autoload', action)) {
                    this.autoLoad(data);
                }
                if (Object.is('load', action)) {
                    this.load(data);
                }
                if (Object.is('loaddraft', action)) {
ibizdev's avatar
ibizdev committed
1086 1087 1088 1089 1090
                    if(this.context.srfsourcekey){
                        this.copy(this.context.srfsourcekey);
                    }else{
                        this.loadDraft(data);
                    }
ibizdev's avatar
ibizdev committed
1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129
                }
                if (Object.is('save', action)) {
                    this.save(data,data.showResultInfo);
                }
                if (Object.is('remove', action)) {
                    this.remove(data);
                }
                if (Object.is('saveandexit', action)) {
                    this.saveAndExit(data);
                }
                if (Object.is('saveandnew', action)) {
                    this.saveAndNew(data);
                }
                if (Object.is('removeandexit', action)) {
                    this.removeAndExit(data);
                }
                if (Object.is('refresh', action)) {
                    this.refresh(data);
                }
            });
        }
        this.dataChang
            .pipe(
                debounceTime(300),
                distinctUntilChanged()
            ).subscribe((data: any) => {
                if (this.autosave) {
                    this.autoSave();
                }
                const state = !Object.is(JSON.stringify(this.oldData), JSON.stringify(this.data)) ? true : false;
                this.$store.commit('viewaction/setViewDataChange', { viewtag: this.viewtag, viewdatachange: state });
            });
    }

    /**
     * vue 生命周期
     *
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1130
    public destroyed() {
ibizdev's avatar
ibizdev committed
1131 1132 1133 1134 1135 1136 1137 1138
        this.afterDestroy();
    }

    /**
     * 执行destroyed后的逻辑
     *
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1139
    public afterDestroy() {
ibizdev's avatar
ibizdev committed
1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153
        if (this.viewStateEvent) {
            this.viewStateEvent.unsubscribe();
        }
        if (this.dataChangEvent) {
            this.dataChangEvent.unsubscribe();
        }
    }

    /**
     * 拷贝内容
     *
     * @param {*} [arg={}]
     * @memberof @memberof Main
     */
ibizdev's avatar
ibizdev committed
1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165
    public copy(srfkey: string): void {
        let copyData = this.$store.getters.getCopyData(srfkey);
        copyData.srfkey = Util.createUUID();
        copyData.ibzorganization = copyData.srfkey;
        copyData.orgid = copyData.srfkey;
        Object.assign(this.context,{ibzorganization:copyData.ibzorganization})
        this.data = copyData;
        this.$nextTick(() => {
          this.formState.next({ type: 'load', data: copyData });
          this.data.srfuf = '0';
          this.setFormEnableCond(this.data);
        });
ibizdev's avatar
ibizdev committed
1166 1167 1168 1169 1170 1171
    }

    /**
     *打印
     *@memberof @memberof Main
     */
ibizdev's avatar
ibizdev committed
1172
    public print(){
ibizdev's avatar
ibizdev committed
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182
        let _this:any = this;
        _this.$print({id:'form',popTitle:'主编辑表单'});
    }

    /**
     * 部件刷新
     *
     * @param {any[]} args
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1183
    public refresh(args: any[]): void {
ibizdev's avatar
ibizdev committed
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
        let arg: any = {};
        Object.assign(arg,args[0]);
        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={}]
     * @returns {void}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1205
    public autoLoad(arg: any = {}): void {
ibizdev's avatar
ibizdev committed
1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221
        if (arg.srfkey && !Object.is(arg.srfkey, '')) {
            Object.assign(arg, { srfkey: arg.srfkey });
            this.load(arg);
            return;
        }
        if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
            Object.assign(arg, { srfkey: arg.srfkeys });
            this.load(arg);
            return;
        }
        this.loadDraft(arg);
    }

    /**
     * 加载
     *
ibizdev's avatar
ibizdev committed
1222
     * @public
ibizdev's avatar
ibizdev committed
1223 1224 1225
     * @param {*} [opt={}]
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1226
    public load(opt: any = {}): void {
ibizdev's avatar
ibizdev committed
1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243
        if(!this.loadAction){
            this.$Notice.error({ title: '错误', desc: 'IBZOrganizationEditView视图表单loadAction参数未配置' });
            return;
        }
        const arg: any = { ...opt };
        let viewparamResult:any = Object.assign(arg,this.viewparams);
        const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
        get.then((response: any) => {
            if (response && response.status === 200) {
                const data = response.data;
                this.onFormLoad(data,'load');
                this.$emit('load', data);
                this.$nextTick(() => {
                    this.formState.next({ type: 'load', data: data });
                });
            }
        }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1244 1245
            if (response && response.status && response.data) {
                this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260
                return;
            }
            if (!response || !response.status || !response.data) {
                this.$Notice.error({ title: '错误', desc: '系统异常' });
                return;
            }
        });
    }

    /**
     * 加载草稿
     *
     * @param {*} [opt={}]
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1261
    public loadDraft(opt: any = {}): void {
ibizdev's avatar
ibizdev committed
1262 1263 1264 1265 1266 1267 1268 1269 1270
        if(!this.loaddraftAction){
            this.$Notice.error({ title: '错误', desc: 'IBZOrganizationEditView视图表单loaddraftAction参数未配置' });
            return;
        }
        const arg: any = { ...opt } ;
        let viewparamResult:any = Object.assign(arg,this.viewparams);
        let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)),{viewparams:viewparamResult}, this.showBusyIndicator);
        post.then((response: any) => {
            if (!response.status || response.status !== 200) {
ibizdev's avatar
ibizdev committed
1271 1272
                if (response.data) {
                    this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
                }
                return;
            }

            const data = response.data;
            if(data.ibzorganization){
                Object.assign(this.context,{ibzorganization:data.ibzorganization})
            }
            this.resetDraftFormStates();
            this.onFormLoad(data,'loadDraft');
            this.$emit('load', data);
            this.$nextTick(() => {
                this.formState.next({ type: 'load', data: data });
            });
            setTimeout(() => {
                const form: any = this.$refs.form;
                if (form) {
                    form.fields.forEach((field: any) => {
                        field.validateMessage = "";
                        field.validateState = "";
                        field.validateStatus = false;
                    });
                }
            });
        }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1298 1299
            if (response && response.status  && response.data) {
                this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314
                return;
            }
            if (!response || !response.status || !response.data) {
                this.$Notice.error({ title: '错误', desc: '系统异常' });
                return;
            }
        });
    }

    /**
     * 自动保存
     *
     * @param {*} [opt={}]
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1315
    public autoSave(opt: any = {}): void {
ibizdev's avatar
ibizdev committed
1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
        if (!this.formValidateStatus()) {
            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;
        if(!action){
            let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
            this.$Notice.error({ title: '错误', desc: 'IBZOrganizationEditView视图表单'+actionName+'参数未配置' });
            return;
        }
        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) {
ibizdev's avatar
ibizdev committed
1332 1333
                if (response.data) {
                    this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345
                }
                return;
            }

            const data = response.data;
            this.onFormLoad(data,'autoSave');
            this.$emit('save', data);
            this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
            this.$nextTick(() => {
                this.formState.next({ type: 'save', data: data });
            });
        }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1346 1347
            if (response && response.status && response.data) {
                this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365
                return;
            }
            if (!response || !response.status || !response.data) {
                this.$Notice.error({ title: '错误', desc: '系统异常' });
                return;
            }
        });
    }

    /**
     * 保存
     *
     * @param {*} [opt={}]
     * @param {boolean} [showResultInfo] 
     * @param {boolean} [ifStateNext] formState是否下发通知
     * @returns {Promise<any>}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1366
    public async save(opt: any = {}, showResultInfo?: boolean, ifStateNext: boolean = true): Promise<any> {
ibizdev's avatar
ibizdev committed
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395
        return new Promise((resolve: any, reject: 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);
            Object.assign(arg, this.context);
            if (ifStateNext) {
                this.drcounter = 0;
                if(this.drcounter !== 0){
                    this.drsaveopt = opt;
                    this.formState.next({ type: 'beforesave', data: arg });//先通知关系界面保存
                    this.saveState = resolve;
                    return;
                }
            }
            const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
            if(!action){
                let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
                this.$Notice.error({ title: '错误', desc: 'IBZOrganizationEditView视图表单'+actionName+'参数未配置' });
                return;
            }
            Object.assign(arg,{viewparams:this.viewparams});
            const post: Promise<any> = Object.is(data.srfuf, '1')?this.service.update(action, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(action,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
            post.then((response: any) => {
                if (!response.status || response.status !== 200) {
ibizdev's avatar
ibizdev committed
1396 1397
                    if (response.data) {
                        this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413
                    }
                    return;
                }

                const data = response.data;
                this.onFormLoad(data,'save');
                this.$emit('save', data);
                this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
                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) => {
ibizdev's avatar
ibizdev committed
1414 1415
                if (response && response.status  && response.data) {
                    this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431
                    reject(response);
                    return;
                }
                if (!response || !response.status || !response.data) {
                    this.$Notice.error({ title: '错误', desc: '系统异常' });
                    reject(response);
                    return;
                }
                reject(response);
            });
        })
    }

    /**
    * 删除
    *
ibizdev's avatar
ibizdev committed
1432
    * @public
ibizdev's avatar
ibizdev committed
1433 1434 1435
    * @param {*} [opt={}]
    * @memberof EditForm
    */
ibizdev's avatar
ibizdev committed
1436
    public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
ibizdev's avatar
ibizdev committed
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465
        return new Promise((resolve: any, reject: any) => {
            if(!this.removeAction){
                this.$Notice.error({ title: '错误', desc: 'IBZOrganizationEditView视图表单removeAction参数未配置' });
                return;
            }
            const arg: any = opt[0];
            const _this: any = this;
            Object.assign(arg,{viewparams:this.viewparams});
            this.service.delete(_this.removeAction, JSON.parse(JSON.stringify(this.context)),arg, showResultInfo).then((response: any) => {
                if (response) {
                    const data = response.data;
                    this.$emit('remove',data);
                    this.formState.next({ type: 'remove', data: data });
                    this.data.ismodify = false;
                    this.$Notice.success({ title: '', desc: (data.srfmajortext ? data.srfmajortext : '') + '&nbsp;删除成功!' });
                    resolve(response);
                }
            }).catch((error: any) => {
                const { data: _data } = error;
                this.$Notice.error({ title: _data.title, desc: _data.message });
                reject(error);
            });
        });
    }

    /**
     * 工作流启动
     *
     * @param {*} [data={}]
ibizdev's avatar
ibizdev committed
1466
     * @param {*} [localdata={}]
ibizdev's avatar
ibizdev committed
1467 1468 1469
     * @returns {Promise<any>}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1470
    public async wfstart(data: any,localdata?:any): Promise<any> {
ibizdev's avatar
ibizdev committed
1471 1472
        return new Promise((resolve: any, reject: any) => {
            const _this: any = this;
ibizdev's avatar
ibizdev committed
1473
            const post: Promise<any> = _this.save({},false);
ibizdev's avatar
ibizdev committed
1474 1475 1476 1477 1478
            post.then((response:any) =>{
                const arg:any = response.data;
                if(this.viewparams){
                    Object.assign(arg,{viewparams:this.viewparams});
                }
ibizdev's avatar
ibizdev committed
1479
                const result: Promise<any> = this.service.wfstart(_this.WFStartAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
ibizdev's avatar
ibizdev committed
1480 1481
                result.then((response: any) => {
                    if (!response || response.status !== 200) {
ibizdev's avatar
ibizdev committed
1482 1483 1484
                        if(response.data){
                            this.$Notice.error({ title: '', desc: '工作流启动失败, ' + response.data.message });
                        }
ibizdev's avatar
ibizdev committed
1485 1486 1487 1488 1489
                        return;
                    }
                    this.$Notice.info({ title: '', desc: '工作流启动成功' });
                    resolve(response);
            }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1490 1491
                if (response && response.status && response.data) {
                    this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502
                    reject(response);
                    return;
                }
                if (!response || !response.status || !response.data) {
                    this.$Notice.error({ title: '错误', desc: '系统异常' });
                    reject(response);
                    return;
                }
                reject(response);
            });
            }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1503 1504
                    if (response && response.status && response.data) {
                        this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521
                        reject(response);
                        return;
                    }
                    if (!response || !response.status || !response.data) {
                        this.$Notice.error({ title: '错误', desc: '系统异常' });
                        reject(response);
                        return;
                    }
                    reject(response);
            })
        });
    }

    /**
     * 工作流提交
     *
     * @param {*} [data={}]
ibizdev's avatar
ibizdev committed
1522
     * @param {*} [localdata={}]
ibizdev's avatar
ibizdev committed
1523 1524 1525
     * @returns {Promise<any>}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1526
    public async wfsubmit(data: any,localdata?:any): Promise<any> {
ibizdev's avatar
ibizdev committed
1527 1528 1529 1530 1531 1532 1533 1534 1535 1536
        return new Promise((resolve: any, reject: any) => {
        const _this: any = this;
        const arg: any = data[0];
        Object.assign(arg,{viewparams:this.viewparams});
        if (!arg.ibzorganization || Object.is(arg.ibzorganization, '')) {
            return;
        }
        const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator);
        post.then((response:any) =>{
                const arg:any = response.data;
ibizdev's avatar
ibizdev committed
1537 1538 1539 1540 1541 1542 1543
                // 保存完成UI处理
                this.onFormLoad(arg,'save');
                this.$emit('save', arg);
                this.$nextTick(() => {
                    this.formState.next({ type: 'save', data: arg });
                });
                // 准备提交参数
ibizdev's avatar
ibizdev committed
1544 1545 1546
                if(this.viewparams){
                    Object.assign(arg,{viewparams:this.viewparams});
                }
ibizdev's avatar
ibizdev committed
1547
                const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
ibizdev's avatar
ibizdev committed
1548 1549
                result.then((response: any) => {
                    if (!response || response.status !== 200) {
ibizdev's avatar
ibizdev committed
1550 1551 1552
                        if(response.data){
                            this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.data.message });
                        }
ibizdev's avatar
ibizdev committed
1553 1554
                        return;
                    }
ibizdev's avatar
ibizdev committed
1555 1556
                    this.onFormLoad(arg,'submit');
                    this.$store.dispatch('viewaction/datasaved', { viewtag: this.viewtag });
ibizdev's avatar
ibizdev committed
1557 1558 1559
                    this.$Notice.info({ title: '', desc: '工作流提交成功' });
                    resolve(response);
            }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1560 1561
                if (response && response.status && response.data) {
                    this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572
                    reject(response);
                    return;
                }
                if (!response || !response.status || !response.data) {
                    this.$Notice.error({ title: '错误', desc: '系统异常' });
                    reject(response);
                    return;
                }
                reject(response);
            });
            }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1573 1574
                    if (response && response.status && response.data) {
                        this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597
                        reject(response);
                        return;
                    }
                    if (!response || !response.status || !response.data) {
                        this.$Notice.error({ title: '错误', desc: '系统异常' });
                        reject(response);
                        return;
                    }
                    reject(response);
            })
        })
    }

    /**
     * 表单项更新
     *
     * @param {string} mode 界面行为名称
     * @param {*} [data={}] 请求数据
     * @param {string[]} updateDetails 更新项
     * @param {boolean} [showloading] 是否显示加载状态
     * @returns {void}
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1598
    public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
ibizdev's avatar
ibizdev committed
1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625
        if (!mode || (mode && Object.is(mode, ''))) {
            return;
        }
        const arg: any = { ...data };
        Object.assign(arg,this.viewparams);
        const post: Promise<any> = this.service.frontLogic(mode,JSON.parse(JSON.stringify(this.context)),arg, showloading);
        post.then((response: any) => {
            if (!response || response.status !== 200) {
                this.$Notice.error({ title: '错误', desc: '表单项更新失败' });
                return;
            }
            const data = response.data;
            const _data: any = {};
            updateDetails.forEach((name: string) => {
                if (!data.hasOwnProperty(name)) {
                    return;
                }
                Object.assign(_data, { [name]: data[name] });
            });
            this.setFormEnableCond(_data);
            this.fillForm(_data,'updateFormItem');
            this.formLogic({ name: '', newVal: null, oldVal: null });
            this.dataChang.next(JSON.stringify(this.data));
            this.$nextTick(() => {
                this.formState.next({ type: 'updateformitem', ufimode: arg.srfufimode, data: _data });
            });
        }).catch((response: any) => {
ibizdev's avatar
ibizdev committed
1626 1627
            if (response && response.status && response.data) {
                this.$Notice.error({ title: '错误', desc: response.data.message });
ibizdev's avatar
ibizdev committed
1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642
                return;
            }
            if (!response || !response.status || !response.data) {
                this.$Notice.error({ title: '错误', desc: '系统异常' });
                return;
            }
        });
    }

    /**
     * 回车事件
     *
     * @param {*} $event
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1643
    public onEnter($event: any): void {
ibizdev's avatar
ibizdev committed
1644 1645 1646 1647 1648 1649 1650 1651
    }

    /**
     * 保存并退出
     *
     * @param {any[]} args
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1652
    public saveAndExit(data:any[]):Promise<any>{
ibizdev's avatar
ibizdev committed
1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676
        let _this = this;
        return new Promise((resolve: any, reject: any) =>{
            let arg: any = {};
            if(data && data.length > 0){
                Object.assign(arg,data[0]);
            }
            _this.currentAction = "saveAndExit";
            _this.save([arg]).then((res) =>{
                if(res){
                    _this.closeView(res.data);
                }
                resolve(res);
            }).catch((error) =>{
                reject(error);
            })
        })
    }

    /**
     * 保存并新建
     *
     * @param {any[]} args
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1677
    public saveAndNew(data:any[]):Promise<any>{
ibizdev's avatar
ibizdev committed
1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699
        let _this = this;
        return new Promise((resolve: any, reject: any) =>{
            let arg: any = {};
            if(data && data.length > 0){
                Object.assign(arg,data[0]);
            }
            _this.currentAction = "saveAndNew";
            _this.save([arg]).then((res) =>{
                _this.ResetData(res);
                _this.loadDraft({});
            }).catch((error) =>{
                reject(error);
            })
        })
    }

    /**
     * 删除并退出
     *
     * @param {any[]} args
     * @memberof Main
     */
ibizdev's avatar
ibizdev committed
1700
    public removeAndExit(data:any[]):Promise<any>{
ibizdev's avatar
ibizdev committed
1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723
        let _this = this;
        return new Promise((resolve: any, reject: any) =>{
            let arg: any = {};
            if(data && data.length > 0){
                Object.assign(arg,data[0]);
            }
            _this.remove([arg]).then((res) =>{
                if(res){
                  _this.closeView(res.data);
                }
                resolve(res);
            }).catch((error) =>{
                reject(error);
            })
        })
    }

    /**
    * 关系界面数据保存完成
    *
    * @param {any} $event
    * @memberof Main
    */
ibizdev's avatar
ibizdev committed
1724
    public drdatasaved($event:any){
ibizdev's avatar
ibizdev committed
1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749
        let _this = this;
        this.drcounter--;
        if(this.drcounter > 0){
            return;
        }
        this.save(this.drsaveopt, undefined, false).then((res) =>{
            this.saveState(res);
            this.drsaveopt = {};
            if(Object.is(_this.currentAction, "saveAndNew")){
                _this.ResetData(res);
                _this.loadDraft({});
            }else if(Object.is(_this.currentAction, "saveAndExit")){
                if(res){
                    _this.closeView(res.data);
                }
            }
        });
    }

    /**
     * 新建默认值
     * @memberof Main
     */
    public createDefault(){                    
        if (this.data.hasOwnProperty('showorder')) {
ibizdev's avatar
ibizdev committed
1750
            this.data['showorder'] = 1;
ibizdev's avatar
ibizdev committed
1751 1752 1753
        }
    }

ibizdev's avatar
ibizdev committed
1754 1755 1756 1757 1758 1759 1760
    /**
     * 更新默认值
     * @memberof Main
     */
    public updateDefault(){                    
    }

ibizdev's avatar
ibizdev committed
1761 1762 1763 1764 1765 1766 1767
    
}
</script>

<style lang='less'>
@import './main-form.less';
</style>