import { getVModelHtml, formItemWrapper, colWrapper } from './common/htmlWrapper' // 创建“el-input” function createInputHtml(formJson, oneText, parent) { const vModel = getVModelHtml(formJson, oneText, parent) const placeholder = oneText.placeholder ? `placeholder="${oneText.placeholder}"` : '' const width = oneText.style && oneText.style.width ? ':style="{width: \'100%\'}"' : '' const disabled = oneText.disabled ? ':disabled=\'true\'' : '' const maxlength = oneText.maxlength ? `:maxlength="${oneText.maxlength}"` : '' const readonly = oneText.readonly ? 'readonly' : '' return `` } /** * 获取“单行文本”HTML * @param formJson 表单结构 * @param oneText “单行文本”组件 * @param parent 父组件(dialog, table...) * @param isSomeSpanUnequal24 是否有的组件“span”不等于“24” * @returns {string} “单行文本”HTML */ export default function getOneTextHtml(formJson, oneText, parent, isSomeSpanUnequal24) { // 创建“el-input” let oneTextHtml = createInputHtml(formJson, oneText, parent) // 用“el-form-item”包裹“el-input” if (parent === null || parent.FComponentType !== 'table') { oneTextHtml = formItemWrapper(formJson, oneText, oneTextHtml) } // span不为24的用“el-col”包裹“el-form-item” if (isSomeSpanUnequal24) { oneTextHtml = colWrapper(oneText, oneTextHtml) } return oneTextHtml }