123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- import { promptBox } from 'nc-lightapp-front';
- import { CARD, CARD_BUTTON, STATUS } from '../../constant';
- import { cardBack, cardCreate, cardSave, cardUpdate,cardModify, cardDelete, cardCancel,cardLogOut, cardRefresh, cardCopy, cardAttachment, cardBillTrack, cardCommit, cardUnCommit, cardLinkApprove } from './cardOperator';
- import { buttonVisibilityControl } from "./buttonVisibilityControl";
- /**
- * @description: 卡片页头部按钮操作
- * @param: isFromSide 是否来自侧拉区域
- * @param: id 当前按钮名
- */
- const formId = 'card_head';
- export function buttonClick(props, id, hotkey, isFromSide) {
- // 当前单据的全部数据
- let pk =
- props.form.getFormItemsValue(this.formId, this.primaryId) &&
- props.form.getFormItemsValue(this.formId, this.primaryId).value;
- debugger;
- switch (id) {
- //返回
- case CARD_BUTTON.back:
- cardBack(props);
- break;
- //头部 新增
- case CARD_BUTTON.create:
- debugger;
- cardCreate(props);
- break;
- //头部 保存
- case CARD_BUTTON.save:
- cardSave({ ...props, json: this.state.json }).then(() => {
- if (isFromSide) {
- props.cardTable.closeModel(CARD.table_code);
- }
- });
- break;
- //头部 保存新增
- case CARD_BUTTON.saveAdd:
- cardSave({ ...props, json: this.state.json }).then(flag => {
- if (flag) {
- cardCreate(props);
- }
- });
- break;
- //头部 保存提交
- case CARD_BUTTON.saveCommit:
- cardSave({ ...props, json: this.state.json }).then(flag => {
- if (flag) {
- cardCommit.call(this, { ...props, json: this.state.json });
- }
- });
- break;
- //头部 修改
- case CARD_BUTTON.update:
- cardUpdate(props);
- break;
- //头部 变更
- case CARD_BUTTON.Modify:
- props.form.setFormItemsDisabled(formId, {
- pk_org: true, //组织不让编辑
- bankdeposit: true,//开户银行不让编辑
- account: true,//账户不让编辑
- });
- cardModify(props);
- break;
- //头部 查看版本
- case CARD_BUTTON.queryVersion :
- props.setUrlParam({ status: "version", signal: "card" });
- this.initVersionTree();
- // buttonVisibilityControl.call(this, props);
- // this.forceUpdate();
- break;
- //头部 复制
- case CARD_BUTTON.copy:
- cardCopy(props);
- break;
- //头部 删除
- case CARD_BUTTON.delete:
- promptBox({
- color: STATUS.warning,
- title: this.state.json['96H10119-000000'],/* 国际化处理: 删除*/
- content: this.state.json['96H10119-000001'],/* 国际化处理: 确定删除吗?*/
- beSureBtnClick: () => {
- cardDelete({ ...props, json: this.state.json });
- }
- });
- break;
- //头部 注销
- case CARD_BUTTON.logout:
- debugger;
- promptBox({
- color: STATUS.warning,
- title: "注销",/* 国际化处理: 注销*/
- content: "确定注销吗",/* 国际化处理: 确定注销吗?*/
- beSureBtnClick: () => {
- cardLogOut({ ...props, json: this.state.json });
- }
- });
- break;
- // 头部 取消
- case CARD_BUTTON.cancel:
- promptBox({
- color: STATUS.warning,
- title: this.state.json['96H10119-000002'],/* 国际化处理: 取消*/
- content: this.state.json['96H10119-000003'],/* 国际化处理: 是否确认要取消?*/
- beSureBtnClick: () => {
- cardCancel({ ...props, json: this.state.json });
- }
- });
- break;
- //头部 刷新
- case CARD_BUTTON.refresh:
- cardRefresh({ ...props, json: this.state.json });
- break;
- //附件
- case CARD_BUTTON.attachment:
- cardAttachment.call(this, props);
- break;
- //单据追溯
- case CARD_BUTTON.billTrack:
- cardBillTrack.call(this, props);
- break;
- //审批详情
- case CARD_BUTTON.approvalLink:
- cardLinkApprove.call(this, props);
- break;
- //单据提交
- case CARD_BUTTON.commit:
- cardCommit.call(this, { ...props, json: this.state.json });
- break;
- //单据收回
- case CARD_BUTTON.unCommit:
- cardUnCommit({ ...props, json: this.state.json });
- break;
- default:
- break;
- }
- }
|