From 57266ee8c62f0fddb42c18c705507fc0dc2416f6 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 18 八月 2023 17:42:39 +0800 Subject: [PATCH] 2023-08-18 --- src/menu/components/card/cardcellcomponent/index.jsx | 115 ++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 77 insertions(+), 38 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index f676322..5e871c2 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -1,12 +1,14 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Modal, Button } from 'antd' +import { Modal, Button, notification } from 'antd' +import moment from 'moment' +import Api from '@/api' import asyncComponent from '@/utils/asyncComponent' import { getCardCellForm } from './formconfig' +import { queryPrintSql } from '@/utils/option.js' import { getActionForm, getBaseTableActionForm } from '@/menu/components/share/actioncomponent/formconfig' - import Utils, { FuncUtils } from '@/utils/utils.js' import MKEmitter from '@/utils/events.js' import MenuUtils from '@/utils/utils-custom.js' @@ -159,6 +161,8 @@ options = ['background', 'border', 'margin'] } else if (element.eleType === 'color') { options = ['border', 'margin', 'padding'] + } else if (element.eleType === 'number' || element.eleType === 'icon') { + options.push('display') } else if (element.eleType === 'text') { options[0] = 'font2' options.push('display') @@ -166,6 +170,10 @@ options = ['padding', 'margin'] } else if (element.eleType === 'splitline') { options = ['padding', 'margin'] + } + + if (element.eleType !== 'button') { + options.push('position') } options.push('clear') @@ -179,12 +187,6 @@ getStyle = (style) => { const { card, elements } = this.state - - // if (card.eleType === 'button') { - // if ((style.paddingLeft || style.paddingRight) && !style.width) { - // style.width = 'auto' - // } - // } let _card = this.resetCardStyle(card, style) @@ -207,7 +209,7 @@ _card.style = style let line = _card.height || null - if (['currentDate', 'sequence', 'icon'].includes(_card.eleType)) { + if (['currentDate', 'sequence'].includes(_card.eleType) || (_card.eleType === 'icon' && _card.tipType !== 'text')) { line = 1 } @@ -314,21 +316,64 @@ let modules = MenuUtils.getSubModules(window.GLOB.customMenu.components, cards.uuid, supId) - if (cards.subtype === 'basetable') { - this.setState({ - actvisible: true, - card: card, - formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules) - }) - } else { - let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] + this.checkPrintTemp().then(() => { + if (cards.subtype === 'basetable') { + this.setState({ + actvisible: true, + card: card, + formlist: getBaseTableActionForm(card, functip, cards, usefulFields, modules) + }) + } else { + let anchors = MenuUtils.getAnchors(window.GLOB.customMenu.components, cards.uuid) || [] + + this.setState({ + actvisible: true, + card: card, + formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors, side) + }) + } + }) + } - this.setState({ - actvisible: true, - card: card, - formlist: getActionForm(card, functip, cards, usefulFields, modules, anchors, side) - }) - } + checkPrintTemp = () => { + return new Promise(resolve => { + if (!window.GLOB.printTemps) { + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(queryPrintSql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getCloudConfig(param).then(res => { + if (!res.status) { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + + let temps = (res.data || []).map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + window.GLOB.printTemps = temps + resolve() + }, () => { + resolve() + }) + } else { + resolve() + } + }) } /** @@ -372,7 +417,7 @@ if (cell.uuid === res.uuid) { res.style = cell.style || {} - if (res.eleType !== 'text') { + if (!['text', 'number', 'icon'].includes(res.eleType)) { delete res.style.display } @@ -382,7 +427,7 @@ } else if (['text', 'number', 'formula', 'currentDate', 'sequence', 'icon'].includes(res.eleType)) { let line = res.height || null - if (['currentDate', 'sequence', 'icon'].includes(res.eleType)) { + if (['currentDate', 'sequence'].includes(res.eleType) || (res.eleType === 'icon' && res.tipType !== 'text')) { line = 1 } @@ -443,17 +488,7 @@ if (cell.uuid === res.uuid) { res.eleType = cell.eleType || null res.style = cell.style || null - // res.modal = cell.modal || null - // res.config = cell.config || null res.wrapStyle = cell.wrapStyle || null - // res = {...cell, ...res} - - // if (!res.control) { - // delete res.controlField - // delete res.controlVal - // } - - // delete res.focus if (res.OpenType === 'form') { if (cell.OpenType !== 'form') { @@ -479,6 +514,8 @@ } res.style = {...res.style, ...style} } + + res.updateTime = moment().format('YYYY-MM-DD HH:mm') return res } @@ -536,6 +573,7 @@ let _elements = elements.map(cell => { if (cell.uuid === card.uuid) { cell.verify = res + cell.updateTime = moment().format('YYYY-MM-DD HH:mm') } return cell @@ -624,10 +662,9 @@ } dropButton = (id) => { - const { cards, cardCell } = this.props + const { cards } = this.props if (!cards.action) return - if (cardCell.type === 'custom') return let index = cards.action.findIndex(item => item.uuid === id) @@ -769,6 +806,7 @@ {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} <Modal title="缂栬緫鍏冪礌" + wrapClassName="mk-scroll-modal" visible={visible} width={850} maskClosable={false} @@ -788,6 +826,7 @@ {/* 缂栬緫鎸夐挳锛氬鍒躲�佺紪杈� */} <Modal title="鎸夐挳路缂栬緫" + wrapClassName="mk-scroll-modal" visible={actvisible} width={920} maskClosable={false} @@ -800,7 +839,7 @@ destroyOnClose > <ActionForm - type={cards.type === 'balcony' ? '' : 'card'} + type={cards.type === 'balcony' || cardCell.$cardType === 'extendCard' ? '' : 'card'} card={card} formlist={this.state.formlist} inputSubmit={this.handleActionSubmit} -- Gitblit v1.8.0