Commit 8ed883f4e71929db084425038d92ce71ef22a08e
1 parent
baf4a6d6
盒型设计新增svg图片
Showing
3 changed files
with
1351 additions
and
863 deletions
src/components/Common/CommonComponent/index.js
| 1 | -import moment from 'moment'; | ||
| 2 | -import React, { Component, createRef } from 'react'; | ||
| 3 | -import reactComponentDebounce from '@/components/Common/ReactDebounce'; | ||
| 4 | -import * as commonFunc from '@/components/Common//commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ | 1 | +import moment from "moment"; |
| 2 | +import React, { Component, createRef } from "react"; | ||
| 3 | +import reactComponentDebounce from "@/components/Common/ReactDebounce"; | ||
| 4 | +import * as commonFunc from "@/components/Common//commonFunc"; /* 通用单据方法 */ /* 通用单据方法 */ | ||
| 5 | // import '@ant-design/compatible/assets/index.css'; | 5 | // import '@ant-design/compatible/assets/index.css'; |
| 6 | import { | 6 | import { |
| 7 | InputNumber, | 7 | InputNumber, |
| @@ -21,24 +21,18 @@ import { | @@ -21,24 +21,18 @@ import { | ||
| 21 | Table, | 21 | Table, |
| 22 | Pagination, | 22 | Pagination, |
| 23 | Tooltip, | 23 | Tooltip, |
| 24 | -} from 'antd-v4'; | ||
| 25 | -import { | ||
| 26 | - EyeOutlined, | ||
| 27 | - FilePdfOutlined, | ||
| 28 | - FileWordOutlined, | ||
| 29 | - FileExcelOutlined, | ||
| 30 | - FileOutlined, | ||
| 31 | - RightOutlined, | ||
| 32 | -} from '@ant-design/icons'; | ||
| 33 | -import * as commonUtils from '@/utils/utils'; | ||
| 34 | -import styles from '@/index.less'; | ||
| 35 | -import Provinces from '@/assets/provinces.json'; | ||
| 36 | -import Cities from '@/assets/cities.json'; | ||
| 37 | -import Areas from '@/assets/areas.json'; | ||
| 38 | -import commonConfig from '@/utils/config'; | ||
| 39 | -import { VirtualKeyboard } from '@/oee/common/oeeKeyBoard';// 虚拟软键盘 | ||
| 40 | -import 'braft-editor/dist/output.css'; | ||
| 41 | -import SvgBox from '../BoxDesignCompontent/svg'; | 24 | + Modal, |
| 25 | +} from "antd-v4"; | ||
| 26 | +import {DeleteOutlined, EyeOutlined, FilePdfOutlined, FileWordOutlined, FileExcelOutlined, FileOutlined, RightOutlined } from "@ant-design/icons"; | ||
| 27 | +import * as commonUtils from "@/utils/utils"; | ||
| 28 | +import styles from "@/index.less"; | ||
| 29 | +import Provinces from "@/assets/provinces.json"; | ||
| 30 | +import Cities from "@/assets/cities.json"; | ||
| 31 | +import Areas from "@/assets/areas.json"; | ||
| 32 | +import commonConfig from "@/utils/config"; | ||
| 33 | +import { VirtualKeyboard } from "@/oee/common/oeeKeyBoard"; // 虚拟软键盘 | ||
| 34 | +import "braft-editor/dist/output.css"; | ||
| 35 | +import SvgBox from "../BoxDesignCompontent/svg"; | ||
| 42 | 36 | ||
| 43 | const FormItem = Form.Item; | 37 | const FormItem = Form.Item; |
| 44 | const { Option } = Select; | 38 | const { Option } = Select; |
| @@ -59,18 +53,18 @@ export default class CommonComponent extends Component { | @@ -59,18 +53,18 @@ export default class CommonComponent extends Component { | ||
| 59 | constructor(props) { | 53 | constructor(props) { |
| 60 | super(props); | 54 | super(props); |
| 61 | this.state = { | 55 | this.state = { |
| 62 | - dataValue: props.dataValue, /* 本showType数据 */ | ||
| 63 | - enabled: props.enabled, /* 是否是查看状态(数据格式:布尔) */ | ||
| 64 | - dropDownData: [], /* 下拉数据集(如果不是下拉控件该值为空,数据格式:数组对象) */ | 56 | + dataValue: props.dataValue /* 本showType数据 */, |
| 57 | + enabled: props.enabled /* 是否是查看状态(数据格式:布尔) */, | ||
| 58 | + dropDownData: [] /* 下拉数据集(如果不是下拉控件该值为空,数据格式:数组对象) */, | ||
| 65 | conditonValues: {}, | 59 | conditonValues: {}, |
| 66 | sFieldName: props.showConfig.sName, // 字段名 | 60 | sFieldName: props.showConfig.sName, // 字段名 |
| 67 | bNotEmpty: props.showConfig.bNotEmpty, | 61 | bNotEmpty: props.showConfig.bNotEmpty, |
| 68 | - mode: props.showConfig.bMultipleChoice ? 'multiple' : 'default', | ||
| 69 | - bNewRecord: props.showConfig.bNewRecord, /* 是否有新纪录 */ | 62 | + mode: props.showConfig.bMultipleChoice ? "multiple" : "default", |
| 63 | + bNewRecord: props.showConfig.bNewRecord /* 是否有新纪录 */, | ||
| 70 | sActiveDisplay: true, | 64 | sActiveDisplay: true, |
| 71 | pageNum: 0, | 65 | pageNum: 0, |
| 72 | totalPageCount: 1, | 66 | totalPageCount: 1, |
| 73 | - searchValue: '', | 67 | + searchValue: "", |
| 74 | searchDropDownData: [], | 68 | searchDropDownData: [], |
| 75 | searchTotalPageCount: 1, | 69 | searchTotalPageCount: 1, |
| 76 | searchPageNum: 0, | 70 | searchPageNum: 0, |
| @@ -89,31 +83,39 @@ export default class CommonComponent extends Component { | @@ -89,31 +83,39 @@ export default class CommonComponent extends Component { | ||
| 89 | // this.getFieldDecorator = commonUtils.isUndefined(props.form) ? undefined : undefined; /* 字段验证(数据格式:数字) */ | 83 | // this.getFieldDecorator = commonUtils.isUndefined(props.form) ? undefined : undefined; /* 字段验证(数据格式:数字) */ |
| 90 | this.floatNum = this.props.getFloatNum(props.showConfig.sName); /* 数字格式化规范转换(数据格式:数字) */ | 84 | this.floatNum = this.props.getFloatNum(props.showConfig.sName); /* 数字格式化规范转换(数据格式:数字) */ |
| 91 | this.floatPrice = this.getFloatPrice(this.floatNum); /* 价格格式化规范转换(数据格式:数字) */ | 85 | this.floatPrice = this.getFloatPrice(this.floatNum); /* 价格格式化规范转换(数据格式:数字) */ |
| 92 | - this.formItemLayout = commonUtils.isNotEmptyObject(props.formItemLayout) ? | ||
| 93 | - props.formItemLayout : | ||
| 94 | - location.pathname.toLowerCase().indexOf('oee') > -1 ? { labelCol: { span: 7, style: { color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#BFEFFF' } }, wrapperCol: { span: 15 } } : | ||
| 95 | - { labelCol: { span: 7, style: { height: '27.82px', color: 'rgba(0, 0, 0, 0.65)', backgroundColor: '#BFEFFF' } }, wrapperCol: { span: 15 } }; /* 表格样式(主要是colspan和rowspan,数据格式:对象) */ | 86 | + this.formItemLayout = commonUtils.isNotEmptyObject(props.formItemLayout) |
| 87 | + ? props.formItemLayout | ||
| 88 | + : location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 89 | + ? { labelCol: { span: 7, style: { color: "rgba(0, 0, 0, 0.65)", backgroundColor: "#BFEFFF" } }, wrapperCol: { span: 15 } } | ||
| 90 | + : { | ||
| 91 | + labelCol: { span: 7, style: { height: "27.82px", color: "rgba(0, 0, 0, 0.65)", backgroundColor: "#BFEFFF" } }, | ||
| 92 | + wrapperCol: { span: 15 }, | ||
| 93 | + }; /* 表格样式(主要是colspan和rowspan,数据格式:对象) */ | ||
| 96 | this.isDropdownFilter = false; | 94 | this.isDropdownFilter = false; |
| 97 | this.V = { value: props.dataValue }; | 95 | this.V = { value: props.dataValue }; |
| 98 | this.myRef = createRef(); | 96 | this.myRef = createRef(); |
| 99 | this.dropDownCount = 0; | 97 | this.dropDownCount = 0; |
| 100 | - this.bSpecial = location.pathname?.includes('ResearchTableTree') && props.showConfig.sName === 'sProductName'; | 98 | + this.bSpecial = location.pathname?.includes("ResearchTableTree") && props.showConfig.sName === "sProductName"; |
| 101 | } | 99 | } |
| 102 | 100 | ||
| 103 | /** 渲染前只执行一次 */ | 101 | /** 渲染前只执行一次 */ |
| 104 | componentWillMount() { | 102 | componentWillMount() { |
| 105 | this.mounted = true; | 103 | this.mounted = true; |
| 106 | - if (this.props.showConfig.sDropDownType === 'const') { /* 常量下拉 */ | 104 | + if (this.props.showConfig.sDropDownType === "const") { |
| 105 | + /* 常量下拉 */ | ||
| 107 | /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ | 106 | /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ |
| 108 | - const showDropDown = commonUtils.isNotEmptyArr(this.props.showConfig.dropDownData) ? this.props.showConfig.dropDownData : | ||
| 109 | - (typeof this.props.showConfig.showDropDown === 'object') ? this.props.showConfig.showDropDown : commonUtils.objectToArr(commonUtils.convertStrToObj(this.props.showConfig.showDropDown)); | 107 | + const showDropDown = commonUtils.isNotEmptyArr(this.props.showConfig.dropDownData) |
| 108 | + ? this.props.showConfig.dropDownData | ||
| 109 | + : typeof this.props.showConfig.showDropDown === "object" | ||
| 110 | + ? this.props.showConfig.showDropDown | ||
| 111 | + : commonUtils.objectToArr(commonUtils.convertStrToObj(this.props.showConfig.showDropDown)); | ||
| 110 | /* 给state赋值 */ | 112 | /* 给state赋值 */ |
| 111 | if (this.mounted) { | 113 | if (this.mounted) { |
| 112 | this.setState({ | 114 | this.setState({ |
| 113 | dropDownData: showDropDown, | 115 | dropDownData: showDropDown, |
| 114 | }); | 116 | }); |
| 115 | } | 117 | } |
| 116 | - } else if (this.props.showConfig.sDropDownType === 'sql' && !commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { | 118 | + } else if (this.props.showConfig.sDropDownType === "sql" && !commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { |
| 117 | if (this.mounted) { | 119 | if (this.mounted) { |
| 118 | this.setState({ | 120 | this.setState({ |
| 119 | dropDownData: this.props.showConfig.dropDownData, | 121 | dropDownData: this.props.showConfig.dropDownData, |
| @@ -128,10 +130,10 @@ export default class CommonComponent extends Component { | @@ -128,10 +130,10 @@ export default class CommonComponent extends Component { | ||
| 128 | const antInput = currentNode.querySelector("input[class*='ant-input']"); | 130 | const antInput = currentNode.querySelector("input[class*='ant-input']"); |
| 129 | const oInput = selectInputNode || antInput; | 131 | const oInput = selectInputNode || antInput; |
| 130 | if (oInput) { | 132 | if (oInput) { |
| 131 | - oInput.addEventListener('compositionstart', () => { | 133 | + oInput.addEventListener("compositionstart", () => { |
| 132 | this.chineseInputting = true; | 134 | this.chineseInputting = true; |
| 133 | }); | 135 | }); |
| 134 | - oInput.addEventListener('compositionend', () => { | 136 | + oInput.addEventListener("compositionend", () => { |
| 135 | this.chineseInputting = false; | 137 | this.chineseInputting = false; |
| 136 | if (this.handleCompleteInputEventCache) { | 138 | if (this.handleCompleteInputEventCache) { |
| 137 | this.handleCompleteInputEventCache(); | 139 | this.handleCompleteInputEventCache(); |
| @@ -140,20 +142,20 @@ export default class CommonComponent extends Component { | @@ -140,20 +142,20 @@ export default class CommonComponent extends Component { | ||
| 140 | } | 142 | } |
| 141 | 143 | ||
| 142 | if (currentNode) { | 144 | if (currentNode) { |
| 143 | - if (['t', 'm', 'y'].includes(this.firstDataIndex)) { | 145 | + if (["t", "m", "y"].includes(this.firstDataIndex)) { |
| 144 | const oInput = currentNode.querySelector(`input[id*="${this.props.showConfig.sName}"]`); | 146 | const oInput = currentNode.querySelector(`input[id*="${this.props.showConfig.sName}"]`); |
| 145 | if (oInput) { | 147 | if (oInput) { |
| 146 | let { sDateFormat } = this.props.showConfig; | 148 | let { sDateFormat } = this.props.showConfig; |
| 147 | if (commonUtils.isEmptyStr(sDateFormat)) { | 149 | if (commonUtils.isEmptyStr(sDateFormat)) { |
| 148 | - if (this.firstDataIndex === 'm') { | ||
| 149 | - sDateFormat = 'YYYY-MM'; | ||
| 150 | - } else if (this.firstDataIndex === 'y') { | ||
| 151 | - sDateFormat = 'YYYY'; | 150 | + if (this.firstDataIndex === "m") { |
| 151 | + sDateFormat = "YYYY-MM"; | ||
| 152 | + } else if (this.firstDataIndex === "y") { | ||
| 153 | + sDateFormat = "YYYY"; | ||
| 152 | } else { | 154 | } else { |
| 153 | sDateFormat = this.props.getDateFormat(); | 155 | sDateFormat = this.props.getDateFormat(); |
| 154 | } | 156 | } |
| 155 | } | 157 | } |
| 156 | - oInput.oninput = (e) => { | 158 | + oInput.oninput = e => { |
| 157 | const { value } = e.target; | 159 | const { value } = e.target; |
| 158 | const isValidDate = moment(value, sDateFormat, true).isValid(); | 160 | const isValidDate = moment(value, sDateFormat, true).isValid(); |
| 159 | if (isValidDate) { | 161 | if (isValidDate) { |
| @@ -163,22 +165,24 @@ export default class CommonComponent extends Component { | @@ -163,22 +165,24 @@ export default class CommonComponent extends Component { | ||
| 163 | } | 165 | } |
| 164 | } | 166 | } |
| 165 | } | 167 | } |
| 166 | - document.addEventListener('mousedown', this.handleSelectClick); | 168 | + document.addEventListener("mousedown", this.handleSelectClick); |
| 167 | } | 169 | } |
| 168 | 170 | ||
| 169 | /** props改变的时候触发 */ | 171 | /** props改变的时候触发 */ |
| 170 | componentWillReceiveProps(nextProps) { | 172 | componentWillReceiveProps(nextProps) { |
| 171 | /* 如果是下拉控件,则要获取数据(获取下拉数据前要先更新sqlCondition) */ | 173 | /* 如果是下拉控件,则要获取数据(获取下拉数据前要先更新sqlCondition) */ |
| 172 | - const { | ||
| 173 | - dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType, | ||
| 174 | - } = this.state; | 174 | + const { dataValue, enabled, sFieldName, bNotEmpty, showName, sDropDownType } = this.state; |
| 175 | if (nextProps.showConfig === undefined || this.props.showConfig === undefined) return; | 175 | if (nextProps.showConfig === undefined || this.props.showConfig === undefined) return; |
| 176 | this.firstDataIndex = nextProps.showConfig.sName.substring(0, 1); /* 控件首字母(数据格式:字符串) */ | 176 | this.firstDataIndex = nextProps.showConfig.sName.substring(0, 1); /* 控件首字母(数据格式:字符串) */ |
| 177 | 177 | ||
| 178 | - if (nextProps.showConfig.sDropDownType === 'const') { /* 常量下拉 */ | 178 | + if (nextProps.showConfig.sDropDownType === "const") { |
| 179 | + /* 常量下拉 */ | ||
| 179 | /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ | 180 | /* 常量下拉其实只取一次数据就可以啦,去过数据的会给state中的dropDownData赋值,所以dropDownData有值的情况就不需要再获取了 */ |
| 180 | - const showDropDown = commonUtils.isNotEmptyArr(nextProps.showConfig.dropDownData) ? nextProps.showConfig.dropDownData : | ||
| 181 | - (typeof nextProps.showConfig.showDropDown === 'object') ? nextProps.showConfig.showDropDown : commonUtils.objectToArr(commonUtils.convertStrToObj(nextProps.showConfig.showDropDown)); | 181 | + const showDropDown = commonUtils.isNotEmptyArr(nextProps.showConfig.dropDownData) |
| 182 | + ? nextProps.showConfig.dropDownData | ||
| 183 | + : typeof nextProps.showConfig.showDropDown === "object" | ||
| 184 | + ? nextProps.showConfig.showDropDown | ||
| 185 | + : commonUtils.objectToArr(commonUtils.convertStrToObj(nextProps.showConfig.showDropDown)); | ||
| 182 | // 对应工序单独处理 | 186 | // 对应工序单独处理 |
| 183 | // if (this.props.showConfig.showName === '对应工序') { | 187 | // if (this.props.showConfig.showName === '对应工序') { |
| 184 | // showDropDown = nextProps.customDropData; | 188 | // showDropDown = nextProps.customDropData; |
| @@ -189,7 +193,7 @@ export default class CommonComponent extends Component { | @@ -189,7 +193,7 @@ export default class CommonComponent extends Component { | ||
| 189 | dropDownData: showDropDown, | 193 | dropDownData: showDropDown, |
| 190 | }); | 194 | }); |
| 191 | } | 195 | } |
| 192 | - } else if (nextProps.showConfig.sDropDownType === 'sql' && !commonUtils.isEmptyArr(nextProps.showConfig.dropDownData)) { | 196 | + } else if (nextProps.showConfig.sDropDownType === "sql" && !commonUtils.isEmptyArr(nextProps.showConfig.dropDownData)) { |
| 193 | if (this.mounted) { | 197 | if (this.mounted) { |
| 194 | this.setState({ | 198 | this.setState({ |
| 195 | dropDownData: nextProps.showConfig.dropDownData, | 199 | dropDownData: nextProps.showConfig.dropDownData, |
| @@ -197,7 +201,16 @@ export default class CommonComponent extends Component { | @@ -197,7 +201,16 @@ export default class CommonComponent extends Component { | ||
| 197 | } | 201 | } |
| 198 | } | 202 | } |
| 199 | /* 把需要更新的数据setState */ | 203 | /* 把需要更新的数据setState */ |
| 200 | - if (dataValue !== nextProps.dataValue || enabled !== nextProps.enabled || bNotEmpty !== nextProps.showConfig.bNotEmpty || sFieldName !== nextProps.showConfig.sName || (showName !== nextProps.showConfig.showName || !showName) || sDropDownType !== nextProps.showConfig.sDropDownType || (this.bSpecial && this.props.record.sProductNo !== nextProps.record.sProductNo)) { | 204 | + if ( |
| 205 | + dataValue !== nextProps.dataValue || | ||
| 206 | + enabled !== nextProps.enabled || | ||
| 207 | + bNotEmpty !== nextProps.showConfig.bNotEmpty || | ||
| 208 | + sFieldName !== nextProps.showConfig.sName || | ||
| 209 | + showName !== nextProps.showConfig.showName || | ||
| 210 | + !showName || | ||
| 211 | + sDropDownType !== nextProps.showConfig.sDropDownType || | ||
| 212 | + (this.bSpecial && this.props.record.sProductNo !== nextProps.record.sProductNo) | ||
| 213 | + ) { | ||
| 201 | if (this.mounted) { | 214 | if (this.mounted) { |
| 202 | if (commonUtils.isEmpty(nextProps.dataValue)) { | 215 | if (commonUtils.isEmpty(nextProps.dataValue)) { |
| 203 | this.lastValue = nextProps.dataValue; | 216 | this.lastValue = nextProps.dataValue; |
| @@ -221,20 +234,40 @@ export default class CommonComponent extends Component { | @@ -221,20 +234,40 @@ export default class CommonComponent extends Component { | ||
| 221 | 234 | ||
| 222 | shouldComponentUpdate(nextProps, nextState) { | 235 | shouldComponentUpdate(nextProps, nextState) { |
| 223 | const { | 236 | const { |
| 224 | - dataValue, enabled, dropDownData, searchValue, searchDropDownData, sFieldName, bNotEmpty, sActiveDisplay, sDropDownType, spinState, showConfig, | 237 | + dataValue, |
| 238 | + enabled, | ||
| 239 | + dropDownData, | ||
| 240 | + searchValue, | ||
| 241 | + searchDropDownData, | ||
| 242 | + sFieldName, | ||
| 243 | + bNotEmpty, | ||
| 244 | + sActiveDisplay, | ||
| 245 | + sDropDownType, | ||
| 246 | + spinState, | ||
| 247 | + showConfig, | ||
| 225 | } = this.state; | 248 | } = this.state; |
| 226 | 249 | ||
| 227 | - return nextProps.showConfig !== undefined && (dataValue !== nextState.dataValue || enabled !== nextState.enabled || | ||
| 228 | - sFieldName !== nextState.sFieldName || sDropDownType !== nextState.sDropDownType || bNotEmpty !== nextState.bNotEmpty || JSON.stringify(dropDownData) !== JSON.stringify(nextState.dropDownData) || | ||
| 229 | - searchValue !== nextState.searchValue || JSON.stringify(searchDropDownData) !== JSON.stringify(nextState.searchDropDownData) || | ||
| 230 | - JSON.stringify(sActiveDisplay) !== JSON.stringify(nextState.sActiveDisplay) || nextProps.showTime !== this.props.showTime || | ||
| 231 | - spinState !== nextState.spinState || JSON.stringify(nextState.selectTableData) !== JSON.stringify(this.state.selectTableData) || | ||
| 232 | - JSON.stringify(nextProps.showConfig) !== JSON.stringify(showConfig)); | 250 | + return ( |
| 251 | + nextProps.showConfig !== undefined && | ||
| 252 | + (dataValue !== nextState.dataValue || | ||
| 253 | + enabled !== nextState.enabled || | ||
| 254 | + sFieldName !== nextState.sFieldName || | ||
| 255 | + sDropDownType !== nextState.sDropDownType || | ||
| 256 | + bNotEmpty !== nextState.bNotEmpty || | ||
| 257 | + JSON.stringify(dropDownData) !== JSON.stringify(nextState.dropDownData) || | ||
| 258 | + searchValue !== nextState.searchValue || | ||
| 259 | + JSON.stringify(searchDropDownData) !== JSON.stringify(nextState.searchDropDownData) || | ||
| 260 | + JSON.stringify(sActiveDisplay) !== JSON.stringify(nextState.sActiveDisplay) || | ||
| 261 | + nextProps.showTime !== this.props.showTime || | ||
| 262 | + spinState !== nextState.spinState || | ||
| 263 | + JSON.stringify(nextState.selectTableData) !== JSON.stringify(this.state.selectTableData) || | ||
| 264 | + JSON.stringify(nextProps.showConfig) !== JSON.stringify(showConfig)) | ||
| 265 | + ); | ||
| 233 | } | 266 | } |
| 234 | 267 | ||
| 235 | componentWillUnmount() { | 268 | componentWillUnmount() { |
| 236 | this.mounted = false; | 269 | this.mounted = false; |
| 237 | - document.removeEventListener('mousedown', this.handleSelectClick); | 270 | + document.removeEventListener("mousedown", this.handleSelectClick); |
| 238 | } | 271 | } |
| 239 | 272 | ||
| 240 | onFocus = () => { | 273 | onFocus = () => { |
| @@ -242,8 +275,8 @@ export default class CommonComponent extends Component { | @@ -242,8 +275,8 @@ export default class CommonComponent extends Component { | ||
| 242 | this.setState({ sActiveDisplay: false }); | 275 | this.setState({ sActiveDisplay: false }); |
| 243 | }; | 276 | }; |
| 244 | 277 | ||
| 245 | - onBlur = (event) => { | ||
| 246 | - if (this.onExecInstructSet('blur')) return; | 278 | + onBlur = event => { |
| 279 | + if (this.onExecInstructSet("blur")) return; | ||
| 247 | 280 | ||
| 248 | this.isDropdownFilter = false; | 281 | this.isDropdownFilter = false; |
| 249 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sTableTitleSql) && this.props.showConfig.iVisCount > 1) { | 282 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sTableTitleSql) && this.props.showConfig.iVisCount > 1) { |
| @@ -251,13 +284,17 @@ export default class CommonComponent extends Component { | @@ -251,13 +284,17 @@ export default class CommonComponent extends Component { | ||
| 251 | searchPageNum: 1, | 284 | searchPageNum: 1, |
| 252 | searchTotalPageCount: 1, | 285 | searchTotalPageCount: 1, |
| 253 | searchDropDownData: [], | 286 | searchDropDownData: [], |
| 254 | - searchValue: '', | 287 | + searchValue: "", |
| 255 | spinState: false, | 288 | spinState: false, |
| 256 | sActiveDisplay: true, | 289 | sActiveDisplay: true, |
| 257 | }); | 290 | }); |
| 258 | - } else if (this.state.searchValue !== '' && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { | 291 | + } else if ( |
| 292 | + this.state.searchValue !== "" && | ||
| 293 | + this.props.showConfig.sDropDownType === "sql" && | ||
| 294 | + commonUtils.isEmptyArr(this.props.showConfig.dropDownData) | ||
| 295 | + ) { | ||
| 259 | if (!this.props.showConfig.bCanInput) { | 296 | if (!this.props.showConfig.bCanInput) { |
| 260 | - this.handleSelectOptionEvent(''); | 297 | + this.handleSelectOptionEvent(""); |
| 261 | } | 298 | } |
| 262 | this.setState({ | 299 | this.setState({ |
| 263 | searchPageNum: 1, | 300 | searchPageNum: 1, |
| @@ -273,7 +310,10 @@ export default class CommonComponent extends Component { | @@ -273,7 +310,10 @@ export default class CommonComponent extends Component { | ||
| 273 | }); | 310 | }); |
| 274 | } | 311 | } |
| 275 | /* 若下拉配置了movesql 则离开时 调用下拉sql数据 */ | 312 | /* 若下拉配置了movesql 则离开时 调用下拉sql数据 */ |
| 276 | - if (this.props.showConfig && (this.props.showConfig.sDropDownType === 'movesql' || commonUtils.isNotEmptyObject(this.props.showConfig.sButtonParam))) { | 313 | + if ( |
| 314 | + this.props.showConfig && | ||
| 315 | + (this.props.showConfig.sDropDownType === "movesql" || commonUtils.isNotEmptyObject(this.props.showConfig.sButtonParam)) | ||
| 316 | + ) { | ||
| 277 | this.props.onDropDownBlur(this.props.name, this.props.showConfig.sName, this.props.record, this.props.showConfig); | 317 | this.props.onDropDownBlur(this.props.name, this.props.showConfig.sName, this.props.record, this.props.showConfig); |
| 278 | } | 318 | } |
| 279 | 319 | ||
| @@ -282,40 +322,34 @@ export default class CommonComponent extends Component { | @@ -282,40 +322,34 @@ export default class CommonComponent extends Component { | ||
| 282 | }; | 322 | }; |
| 283 | 323 | ||
| 284 | onBlurText = (event, timeout = 0) => { | 324 | onBlurText = (event, timeout = 0) => { |
| 285 | - if (this.onExecInstructSet('blur')) return; | 325 | + if (this.onExecInstructSet("blur")) return; |
| 286 | const currentValue = event?.target?.value; | 326 | const currentValue = event?.target?.value; |
| 287 | if (currentValue === this.lastValue) return; | 327 | if (currentValue === this.lastValue) return; |
| 288 | setTimeout(() => { | 328 | setTimeout(() => { |
| 289 | - const { | ||
| 290 | - name, | ||
| 291 | - record, | ||
| 292 | - sBtnSendDialogConfigList, | ||
| 293 | - onToolBarBtnClick, | ||
| 294 | - } = this.props; | ||
| 295 | - if (name !== 'master') return; | 329 | + const { name, record, sBtnSendDialogConfigList, onToolBarBtnClick } = this.props; |
| 330 | + if (name !== "master") return; | ||
| 296 | if (commonUtils.isEmptyArr(sBtnSendDialogConfigList)) return; | 331 | if (commonUtils.isEmptyArr(sBtnSendDialogConfigList)) return; |
| 297 | const { sName } = this.props.showConfig; | 332 | const { sName } = this.props.showConfig; |
| 298 | if (!record[sName]) return; | 333 | if (!record[sName]) return; |
| 299 | 334 | ||
| 300 | const { sActiveKey, sControlName } = | 335 | const { sActiveKey, sControlName } = |
| 301 | - sBtnSendDialogConfigList.find((item) => { | ||
| 302 | - const { sActiveKey = '' } = item; | ||
| 303 | - return sActiveKey.split(',').includes(`${name}.${sName}`); | ||
| 304 | - }) | ||
| 305 | - || {}; | ||
| 306 | - if (sControlName !== 'BtnSendDialog') { | 336 | + sBtnSendDialogConfigList.find(item => { |
| 337 | + const { sActiveKey = "" } = item; | ||
| 338 | + return sActiveKey.split(",").includes(`${name}.${sName}`); | ||
| 339 | + }) || {}; | ||
| 340 | + if (sControlName !== "BtnSendDialog") { | ||
| 307 | if (!sActiveKey) return; | 341 | if (!sActiveKey) return; |
| 308 | this.lastValue = currentValue; | 342 | this.lastValue = currentValue; |
| 309 | onToolBarBtnClick({ key: sControlName }); | 343 | onToolBarBtnClick({ key: sControlName }); |
| 310 | } | 344 | } |
| 311 | }, timeout); | 345 | }, timeout); |
| 312 | - } | 346 | + }; |
| 313 | 347 | ||
| 314 | - onExecInstructSet = (type) => { | 348 | + onExecInstructSet = type => { |
| 315 | const { sInstruct: sInstructStr, showName, sOnChangeInstruct } = this.props.showConfig; | 349 | const { sInstruct: sInstructStr, showName, sOnChangeInstruct } = this.props.showConfig; |
| 316 | const sInstruct = commonUtils.convertStrToObj(sInstructStr, {}); | 350 | const sInstruct = commonUtils.convertStrToObj(sInstructStr, {}); |
| 317 | let { [type]: instructType } = sInstruct; | 351 | let { [type]: instructType } = sInstruct; |
| 318 | - if (type === 'change') { | 352 | + if (type === "change") { |
| 319 | const onChangeNew = commonUtils.convertStrToObj(sOnChangeInstruct, {}); | 353 | const onChangeNew = commonUtils.convertStrToObj(sOnChangeInstruct, {}); |
| 320 | instructType = onChangeNew[type]; | 354 | instructType = onChangeNew[type]; |
| 321 | } | 355 | } |
| @@ -324,48 +358,46 @@ export default class CommonComponent extends Component { | @@ -324,48 +358,46 @@ export default class CommonComponent extends Component { | ||
| 324 | this.props.onExecInstructSet({ | 358 | this.props.onExecInstructSet({ |
| 325 | type, | 359 | type, |
| 326 | sInstruct: instructType, | 360 | sInstruct: instructType, |
| 327 | - showName: `${showName}-${type === 'blur' ? '离焦' : '变化'}`, | 361 | + showName: `${showName}-${type === "blur" ? "离焦" : "变化"}`, |
| 328 | }); | 362 | }); |
| 329 | } else { | 363 | } else { |
| 330 | - message.error('未定义调用指令集事件!'); | 364 | + message.error("未定义调用指令集事件!"); |
| 331 | } | 365 | } |
| 332 | return true; | 366 | return true; |
| 333 | } | 367 | } |
| 334 | return false; | 368 | return false; |
| 335 | - } | 369 | + }; |
| 336 | 370 | ||
| 337 | onCheckFields = () => { | 371 | onCheckFields = () => { |
| 338 | // 手机号、邮箱校验等校验 | 372 | // 手机号、邮箱校验等校验 |
| 339 | // setTimeout(() => { | 373 | // setTimeout(() => { |
| 340 | - const sDateFormatTypeList = ['phone', 'mobile', 'mail', 'postcode']; | 374 | + const sDateFormatTypeList = ["phone", "mobile", "mail", "postcode"]; |
| 341 | const { sName, showName, sDateFormat } = this.props.showConfig; | 375 | const { sName, showName, sDateFormat } = this.props.showConfig; |
| 342 | const { record } = this.props; | 376 | const { record } = this.props; |
| 343 | - const IncorrectFormat = commonFunc.showLocalMessage(this.props, 'IncorrectFormat', '格式不正确'); | 377 | + const IncorrectFormat = commonFunc.showLocalMessage(this.props, "IncorrectFormat", "格式不正确"); |
| 344 | const value = record[sName]; | 378 | const value = record[sName]; |
| 345 | - if ( | ||
| 346 | - value !== undefined && value !== '' && sDateFormatTypeList.includes(sDateFormat) | ||
| 347 | - ) { | 379 | + if (value !== undefined && value !== "" && sDateFormatTypeList.includes(sDateFormat)) { |
| 348 | let flag = false; | 380 | let flag = false; |
| 349 | - if (sDateFormat === 'phone') { | 381 | + if (sDateFormat === "phone") { |
| 350 | const reg = /^0\d{2,3}-\d{7,8}$/; | 382 | const reg = /^0\d{2,3}-\d{7,8}$/; |
| 351 | const reg1 = /^1[0-9]{10}$/; | 383 | const reg1 = /^1[0-9]{10}$/; |
| 352 | const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/; | 384 | const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/; |
| 353 | if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) { | 385 | if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) { |
| 354 | flag = true; | 386 | flag = true; |
| 355 | } | 387 | } |
| 356 | - } else if (sDateFormat === 'mobile') { | 388 | + } else if (sDateFormat === "mobile") { |
| 357 | const reg = /^0\d{2,3}-\d{7,8}$/; | 389 | const reg = /^0\d{2,3}-\d{7,8}$/; |
| 358 | const reg1 = /^1[0-9]{10}$/; | 390 | const reg1 = /^1[0-9]{10}$/; |
| 359 | const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/; | 391 | const reg2 = /^0\d{2,3}-\d{7,8}-\d{1,8}$/; |
| 360 | if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) { | 392 | if (!reg.test(value) && !reg1.test(value) && !reg2.test(value)) { |
| 361 | flag = true; | 393 | flag = true; |
| 362 | } | 394 | } |
| 363 | - } else if (sDateFormat === 'mail') { | 395 | + } else if (sDateFormat === "mail") { |
| 364 | const reg = /^[a-zA-Z0-9]{1,20}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}$/; | 396 | const reg = /^[a-zA-Z0-9]{1,20}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}$/; |
| 365 | if (!reg.test(value)) { | 397 | if (!reg.test(value)) { |
| 366 | flag = true; | 398 | flag = true; |
| 367 | } | 399 | } |
| 368 | - } else if (sDateFormat === 'postcode') { | 400 | + } else if (sDateFormat === "postcode") { |
| 369 | const reg = /^[1-9][0-9]{5}$/; | 401 | const reg = /^[1-9][0-9]{5}$/; |
| 370 | if (!reg.test(value)) { | 402 | if (!reg.test(value)) { |
| 371 | flag = true; | 403 | flag = true; |
| @@ -373,26 +405,30 @@ export default class CommonComponent extends Component { | @@ -373,26 +405,30 @@ export default class CommonComponent extends Component { | ||
| 373 | } | 405 | } |
| 374 | 406 | ||
| 375 | if (flag) { | 407 | if (flag) { |
| 376 | - this.props.onChange(this.props.name, 'verificationFailed', { verificationFailed: true, verificationFailedMsg: `【${showName}】【${sName}】${IncorrectFormat}!` }, this.props.sId, []); | 408 | + this.props.onChange( |
| 409 | + this.props.name, | ||
| 410 | + "verificationFailed", | ||
| 411 | + { verificationFailed: true, verificationFailedMsg: `【${showName}】【${sName}】${IncorrectFormat}!` }, | ||
| 412 | + this.props.sId, | ||
| 413 | + [] | ||
| 414 | + ); | ||
| 377 | message.warning(`【${showName}】【${sName}】${IncorrectFormat}!`); | 415 | message.warning(`【${showName}】【${sName}】${IncorrectFormat}!`); |
| 378 | } else if (record.verificationFailed) { | 416 | } else if (record.verificationFailed) { |
| 379 | record.verificationFailed = undefined; | 417 | record.verificationFailed = undefined; |
| 380 | } | 418 | } |
| 381 | } | 419 | } |
| 382 | // }, timeout); | 420 | // }, timeout); |
| 383 | - } | 421 | + }; |
| 384 | 422 | ||
| 385 | /** 下拉时看是否要重新获取数据 */ | 423 | /** 下拉时看是否要重新获取数据 */ |
| 386 | - onDropdownVisibleChange = (open) => { | ||
| 387 | - const { | ||
| 388 | - dropDownData, bNewRecord, pageNum: pageNumOld, totalPageCount: totalPageCountOld, searchValue, conditonValues, | ||
| 389 | - } = this.state; | 424 | + onDropdownVisibleChange = open => { |
| 425 | + const { dropDownData, bNewRecord, pageNum: pageNumOld, totalPageCount: totalPageCountOld, searchValue, conditonValues } = this.state; | ||
| 390 | 426 | ||
| 391 | if (this.mounted && open) { | 427 | if (this.mounted && open) { |
| 392 | const conditonValuesNew = this.props.getSqlCondition(this.props.showConfig, this.props.name, this.props.record); | 428 | const conditonValuesNew = this.props.getSqlCondition(this.props.showConfig, this.props.name, this.props.record); |
| 393 | const pageNum = JSON.stringify(conditonValuesNew) !== JSON.stringify(conditonValues) ? 1 : pageNumOld === 0 ? 1 : pageNumOld; | 429 | const pageNum = JSON.stringify(conditonValuesNew) !== JSON.stringify(conditonValues) ? 1 : pageNumOld === 0 ? 1 : pageNumOld; |
| 394 | const totalPageCount = conditonValuesNew !== conditonValues ? 1 : totalPageCountOld; | 430 | const totalPageCount = conditonValuesNew !== conditonValues ? 1 : totalPageCountOld; |
| 395 | - if (pageNum === 1 && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { | 431 | + if (pageNum === 1 && this.props.showConfig.sDropDownType === "sql" && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { |
| 396 | this.setState({ spinState: true }); | 432 | this.setState({ spinState: true }); |
| 397 | this.getDropDownData(pageNum, totalPageCount, searchValue, this.dropDownCount); | 433 | this.getDropDownData(pageNum, totalPageCount, searchValue, this.dropDownCount); |
| 398 | } | 434 | } |
| @@ -411,14 +447,17 @@ export default class CommonComponent extends Component { | @@ -411,14 +447,17 @@ export default class CommonComponent extends Component { | ||
| 411 | } | 447 | } |
| 412 | this.props.onDropdownVisibleChange(open); | 448 | this.props.onDropdownVisibleChange(open); |
| 413 | } | 449 | } |
| 414 | - } | 450 | + }; |
| 415 | 451 | ||
| 416 | onDoubleClick = () => { | 452 | onDoubleClick = () => { |
| 417 | const sMemo = this.props.showConfig.sName; | 453 | const sMemo = this.props.showConfig.sName; |
| 418 | const title = this.props.showConfig.showName; | 454 | const title = this.props.showConfig.showName; |
| 419 | - const bSParamValue = sMemo === 'sParamValue'; | ||
| 420 | - if ((commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('Memo') > -1) || (bSParamValue && !this.props.record.sDropDownData) || | ||
| 421 | - (this.props.showConfig.sControlName && this.props.showConfig.sControlName.toLowerCase().indexOf('memo') > -1)) { | 455 | + const bSParamValue = sMemo === "sParamValue"; |
| 456 | + if ( | ||
| 457 | + (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("Memo") > -1) || | ||
| 458 | + (bSParamValue && !this.props.record.sDropDownData) || | ||
| 459 | + (this.props.showConfig.sControlName && this.props.showConfig.sControlName.toLowerCase().indexOf("memo") > -1) | ||
| 460 | + ) { | ||
| 422 | const sCurrMemoProps = { | 461 | const sCurrMemoProps = { |
| 423 | title, | 462 | title, |
| 424 | name: this.props.name, | 463 | name: this.props.name, |
| @@ -434,16 +473,20 @@ export default class CommonComponent extends Component { | @@ -434,16 +473,20 @@ export default class CommonComponent extends Component { | ||
| 434 | } else if (this.props.onSaveState) { | 473 | } else if (this.props.onSaveState) { |
| 435 | this.props.onSaveState({ sCurrMemoProps }); | 474 | this.props.onSaveState({ sCurrMemoProps }); |
| 436 | } | 475 | } |
| 437 | - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sName') > -1) { /* 计算方案 变量设置双击弹出 */ | 476 | + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sName") > -1) { |
| 477 | + /* 计算方案 变量设置双击弹出 */ | ||
| 438 | this.props.onFieldDoubleClick(this.props.record, this.state.dataValue, this.props.showConfig, this.props.name); | 478 | this.props.onFieldDoubleClick(this.props.record, this.state.dataValue, this.props.showConfig, this.props.name); |
| 439 | - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sValue') > -1) { /* 计算方案 变量设置双击弹出 */ | 479 | + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sValue") > -1) { |
| 480 | + /* 计算方案 变量设置双击弹出 */ | ||
| 440 | this.props.onFieldDoubleClick(this.props.record, this.state.dataValue, this.props.showConfig, this.props.name); | 481 | this.props.onFieldDoubleClick(this.props.record, this.state.dataValue, this.props.showConfig, this.props.name); |
| 441 | - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sAssignField') > -1) { /* 赋值字段 变量设置双击弹出 */ | 482 | + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sAssignField") > -1) { |
| 483 | + /* 赋值字段 变量设置双击弹出 */ | ||
| 442 | this.props.onFieldDoubleClick(this.state.dataValue, this.props.showConfig, this.props.name); | 484 | this.props.onFieldDoubleClick(this.state.dataValue, this.props.showConfig, this.props.name); |
| 443 | - } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf('sInstruct') > -1) { /* 赋值字段 变量设置双击弹出 */ | 485 | + } else if (commonUtils.isNotEmptyObject(sMemo) && sMemo.indexOf("sInstruct") > -1) { |
| 486 | + /* 赋值字段 变量设置双击弹出 */ | ||
| 444 | this.props.onFieldDoubleClick(this.state.dataValue, this.props.showConfig, this.props.name); | 487 | this.props.onFieldDoubleClick(this.state.dataValue, this.props.showConfig, this.props.name); |
| 445 | } | 488 | } |
| 446 | - } | 489 | + }; |
| 447 | 490 | ||
| 448 | onEditorClick = () => { | 491 | onEditorClick = () => { |
| 449 | // if (this.props.enabled) { | 492 | // if (this.props.enabled) { |
| @@ -459,42 +502,44 @@ export default class CommonComponent extends Component { | @@ -459,42 +502,44 @@ export default class CommonComponent extends Component { | ||
| 459 | config: this.props.showConfig, | 502 | config: this.props.showConfig, |
| 460 | }; | 503 | }; |
| 461 | this.props.onSaveState({ curEditorProps }); | 504 | this.props.onSaveState({ curEditorProps }); |
| 462 | - } | 505 | + }; |
| 463 | 506 | ||
| 464 | - onKeyUp = (e) => { | 507 | + onKeyUp = e => { |
| 465 | if (this.props.onKeyUp) { | 508 | if (this.props.onKeyUp) { |
| 466 | this.props.onKeyUp(e); | 509 | this.props.onKeyUp(e); |
| 467 | } | 510 | } |
| 468 | - } | 511 | + }; |
| 469 | 512 | ||
| 470 | - onKeyDown = (e) => { | 513 | + onKeyDown = e => { |
| 471 | // 如果输入的是字母数字或者中文 | 514 | // 如果输入的是字母数字或者中文 |
| 472 | if (!this.state.bDropDownOpen && /^[a-zA-Z0-9\u4e00-\u9fa5]+$/.test(e.keyCode)) { | 515 | if (!this.state.bDropDownOpen && /^[a-zA-Z0-9\u4e00-\u9fa5]+$/.test(e.keyCode)) { |
| 473 | this.setState({ bDropDownOpen: true }); | 516 | this.setState({ bDropDownOpen: true }); |
| 474 | } | 517 | } |
| 475 | - if (e.ctrlKey && e.keyCode === 82) { /* CTRL+ALT+R 代替右击事件 */ | 518 | + if (e.ctrlKey && e.keyCode === 82) { |
| 519 | + /* CTRL+ALT+R 代替右击事件 */ | ||
| 476 | this.onContextMenu(e); | 520 | this.onContextMenu(e); |
| 477 | - } else if (e.key === 'F10') { | 521 | + } else if (e.key === "F10") { |
| 478 | message.info(this.props.showConfig.sName); | 522 | message.info(this.props.showConfig.sName); |
| 479 | - } else if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) { /* CTRL+ALT+G F7 设置界面 */ | 523 | + } else if (e.ctrlKey && (e.altKey || e.metaKey) && e.keyCode === 71) { |
| 524 | + /* CTRL+ALT+G F7 设置界面 */ | ||
| 480 | const { sType } = this.props?.app?.userinfo || {}; | 525 | const { sType } = this.props?.app?.userinfo || {}; |
| 481 | - if (!['sysadmin'].includes(sType)) { | 526 | + if (!["sysadmin"].includes(sType)) { |
| 482 | return; | 527 | return; |
| 483 | } | 528 | } |
| 484 | if (commonUtils.isNotEmptyObject(this.props)) { | 529 | if (commonUtils.isNotEmptyObject(this.props)) { |
| 485 | - const { | ||
| 486 | - name, tableConfig, record, configName, | ||
| 487 | - } = this.props; | 530 | + const { name, tableConfig, record, configName } = this.props; |
| 488 | if (commonUtils.isNotEmptyObject(tableConfig)) { | 531 | if (commonUtils.isNotEmptyObject(tableConfig)) { |
| 489 | const myTableConfig = JSON.parse(JSON.stringify(tableConfig)); | 532 | const myTableConfig = JSON.parse(JSON.stringify(tableConfig)); |
| 490 | - myTableConfig.sActiveId = '16411004790004762980820285096000'; | 533 | + myTableConfig.sActiveId = "16411004790004762980820285096000"; |
| 491 | myTableConfig.sName = this.props.showConfig.sName; | 534 | myTableConfig.sName = this.props.showConfig.sName; |
| 492 | const myTableConfigArr = []; | 535 | const myTableConfigArr = []; |
| 493 | myTableConfigArr.push(myTableConfig); | 536 | myTableConfigArr.push(myTableConfig); |
| 494 | - if (this.props.name === 'master') { /* 主表 */ | ||
| 495 | - this.props.onViewClick(name, 'myTableConfig', record, 0, myTableConfigArr, configName); | ||
| 496 | - } else { /* 从表 */ | ||
| 497 | - this.props.onViewClick(name, 'myTableConfig', record, 0, myTableConfigArr, configName); | 537 | + if (this.props.name === "master") { |
| 538 | + /* 主表 */ | ||
| 539 | + this.props.onViewClick(name, "myTableConfig", record, 0, myTableConfigArr, configName); | ||
| 540 | + } else { | ||
| 541 | + /* 从表 */ | ||
| 542 | + this.props.onViewClick(name, "myTableConfig", record, 0, myTableConfigArr, configName); | ||
| 498 | } | 543 | } |
| 499 | } | 544 | } |
| 500 | } | 545 | } |
| @@ -502,28 +547,33 @@ export default class CommonComponent extends Component { | @@ -502,28 +547,33 @@ export default class CommonComponent extends Component { | ||
| 502 | const { showConfig, record, name } = this.props; | 547 | const { showConfig, record, name } = this.props; |
| 503 | this.props.onKeyDown(e, record, showConfig.sName, name); | 548 | this.props.onKeyDown(e, record, showConfig.sName, name); |
| 504 | } | 549 | } |
| 505 | - } | 550 | + }; |
| 506 | 551 | ||
| 507 | /* CommonList列表onkeydown-F10处理 */ | 552 | /* CommonList列表onkeydown-F10处理 */ |
| 508 | - onKeyDownDiv = (e) => { | 553 | + onKeyDownDiv = e => { |
| 509 | if (this.props.onKeyDown) { | 554 | if (this.props.onKeyDown) { |
| 510 | this.props.onKeyDown(e); | 555 | this.props.onKeyDown(e); |
| 511 | } | 556 | } |
| 512 | - if (e.key === 'F10') { | 557 | + if (e.key === "F10") { |
| 513 | message.info(this.props.showConfig.sName); | 558 | message.info(this.props.showConfig.sName); |
| 514 | } else if (e.ctrlKey && e.keyCode === 67) { | 559 | } else if (e.ctrlKey && e.keyCode === 67) { |
| 515 | - console.log('复制成功!'); | 560 | + console.log("复制成功!"); |
| 516 | } else if (e.ctrlKey && e.keyCode === 65) { | 561 | } else if (e.ctrlKey && e.keyCode === 65) { |
| 517 | - console.log('全选成功!'); | 562 | + console.log("全选成功!"); |
| 518 | } else { | 563 | } else { |
| 519 | e.preventDefault(); | 564 | e.preventDefault(); |
| 520 | return false; | 565 | return false; |
| 521 | } | 566 | } |
| 522 | - } | 567 | + }; |
| 523 | 568 | ||
| 524 | /* 单击右键全部更新,弹出窗选择后,更新此列所有数据 (只更新非只读字段) */ | 569 | /* 单击右键全部更新,弹出窗选择后,更新此列所有数据 (只更新非只读字段) */ |
| 525 | - onContextMenu = (e) => { | ||
| 526 | - if (this.state.enabled && commonUtils.isNotEmptyObject(this.props) && this.props.name !== 'master' && commonUtils.isNotEmptyObject(this.props.showConfig)) { | 570 | + onContextMenu = e => { |
| 571 | + if ( | ||
| 572 | + this.state.enabled && | ||
| 573 | + commonUtils.isNotEmptyObject(this.props) && | ||
| 574 | + this.props.name !== "master" && | ||
| 575 | + commonUtils.isNotEmptyObject(this.props.showConfig) | ||
| 576 | + ) { | ||
| 527 | const { showConfig, name } = this.props; | 577 | const { showConfig, name } = this.props; |
| 528 | const { bReadonly } = showConfig; | 578 | const { bReadonly } = showConfig; |
| 529 | if (bReadonly) { | 579 | if (bReadonly) { |
| @@ -535,47 +585,47 @@ export default class CommonComponent extends Component { | @@ -535,47 +585,47 @@ export default class CommonComponent extends Component { | ||
| 535 | this.props.onContextMenu(e, record, showConfig, name); | 585 | this.props.onContextMenu(e, record, showConfig, name); |
| 536 | } | 586 | } |
| 537 | } | 587 | } |
| 538 | - } | 588 | + }; |
| 539 | 589 | ||
| 540 | /* 字段选择弹窗 */ | 590 | /* 字段选择弹窗 */ |
| 541 | onFieldPopupModal = (showConfig, name, open) => { | 591 | onFieldPopupModal = (showConfig, name, open) => { |
| 542 | if (open !== undefined) { | 592 | if (open !== undefined) { |
| 543 | this.props.onFieldPopupModal(showConfig, name); | 593 | this.props.onFieldPopupModal(showConfig, name); |
| 544 | } | 594 | } |
| 545 | - } | 595 | + }; |
| 546 | /** 获取selectprops对象 */ | 596 | /** 获取selectprops对象 */ |
| 547 | getSelectProps = () => { | 597 | getSelectProps = () => { |
| 548 | /* 返回值声明 */ | 598 | /* 返回值声明 */ |
| 549 | const obj = { | 599 | const obj = { |
| 550 | id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, | 600 | id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, |
| 551 | - showSearch: true, /* 是否有查找功能 */ | 601 | + showSearch: true /* 是否有查找功能 */, |
| 552 | // disabled: !this.state.enabled /* 修改的时候传过来的数据 */ | 602 | // disabled: !this.state.enabled /* 修改的时候传过来的数据 */ |
| 553 | onSelect: () => { | 603 | onSelect: () => { |
| 554 | - if (this.state.mode !== 'multiple') { | 604 | + if (this.state.mode !== "multiple") { |
| 555 | this.setState({ bDropDownOpen: false, bNotFirstEnter: true }); | 605 | this.setState({ bDropDownOpen: false, bNotFirstEnter: true }); |
| 556 | } | 606 | } |
| 557 | }, | 607 | }, |
| 558 | - onChange: this.handleSelectOptionEvent, /* 选择触发事件 */ | ||
| 559 | - filterOption: this.filterOption, /* 搜索时过滤对应的 option 属性 */ | 608 | + onChange: this.handleSelectOptionEvent /* 选择触发事件 */, |
| 609 | + filterOption: this.filterOption /* 搜索时过滤对应的 option 属性 */, | ||
| 560 | onDropdownVisibleChange: this.onDropdownVisibleChange, | 610 | onDropdownVisibleChange: this.onDropdownVisibleChange, |
| 561 | onPopupScroll: this.handlePopupScroll, | 611 | onPopupScroll: this.handlePopupScroll, |
| 562 | onSearch: this.handleSearch, | 612 | onSearch: this.handleSearch, |
| 563 | - notFoundContent: this.state.spinState ? <Spin /> : '暂无数据', | 613 | + notFoundContent: this.state.spinState ? <Spin /> : "暂无数据", |
| 564 | // getPopupContainer: this.props.name === 'slave' || this.props.name === 'searchColumnShow' ? this.getPopupContainer : null,/*解决下拉框不随浏览器滚动问题 */ | 614 | // getPopupContainer: this.props.name === 'slave' || this.props.name === 'searchColumnShow' ? this.getPopupContainer : null,/*解决下拉框不随浏览器滚动问题 */ |
| 565 | onFocus: this.onFocus, | 615 | onFocus: this.onFocus, |
| 566 | // onBlur: this.onBlur, | 616 | // onBlur: this.onBlur, |
| 567 | - onBlur: (e) => { | 617 | + onBlur: e => { |
| 568 | this.setState({ bDropDownOpen: false, bNotFirstEnter: false }); | 618 | this.setState({ bDropDownOpen: false, bNotFirstEnter: false }); |
| 569 | this.onBlur(e); | 619 | this.onBlur(e); |
| 570 | }, | 620 | }, |
| 571 | mode: this.state.mode, | 621 | mode: this.state.mode, |
| 572 | - onPaste: (event) => { | 622 | + onPaste: event => { |
| 573 | if (this.props.showConfig.bMultipleChoice) { | 623 | if (this.props.showConfig.bMultipleChoice) { |
| 574 | - const clipboardText = event.clipboardData.getData('text/plain').trim(); | 624 | + const clipboardText = event.clipboardData.getData("text/plain").trim(); |
| 575 | if (clipboardText) { | 625 | if (clipboardText) { |
| 576 | - const { dataValue = '' } = this.state; | 626 | + const { dataValue = "" } = this.state; |
| 577 | let dataValueNew = dataValue; | 627 | let dataValueNew = dataValue; |
| 578 | - if (dataValueNew === '') { | 628 | + if (dataValueNew === "") { |
| 579 | dataValueNew += clipboardText; | 629 | dataValueNew += clipboardText; |
| 580 | } else { | 630 | } else { |
| 581 | dataValueNew += `,${clipboardText}`; | 631 | dataValueNew += `,${clipboardText}`; |
| @@ -586,22 +636,30 @@ export default class CommonComponent extends Component { | @@ -586,22 +636,30 @@ export default class CommonComponent extends Component { | ||
| 586 | } | 636 | } |
| 587 | }, | 637 | }, |
| 588 | }; | 638 | }; |
| 589 | - if (this.props.showConfig.sDropDownType === 'sql') { | ||
| 590 | - obj.optionLabelProp = 'title'; | 639 | + if (this.props.showConfig.sDropDownType === "sql") { |
| 640 | + obj.optionLabelProp = "title"; | ||
| 591 | } | 641 | } |
| 592 | if (this.props.readOnly) { | 642 | if (this.props.readOnly) { |
| 593 | - obj.readOnly = 'readOnly'; | 643 | + obj.readOnly = "readOnly"; |
| 594 | } else { | 644 | } else { |
| 595 | obj.disabled = !this.state.enabled; | 645 | obj.disabled = !this.state.enabled; |
| 596 | } | 646 | } |
| 597 | obj.placeholder = this.props.showConfig.placeholder; | 647 | obj.placeholder = this.props.showConfig.placeholder; |
| 598 | /* 区分Oee设置字体与其他系统设置字体 */ | 648 | /* 区分Oee设置字体与其他系统设置字体 */ |
| 599 | - obj.dropdownStyle = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? { fontSize: '1.3rem' } : { fontSize: '12px' }; | ||
| 600 | - obj.dropdownClassName = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? (location.pathname.toLowerCase().indexOf('loginoee') > -1 ? 'loginOeeDropDown' : 'oeeDropDown') : ''; | 649 | + obj.dropdownStyle = |
| 650 | + commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 651 | + ? { fontSize: "1.3rem" } | ||
| 652 | + : { fontSize: "12px" }; | ||
| 653 | + obj.dropdownClassName = | ||
| 654 | + commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 655 | + ? location.pathname.toLowerCase().indexOf("loginoee") > -1 | ||
| 656 | + ? "loginOeeDropDown" | ||
| 657 | + : "oeeDropDown" | ||
| 658 | + : ""; | ||
| 601 | /* 主表时才赋值value */ | 659 | /* 主表时才赋值value */ |
| 602 | if (this.props.bTable) { | 660 | if (this.props.bTable) { |
| 603 | if (this.props.showConfig.bMultipleChoice) { | 661 | if (this.props.showConfig.bMultipleChoice) { |
| 604 | - obj.value = !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(',') : []; /* 数据值 */ | 662 | + obj.value = !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(",") : []; /* 数据值 */ |
| 605 | } else { | 663 | } else { |
| 606 | obj.value = this.state.dataValue; /* 数据值 */ | 664 | obj.value = this.state.dataValue; /* 数据值 */ |
| 607 | } | 665 | } |
| @@ -611,7 +669,7 @@ export default class CommonComponent extends Component { | @@ -611,7 +669,7 @@ export default class CommonComponent extends Component { | ||
| 611 | obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ | 669 | obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ |
| 612 | obj.dropdownStyle.width = this.props.showConfig.iDropWidth; | 670 | obj.dropdownStyle.width = this.props.showConfig.iDropWidth; |
| 613 | } | 671 | } |
| 614 | - obj.onInputKeyDown = (e) => { | 672 | + obj.onInputKeyDown = e => { |
| 615 | const { bDropDownOpen, bNotFirstEnter } = this.state; | 673 | const { bDropDownOpen, bNotFirstEnter } = this.state; |
| 616 | if (bDropDownOpen && [38, 40, 13].includes(e.keyCode)) { | 674 | if (bDropDownOpen && [38, 40, 13].includes(e.keyCode)) { |
| 617 | // eslint-disable-next-line no-console | 675 | // eslint-disable-next-line no-console |
| @@ -637,25 +695,25 @@ export default class CommonComponent extends Component { | @@ -637,25 +695,25 @@ export default class CommonComponent extends Component { | ||
| 637 | /* 返回值 */ | 695 | /* 返回值 */ |
| 638 | return obj; | 696 | return obj; |
| 639 | }; | 697 | }; |
| 640 | - getLocalizedString = (jsonStr, language) =>{ | 698 | + getLocalizedString = (jsonStr, language) => { |
| 641 | try { | 699 | try { |
| 642 | const data = JSON.parse(jsonStr); | 700 | const data = JSON.parse(jsonStr); |
| 643 | - return data[language] || ''; | 701 | + return data[language] || ""; |
| 644 | } catch (e) { | 702 | } catch (e) { |
| 645 | - console.error('Error parsing JSON:', e); | ||
| 646 | - return ''; | 703 | + console.error("Error parsing JSON:", e); |
| 704 | + return ""; | ||
| 647 | } | 705 | } |
| 648 | - } | 706 | + }; |
| 649 | getSelectTableProps = () => { | 707 | getSelectTableProps = () => { |
| 650 | const { currentPage, tempCurrentPage, searchValue } = this.state; | 708 | const { currentPage, tempCurrentPage, searchValue } = this.state; |
| 651 | - const pageNum = searchValue === '' ? currentPage : tempCurrentPage; | 709 | + const pageNum = searchValue === "" ? currentPage : tempCurrentPage; |
| 652 | 710 | ||
| 653 | /* 返回值声明 */ | 711 | /* 返回值声明 */ |
| 654 | const obj = { | 712 | const obj = { |
| 655 | id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, | 713 | id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, |
| 656 | dropdownMatchSelectWidth: false, | 714 | dropdownMatchSelectWidth: false, |
| 657 | - filterOption: this.filterOption, /* 搜索时过滤对应的 option 属性 */ | ||
| 658 | - onDropdownVisibleChange: (open) => { | 715 | + filterOption: this.filterOption /* 搜索时过滤对应的 option 属性 */, |
| 716 | + onDropdownVisibleChange: open => { | ||
| 659 | this.onDropdownVisibleChange(open); | 717 | this.onDropdownVisibleChange(open); |
| 660 | if (open === false) { | 718 | if (open === false) { |
| 661 | clearTimeout(this.blurtimer); | 719 | clearTimeout(this.blurtimer); |
| @@ -672,41 +730,47 @@ export default class CommonComponent extends Component { | @@ -672,41 +730,47 @@ export default class CommonComponent extends Component { | ||
| 672 | // onFocus: this.onFocus, | 730 | // onFocus: this.onFocus, |
| 673 | // onBlur: this.onBlur, | 731 | // onBlur: this.onBlur, |
| 674 | }; | 732 | }; |
| 675 | - if (this.props.showConfig.sDropDownType === 'sql') { | ||
| 676 | - obj.optionLabelProp = 'title'; | 733 | + if (this.props.showConfig.sDropDownType === "sql") { |
| 734 | + obj.optionLabelProp = "title"; | ||
| 677 | } | 735 | } |
| 678 | if (this.props.readOnly) { | 736 | if (this.props.readOnly) { |
| 679 | - obj.readOnly = 'readOnly'; | 737 | + obj.readOnly = "readOnly"; |
| 680 | } else { | 738 | } else { |
| 681 | obj.disabled = !this.state.enabled; | 739 | obj.disabled = !this.state.enabled; |
| 682 | } | 740 | } |
| 683 | obj.placeholder = this.props.showConfig.placeholder; | 741 | obj.placeholder = this.props.showConfig.placeholder; |
| 684 | /* 区分Oee设置字体与其他系统设置字体 */ | 742 | /* 区分Oee设置字体与其他系统设置字体 */ |
| 685 | - obj.dropdownStyle = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? { fontSize: '1.3rem' } : { fontSize: '12px' }; | ||
| 686 | - obj.dropdownClassName = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? (location.pathname.toLowerCase().indexOf('loginoee') > -1 ? 'loginOeeDropDown' : 'oeeDropDown') : ''; | 743 | + obj.dropdownStyle = |
| 744 | + commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 745 | + ? { fontSize: "1.3rem" } | ||
| 746 | + : { fontSize: "12px" }; | ||
| 747 | + obj.dropdownClassName = | ||
| 748 | + commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 749 | + ? location.pathname.toLowerCase().indexOf("loginoee") > -1 | ||
| 750 | + ? "loginOeeDropDown" | ||
| 751 | + : "oeeDropDown" | ||
| 752 | + : ""; | ||
| 687 | /* 主表时才赋值value */ | 753 | /* 主表时才赋值value */ |
| 688 | if (this.props.bTable) { | 754 | if (this.props.bTable) { |
| 689 | - obj.value = this.props.showConfig.bMultipleChoice && !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(',') : this.state.dataValue; /* 数据值 */ | 755 | + obj.value = |
| 756 | + this.props.showConfig.bMultipleChoice && !commonUtils.isEmpty(this.state.dataValue) | ||
| 757 | + ? this.state.dataValue.split(",") | ||
| 758 | + : this.state.dataValue; /* 数据值 */ | ||
| 690 | obj.className = this.props.costomClassName === undefined ? styles.editSelect : this.props.costomClassName; | 759 | obj.className = this.props.costomClassName === undefined ? styles.editSelect : this.props.costomClassName; |
| 691 | } | 760 | } |
| 692 | if (this.props.showConfig.iDropWidth > 0) { | 761 | if (this.props.showConfig.iDropWidth > 0) { |
| 693 | obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ | 762 | obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ |
| 694 | } | 763 | } |
| 695 | - obj.onInputKeyDown = (e) => { | ||
| 696 | - const { | ||
| 697 | - selectTableData = [], | ||
| 698 | - selectTableIndex = 0, | ||
| 699 | - bDropDownOpen, | ||
| 700 | - bNotFirstEnter, | ||
| 701 | - } = this.state; | 764 | + obj.onInputKeyDown = e => { |
| 765 | + const { selectTableData = [], selectTableIndex = 0, bDropDownOpen, bNotFirstEnter } = this.state; | ||
| 702 | const { keyCode } = e; | 766 | const { keyCode } = e; |
| 703 | 767 | ||
| 704 | try { | 768 | try { |
| 705 | if (bDropDownOpen) { | 769 | if (bDropDownOpen) { |
| 706 | - const oTBody = this.selectTableRef1.querySelector('.ant-table-body'); | 770 | + const oTBody = this.selectTableRef1.querySelector(".ant-table-body"); |
| 707 | const { scrollTop } = oTBody; | 771 | const { scrollTop } = oTBody; |
| 708 | 772 | ||
| 709 | - const oTr = this.selectTableRef1.querySelector('.selected-record-row'); | 773 | + const oTr = this.selectTableRef1.querySelector(".selected-record-row"); |
| 710 | const trRect = oTr.getBoundingClientRect(); | 774 | const trRect = oTr.getBoundingClientRect(); |
| 711 | const tbodyRect = oTBody.getBoundingClientRect(); | 775 | const tbodyRect = oTBody.getBoundingClientRect(); |
| 712 | 776 | ||
| @@ -771,7 +835,7 @@ export default class CommonComponent extends Component { | @@ -771,7 +835,7 @@ export default class CommonComponent extends Component { | ||
| 771 | }; | 835 | }; |
| 772 | obj.onKeyUp = this.onKeyUp; | 836 | obj.onKeyUp = this.onKeyUp; |
| 773 | /* eslint-disable */ | 837 | /* eslint-disable */ |
| 774 | - obj.dropdownRender = (menu) => ( | 838 | + obj.dropdownRender = menu => ( |
| 775 | <> | 839 | <> |
| 776 | {/* <div className="select-search"> | 840 | {/* <div className="select-search"> |
| 777 | <Search allowClear onSearch={e => this.selectTableSearch(e)}/> | 841 | <Search allowClear onSearch={e => this.selectTableSearch(e)}/> |
| @@ -779,7 +843,9 @@ export default class CommonComponent extends Component { | @@ -779,7 +843,9 @@ export default class CommonComponent extends Component { | ||
| 779 | {menu} | 843 | {menu} |
| 780 | <div | 844 | <div |
| 781 | className="select-pagination" | 845 | className="select-pagination" |
| 782 | - onMouseEnter={() => { this.bInPagination = true; }} | 846 | + onMouseEnter={() => { |
| 847 | + this.bInPagination = true; | ||
| 848 | + }} | ||
| 783 | onMouseLeave={() => { | 849 | onMouseLeave={() => { |
| 784 | this.bInPagination = false; | 850 | this.bInPagination = false; |
| 785 | if (this.selectTableRef) { | 851 | if (this.selectTableRef) { |
| @@ -787,50 +853,57 @@ export default class CommonComponent extends Component { | @@ -787,50 +853,57 @@ export default class CommonComponent extends Component { | ||
| 787 | } | 853 | } |
| 788 | }} | 854 | }} |
| 789 | > | 855 | > |
| 790 | - <Pagination onChange={e => this.selectTableChange(e)} showSizeChanger={false} current={pageNum} pageSize={20} size="small" total={this.state.totalCount} /> | 856 | + <Pagination |
| 857 | + onChange={e => this.selectTableChange(e)} | ||
| 858 | + showSizeChanger={false} | ||
| 859 | + current={pageNum} | ||
| 860 | + pageSize={20} | ||
| 861 | + size="small" | ||
| 862 | + total={this.state.totalCount} | ||
| 863 | + /> | ||
| 791 | <Space> | 864 | <Space> |
| 792 | {this.props.showConfig.bFirstEmpty && ( | 865 | {this.props.showConfig.bFirstEmpty && ( |
| 793 | <Button | 866 | <Button |
| 794 | - type='link' | 867 | + type="link" |
| 795 | onClick={() => { | 868 | onClick={() => { |
| 796 | - document.querySelectorAll('.ant-select-dropdown').forEach(item => { | ||
| 797 | - item.classList.add('ant-select-dropdown-hidden'); | 869 | + document.querySelectorAll(".ant-select-dropdown").forEach(item => { |
| 870 | + item.classList.add("ant-select-dropdown-hidden"); | ||
| 798 | const displayBak = item.style.display; | 871 | const displayBak = item.style.display; |
| 799 | - item.style.display = 'none'; | 872 | + item.style.display = "none"; |
| 800 | setTimeout(() => { | 873 | setTimeout(() => { |
| 801 | item.style.display = displayBak; | 874 | item.style.display = displayBak; |
| 802 | }, 200); | 875 | }, 200); |
| 803 | }); | 876 | }); |
| 804 | this.setState({ tempCurrentPage: null }); | 877 | this.setState({ tempCurrentPage: null }); |
| 805 | - this.handleSelectOptionEvent(''); | 878 | + this.handleSelectOptionEvent(""); |
| 806 | }} | 879 | }} |
| 807 | > | 880 | > |
| 808 | 清空 | 881 | 清空 |
| 809 | - </Button>) | ||
| 810 | - } | 882 | + </Button> |
| 883 | + )} | ||
| 811 | {this.props.showConfig.bNewRecord && ( | 884 | {this.props.showConfig.bNewRecord && ( |
| 812 | <Button | 885 | <Button |
| 813 | - type='link' | 886 | + type="link" |
| 814 | onClick={() => { | 887 | onClick={() => { |
| 815 | - document.querySelectorAll('.ant-select-dropdown').forEach(item => { | ||
| 816 | - item.classList.add('ant-select-dropdown-hidden'); | 888 | + document.querySelectorAll(".ant-select-dropdown").forEach(item => { |
| 889 | + item.classList.add("ant-select-dropdown-hidden"); | ||
| 817 | const displayBak = item.style.display; | 890 | const displayBak = item.style.display; |
| 818 | - item.style.display = 'none'; | 891 | + item.style.display = "none"; |
| 819 | setTimeout(() => { | 892 | setTimeout(() => { |
| 820 | item.style.display = displayBak; | 893 | item.style.display = displayBak; |
| 821 | }, 200); | 894 | }, 200); |
| 822 | }); | 895 | }); |
| 823 | this.setState({ tempCurrentPage: null }); | 896 | this.setState({ tempCurrentPage: null }); |
| 824 | - this.handleSelectOptionEvent('@#*000@'); | 897 | + this.handleSelectOptionEvent("@#*000@"); |
| 825 | }} | 898 | }} |
| 826 | > | 899 | > |
| 827 | NEW RECORD | 900 | NEW RECORD |
| 828 | - </Button>) | ||
| 829 | - } | 901 | + </Button> |
| 902 | + )} | ||
| 830 | </Space> | 903 | </Space> |
| 831 | </div> | 904 | </div> |
| 832 | </> | 905 | </> |
| 833 | - ) | 906 | + ); |
| 834 | /* eslint-enable */ | 907 | /* eslint-enable */ |
| 835 | /* 返回值 */ | 908 | /* 返回值 */ |
| 836 | return obj; | 909 | return obj; |
| @@ -838,38 +911,40 @@ export default class CommonComponent extends Component { | @@ -838,38 +911,40 @@ export default class CommonComponent extends Component { | ||
| 838 | 911 | ||
| 839 | getSelectTableOption = () => { | 912 | getSelectTableOption = () => { |
| 840 | const { selectTableData, selectTableIndex = 0 } = this.state; | 913 | const { selectTableData, selectTableIndex = 0 } = this.state; |
| 841 | - const { showConfig , app} = this.props; | 914 | + const { showConfig, app } = this.props; |
| 842 | const { userinfo } = app; | 915 | const { userinfo } = app; |
| 843 | let { sTableTitleSql } = showConfig; | 916 | let { sTableTitleSql } = showConfig; |
| 844 | /* 根据用户配置语言 设置表格标题 */ | 917 | /* 根据用户配置语言 设置表格标题 */ |
| 845 | - if(commonUtils.isJSON(sTableTitleSql) && sTableTitleSql.includes('Chinese')) { | 918 | + if (commonUtils.isJSON(sTableTitleSql) && sTableTitleSql.includes("Chinese")) { |
| 846 | sTableTitleSql = this.getLocalizedString(sTableTitleSql, userinfo.sLanguage); | 919 | sTableTitleSql = this.getLocalizedString(sTableTitleSql, userinfo.sLanguage); |
| 847 | } | 920 | } |
| 848 | - const tempColumnArr = sTableTitleSql.split(','); | 921 | + const tempColumnArr = sTableTitleSql.split(","); |
| 849 | let scrollX = 0; | 922 | let scrollX = 0; |
| 850 | const columns = tempColumnArr.map((item, index) => { | 923 | const columns = tempColumnArr.map((item, index) => { |
| 851 | - const tempArr = item.split(':'); | 924 | + const tempArr = item.split(":"); |
| 852 | const [value, title, columnWidth] = tempArr; | 925 | const [value, title, columnWidth] = tempArr; |
| 853 | let width; | 926 | let width; |
| 854 | - if (!Number.isNaN(Number(columnWidth))) { // 如果配置了列宽 | 927 | + if (!Number.isNaN(Number(columnWidth))) { |
| 928 | + // 如果配置了列宽 | ||
| 855 | width = Number(columnWidth); | 929 | width = Number(columnWidth); |
| 856 | - } else { // 没有配置列宽,就根据字符数算宽度 | 930 | + } else { |
| 931 | + // 没有配置列宽,就根据字符数算宽度 | ||
| 857 | // 获取中文字数、非中文字数, 中文12px,其它8px | 932 | // 获取中文字数、非中文字数, 中文12px,其它8px |
| 858 | const titleStr = title; | 933 | const titleStr = title; |
| 859 | const totalStringLen = titleStr.length; | 934 | const totalStringLen = titleStr.length; |
| 860 | - const otherStrLen = titleStr.replace(/[^\x00-\xff]/g, '').length; // eslint-disable-line | 935 | + const otherStrLen = titleStr.replace(/[^\x00-\xff]/g, "").length; // eslint-disable-line |
| 861 | const chineseStrLen = totalStringLen - otherStrLen; | 936 | const chineseStrLen = totalStringLen - otherStrLen; |
| 862 | - const defaultWidth = (chineseStrLen * 12) + (otherStrLen * 8); | 937 | + const defaultWidth = chineseStrLen * 12 + otherStrLen * 8; |
| 863 | const maxStrLen = selectTableData.reduce((res, pre) => { | 938 | const maxStrLen = selectTableData.reduce((res, pre) => { |
| 864 | - let tempValue = pre[value] !== undefined ? pre[value] : ''; | ||
| 865 | - if (tempValue === '') { | 939 | + let tempValue = pre[value] !== undefined ? pre[value] : ""; |
| 940 | + if (tempValue === "") { | ||
| 866 | return res; | 941 | return res; |
| 867 | } | 942 | } |
| 868 | - tempValue = typeof tempValue === 'string' ? tempValue : JSON.stringify(tempValue); | 943 | + tempValue = typeof tempValue === "string" ? tempValue : JSON.stringify(tempValue); |
| 869 | const totalStringLen = tempValue.length; | 944 | const totalStringLen = tempValue.length; |
| 870 | - const otherStrLen = tempValue.replace(/[^\x00-\xff]/g, '').length; // eslint-disable-line | 945 | + const otherStrLen = tempValue.replace(/[^\x00-\xff]/g, "").length; // eslint-disable-line |
| 871 | const chineseStrLen = totalStringLen - otherStrLen; | 946 | const chineseStrLen = totalStringLen - otherStrLen; |
| 872 | - const tempWidth = (chineseStrLen * 12) + (otherStrLen * 8); | 947 | + const tempWidth = chineseStrLen * 12 + otherStrLen * 8; |
| 873 | return Math.max(tempWidth, res); | 948 | return Math.max(tempWidth, res); |
| 874 | }, defaultWidth); | 949 | }, defaultWidth); |
| 875 | width = Math.min(maxStrLen + 8, 300); | 950 | width = Math.min(maxStrLen + 8, 300); |
| @@ -882,20 +957,29 @@ export default class CommonComponent extends Component { | @@ -882,20 +957,29 @@ export default class CommonComponent extends Component { | ||
| 882 | dataIndex: value, | 957 | dataIndex: value, |
| 883 | key: value, | 958 | key: value, |
| 884 | width: index !== tempColumnArr.length - 1 ? width : undefined, | 959 | width: index !== tempColumnArr.length - 1 ? width : undefined, |
| 885 | - render: (text) => { | ||
| 886 | - return (<Tooltip placement="topRight" title={text}>{text}</Tooltip>); | 960 | + render: text => { |
| 961 | + return ( | ||
| 962 | + <Tooltip placement="topRight" title={text}> | ||
| 963 | + {text} | ||
| 964 | + </Tooltip> | ||
| 965 | + ); | ||
| 887 | }, | 966 | }, |
| 888 | }; | 967 | }; |
| 889 | }); | 968 | }); |
| 890 | 969 | ||
| 891 | return ( | 970 | return ( |
| 892 | <Option key="" className="select-table-option"> | 971 | <Option key="" className="select-table-option"> |
| 893 | - <div style={{ width: scrollX + 8, maxWidth: 'calc(100vw - 16px)', minWidth: '100%' }} ref={(ref) => { this.selectTableRef1 = ref; }}> | 972 | + <div |
| 973 | + style={{ width: scrollX + 8, maxWidth: "calc(100vw - 16px)", minWidth: "100%" }} | ||
| 974 | + ref={ref => { | ||
| 975 | + this.selectTableRef1 = ref; | ||
| 976 | + }} | ||
| 977 | + > | ||
| 894 | <Table | 978 | <Table |
| 895 | size="small" | 979 | size="small" |
| 896 | className="select-table" | 980 | className="select-table" |
| 897 | rowClassName={(_, index) => { | 981 | rowClassName={(_, index) => { |
| 898 | - return selectTableIndex === index ? 'selected-record-row' : ''; | 982 | + return selectTableIndex === index ? "selected-record-row" : ""; |
| 899 | }} | 983 | }} |
| 900 | rowKey="sId" | 984 | rowKey="sId" |
| 901 | onRow={(record, index) => { | 985 | onRow={(record, index) => { |
| @@ -921,8 +1005,9 @@ export default class CommonComponent extends Component { | @@ -921,8 +1005,9 @@ export default class CommonComponent extends Component { | ||
| 921 | columns={columns} | 1005 | columns={columns} |
| 922 | /> | 1006 | /> |
| 923 | </div> | 1007 | </div> |
| 924 | - </Option>); | ||
| 925 | - } | 1008 | + </Option> |
| 1009 | + ); | ||
| 1010 | + }; | ||
| 926 | 1011 | ||
| 927 | /** 获取complete对象 */ | 1012 | /** 获取complete对象 */ |
| 928 | getCompleteProps = () => { | 1013 | getCompleteProps = () => { |
| @@ -930,12 +1015,12 @@ export default class CommonComponent extends Component { | @@ -930,12 +1015,12 @@ export default class CommonComponent extends Component { | ||
| 930 | const obj = { | 1015 | const obj = { |
| 931 | id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, | 1016 | id: `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`, |
| 932 | // disabled: !this.state.enabled /* 修改的时候传过来的数据 */ | 1017 | // disabled: !this.state.enabled /* 修改的时候传过来的数据 */ |
| 933 | - onChange: this.handleCompleteInputEvent, /* 选择触发事件 */ | ||
| 934 | - onSelect: (value) => { | 1018 | + onChange: this.handleCompleteInputEvent /* 选择触发事件 */, |
| 1019 | + onSelect: value => { | ||
| 935 | this.setState({ bDropDownOpen: false, bNotFirstEnter: true }); | 1020 | this.setState({ bDropDownOpen: false, bNotFirstEnter: true }); |
| 936 | this.completeSelectFlag = true; | 1021 | this.completeSelectFlag = true; |
| 937 | - if (value === '') { | ||
| 938 | - if (this.props.showConfig.sDropDownType === 'sql') { | 1022 | + if (value === "") { |
| 1023 | + if (this.props.showConfig.sDropDownType === "sql") { | ||
| 939 | this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name); | 1024 | this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name); |
| 940 | } | 1025 | } |
| 941 | } else if (this.state.dataValue === value) { | 1026 | } else if (this.state.dataValue === value) { |
| @@ -956,40 +1041,56 @@ export default class CommonComponent extends Component { | @@ -956,40 +1041,56 @@ export default class CommonComponent extends Component { | ||
| 956 | } | 1041 | } |
| 957 | } | 1042 | } |
| 958 | }, | 1043 | }, |
| 959 | - filterOption: this.filterOption, /* 搜索时过滤对应的 option 属性 */ | 1044 | + filterOption: this.filterOption /* 搜索时过滤对应的 option 属性 */, |
| 960 | onDropdownVisibleChange: this.onDropdownVisibleChange, | 1045 | onDropdownVisibleChange: this.onDropdownVisibleChange, |
| 961 | onPopupScroll: this.handlePopupScroll, | 1046 | onPopupScroll: this.handlePopupScroll, |
| 962 | /* 区分Oee设置字体与其他系统设置字体 */ | 1047 | /* 区分Oee设置字体与其他系统设置字体 */ |
| 963 | - dropdownClassName: commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? (location.pathname.toLowerCase().indexOf('loginoee') > -1 ? 'loginOeeDropDown' : 'oeeDropDown') : '', | 1048 | + dropdownClassName: |
| 1049 | + commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 1050 | + ? location.pathname.toLowerCase().indexOf("loginoee") > -1 | ||
| 1051 | + ? "loginOeeDropDown" | ||
| 1052 | + : "oeeDropDown" | ||
| 1053 | + : "", | ||
| 964 | onSearch: this.handleSearch, | 1054 | onSearch: this.handleSearch, |
| 965 | - notFoundContent: this.state.spinState ? <Spin /> : '暂无数据', | 1055 | + notFoundContent: this.state.spinState ? <Spin /> : "暂无数据", |
| 966 | onFocus: this.onFocus, | 1056 | onFocus: this.onFocus, |
| 967 | - onBlur: (e) => { | 1057 | + onBlur: e => { |
| 968 | this.setState({ bDropDownOpen: false, bNotFirstEnter: false }); | 1058 | this.setState({ bDropDownOpen: false, bNotFirstEnter: false }); |
| 969 | this.onBlur(e); | 1059 | this.onBlur(e); |
| 970 | }, | 1060 | }, |
| 971 | }; | 1061 | }; |
| 972 | if (this.props.readOnly) { | 1062 | if (this.props.readOnly) { |
| 973 | - obj.readOnly = 'readOnly'; | 1063 | + obj.readOnly = "readOnly"; |
| 974 | } else { | 1064 | } else { |
| 975 | obj.disabled = !this.state.enabled; | 1065 | obj.disabled = !this.state.enabled; |
| 976 | } | 1066 | } |
| 977 | obj.placeholder = this.props.showConfig.placeholder; | 1067 | obj.placeholder = this.props.showConfig.placeholder; |
| 978 | /* 区分Oee设置字体与其他系统设置字体 */ | 1068 | /* 区分Oee设置字体与其他系统设置字体 */ |
| 979 | - obj.dropdownStyle = commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf('oee') > -1 ? { fontSize: '1.3rem' } : { fontSize: '12px' }; | 1069 | + obj.dropdownStyle = |
| 1070 | + commonUtils.isNotEmptyObject(location.pathname) && location.pathname.toLowerCase().indexOf("oee") > -1 | ||
| 1071 | + ? { fontSize: "1.3rem" } | ||
| 1072 | + : { fontSize: "12px" }; | ||
| 980 | /* 主表时才赋值value */ | 1073 | /* 主表时才赋值value */ |
| 981 | if (this.props.bTable) { | 1074 | if (this.props.bTable) { |
| 982 | - obj.value = this.props.showConfig.bMultipleChoice && !commonUtils.isEmpty(this.state.dataValue) ? this.state.dataValue.split(',') : this.state.dataValue; /* 数据值 */ | 1075 | + obj.value = |
| 1076 | + this.props.showConfig.bMultipleChoice && !commonUtils.isEmpty(this.state.dataValue) | ||
| 1077 | + ? this.state.dataValue.split(",") | ||
| 1078 | + : this.state.dataValue; /* 数据值 */ | ||
| 983 | obj.className = this.props.costomClassName === undefined ? styles.editSelect : this.props.costomClassName; | 1079 | obj.className = this.props.costomClassName === undefined ? styles.editSelect : this.props.costomClassName; |
| 984 | } | 1080 | } |
| 985 | if (this.props.showConfig.iDropWidth > 0) { | 1081 | if (this.props.showConfig.iDropWidth > 0) { |
| 986 | obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ | 1082 | obj.dropdownMatchSelectWidth = false; /* true时 下拉菜单和选择器同宽。默认将设置 min-width,当值小于选择框宽度时会被忽略。 */ |
| 987 | obj.dropdownStyle.width = this.props.showConfig.iDropWidth; | 1083 | obj.dropdownStyle.width = this.props.showConfig.iDropWidth; |
| 988 | } | 1084 | } |
| 989 | - if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 1085 | + if ( |
| 1086 | + typeof commonUtils.convertStrToNumber(this.max) === "number" && | ||
| 1087 | + commonUtils.convertStrToNumber(this.max) !== 0 && | ||
| 1088 | + this.max.indexOf(".d") === -1 && | ||
| 1089 | + this.max.indexOf(".i") === -1 | ||
| 1090 | + ) { | ||
| 990 | obj.maxLength = this.max; /* 最大长度 */ | 1091 | obj.maxLength = this.max; /* 最大长度 */ |
| 991 | } | 1092 | } |
| 992 | - obj.onInputKeyDown = (e) => { | 1093 | + obj.onInputKeyDown = e => { |
| 993 | const { bDropDownOpen, bNotFirstEnter } = this.state; | 1094 | const { bDropDownOpen, bNotFirstEnter } = this.state; |
| 994 | if (bDropDownOpen && [38, 40, 13].includes(e.keyCode)) { | 1095 | if (bDropDownOpen && [38, 40, 13].includes(e.keyCode)) { |
| 995 | // eslint-disable-next-line no-console | 1096 | // eslint-disable-next-line no-console |
| @@ -1012,43 +1113,44 @@ export default class CommonComponent extends Component { | @@ -1012,43 +1113,44 @@ export default class CommonComponent extends Component { | ||
| 1012 | }; | 1113 | }; |
| 1013 | 1114 | ||
| 1014 | getSearchProps = () => { | 1115 | getSearchProps = () => { |
| 1015 | - let chooseTitle = '选择'; | ||
| 1016 | - if(commonUtils.isNotEmptyObject(this.props.app) && commonUtils.isNotEmptyObject(this.props.app.commonConst)) { | ||
| 1017 | - chooseTitle = commonFunc.showMessage(this.props.app.commonConst, 'choose') ; | 1116 | + let chooseTitle = "选择"; |
| 1117 | + if (commonUtils.isNotEmptyObject(this.props.app) && commonUtils.isNotEmptyObject(this.props.app.commonConst)) { | ||
| 1118 | + chooseTitle = commonFunc.showMessage(this.props.app.commonConst, "choose"); | ||
| 1018 | } | 1119 | } |
| 1019 | const obj = { | 1120 | const obj = { |
| 1020 | onKeyDown: this.onKeyDown, | 1121 | onKeyDown: this.onKeyDown, |
| 1021 | - onChange: e => this.handleSelectOptionEvent(e.target.value), /* 数据改变回带到父组件 */ | ||
| 1022 | - value: commonUtils.isUndefined(this.state.dataValue) ? chooseTitle : commonUtils.strUndefinedToEmpty(this.state.dataValue), /* 数据值 */ | 1122 | + onChange: e => this.handleSelectOptionEvent(e.target.value) /* 数据改变回带到父组件 */, |
| 1123 | + value: commonUtils.isUndefined(this.state.dataValue) ? chooseTitle : commonUtils.strUndefinedToEmpty(this.state.dataValue) /* 数据值 */, | ||
| 1023 | }; | 1124 | }; |
| 1024 | return obj; | 1125 | return obj; |
| 1025 | - } | 1126 | + }; |
| 1026 | /** 获取optionValue对象 */ | 1127 | /** 获取optionValue对象 */ |
| 1027 | - getOptionValues = (data) => { | 1128 | + getOptionValues = data => { |
| 1028 | /* 返回值声明 */ | 1129 | /* 返回值声明 */ |
| 1029 | - let res = ''; | 1130 | + let res = ""; |
| 1030 | /* 计数器 */ | 1131 | /* 计数器 */ |
| 1031 | let count = 1; | 1132 | let count = 1; |
| 1032 | /* 遍历每一条数据 */ | 1133 | /* 遍历每一条数据 */ |
| 1033 | - const iVisCount = commonUtils.isEmpty(this.props.showConfig.iVisCount) || this.props.showConfig.iVisCount === 0 ? 1 : this.props.showConfig.iVisCount; | 1134 | + const iVisCount = |
| 1135 | + commonUtils.isEmpty(this.props.showConfig.iVisCount) || this.props.showConfig.iVisCount === 0 ? 1 : this.props.showConfig.iVisCount; | ||
| 1034 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) { | 1136 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) { |
| 1035 | res = data[this.props.showConfig.sVisColumnName]; | 1137 | res = data[this.props.showConfig.sVisColumnName]; |
| 1036 | } else { | 1138 | } else { |
| 1037 | for (const key of Object.keys(data)) { | 1139 | for (const key of Object.keys(data)) { |
| 1038 | /* 这里主要是为了实现配置中控制下拉的展现列数 */ | 1140 | /* 这里主要是为了实现配置中控制下拉的展现列数 */ |
| 1039 | - if (count <= iVisCount && key !== 'sId') { | ||
| 1040 | - if (res === '') { | 1141 | + if (count <= iVisCount && key !== "sId") { |
| 1142 | + if (res === "") { | ||
| 1041 | res = data[key]; | 1143 | res = data[key]; |
| 1042 | } else { | 1144 | } else { |
| 1043 | - res = res.concat('-').concat(data[key]); | 1145 | + res = res.concat("-").concat(data[key]); |
| 1044 | } | 1146 | } |
| 1045 | count += 1; | 1147 | count += 1; |
| 1046 | } | 1148 | } |
| 1047 | } | 1149 | } |
| 1048 | } | 1150 | } |
| 1049 | // 如果res值为''时,下拉会显示value值,为了解决这种情况,返回' ' | 1151 | // 如果res值为''时,下拉会显示value值,为了解决这种情况,返回' ' |
| 1050 | - if (res === '') { | ||
| 1051 | - res = ' '; | 1152 | + if (res === "") { |
| 1153 | + res = " "; | ||
| 1052 | } | 1154 | } |
| 1053 | /* 返回值 */ | 1155 | /* 返回值 */ |
| 1054 | return res; | 1156 | return res; |
| @@ -1059,11 +1161,11 @@ export default class CommonComponent extends Component { | @@ -1059,11 +1161,11 @@ export default class CommonComponent extends Component { | ||
| 1059 | const { formId, app, enabled } = this.props; | 1161 | const { formId, app, enabled } = this.props; |
| 1060 | const { token } = app; | 1162 | const { token } = app; |
| 1061 | return { | 1163 | return { |
| 1062 | - listType: 'picture-card', | ||
| 1063 | - className: 'avatar-uploader', | 1164 | + listType: "picture-card", |
| 1165 | + className: "avatar-uploader", | ||
| 1064 | action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}&sUploadType=model`, | 1166 | action: `${commonConfig.file_host}file/upload?sModelsId=${formId}&token=${token}&sUploadType=model`, |
| 1065 | disabled: !enabled || false, | 1167 | disabled: !enabled || false, |
| 1066 | - onChange: (info) => { | 1168 | + onChange: info => { |
| 1067 | const { file } = info; | 1169 | const { file } = info; |
| 1068 | if (file.response && file.response.code === 1) { | 1170 | if (file.response && file.response.code === 1) { |
| 1069 | const sPicturePath = file.response.dataset.rows[0].savePathStr; | 1171 | const sPicturePath = file.response.dataset.rows[0].savePathStr; |
| @@ -1072,97 +1174,113 @@ export default class CommonComponent extends Component { | @@ -1072,97 +1174,113 @@ export default class CommonComponent extends Component { | ||
| 1072 | message.error(file.response.msg); | 1174 | message.error(file.response.msg); |
| 1073 | } | 1175 | } |
| 1074 | }, | 1176 | }, |
| 1075 | - accept: 'image/*', | 1177 | + accept: "image/*", |
| 1076 | showUploadList: false, | 1178 | showUploadList: false, |
| 1077 | }; | 1179 | }; |
| 1078 | }; | 1180 | }; |
| 1079 | 1181 | ||
| 1080 | // 获取上传组件内容 | 1182 | // 获取上传组件内容 |
| 1081 | getUploadContents = () => { | 1183 | getUploadContents = () => { |
| 1082 | - const fileName = commonUtils.isUndefined(this.state.dataValue) ? '' : commonUtils.strUndefinedToEmpty(this.state.dataValue); | 1184 | + const fileName = commonUtils.isUndefined(this.state.dataValue) ? "" : commonUtils.strUndefinedToEmpty(this.state.dataValue); |
| 1083 | const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&sModelsId=100&token=${this.props.token}`; | 1185 | const imageUrl = `${commonConfig.file_host}file/download?savePathStr=${fileName}&sModelsId=100&token=${this.props.token}`; |
| 1084 | - return fileName ? | ||
| 1085 | - (<Image | 1186 | + return fileName ? ( |
| 1187 | + <Image | ||
| 1086 | key={fileName} | 1188 | key={fileName} |
| 1087 | src={imageUrl} | 1189 | src={imageUrl} |
| 1088 | - alt={fileName.split('/').pop()} | 1190 | + alt={fileName.split("/").pop()} |
| 1089 | style={{ | 1191 | style={{ |
| 1090 | - width: '100%', | 1192 | + width: "100%", |
| 1091 | }} | 1193 | }} |
| 1092 | preview={!this.props.enabled} | 1194 | preview={!this.props.enabled} |
| 1093 | - />) : ( | ||
| 1094 | - <div> | ||
| 1095 | - <div style={{ marginTop: 8 }} > | ||
| 1096 | - 上传 | ||
| 1097 | - </div> | ||
| 1098 | - </div>); | 1195 | + /> |
| 1196 | + ) : ( | ||
| 1197 | + <div> | ||
| 1198 | + <div style={{ marginTop: 8 }}>上传</div> | ||
| 1199 | + </div> | ||
| 1200 | + ); | ||
| 1099 | }; | 1201 | }; |
| 1100 | 1202 | ||
| 1101 | // 获取上传图片右上角清空按钮属性 | 1203 | // 获取上传图片右上角清空按钮属性 |
| 1102 | getUploadButtonProps = () => { | 1204 | getUploadButtonProps = () => { |
| 1103 | - const fileName = commonUtils.isUndefined(this.state.dataValue) ? '' : commonUtils.strUndefinedToEmpty(this.state.dataValue); | 1205 | + const fileName = commonUtils.isUndefined(this.state.dataValue) ? "" : commonUtils.strUndefinedToEmpty(this.state.dataValue); |
| 1104 | return { | 1206 | return { |
| 1105 | - type: 'link', | 1207 | + type: "link", |
| 1106 | style: { | 1208 | style: { |
| 1107 | - position: 'absolute', | 1209 | + position: "absolute", |
| 1108 | top: 0, | 1210 | top: 0, |
| 1109 | left: 75, | 1211 | left: 75, |
| 1110 | - display: this.props.enabled && fileName ? '' : 'none', | 1212 | + display: this.props.enabled && fileName ? "" : "none", |
| 1111 | }, | 1213 | }, |
| 1112 | onClick: () => { | 1214 | onClick: () => { |
| 1113 | - this.props.onChange(this.props.name, this.props.showConfig.sName, { [this.props.showConfig.sName]: '' }, this.props.sId, []); | 1215 | + this.props.onChange(this.props.name, this.props.showConfig.sName, { [this.props.showConfig.sName]: "" }, this.props.sId, []); |
| 1114 | }, | 1216 | }, |
| 1115 | }; | 1217 | }; |
| 1116 | }; | 1218 | }; |
| 1117 | /** 获取innerinput控件1 */ | 1219 | /** 获取innerinput控件1 */ |
| 1118 | - getInnerInput = (innerInputProps) => { | ||
| 1119 | - const { | ||
| 1120 | - sTableTitleSql, iVisCount, sName, sDateFormat, | ||
| 1121 | - } = this.props.showConfig; | ||
| 1122 | - let chooseTitle = '选择'; | ||
| 1123 | - if(commonUtils.isNotEmptyObject(this.props.app) && commonUtils.isNotEmptyObject(this.props.app.commonConst)) { | ||
| 1124 | - chooseTitle = commonFunc.showMessage(this.props.app.commonConst, 'choose') ; | 1220 | + getInnerInput = innerInputProps => { |
| 1221 | + const { sTableTitleSql, iVisCount, sName, sDateFormat } = this.props.showConfig; | ||
| 1222 | + let chooseTitle = "选择"; | ||
| 1223 | + if (commonUtils.isNotEmptyObject(this.props.app) && commonUtils.isNotEmptyObject(this.props.app.commonConst)) { | ||
| 1224 | + chooseTitle = commonFunc.showMessage(this.props.app.commonConst, "choose"); | ||
| 1125 | } | 1225 | } |
| 1126 | if (commonUtils.isNotEmptyStr(sTableTitleSql) && iVisCount > 1) { | 1226 | if (commonUtils.isNotEmptyStr(sTableTitleSql) && iVisCount > 1) { |
| 1127 | - return <Select ref={(ref) => { this.selectTableRef = ref; }} {...this.getSelectTableProps()}>{this.getSelectTableOption()}</Select>; | 1227 | + return ( |
| 1228 | + <Select | ||
| 1229 | + ref={ref => { | ||
| 1230 | + this.selectTableRef = ref; | ||
| 1231 | + }} | ||
| 1232 | + {...this.getSelectTableProps()} | ||
| 1233 | + > | ||
| 1234 | + {this.getSelectTableOption()} | ||
| 1235 | + </Select> | ||
| 1236 | + ); | ||
| 1128 | } | 1237 | } |
| 1129 | - if (sName === 'sIcon') { | ||
| 1130 | - return (<><Upload {...this.getUploadProps()}>{this.getUploadContents()}</Upload><Button {...this.getUploadButtonProps()}>X</Button></>); | 1238 | + if (sName === "sIcon") { |
| 1239 | + return ( | ||
| 1240 | + <> | ||
| 1241 | + <Upload {...this.getUploadProps()}>{this.getUploadContents()}</Upload> | ||
| 1242 | + <Button {...this.getUploadButtonProps()}>X</Button> | ||
| 1243 | + </> | ||
| 1244 | + ); | ||
| 1131 | } | 1245 | } |
| 1132 | - if (sName === 'sPackPath' || sName === 'sPackDetailPathUpLoad') { | 1246 | + if (sName === "sPackPath" || sName === "sPackDetailPathUpLoad" || sName === "sSvgPath") { |
| 1247 | + let imageUrls = ""; | ||
| 1133 | const uploadProps = { | 1248 | const uploadProps = { |
| 1134 | - listType: 'picture-card', | ||
| 1135 | - className: 'avatar-uploader', | 1249 | + listType: "picture-card", |
| 1250 | + className: "avatar-uploader", | ||
| 1136 | action: `${commonConfig.server_host}file/uploadLogo?sLogoName=logo${sName}${this.props.record.sName}`, | 1251 | action: `${commonConfig.server_host}file/uploadLogo?sLogoName=logo${sName}${this.props.record.sName}`, |
| 1137 | disabled: !this.props.enabled, | 1252 | disabled: !this.props.enabled, |
| 1138 | - onChange: (info) => { | 1253 | + onChange: info => { |
| 1139 | const { fileList } = info; | 1254 | const { fileList } = info; |
| 1140 | const file = fileList[fileList.length - 1]; | 1255 | const file = fileList[fileList.length - 1]; |
| 1141 | const { status, response } = file; | 1256 | const { status, response } = file; |
| 1142 | - if (status === 'done') { | 1257 | + if (status === "done") { |
| 1143 | if (response && response.code === 1) { | 1258 | if (response && response.code === 1) { |
| 1144 | - const imageUrlNew = `${commonConfig.server_host}file/downloadLogo?sLogoName=logo${sName}${this.props.record.sName}&date=${new Date().getTime()}`; | ||
| 1145 | - if (sName === 'sPackPath') { | ||
| 1146 | - this.props.onChange(this.props.name, sName, { sPackPath: imageUrlNew }, this.props.sId, []); | ||
| 1147 | - } else { | 1259 | + const imageUrlNew = `${commonConfig.server_host}file/downloadLogo?sLogoName=logo${sName}${ |
| 1260 | + this.props.record.sName | ||
| 1261 | + }&date=${new Date().getTime()}`; | ||
| 1262 | + if (sName === "sPackPath") { | ||
| 1263 | + this.props.onChange(this.props.name, sName, { sPackPath: imageUrlNew }, this.props.sId, []); | ||
| 1264 | + } else if (sName === "sPackDetailPathUpLoad") { | ||
| 1148 | this.props.onChange(this.props.name, sName, { sPackDetailPathUpLoad: imageUrlNew }, this.props.sId, []); | 1265 | this.props.onChange(this.props.name, sName, { sPackDetailPathUpLoad: imageUrlNew }, this.props.sId, []); |
| 1266 | + } else { | ||
| 1267 | + this.props.onChange(this.props.name, sName, { sSvgPath: imageUrlNew }, this.props.sId, []); | ||
| 1149 | } | 1268 | } |
| 1269 | + imageUrls = imageUrlNew; | ||
| 1150 | } else if (response && response.code === -1) { | 1270 | } else if (response && response.code === -1) { |
| 1151 | message.error(response.msg); | 1271 | message.error(response.msg); |
| 1152 | } | 1272 | } |
| 1153 | } | 1273 | } |
| 1154 | }, | 1274 | }, |
| 1155 | - accept: 'image/*', | 1275 | + accept: "image/*", |
| 1156 | showUploadList: false, | 1276 | showUploadList: false, |
| 1157 | openFileDialogOnClick: this.props.enabled, | 1277 | openFileDialogOnClick: this.props.enabled, |
| 1158 | }; | 1278 | }; |
| 1159 | - const imageUrl = sName === 'sPackPath' ? this.props.record.sPackPath : this.props.record.sPackDetailPathUpLoad; | 1279 | + const imageUrl = sName === "sPackPath" ? this.props.record.sPackPath : sName === "sPackDetailPathUpLoad" ? this.props.record.sPackDetailPathUpLoad : this.props.record.sSvgPath; |
| 1160 | return ( | 1280 | return ( |
| 1161 | <div> | 1281 | <div> |
| 1162 | - <Upload | ||
| 1163 | - {...uploadProps} | ||
| 1164 | - > | ||
| 1165 | - {imageUrl ? ( | 1282 | + <Upload {...uploadProps}> |
| 1283 | + {imageUrl ? ( | ||
| 1166 | <Image | 1284 | <Image |
| 1167 | key={imageUrl} | 1285 | key={imageUrl} |
| 1168 | src={imageUrl} | 1286 | src={imageUrl} |
| @@ -1170,62 +1288,60 @@ export default class CommonComponent extends Component { | @@ -1170,62 +1288,60 @@ export default class CommonComponent extends Component { | ||
| 1170 | style={{ width: '100%' }} | 1288 | style={{ width: '100%' }} |
| 1171 | preview={!this.props.enabled} | 1289 | preview={!this.props.enabled} |
| 1172 | /> | 1290 | /> |
| 1173 | - ) : ( | ||
| 1174 | - <div> | ||
| 1175 | - <div | ||
| 1176 | - style={{ marginTop: 8 }} | ||
| 1177 | - > | ||
| 1178 | - 上传 | ||
| 1179 | - </div> | ||
| 1180 | - </div> | ||
| 1181 | - )} | ||
| 1182 | - </Upload> | 1291 | + |
| 1292 | + ) : ( | ||
| 1293 | + <div> | ||
| 1294 | + <div style={{ marginTop: 8 }}>上传</div> | ||
| 1295 | + </div> | ||
| 1296 | + )} | ||
| 1297 | + </Upload> | ||
| 1298 | + <Button {...this.getUploadButtonProps()}><DeleteOutlined /></Button> | ||
| 1183 | </div> | 1299 | </div> |
| 1184 | ); | 1300 | ); |
| 1185 | } | 1301 | } |
| 1186 | - if (sName === 'sPackDetailPath') { | 1302 | + if (sName === "sPackDetailPath") { |
| 1187 | const boxList = []; | 1303 | const boxList = []; |
| 1188 | const tables = [ | 1304 | const tables = [ |
| 1189 | - { name: '盒型类别', value: this.props.record.sBoxType, type: null }, | ||
| 1190 | - { name: '盒身', value: this.props.record.sBoxBody, type: this.props.record.sTypes }, | ||
| 1191 | - { name: '盒长', value: this.props.record.dBoxLength, type: null }, | ||
| 1192 | - { name: '盒宽', value: this.props.record.dBoxWidth, type: null }, | ||
| 1193 | - { name: '盒高', value: this.props.record.dBoxHeight, type: null }, | 1305 | + { name: "盒型类别", value: this.props.record.sBoxType, type: null }, |
| 1306 | + { name: "盒身", value: this.props.record.sBoxBody, type: this.props.record.sTypes }, | ||
| 1307 | + { name: "盒长", value: this.props.record.dBoxLength, type: null }, | ||
| 1308 | + { name: "盒宽", value: this.props.record.dBoxWidth, type: null }, | ||
| 1309 | + { name: "盒高", value: this.props.record.dBoxHeight, type: null }, | ||
| 1194 | ]; | 1310 | ]; |
| 1195 | const { slaveData = [] } = this.props; | 1311 | const { slaveData = [] } = this.props; |
| 1196 | const titleList1 = [ | 1312 | const titleList1 = [ |
| 1197 | - { name: '上方盒舌', value: 'dSFHS' }, | ||
| 1198 | - { name: '盒底组件', value: 'dHDC' }, | ||
| 1199 | - { name: '下方盒舌', value: 'dXFHS' }, | ||
| 1200 | - { name: '左(上)插位组件', value: 'dZSCW' }, | ||
| 1201 | - { name: '左贴边位', value: 'dZTBW' }, | ||
| 1202 | - { name: '左(下)插位组件', value: 'dZXCW' }, | ||
| 1203 | - { name: '右(上)插位组件', value: 'dYSCW' }, | ||
| 1204 | - { name: '右贴边位', value: 'dYTBW' }, | ||
| 1205 | - { name: '右(下)插位组件', value: 'dYXCW' }, | 1313 | + { name: "上方盒舌", value: "dSFHS" }, |
| 1314 | + { name: "盒底组件", value: "dHDC" }, | ||
| 1315 | + { name: "下方盒舌", value: "dXFHS" }, | ||
| 1316 | + { name: "左(上)插位组件", value: "dZSCW" }, | ||
| 1317 | + { name: "左贴边位", value: "dZTBW" }, | ||
| 1318 | + { name: "左(下)插位组件", value: "dZXCW" }, | ||
| 1319 | + { name: "右(上)插位组件", value: "dYSCW" }, | ||
| 1320 | + { name: "右贴边位", value: "dYTBW" }, | ||
| 1321 | + { name: "右(下)插位组件", value: "dYXCW" }, | ||
| 1206 | ]; | 1322 | ]; |
| 1207 | - slaveData.forEach((x) => { | 1323 | + slaveData.forEach(x => { |
| 1208 | boxList.push({ | 1324 | boxList.push({ |
| 1209 | value: x.iValue, | 1325 | value: x.iValue, |
| 1210 | - sName: titleList1.find(item => item.value === x.sCode)?.name || '', | 1326 | + sName: titleList1.find(item => item.value === x.sCode)?.name || "", |
| 1211 | isEditable: true, | 1327 | isEditable: true, |
| 1212 | isSelect: false, | 1328 | isSelect: false, |
| 1213 | selectValue: null, | 1329 | selectValue: null, |
| 1214 | - selectLabel: '', | 1330 | + selectLabel: "", |
| 1215 | selectImage: null, | 1331 | selectImage: null, |
| 1216 | type: x.sTypes || null, | 1332 | type: x.sTypes || null, |
| 1217 | show: true, | 1333 | show: true, |
| 1218 | showName: x.sName, // 参数名称 | 1334 | showName: x.sName, // 参数名称 |
| 1219 | }); | 1335 | }); |
| 1220 | }); | 1336 | }); |
| 1221 | - tables.forEach((x) => { | 1337 | + tables.forEach(x => { |
| 1222 | boxList.push({ | 1338 | boxList.push({ |
| 1223 | value: x.value, | 1339 | value: x.value, |
| 1224 | sName: x.name, | 1340 | sName: x.name, |
| 1225 | isEditable: true, | 1341 | isEditable: true, |
| 1226 | isSelect: false, | 1342 | isSelect: false, |
| 1227 | selectValue: null, | 1343 | selectValue: null, |
| 1228 | - selectLabel: '', | 1344 | + selectLabel: "", |
| 1229 | selectImage: null, | 1345 | selectImage: null, |
| 1230 | type: x.type || null, | 1346 | type: x.type || null, |
| 1231 | show: true, | 1347 | show: true, |
| @@ -1240,54 +1356,115 @@ export default class CommonComponent extends Component { | @@ -1240,54 +1356,115 @@ export default class CommonComponent extends Component { | ||
| 1240 | showNew: 1, | 1356 | showNew: 1, |
| 1241 | }; | 1357 | }; |
| 1242 | return ( | 1358 | return ( |
| 1243 | - <div style={{ width: '100px', height: '100px' }}> | 1359 | + <div style={{ width: "100px", height: "100px" }}> |
| 1244 | <SvgBox {...svgProps} /> | 1360 | <SvgBox {...svgProps} /> |
| 1245 | </div> | 1361 | </div> |
| 1246 | ); | 1362 | ); |
| 1247 | } | 1363 | } |
| 1248 | - if (this.props.showConfig.sName && this.props.showConfig.sName.toLowerCase().includes('fullmemo')) { | 1364 | + if (this.props.showConfig.sName && this.props.showConfig.sName.toLowerCase().includes("fullmemo")) { |
| 1249 | const row = commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1; | 1365 | const row = commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1; |
| 1250 | - const minHeight = (row * 20) + 6 + 4 + 2; | ||
| 1251 | - return <div onDoubleClick={this.onEditorClick} style={{ minHeight }} className="braft-output-content" dangerouslySetInnerHTML={{ __html: this.state.dataValue }} />; | 1366 | + const minHeight = row * 20 + 6 + 4 + 2; |
| 1367 | + return ( | ||
| 1368 | + <div | ||
| 1369 | + onDoubleClick={this.onEditorClick} | ||
| 1370 | + style={{ minHeight }} | ||
| 1371 | + className="braft-output-content" | ||
| 1372 | + dangerouslySetInnerHTML={{ __html: this.state.dataValue }} | ||
| 1373 | + /> | ||
| 1374 | + ); | ||
| 1252 | } | 1375 | } |
| 1253 | - if ((this.props.showConfig.sDropDownType === 'sql' || this.props.showConfig.sDropDownType === 'const') | ||
| 1254 | - && (this.firstDataIndex === 'i' || this.firstDataIndex === 'd' || this.firstDataIndex === 's')) { /* 下拉选择框(数字和文本选择框才会下拉) */ | ||
| 1255 | - if (this.props.showConfig.bCanInput) { /* 文本输入下拉框 */ | 1376 | + if ( |
| 1377 | + (this.props.showConfig.sDropDownType === "sql" || this.props.showConfig.sDropDownType === "const") && | ||
| 1378 | + (this.firstDataIndex === "i" || this.firstDataIndex === "d" || this.firstDataIndex === "s") | ||
| 1379 | + ) { | ||
| 1380 | + /* 下拉选择框(数字和文本选择框才会下拉) */ | ||
| 1381 | + if (this.props.showConfig.bCanInput) { | ||
| 1382 | + /* 文本输入下拉框 */ | ||
| 1256 | const propsObj = { ...this.getCompleteProps() }; | 1383 | const propsObj = { ...this.getCompleteProps() }; |
| 1257 | - return <AutoCompleteA {...propsObj}>{this.getSelectOption('autoComplete')}</AutoCompleteA>; | ||
| 1258 | - } else { /* 普通下拉框 */ | ||
| 1259 | - return <Select {...this.getSelectProps()} >{this.getSelectOption()}</Select>; | ||
| 1260 | - } | ||
| 1261 | - } else if (this.state.enabled && commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sDropDownType === 'popup') { /* 通用弹窗 */ | ||
| 1262 | - return (<Search placeholder={chooseTitle} defaultValue={chooseTitle} {...this.getSearchProps()} onSearch={this.onFieldPopupModal.bind(this, this.props.showConfig, this.props.name)} />); | ||
| 1263 | - } else if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */ | ||
| 1264 | - return innerInputProps.readOnly ? <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"><InputNumberA {...innerInputProps} /></span> : | ||
| 1265 | - location.pathname.includes('quotationPackTableTree') && this.props.name === 'control' && this.props.showConfig.sName === 'dSinglePQty' ? <span style={{ position: 'relative' }}><InputNumberA {...innerInputProps} /><span onClick={this.handleViewClick} style={{ position: 'absolute', right: '2px' }}><EyeOutlined /></span></span> : <InputNumberA {...innerInputProps} style={{ width: '100%' }} />; | ||
| 1266 | - } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */ | 1384 | + return <AutoCompleteA {...propsObj}>{this.getSelectOption("autoComplete")}</AutoCompleteA>; |
| 1385 | + } else { | ||
| 1386 | + /* 普通下拉框 */ | ||
| 1387 | + return <Select {...this.getSelectProps()}>{this.getSelectOption()}</Select>; | ||
| 1388 | + } | ||
| 1389 | + } else if (this.state.enabled && commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sDropDownType === "popup") { | ||
| 1390 | + /* 通用弹窗 */ | ||
| 1391 | + return ( | ||
| 1392 | + <Search | ||
| 1393 | + placeholder={chooseTitle} | ||
| 1394 | + defaultValue={chooseTitle} | ||
| 1395 | + {...this.getSearchProps()} | ||
| 1396 | + onSearch={this.onFieldPopupModal.bind(this, this.props.showConfig, this.props.name)} | ||
| 1397 | + /> | ||
| 1398 | + ); | ||
| 1399 | + } else if (this.firstDataIndex === "i" || this.firstDataIndex === "d") { | ||
| 1400 | + /* 数字输入框(整形i和浮点型d) */ | ||
| 1401 | + return innerInputProps.readOnly ? ( | ||
| 1402 | + <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"> | ||
| 1403 | + <InputNumberA {...innerInputProps} /> | ||
| 1404 | + </span> | ||
| 1405 | + ) : location.pathname.includes("quotationPackTableTree") && this.props.name === "control" && this.props.showConfig.sName === "dSinglePQty" ? ( | ||
| 1406 | + <span style={{ position: "relative" }}> | ||
| 1407 | + <InputNumberA {...innerInputProps} /> | ||
| 1408 | + <span onClick={this.handleViewClick} style={{ position: "absolute", right: "2px" }}> | ||
| 1409 | + <EyeOutlined /> | ||
| 1410 | + </span> | ||
| 1411 | + </span> | ||
| 1412 | + ) : ( | ||
| 1413 | + <InputNumberA {...innerInputProps} style={{ width: "100%" }} /> | ||
| 1414 | + ); | ||
| 1415 | + } else if (this.firstDataIndex === "b") { | ||
| 1416 | + /* 选择框(布尔类型b) */ | ||
| 1267 | return <Checkbox {...innerInputProps}>{this.showName}</Checkbox>; | 1417 | return <Checkbox {...innerInputProps}>{this.showName}</Checkbox>; |
| 1268 | // return <span onKeyDown={this.onKeyDownDiv} suppressContentEditableWarning contentEditable="true"> <Checkbox {...innerInputProps}>{this.showName}</Checkbox></span>; | 1418 | // return <span onKeyDown={this.onKeyDownDiv} suppressContentEditableWarning contentEditable="true"> <Checkbox {...innerInputProps}>{this.showName}</Checkbox></span>; |
| 1269 | - } else if (this.firstDataIndex === 'm' || sDateFormat === 'YYYY-MM' || sDateFormat === 'YYYYMM') { /* 月份选择框(月份类型m) */ | ||
| 1270 | - return this.props.bTable ? <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"><MonthPicker {...innerInputProps} /></span> : <MonthPicker {...innerInputProps} />; | ||
| 1271 | - } else if (this.firstDataIndex === 't') { /* 时间选择框(时间类型t) */ | ||
| 1272 | - if (['tYear'].includes(this.props.showConfig.sName)) { | ||
| 1273 | - innerInputProps.picker = 'year'; | ||
| 1274 | - innerInputProps.format = 'YYYY'; | 1419 | + } else if (this.firstDataIndex === "m" || sDateFormat === "YYYY-MM" || sDateFormat === "YYYYMM") { |
| 1420 | + /* 月份选择框(月份类型m) */ | ||
| 1421 | + return this.props.bTable ? ( | ||
| 1422 | + <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"> | ||
| 1423 | + <MonthPicker {...innerInputProps} /> | ||
| 1424 | + </span> | ||
| 1425 | + ) : ( | ||
| 1426 | + <MonthPicker {...innerInputProps} /> | ||
| 1427 | + ); | ||
| 1428 | + } else if (this.firstDataIndex === "t") { | ||
| 1429 | + /* 时间选择框(时间类型t) */ | ||
| 1430 | + if (["tYear"].includes(this.props.showConfig.sName)) { | ||
| 1431 | + innerInputProps.picker = "year"; | ||
| 1432 | + innerInputProps.format = "YYYY"; | ||
| 1275 | innerInputProps.allowClear = false; | 1433 | innerInputProps.allowClear = false; |
| 1276 | } | 1434 | } |
| 1277 | - return this.props.bTable ? <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"><DatePicker {...innerInputProps} /></span> : <DatePicker {...innerInputProps} dropdownClassName="datePickerWrapper" />; | ||
| 1278 | - } else if (this.firstDataIndex === 'y') { /* 年份选择框(年份类型y) */ | ||
| 1279 | - return this.props.bTable ? <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"><DatePicker {...innerInputProps} /></span> : <DatePicker {...innerInputProps} picker="year" />; | ||
| 1280 | - } else if (this.firstDataIndex === 'p') { /* 时间选择框(时间类型t) */ | 1435 | + return this.props.bTable ? ( |
| 1436 | + <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"> | ||
| 1437 | + <DatePicker {...innerInputProps} /> | ||
| 1438 | + </span> | ||
| 1439 | + ) : ( | ||
| 1440 | + <DatePicker {...innerInputProps} dropdownClassName="datePickerWrapper" /> | ||
| 1441 | + ); | ||
| 1442 | + } else if (this.firstDataIndex === "y") { | ||
| 1443 | + /* 年份选择框(年份类型y) */ | ||
| 1444 | + return this.props.bTable ? ( | ||
| 1445 | + <span onKeyDown={this.onKeyDown} suppressContentEditableWarning contentEditable="true"> | ||
| 1446 | + <DatePicker {...innerInputProps} /> | ||
| 1447 | + </span> | ||
| 1448 | + ) : ( | ||
| 1449 | + <DatePicker {...innerInputProps} picker="year" /> | ||
| 1450 | + ); | ||
| 1451 | + } else if (this.firstDataIndex === "p") { | ||
| 1452 | + /* 时间选择框(时间类型t) */ | ||
| 1281 | return <RangePicker {...innerInputProps} />; | 1453 | return <RangePicker {...innerInputProps} />; |
| 1282 | - } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */ | ||
| 1283 | - if (this.props.textArea) { /* 大文本输入框 */ | 1454 | + } else if (this.firstDataIndex === "s") { |
| 1455 | + /* 文本输入框(文本s) */ | ||
| 1456 | + if (this.props.textArea) { | ||
| 1457 | + /* 大文本输入框 */ | ||
| 1284 | return <TextAreaA {...innerInputProps} />; | 1458 | return <TextAreaA {...innerInputProps} />; |
| 1285 | - } else { /* 普通文本输入框 */ | 1459 | + } else { |
| 1460 | + /* 普通文本输入框 */ | ||
| 1286 | return <InputA {...innerInputProps} />; | 1461 | return <InputA {...innerInputProps} />; |
| 1287 | } | 1462 | } |
| 1288 | - } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */ | 1463 | + } else if (this.firstDataIndex === "c") { |
| 1464 | + /* 地址联动框(联动下拉类型c) */ | ||
| 1289 | return <Cascader {...innerInputProps} />; | 1465 | return <Cascader {...innerInputProps} />; |
| 1290 | - } else { /* 文本输入框(默认类型) */ | 1466 | + } else { |
| 1467 | + /* 文本输入框(默认类型) */ | ||
| 1291 | return <InputA {...innerInputProps} />; | 1468 | return <InputA {...innerInputProps} />; |
| 1292 | } | 1469 | } |
| 1293 | }; | 1470 | }; |
| @@ -1300,15 +1477,19 @@ export default class CommonComponent extends Component { | @@ -1300,15 +1477,19 @@ export default class CommonComponent extends Component { | ||
| 1300 | const { sName } = this.props.showConfig; | 1477 | const { sName } = this.props.showConfig; |
| 1301 | const config = gdsconfigformslave.find(item => item.sControlName === `BtnPopup.${sName}`); | 1478 | const config = gdsconfigformslave.find(item => item.sControlName === `BtnPopup.${sName}`); |
| 1302 | if (config && this.props.onFieldPopupModal) { | 1479 | if (config && this.props.onFieldPopupModal) { |
| 1303 | - this.props.onFieldPopupModal(config, this.props.name, 'CommonListSelect'); | 1480 | + this.props.onFieldPopupModal(config, this.props.name, "CommonListSelect"); |
| 1304 | } | 1481 | } |
| 1305 | }, | 1482 | }, |
| 1306 | }; | 1483 | }; |
| 1307 | - return <Button {...props}><span style={{ fontWeight: 'bold' }}>...</span></Button>; | ||
| 1308 | - } | 1484 | + return ( |
| 1485 | + <Button {...props}> | ||
| 1486 | + <span style={{ fontWeight: "bold" }}>...</span> | ||
| 1487 | + </Button> | ||
| 1488 | + ); | ||
| 1489 | + }; | ||
| 1309 | 1490 | ||
| 1310 | // 获取innerinput控件后面的按钮(自定义) | 1491 | // 获取innerinput控件后面的按钮(自定义) |
| 1311 | - getInnerButtonCostom = (showConfig) => { | 1492 | + getInnerButtonCostom = showConfig => { |
| 1312 | const { name, sysEnabled } = this.props; | 1493 | const { name, sysEnabled } = this.props; |
| 1313 | const { showName } = showConfig; | 1494 | const { showName } = showConfig; |
| 1314 | let disabled = this.props.showConfig?.buttonbReadonly; | 1495 | let disabled = this.props.showConfig?.buttonbReadonly; |
| @@ -1316,7 +1497,7 @@ export default class CommonComponent extends Component { | @@ -1316,7 +1497,7 @@ export default class CommonComponent extends Component { | ||
| 1316 | disabled = !sysEnabled; | 1497 | disabled = !sysEnabled; |
| 1317 | } | 1498 | } |
| 1318 | const props = { | 1499 | const props = { |
| 1319 | - type: 'primary', | 1500 | + type: "primary", |
| 1320 | disabled, | 1501 | disabled, |
| 1321 | loading: this.state.buttonLoading, | 1502 | loading: this.state.buttonLoading, |
| 1322 | onClick: () => { | 1503 | onClick: () => { |
| @@ -1326,10 +1507,10 @@ export default class CommonComponent extends Component { | @@ -1326,10 +1507,10 @@ export default class CommonComponent extends Component { | ||
| 1326 | }, | 1507 | }, |
| 1327 | }; | 1508 | }; |
| 1328 | return <Button {...props}>{showName}</Button>; | 1509 | return <Button {...props}>{showName}</Button>; |
| 1329 | - } | 1510 | + }; |
| 1330 | 1511 | ||
| 1331 | /** 获取selectOption对象 */ | 1512 | /** 获取selectOption对象 */ |
| 1332 | - getSelectOption = (type) => { | 1513 | + getSelectOption = type => { |
| 1333 | /* 返回值声明 */ | 1514 | /* 返回值声明 */ |
| 1334 | const options = []; | 1515 | const options = []; |
| 1335 | /* 执行条件 */ | 1516 | /* 执行条件 */ |
| @@ -1341,40 +1522,52 @@ export default class CommonComponent extends Component { | @@ -1341,40 +1522,52 @@ export default class CommonComponent extends Component { | ||
| 1341 | if (commonUtils.isNotEmptyObject(each)) { | 1522 | if (commonUtils.isNotEmptyObject(each)) { |
| 1342 | /* 拼接optoin对象 */ | 1523 | /* 拼接optoin对象 */ |
| 1343 | let keyValue = !commonUtils.isEmpty(each.sSlaveId) ? each.sSlaveId : each.sId; | 1524 | let keyValue = !commonUtils.isEmpty(each.sSlaveId) ? each.sSlaveId : each.sId; |
| 1344 | - if (this.firstDataIndex === 'i') { | 1525 | + if (this.firstDataIndex === "i") { |
| 1345 | keyValue = parseInt(keyValue, 0); | 1526 | keyValue = parseInt(keyValue, 0); |
| 1346 | - } else if (this.firstDataIndex === 'd') { | 1527 | + } else if (this.firstDataIndex === "d") { |
| 1347 | keyValue = parseFloat(keyValue); | 1528 | keyValue = parseFloat(keyValue); |
| 1348 | } | 1529 | } |
| 1349 | - let res = ''; | 1530 | + let res = ""; |
| 1350 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) { | 1531 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) { |
| 1351 | res = each[this.props.showConfig.sVisColumnName]; | 1532 | res = each[this.props.showConfig.sVisColumnName]; |
| 1352 | } else { | 1533 | } else { |
| 1353 | - res = Object.keys(each).length > 0 ? each[Object.keys(each)[0]] : ''; | 1534 | + res = Object.keys(each).length > 0 ? each[Object.keys(each)[0]] : ""; |
| 1354 | } | 1535 | } |
| 1355 | - keyValue = commonUtils.isEmpty(keyValue) ? '' : keyValue; | ||
| 1356 | - if (type === 'autoComplete') { | 1536 | + keyValue = commonUtils.isEmpty(keyValue) ? "" : keyValue; |
| 1537 | + if (type === "autoComplete") { | ||
| 1357 | // 为autoComplete作特殊处理 | 1538 | // 为autoComplete作特殊处理 |
| 1358 | - const option = this.props.showConfig.bCanInput ? | ||
| 1359 | - (<Option key={keyValue.toString()} label={res} value={res} title={res}>{this.getOptionValues(each)}</Option>) : | ||
| 1360 | - (<Option key={keyValue} value={res} label={res} title={res}>{this.getOptionValues(each)}</Option>); | 1539 | + const option = this.props.showConfig.bCanInput ? ( |
| 1540 | + <Option key={keyValue.toString()} label={res} value={res} title={res}> | ||
| 1541 | + {this.getOptionValues(each)} | ||
| 1542 | + </Option> | ||
| 1543 | + ) : ( | ||
| 1544 | + <Option key={keyValue} value={res} label={res} title={res}> | ||
| 1545 | + {this.getOptionValues(each)} | ||
| 1546 | + </Option> | ||
| 1547 | + ); | ||
| 1361 | /* 返回值赋值s */ | 1548 | /* 返回值赋值s */ |
| 1362 | options.push(option); | 1549 | options.push(option); |
| 1363 | } else { | 1550 | } else { |
| 1364 | - const option = this.props.showConfig.bCanInput ? | ||
| 1365 | - (<Option key={keyValue.toString()} label={res} value={keyValue.toString()} title={res}>{this.getOptionValues(each)}</Option>) : | ||
| 1366 | - (<Option key={keyValue} value={keyValue} label={res} title={res}>{this.getOptionValues(each)}</Option>); | 1551 | + const option = this.props.showConfig.bCanInput ? ( |
| 1552 | + <Option key={keyValue.toString()} label={res} value={keyValue.toString()} title={res}> | ||
| 1553 | + {this.getOptionValues(each)} | ||
| 1554 | + </Option> | ||
| 1555 | + ) : ( | ||
| 1556 | + <Option key={keyValue} value={keyValue} label={res} title={res}> | ||
| 1557 | + {this.getOptionValues(each)} | ||
| 1558 | + </Option> | ||
| 1559 | + ); | ||
| 1367 | /* 返回值赋值 */ | 1560 | /* 返回值赋值 */ |
| 1368 | options.push(option); | 1561 | options.push(option); |
| 1369 | } | 1562 | } |
| 1370 | } | 1563 | } |
| 1371 | } | 1564 | } |
| 1372 | } | 1565 | } |
| 1373 | - if (this.state.searchValue === '') { | 1566 | + if (this.state.searchValue === "") { |
| 1374 | /* 下拉空处理 */ | 1567 | /* 下拉空处理 */ |
| 1375 | if (this.props.showConfig.bFirstEmpty) { | 1568 | if (this.props.showConfig.bFirstEmpty) { |
| 1376 | // 重构修改 options.unshift(<Option className="dropdown-empty" key=" " value="=+@" />); | 1569 | // 重构修改 options.unshift(<Option className="dropdown-empty" key=" " value="=+@" />); |
| 1377 | - if (type === 'autoComplete') { | 1570 | + if (type === "autoComplete") { |
| 1378 | // options.unshift(<Option className="dropdown-empty" key=" " value="=+@" />);/* 解决销售订单-产品名称,五笔输入法输入不支持直接输入中文 */ | 1571 | // options.unshift(<Option className="dropdown-empty" key=" " value="=+@" />);/* 解决销售订单-产品名称,五笔输入法输入不支持直接输入中文 */ |
| 1379 | } else { | 1572 | } else { |
| 1380 | options.unshift(<Option className="dropdown-empty" key=" " value="" />); | 1573 | options.unshift(<Option className="dropdown-empty" key=" " value="" />); |
| @@ -1383,10 +1576,14 @@ export default class CommonComponent extends Component { | @@ -1383,10 +1576,14 @@ export default class CommonComponent extends Component { | ||
| 1383 | /* 下拉新增处理 */ | 1576 | /* 下拉新增处理 */ |
| 1384 | if (this.props.showConfig.bNewRecord) { | 1577 | if (this.props.showConfig.bNewRecord) { |
| 1385 | // 重构修改 options.unshift(<Option key="@#*000@" value="">NEW RECORD</Option>); | 1578 | // 重构修改 options.unshift(<Option key="@#*000@" value="">NEW RECORD</Option>); |
| 1386 | - if (type === 'autoComplete') { | 1579 | + if (type === "autoComplete") { |
| 1387 | options.unshift(<Option value="">NEW RECORD</Option>); | 1580 | options.unshift(<Option value="">NEW RECORD</Option>); |
| 1388 | } else { | 1581 | } else { |
| 1389 | - options.unshift(<Option key="@#*000@" title="">NEW RECORD</Option>); | 1582 | + options.unshift( |
| 1583 | + <Option key="@#*000@" title=""> | ||
| 1584 | + NEW RECORD | ||
| 1585 | + </Option> | ||
| 1586 | + ); | ||
| 1390 | } | 1587 | } |
| 1391 | } | 1588 | } |
| 1392 | } | 1589 | } |
| @@ -1395,13 +1592,13 @@ export default class CommonComponent extends Component { | @@ -1395,13 +1592,13 @@ export default class CommonComponent extends Component { | ||
| 1395 | }; | 1592 | }; |
| 1396 | 1593 | ||
| 1397 | /* 获取sqlCondition对象 */ | 1594 | /* 获取sqlCondition对象 */ |
| 1398 | - getFloatPrice = (floatNum) => { | 1595 | + getFloatPrice = floatNum => { |
| 1399 | /* 返回值声明 */ | 1596 | /* 返回值声明 */ |
| 1400 | - let floatPrice = ''; | 1597 | + let floatPrice = ""; |
| 1401 | /* 返回值赋值 */ | 1598 | /* 返回值赋值 */ |
| 1402 | if (!commonUtils.isUndefined(floatNum)) { | 1599 | if (!commonUtils.isUndefined(floatNum)) { |
| 1403 | for (let i = 0; i < floatNum; i += 1) { | 1600 | for (let i = 0; i < floatNum; i += 1) { |
| 1404 | - floatPrice += '\\d'; | 1601 | + floatPrice += "\\d"; |
| 1405 | } | 1602 | } |
| 1406 | } | 1603 | } |
| 1407 | /* 返回值 */ | 1604 | /* 返回值 */ |
| @@ -1417,15 +1614,23 @@ export default class CommonComponent extends Component { | @@ -1417,15 +1614,23 @@ export default class CommonComponent extends Component { | ||
| 1417 | 1、判断是否直接传下拉,如果传了就直接用,并存储到store中去 | 1614 | 1、判断是否直接传下拉,如果传了就直接用,并存储到store中去 |
| 1418 | 2、没有传看 getStoreDropDownData有没有存储,存储后直接取用 | 1615 | 2、没有传看 getStoreDropDownData有没有存储,存储后直接取用 |
| 1419 | 3、 没有存储时直接调用后台SQL语句去下拉 */ | 1616 | 3、 没有存储时直接调用后台SQL语句去下拉 */ |
| 1420 | - if (this.props.showConfig.sDropDownType === 'sql') { /* 数据下拉 */ | 1617 | + if (this.props.showConfig.sDropDownType === "sql") { |
| 1618 | + /* 数据下拉 */ | ||
| 1421 | const { dropDownData: dropDownDataOld, searchDropDownData: searchDropDownDataOld } = this.state; | 1619 | const { dropDownData: dropDownDataOld, searchDropDownData: searchDropDownDataOld } = this.state; |
| 1422 | if (pageNum <= totalPageCount) { | 1620 | if (pageNum <= totalPageCount) { |
| 1423 | - const sqlDropDownData = await this.props.getSqlDropDownData(this.props.formId, this.props.name, this.props.showConfig, this.props.record, searchValue, pageNum); | 1621 | + const sqlDropDownData = await this.props.getSqlDropDownData( |
| 1622 | + this.props.formId, | ||
| 1623 | + this.props.name, | ||
| 1624 | + this.props.showConfig, | ||
| 1625 | + this.props.record, | ||
| 1626 | + searchValue, | ||
| 1627 | + pageNum | ||
| 1628 | + ); | ||
| 1424 | if (dropDownCount !== undefined && dropDownCount < this.dropDownCount) { | 1629 | if (dropDownCount !== undefined && dropDownCount < this.dropDownCount) { |
| 1425 | return; | 1630 | return; |
| 1426 | } | 1631 | } |
| 1427 | if (this.mounted) { | 1632 | if (this.mounted) { |
| 1428 | - if (searchValue !== '') { | 1633 | + if (searchValue !== "") { |
| 1429 | const dropDownData = []; | 1634 | const dropDownData = []; |
| 1430 | if (commonUtils.isNotEmptyArr(sqlDropDownData.dropDownData)) { | 1635 | if (commonUtils.isNotEmptyArr(sqlDropDownData.dropDownData)) { |
| 1431 | if (pageNum !== 1) { | 1636 | if (pageNum !== 1) { |
| @@ -1457,7 +1662,7 @@ export default class CommonComponent extends Component { | @@ -1457,7 +1662,7 @@ export default class CommonComponent extends Component { | ||
| 1457 | totalPageCount: sqlDropDownData.totalPageCount, | 1662 | totalPageCount: sqlDropDownData.totalPageCount, |
| 1458 | pageNum: sqlDropDownData.currentPageNo, | 1663 | pageNum: sqlDropDownData.currentPageNo, |
| 1459 | spinState: false, | 1664 | spinState: false, |
| 1460 | - searchValue: '', | 1665 | + searchValue: "", |
| 1461 | totalCount: sqlDropDownData.totalCount, | 1666 | totalCount: sqlDropDownData.totalCount, |
| 1462 | selectTableData: sqlDropDownData.dropDownData, | 1667 | selectTableData: sqlDropDownData.dropDownData, |
| 1463 | }); | 1668 | }); |
| @@ -1470,9 +1675,11 @@ export default class CommonComponent extends Component { | @@ -1470,9 +1675,11 @@ export default class CommonComponent extends Component { | ||
| 1470 | /** 获取innerinput控件参数 */ | 1675 | /** 获取innerinput控件参数 */ |
| 1471 | getInnerInputProps = () => { | 1676 | getInnerInputProps = () => { |
| 1472 | /* 主表和从表的innerinputprops对象有区别 */ | 1677 | /* 主表和从表的innerinputprops对象有区别 */ |
| 1473 | - if (!this.props.bTable) { /* 主表 */ | 1678 | + if (!this.props.bTable) { |
| 1679 | + /* 主表 */ | ||
| 1474 | return this.getInnerInputPropsMaster(); | 1680 | return this.getInnerInputPropsMaster(); |
| 1475 | - } else { /* 主从表 */ | 1681 | + } else { |
| 1682 | + /* 主从表 */ | ||
| 1476 | return this.getInnerInputPropsSlave(); | 1683 | return this.getInnerInputPropsSlave(); |
| 1477 | } | 1684 | } |
| 1478 | }; | 1685 | }; |
| @@ -1481,16 +1688,21 @@ export default class CommonComponent extends Component { | @@ -1481,16 +1688,21 @@ export default class CommonComponent extends Component { | ||
| 1481 | getInnerInputPropsSlave = () => { | 1688 | getInnerInputPropsSlave = () => { |
| 1482 | /* 返回值声明 */ | 1689 | /* 返回值声明 */ |
| 1483 | let obj = {}; | 1690 | let obj = {}; |
| 1484 | - if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */ | 1691 | + if (this.firstDataIndex === "i" || this.firstDataIndex === "d") { |
| 1692 | + /* 数字输入框(整形i和浮点型d) */ | ||
| 1485 | obj = this.getNumberInnerInputPropsSlave(); | 1693 | obj = this.getNumberInnerInputPropsSlave(); |
| 1486 | - } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */ | 1694 | + } else if (this.firstDataIndex === "b") { |
| 1695 | + /* 选择框(布尔类型b) */ | ||
| 1487 | obj = this.getBooleanInnerInputPropsSlave(); | 1696 | obj = this.getBooleanInnerInputPropsSlave(); |
| 1488 | - } else if (this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 'm' || this.firstDataIndex === 'y') { /* 时间选择框(时间类型t) */ | 1697 | + } else if (this.firstDataIndex === "t" || this.firstDataIndex === "p" || this.firstDataIndex === "m" || this.firstDataIndex === "y") { |
| 1698 | + /* 时间选择框(时间类型t) */ | ||
| 1489 | obj = this.getDateInnerInputPropsSlave(); | 1699 | obj = this.getDateInnerInputPropsSlave(); |
| 1490 | - } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */ | 1700 | + } else if (this.firstDataIndex === "s") { |
| 1701 | + /* 文本输入框(文本s) */ | ||
| 1491 | obj = this.getTextInnerInputPropsSlave(); | 1702 | obj = this.getTextInnerInputPropsSlave(); |
| 1492 | obj.onDoubleClick = this.onDoubleClick; | 1703 | obj.onDoubleClick = this.onDoubleClick; |
| 1493 | - } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */ | 1704 | + } else if (this.firstDataIndex === "c") { |
| 1705 | + /* 地址联动框(联动下拉类型c) */ | ||
| 1494 | obj = this.getAddressInnerInputPropsSlave(); | 1706 | obj = this.getAddressInnerInputPropsSlave(); |
| 1495 | } | 1707 | } |
| 1496 | obj.onKeyDown = this.onKeyDown; | 1708 | obj.onKeyDown = this.onKeyDown; |
| @@ -1498,7 +1710,7 @@ export default class CommonComponent extends Component { | @@ -1498,7 +1710,7 @@ export default class CommonComponent extends Component { | ||
| 1498 | obj.onBlur = this.onBlur; | 1710 | obj.onBlur = this.onBlur; |
| 1499 | obj.onMouseEnter = this.onFocus; | 1711 | obj.onMouseEnter = this.onFocus; |
| 1500 | obj.id = `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`; /* 所有从表组件添加id */ | 1712 | obj.id = `${this.props.showConfig.sName}${this.props.record ? this.props.record.sId : commonUtils.createSid()}`; /* 所有从表组件添加id */ |
| 1501 | - obj.placeholder = this.props.showConfig.placeholder || ''; | 1713 | + obj.placeholder = this.props.showConfig.placeholder || ""; |
| 1502 | /* 返回值 */ | 1714 | /* 返回值 */ |
| 1503 | return obj; | 1715 | return obj; |
| 1504 | }; | 1716 | }; |
| @@ -1508,15 +1720,18 @@ export default class CommonComponent extends Component { | @@ -1508,15 +1720,18 @@ export default class CommonComponent extends Component { | ||
| 1508 | /* 返回值 */ | 1720 | /* 返回值 */ |
| 1509 | const obj = { | 1721 | const obj = { |
| 1510 | // disabled: !this.state.enabled, /* 是否可编辑 */ | 1722 | // disabled: !this.state.enabled, /* 是否可编辑 */ |
| 1511 | - placeholder: '请选择省市区', /* 预期值的提示信息 */ | ||
| 1512 | - options: this.getProvinceCityAreaData(), /* 数据 */ | ||
| 1513 | - changeOnSelect: true, /* 对每个选择值进行更改 */ | ||
| 1514 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | ||
| 1515 | - value: commonUtils.isUndefined(this.state.dataValue) ? [] : typeof this.state.dataValue === 'string' ? | ||
| 1516 | - this.state.dataValue.split(',') : commonUtils.convertUndefinedToEmptyArr(this.state.dataValue), /* 数据值 */ | 1723 | + placeholder: "请选择省市区" /* 预期值的提示信息 */, |
| 1724 | + options: this.getProvinceCityAreaData() /* 数据 */, | ||
| 1725 | + changeOnSelect: true /* 对每个选择值进行更改 */, | ||
| 1726 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 1727 | + value: commonUtils.isUndefined(this.state.dataValue) | ||
| 1728 | + ? [] | ||
| 1729 | + : typeof this.state.dataValue === "string" | ||
| 1730 | + ? this.state.dataValue.split(",") | ||
| 1731 | + : commonUtils.convertUndefinedToEmptyArr(this.state.dataValue) /* 数据值 */, | ||
| 1517 | }; | 1732 | }; |
| 1518 | if (this.props.readOnly) { | 1733 | if (this.props.readOnly) { |
| 1519 | - obj.readOnly = 'readOnly'; | 1734 | + obj.readOnly = "readOnly"; |
| 1520 | } else { | 1735 | } else { |
| 1521 | obj.disabled = !this.state.enabled; | 1736 | obj.disabled = !this.state.enabled; |
| 1522 | } | 1737 | } |
| @@ -1527,32 +1742,51 @@ export default class CommonComponent extends Component { | @@ -1527,32 +1742,51 @@ export default class CommonComponent extends Component { | ||
| 1527 | /* 获取文本innerinputprops对象(从) */ | 1742 | /* 获取文本innerinputprops对象(从) */ |
| 1528 | getTextInnerInputPropsSlave = () => { | 1743 | getTextInnerInputPropsSlave = () => { |
| 1529 | /* 返回值声明 */ | 1744 | /* 返回值声明 */ |
| 1530 | - const bShowSuffix = this.props.showConfig.sName === 'sSaveProName' || this.props.showConfig.sName === 'sDeleteProName' || this.props.showConfig.sName === 'sSaveProNameBefore' || this.props.showConfig.sName === 'sProcName' || this.props.showConfig.sName === 'sButtonParam'; /* 是否展示后缀图标 */ | ||
| 1531 | - const bShowArrow = this.props.showConfig.sName === 'dNeedAuxiliaryQty'; | 1745 | + const bShowSuffix = |
| 1746 | + this.props.showConfig.sName === "sSaveProName" || | ||
| 1747 | + this.props.showConfig.sName === "sDeleteProName" || | ||
| 1748 | + this.props.showConfig.sName === "sSaveProNameBefore" || | ||
| 1749 | + this.props.showConfig.sName === "sProcName" || | ||
| 1750 | + this.props.showConfig.sName === "sButtonParam"; /* 是否展示后缀图标 */ | ||
| 1751 | + const bShowArrow = this.props.showConfig.sName === "dNeedAuxiliaryQty"; | ||
| 1532 | const obj = { | 1752 | const obj = { |
| 1533 | // disabled: !this.state.enabled, /* 是否可编辑 */ | 1753 | // disabled: !this.state.enabled, /* 是否可编辑 */ |
| 1534 | - id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */ | ||
| 1535 | - onChange: e => this.handleSelectOptionEvent(e), /* 数据改变回带到父组件 */ | ||
| 1536 | - value: commonUtils.isUndefined(this.state.dataValue) ? '' : commonUtils.strUndefinedToEmpty(this.state.dataValue), /* 数据值 */ | 1754 | + id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */, |
| 1755 | + onChange: e => this.handleSelectOptionEvent(e) /* 数据改变回带到父组件 */, | ||
| 1756 | + value: commonUtils.isUndefined(this.state.dataValue) ? "" : commonUtils.strUndefinedToEmpty(this.state.dataValue) /* 数据值 */, | ||
| 1537 | // eslint-disable-next-line no-return-assign | 1757 | // eslint-disable-next-line no-return-assign |
| 1538 | - ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */ | ||
| 1539 | - onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */ | ||
| 1540 | - suffix: bShowSuffix ? <span style={{ width: '8px' }} onClick={this.handleOpenWin}><EyeOutlined style={{ color: 'rgba(0,0,0,.85)' }} /></span> : | ||
| 1541 | - (bShowArrow ? <span style={{ width: '8px' }} onClick={this.handleRightArrow}><RightOutlined style={{ color: 'rgba(0,0,0,.85)' }} /></span> : ''), | 1758 | + ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */, |
| 1759 | + onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */, | ||
| 1760 | + suffix: bShowSuffix ? ( | ||
| 1761 | + <span style={{ width: "8px" }} onClick={this.handleOpenWin}> | ||
| 1762 | + <EyeOutlined style={{ color: "rgba(0,0,0,.85)" }} /> | ||
| 1763 | + </span> | ||
| 1764 | + ) : bShowArrow ? ( | ||
| 1765 | + <span style={{ width: "8px" }} onClick={this.handleRightArrow}> | ||
| 1766 | + <RightOutlined style={{ color: "rgba(0,0,0,.85)" }} /> | ||
| 1767 | + </span> | ||
| 1768 | + ) : ( | ||
| 1769 | + "" | ||
| 1770 | + ), | ||
| 1542 | rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1, | 1771 | rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1, |
| 1543 | }; | 1772 | }; |
| 1544 | if (this.props.readOnly) { | 1773 | if (this.props.readOnly) { |
| 1545 | - obj.readOnly = 'readOnly'; | 1774 | + obj.readOnly = "readOnly"; |
| 1546 | } else { | 1775 | } else { |
| 1547 | obj.disabled = !this.state.enabled; | 1776 | obj.disabled = !this.state.enabled; |
| 1548 | } | 1777 | } |
| 1549 | /* 最大值最小值 */ | 1778 | /* 最大值最小值 */ |
| 1550 | - if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 1779 | + if ( |
| 1780 | + typeof commonUtils.convertStrToNumber(this.max) === "number" && | ||
| 1781 | + commonUtils.convertStrToNumber(this.max) !== 0 && | ||
| 1782 | + this.max.indexOf(".d") === -1 && | ||
| 1783 | + this.max.indexOf(".i") === -1 | ||
| 1784 | + ) { | ||
| 1551 | obj.maxLength = this.max; /* 最大长度 */ | 1785 | obj.maxLength = this.max; /* 最大长度 */ |
| 1552 | obj.title = obj.value; | 1786 | obj.title = obj.value; |
| 1553 | } | 1787 | } |
| 1554 | obj.placeholder = this.props.showConfig.placeholder; | 1788 | obj.placeholder = this.props.showConfig.placeholder; |
| 1555 | - obj.autocomplete = 'new-password'; | 1789 | + obj.autocomplete = "new-password"; |
| 1556 | /* 返回值 */ | 1790 | /* 返回值 */ |
| 1557 | return obj; | 1791 | return obj; |
| 1558 | }; | 1792 | }; |
| @@ -1561,10 +1795,10 @@ export default class CommonComponent extends Component { | @@ -1561,10 +1795,10 @@ export default class CommonComponent extends Component { | ||
| 1561 | getDateInnerInputPropsSlave = () => { | 1795 | getDateInnerInputPropsSlave = () => { |
| 1562 | let { sDateFormat } = this.props.showConfig; | 1796 | let { sDateFormat } = this.props.showConfig; |
| 1563 | if (commonUtils.isEmptyStr(sDateFormat)) { | 1797 | if (commonUtils.isEmptyStr(sDateFormat)) { |
| 1564 | - if (this.firstDataIndex === 'm') { | ||
| 1565 | - sDateFormat = 'YYYY-MM'; | ||
| 1566 | - } else if (this.firstDataIndex === 'y') { | ||
| 1567 | - sDateFormat = 'YYYY'; | 1798 | + if (this.firstDataIndex === "m") { |
| 1799 | + sDateFormat = "YYYY-MM"; | ||
| 1800 | + } else if (this.firstDataIndex === "y") { | ||
| 1801 | + sDateFormat = "YYYY"; | ||
| 1568 | } else { | 1802 | } else { |
| 1569 | sDateFormat = this.props.getDateFormat(); | 1803 | sDateFormat = this.props.getDateFormat(); |
| 1570 | } | 1804 | } |
| @@ -1578,15 +1812,15 @@ export default class CommonComponent extends Component { | @@ -1578,15 +1812,15 @@ export default class CommonComponent extends Component { | ||
| 1578 | } | 1812 | } |
| 1579 | /* 返回值声明 */ | 1813 | /* 返回值声明 */ |
| 1580 | const obj = { | 1814 | const obj = { |
| 1581 | - placeholder: '', /* 时间的提示信息 */ | ||
| 1582 | - disabled: !this.state.enabled, /* 是否可编辑 */ | ||
| 1583 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | 1815 | + placeholder: "" /* 时间的提示信息 */, |
| 1816 | + disabled: !this.state.enabled /* 是否可编辑 */, | ||
| 1817 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 1584 | format: sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */ | 1818 | format: sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */ |
| 1585 | - disabledDate: this.getDataMaxAndMin, /* 不可选日期 */ | 1819 | + disabledDate: this.getDataMaxAndMin /* 不可选日期 */, |
| 1586 | showTime: showtimeFormat, | 1820 | showTime: showtimeFormat, |
| 1587 | - style: { width: '100%' }, /* 样式 */ | 1821 | + style: { width: "100%" } /* 样式 */, |
| 1588 | onBlur: () => { | 1822 | onBlur: () => { |
| 1589 | - this.onExecInstructSet('blur'); | 1823 | + this.onExecInstructSet("blur"); |
| 1590 | }, | 1824 | }, |
| 1591 | }; | 1825 | }; |
| 1592 | // if (this.props.readOnly) { | 1826 | // if (this.props.readOnly) { |
| @@ -1607,9 +1841,9 @@ export default class CommonComponent extends Component { | @@ -1607,9 +1841,9 @@ export default class CommonComponent extends Component { | ||
| 1607 | getBooleanInnerInputPropsSlave = () => { | 1841 | getBooleanInnerInputPropsSlave = () => { |
| 1608 | /* 返回值声明 */ | 1842 | /* 返回值声明 */ |
| 1609 | const obj = { | 1843 | const obj = { |
| 1610 | - disabled: !this.state.enabled, /* 是否可编辑 */ | ||
| 1611 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | ||
| 1612 | - checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue), /* 是否选中 */ | 1844 | + disabled: !this.state.enabled /* 是否可编辑 */, |
| 1845 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 1846 | + checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue) /* 是否选中 */, | ||
| 1613 | }; | 1847 | }; |
| 1614 | // if (this.props.readOnly) { | 1848 | // if (this.props.readOnly) { |
| 1615 | // obj.readOnly = true; | 1849 | // obj.readOnly = true; |
| @@ -1622,23 +1856,27 @@ export default class CommonComponent extends Component { | @@ -1622,23 +1856,27 @@ export default class CommonComponent extends Component { | ||
| 1622 | 1856 | ||
| 1623 | /* 获取数字innerinputprops对象(从) */ | 1857 | /* 获取数字innerinputprops对象(从) */ |
| 1624 | getNumberInnerInputPropsSlave = () => { | 1858 | getNumberInnerInputPropsSlave = () => { |
| 1625 | - const bShowArrow = this.props.showConfig.sName === 'dNeedAuxiliaryQty' && this.props.showConfig.sControlName !== 'slaveInfo'; | 1859 | + const bShowArrow = this.props.showConfig.sName === "dNeedAuxiliaryQty" && this.props.showConfig.sControlName !== "slaveInfo"; |
| 1626 | /* 返回值声明 */ | 1860 | /* 返回值声明 */ |
| 1627 | const obj = { | 1861 | const obj = { |
| 1628 | - id: `${this.props.showConfig.sName}${this.props.showConfig.sId}`, /* 虚拟数字键盘使用id获取光标 */ | ||
| 1629 | - className: styles.inputNum, /* 样式名称 */ | 1862 | + id: `${this.props.showConfig.sName}${this.props.showConfig.sId}` /* 虚拟数字键盘使用id获取光标 */, |
| 1863 | + className: styles.inputNum /* 样式名称 */, | ||
| 1630 | // disabled: !this.state.enabled, /* 是否可编辑 */ | 1864 | // disabled: !this.state.enabled, /* 是否可编辑 */ |
| 1631 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | ||
| 1632 | - parser: (oldValue) => { | 1865 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, |
| 1866 | + parser: oldValue => { | ||
| 1633 | const value = this.handleCheckNumberInnerInput(oldValue); | 1867 | const value = this.handleCheckNumberInnerInput(oldValue); |
| 1634 | return value; | 1868 | return value; |
| 1635 | }, | 1869 | }, |
| 1636 | // eslint-disable-next-line no-return-assign | 1870 | // eslint-disable-next-line no-return-assign |
| 1637 | - ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */ | ||
| 1638 | - onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */ | 1871 | + ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */, |
| 1872 | + onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */, | ||
| 1639 | }; | 1873 | }; |
| 1640 | if (bShowArrow) { | 1874 | if (bShowArrow) { |
| 1641 | - obj.addonAfter = <span style={{ width: '5px' }} onClick={this.handleRightArrow}><RightOutlined style={{ color: 'rgba(0,0,0,.85)' }} /></span>; | 1875 | + obj.addonAfter = ( |
| 1876 | + <span style={{ width: "5px" }} onClick={this.handleRightArrow}> | ||
| 1877 | + <RightOutlined style={{ color: "rgba(0,0,0,.85)" }} /> | ||
| 1878 | + </span> | ||
| 1879 | + ); | ||
| 1642 | } | 1880 | } |
| 1643 | if (this.props.readOnly) { | 1881 | if (this.props.readOnly) { |
| 1644 | obj.readOnly = true; | 1882 | obj.readOnly = true; |
| @@ -1646,20 +1884,26 @@ export default class CommonComponent extends Component { | @@ -1646,20 +1884,26 @@ export default class CommonComponent extends Component { | ||
| 1646 | obj.disabled = !this.state.enabled; | 1884 | obj.disabled = !this.state.enabled; |
| 1647 | } | 1885 | } |
| 1648 | /* 最大值最小值 */ | 1886 | /* 最大值最小值 */ |
| 1649 | - if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 1887 | + if ( |
| 1888 | + typeof commonUtils.convertStrToNumber(this.max) === "number" && | ||
| 1889 | + commonUtils.convertStrToNumber(this.max) !== 0 && | ||
| 1890 | + this.max.indexOf(".d") === -1 && | ||
| 1891 | + this.max.indexOf(".i") === -1 | ||
| 1892 | + ) { | ||
| 1650 | obj.max = this.max; /* 最大值 */ | 1893 | obj.max = this.max; /* 最大值 */ |
| 1651 | - } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf('.') > -1 && commonUtils.isNotEmptyObject(this.props.record)) { | ||
| 1652 | - obj.max = this.props.record[this.max.substring(this.max.indexOf('.') + 1)]; | 1894 | + } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf(".") > -1 && commonUtils.isNotEmptyObject(this.props.record)) { |
| 1895 | + obj.max = this.props.record[this.max.substring(this.max.indexOf(".") + 1)]; | ||
| 1653 | } | 1896 | } |
| 1654 | - if (typeof commonUtils.convertStrToNumber(this.min) === 'number' && commonUtils.convertStrToNumber(this.min) !== 0) { | 1897 | + if (typeof commonUtils.convertStrToNumber(this.min) === "number" && commonUtils.convertStrToNumber(this.min) !== 0) { |
| 1655 | obj.min = this.min; /* 最小值 */ | 1898 | obj.min = this.min; /* 最小值 */ |
| 1656 | } | 1899 | } |
| 1657 | - if (obj.max < 0) { /* 为解决收付款单据未收款为负数时收款金额不能大于未收款问题,当最大值小于0时,变更为设为最小值 */ | 1900 | + if (obj.max < 0) { |
| 1901 | + /* 为解决收付款单据未收款为负数时收款金额不能大于未收款问题,当最大值小于0时,变更为设为最小值 */ | ||
| 1658 | obj.min = obj.max; | 1902 | obj.min = obj.max; |
| 1659 | obj.max = 0; | 1903 | obj.max = 0; |
| 1660 | } | 1904 | } |
| 1661 | /* 浮点型需要格式化 */ | 1905 | /* 浮点型需要格式化 */ |
| 1662 | - if (this.firstDataIndex === 'd') { | 1906 | + if (this.firstDataIndex === "d") { |
| 1663 | // obj.formatter = value => this.toFamatter(value); | 1907 | // obj.formatter = value => this.toFamatter(value); |
| 1664 | // obj.parser = value => this.toFamatter(value); | 1908 | // obj.parser = value => this.toFamatter(value); |
| 1665 | // obj.precision = this.floatNum; | 1909 | // obj.precision = this.floatNum; |
| @@ -1671,7 +1915,7 @@ export default class CommonComponent extends Component { | @@ -1671,7 +1915,7 @@ export default class CommonComponent extends Component { | ||
| 1671 | const { dNetPrice } = this.props.app.decimals; | 1915 | const { dNetPrice } = this.props.app.decimals; |
| 1672 | const { showConfig } = this.props; | 1916 | const { showConfig } = this.props; |
| 1673 | const { sName, showName } = showConfig; | 1917 | const { sName, showName } = showConfig; |
| 1674 | - const digit = sName.includes('Price') ? dNetPrice : 6; | 1918 | + const digit = sName.includes("Price") ? dNetPrice : 6; |
| 1675 | const numCheck = new RegExp(`^(-?\\d+)(\\.?)(\\d{1,${digit}})?$`); | 1919 | const numCheck = new RegExp(`^(-?\\d+)(\\.?)(\\d{1,${digit}})?$`); |
| 1676 | const numValue = this.state.dataValue; | 1920 | const numValue = this.state.dataValue; |
| 1677 | if (!isNaN(+numValue)) { | 1921 | if (!isNaN(+numValue)) { |
| @@ -1689,23 +1933,30 @@ export default class CommonComponent extends Component { | @@ -1689,23 +1933,30 @@ export default class CommonComponent extends Component { | ||
| 1689 | getInnerInputPropsMaster = () => { | 1933 | getInnerInputPropsMaster = () => { |
| 1690 | /* 返回值声明 */ | 1934 | /* 返回值声明 */ |
| 1691 | let obj = {}; | 1935 | let obj = {}; |
| 1692 | - if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd') { /* 数字输入框(整形i和浮点型d) */ | 1936 | + if (this.firstDataIndex === "i" || this.firstDataIndex === "d") { |
| 1937 | + /* 数字输入框(整形i和浮点型d) */ | ||
| 1693 | obj = this.getNumberInnerInputPropsMaster(); | 1938 | obj = this.getNumberInnerInputPropsMaster(); |
| 1694 | - } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */ | 1939 | + } else if (this.firstDataIndex === "b") { |
| 1940 | + /* 选择框(布尔类型b) */ | ||
| 1695 | obj = this.getBooleanInnerInputPropsMaster(); | 1941 | obj = this.getBooleanInnerInputPropsMaster(); |
| 1696 | - } else if (this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 'm' || this.firstDataIndex === 'y') { /* 时间选择框(时间类型t) */ | 1942 | + } else if (this.firstDataIndex === "t" || this.firstDataIndex === "p" || this.firstDataIndex === "m" || this.firstDataIndex === "y") { |
| 1943 | + /* 时间选择框(时间类型t) */ | ||
| 1697 | obj = this.getDateInnerInputPropsMaster(); | 1944 | obj = this.getDateInnerInputPropsMaster(); |
| 1698 | - } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */ | ||
| 1699 | - if (this.props.textArea) { /* 大文本输入框 */ | 1945 | + } else if (this.firstDataIndex === "s") { |
| 1946 | + /* 文本输入框(文本s) */ | ||
| 1947 | + if (this.props.textArea) { | ||
| 1948 | + /* 大文本输入框 */ | ||
| 1700 | obj = this.getTextAreaInnerInputPropsMaster(); | 1949 | obj = this.getTextAreaInnerInputPropsMaster(); |
| 1701 | obj.onDoubleClick = this.onDoubleClick; | 1950 | obj.onDoubleClick = this.onDoubleClick; |
| 1702 | - } else { /* 普通文本输入框 */ | 1951 | + } else { |
| 1952 | + /* 普通文本输入框 */ | ||
| 1703 | obj = this.getTextInnerInputPropsMaster(); | 1953 | obj = this.getTextInnerInputPropsMaster(); |
| 1704 | - if (this.props?.showConfig?.sName === 'sInstruct') { | 1954 | + if (this.props?.showConfig?.sName === "sInstruct") { |
| 1705 | obj.onDoubleClick = this.onDoubleClick; | 1955 | obj.onDoubleClick = this.onDoubleClick; |
| 1706 | } | 1956 | } |
| 1707 | } | 1957 | } |
| 1708 | - } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */ | 1958 | + } else if (this.firstDataIndex === "c") { |
| 1959 | + /* 地址联动框(联动下拉类型c) */ | ||
| 1709 | obj = this.getAddressInnerInputPropsMaster(); | 1960 | obj = this.getAddressInnerInputPropsMaster(); |
| 1710 | } | 1961 | } |
| 1711 | obj.onKeyDown = this.onKeyDown; | 1962 | obj.onKeyDown = this.onKeyDown; |
| @@ -1714,7 +1965,7 @@ export default class CommonComponent extends Component { | @@ -1714,7 +1965,7 @@ export default class CommonComponent extends Component { | ||
| 1714 | if (this.props.allowClear) { | 1965 | if (this.props.allowClear) { |
| 1715 | obj.allowClear = this.props.allowClear; /* 带移除图标 */ | 1966 | obj.allowClear = this.props.allowClear; /* 带移除图标 */ |
| 1716 | } | 1967 | } |
| 1717 | - obj.placeholder = this.props.showConfig.placeholder || ''; | 1968 | + obj.placeholder = this.props.showConfig.placeholder || ""; |
| 1718 | // obj.onContextMenu = this.onContextMenu; | 1969 | // obj.onContextMenu = this.onContextMenu; |
| 1719 | /* 返回值 */ | 1970 | /* 返回值 */ |
| 1720 | return obj; | 1971 | return obj; |
| @@ -1724,13 +1975,13 @@ export default class CommonComponent extends Component { | @@ -1724,13 +1975,13 @@ export default class CommonComponent extends Component { | ||
| 1724 | getAddressInnerInputPropsMaster = () => { | 1975 | getAddressInnerInputPropsMaster = () => { |
| 1725 | const obj = { | 1976 | const obj = { |
| 1726 | // disabled: !this.state.enabled, /* 是否可编辑 */ | 1977 | // disabled: !this.state.enabled, /* 是否可编辑 */ |
| 1727 | - placeholder: '请选择省市区', /* 预期值的提示信息 */ | ||
| 1728 | - options: this.getProvinceCityAreaData(), /* 数据 */ | ||
| 1729 | - changeOnSelect: true, /* 对每个选择值进行更改 */ | ||
| 1730 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | 1978 | + placeholder: "请选择省市区" /* 预期值的提示信息 */, |
| 1979 | + options: this.getProvinceCityAreaData() /* 数据 */, | ||
| 1980 | + changeOnSelect: true /* 对每个选择值进行更改 */, | ||
| 1981 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 1731 | }; | 1982 | }; |
| 1732 | if (this.props.readOnly) { | 1983 | if (this.props.readOnly) { |
| 1733 | - obj.readOnly = 'readOnly'; | 1984 | + obj.readOnly = "readOnly"; |
| 1734 | } else { | 1985 | } else { |
| 1735 | obj.disabled = !this.state.enabled; | 1986 | obj.disabled = !this.state.enabled; |
| 1736 | } | 1987 | } |
| @@ -1740,33 +1991,48 @@ export default class CommonComponent extends Component { | @@ -1740,33 +1991,48 @@ export default class CommonComponent extends Component { | ||
| 1740 | /* 获取文本innerinputprops对象(主) */ | 1991 | /* 获取文本innerinputprops对象(主) */ |
| 1741 | getTextInnerInputPropsMaster = () => { | 1992 | getTextInnerInputPropsMaster = () => { |
| 1742 | /* 返回值声明 */ | 1993 | /* 返回值声明 */ |
| 1743 | - const bShowSuffix = this.props.showConfig.sName === 'sButtonParam' || this.props.showConfig.sName === 'sSqlStr' || this.props.showConfig.sName === 'sConfigSqlStr' || this.props.showConfig.sName === 'sProcName'; /* 是否展示后缀图标 */ | 1994 | + const bShowSuffix = |
| 1995 | + this.props.showConfig.sName === "sButtonParam" || | ||
| 1996 | + this.props.showConfig.sName === "sSqlStr" || | ||
| 1997 | + this.props.showConfig.sName === "sConfigSqlStr" || | ||
| 1998 | + this.props.showConfig.sName === "sProcName"; /* 是否展示后缀图标 */ | ||
| 1744 | const obj = { | 1999 | const obj = { |
| 1745 | - id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */ | 2000 | + id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */, |
| 1746 | // disabled: !this.state.enabled, /* 是否可编辑 */ | 2001 | // disabled: !this.state.enabled, /* 是否可编辑 */ |
| 1747 | - onChange: e => this.handleSelectOptionEvent(e), /* 数据改变回带到父组件 */ | 2002 | + onChange: e => this.handleSelectOptionEvent(e) /* 数据改变回带到父组件 */, |
| 1748 | // eslint-disable-next-line no-return-assign | 2003 | // eslint-disable-next-line no-return-assign |
| 1749 | - ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */ | ||
| 1750 | - onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */ | ||
| 1751 | - suffix: bShowSuffix ? <span onClick={this.handleOpenWin}><EyeOutlined style={{ color: 'rgba(0,0,0,.85)' }} /></span> : '', | 2004 | + ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */, |
| 2005 | + onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */, | ||
| 2006 | + suffix: bShowSuffix ? ( | ||
| 2007 | + <span onClick={this.handleOpenWin}> | ||
| 2008 | + <EyeOutlined style={{ color: "rgba(0,0,0,.85)" }} /> | ||
| 2009 | + </span> | ||
| 2010 | + ) : ( | ||
| 2011 | + "" | ||
| 2012 | + ), | ||
| 1752 | }; | 2013 | }; |
| 1753 | if (this.props.readOnly) { | 2014 | if (this.props.readOnly) { |
| 1754 | - obj.readOnly = 'readOnly'; | 2015 | + obj.readOnly = "readOnly"; |
| 1755 | } else { | 2016 | } else { |
| 1756 | obj.disabled = !this.state.enabled; | 2017 | obj.disabled = !this.state.enabled; |
| 1757 | } | 2018 | } |
| 1758 | if (this.props.bPassWord) { | 2019 | if (this.props.bPassWord) { |
| 1759 | - obj.type = 'password'; /* 文本密码类型 */ | 2020 | + obj.type = "password"; /* 文本密码类型 */ |
| 1760 | } | 2021 | } |
| 1761 | /* 最大值最小值 */ | 2022 | /* 最大值最小值 */ |
| 1762 | // if (this.props.showConfig.sName === 'sZmmGgxh') { | 2023 | // if (this.props.showConfig.sName === 'sZmmGgxh') { |
| 1763 | // console.log('sZmmGgxhsZmmGgxh', this.max, (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1)); | 2024 | // console.log('sZmmGgxhsZmmGgxh', this.max, (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1)); |
| 1764 | // } | 2025 | // } |
| 1765 | - if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 2026 | + if ( |
| 2027 | + typeof commonUtils.convertStrToNumber(this.max) === "number" && | ||
| 2028 | + commonUtils.convertStrToNumber(this.max) !== 0 && | ||
| 2029 | + this.max.indexOf(".d") === -1 && | ||
| 2030 | + this.max.indexOf(".i") === -1 | ||
| 2031 | + ) { | ||
| 1766 | obj.maxLength = this.max; /* 最大长度 */ | 2032 | obj.maxLength = this.max; /* 最大长度 */ |
| 1767 | } | 2033 | } |
| 1768 | obj.onBlur = this.onBlurText; | 2034 | obj.onBlur = this.onBlurText; |
| 1769 | - obj.autocomplete = 'new-password'; | 2035 | + obj.autocomplete = "new-password"; |
| 1770 | /* 返回值 */ | 2036 | /* 返回值 */ |
| 1771 | return obj; | 2037 | return obj; |
| 1772 | }; | 2038 | }; |
| @@ -1775,21 +2041,23 @@ export default class CommonComponent extends Component { | @@ -1775,21 +2041,23 @@ export default class CommonComponent extends Component { | ||
| 1775 | getTextAreaInnerInputPropsMaster = () => { | 2041 | getTextAreaInnerInputPropsMaster = () => { |
| 1776 | /* 返回值声明 */ | 2042 | /* 返回值声明 */ |
| 1777 | const obj = { | 2043 | const obj = { |
| 1778 | - id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */ | 2044 | + id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */, |
| 1779 | // disabled: !this.state.enabled, /* 是否可编辑 */ | 2045 | // disabled: !this.state.enabled, /* 是否可编辑 */ |
| 1780 | // rows: 3, /* 纵跨度 */ | 2046 | // rows: 3, /* 纵跨度 */ |
| 1781 | - rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1, /* 产品部要求 备注设置成一行到底 */ | ||
| 1782 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | 2047 | + rows: commonUtils.isNotEmptyNumber(this.props.showConfig.iRowValue) ? this.props.showConfig.iRowValue : 1 /* 产品部要求 备注设置成一行到底 */, |
| 2048 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 1783 | // eslint-disable-next-line no-return-assign | 2049 | // eslint-disable-next-line no-return-assign |
| 1784 | - ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 */ | ||
| 1785 | - onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */ | 2050 | + ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 */, |
| 2051 | + onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */, | ||
| 1786 | }; | 2052 | }; |
| 1787 | if (this.props.readOnly) { | 2053 | if (this.props.readOnly) { |
| 1788 | - obj.readOnly = 'readOnly'; | ||
| 1789 | - } if (commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sName.toLowerCase().endsWith('memo')) { | ||
| 1790 | - if (!this.state.enabled) { /* 非编辑模式下 */ | 2054 | + obj.readOnly = "readOnly"; |
| 2055 | + } | ||
| 2056 | + if (commonUtils.isNotEmptyObject(this.props.showConfig.sName) && this.props.showConfig.sName.toLowerCase().endsWith("memo")) { | ||
| 2057 | + if (!this.state.enabled) { | ||
| 2058 | + /* 非编辑模式下 */ | ||
| 1791 | obj.readOnly = true; | 2059 | obj.readOnly = true; |
| 1792 | - obj.style = { backgroundColor: '#f1f2f8' }; | 2060 | + obj.style = { backgroundColor: "#f1f2f8" }; |
| 1793 | } else { | 2061 | } else { |
| 1794 | obj.disabled = !this.state.enabled; | 2062 | obj.disabled = !this.state.enabled; |
| 1795 | } | 2063 | } |
| @@ -1797,57 +2065,66 @@ export default class CommonComponent extends Component { | @@ -1797,57 +2065,66 @@ export default class CommonComponent extends Component { | ||
| 1797 | obj.disabled = !this.state.enabled; | 2065 | obj.disabled = !this.state.enabled; |
| 1798 | } | 2066 | } |
| 1799 | /* 最大值最小值 */ | 2067 | /* 最大值最小值 */ |
| 1800 | - if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 2068 | + if ( |
| 2069 | + typeof commonUtils.convertStrToNumber(this.max) === "number" && | ||
| 2070 | + commonUtils.convertStrToNumber(this.max) !== 0 && | ||
| 2071 | + this.max.indexOf(".d") === -1 && | ||
| 2072 | + this.max.indexOf(".i") === -1 | ||
| 2073 | + ) { | ||
| 1801 | obj.maxLength = this.max; /* 最大长度 */ | 2074 | obj.maxLength = this.max; /* 最大长度 */ |
| 1802 | } | 2075 | } |
| 1803 | return obj; | 2076 | return obj; |
| 1804 | }; | 2077 | }; |
| 1805 | 2078 | ||
| 1806 | /* 获取日期最大值和最小值 */ | 2079 | /* 获取日期最大值和最小值 */ |
| 1807 | - getDataMaxAndMin = (current) => { | 2080 | + getDataMaxAndMin = current => { |
| 1808 | return this.getDataMax(current) || this.getDataMin(current); | 2081 | return this.getDataMax(current) || this.getDataMin(current); |
| 1809 | - } | 2082 | + }; |
| 1810 | 2083 | ||
| 1811 | /* 获取日期最大值 */ | 2084 | /* 获取日期最大值 */ |
| 1812 | - getDataMax = (current) => { | 2085 | + getDataMax = current => { |
| 1813 | const showtimeFormat = this.props.showConfig.sDateFormat?.length > 11; | 2086 | const showtimeFormat = this.props.showConfig.sDateFormat?.length > 11; |
| 1814 | - if (commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && this.props.showConfig.sMaxValue.split('.').length > 1) { | ||
| 1815 | - const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMaxValue }, '', {}); | 2087 | + if (commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && this.props.showConfig.sMaxValue.split(".").length > 1) { |
| 2088 | + const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMaxValue }, "", {}); | ||
| 1816 | const sMaxValue = Object.keys(conditionValues).length > 0 ? conditionValues[Object.keys(conditionValues)[0]] : this.props.showConfig.sMaxValue; | 2089 | const sMaxValue = Object.keys(conditionValues).length > 0 ? conditionValues[Object.keys(conditionValues)[0]] : this.props.showConfig.sMaxValue; |
| 1817 | - const tDate = this.props.showConfig.sMaxValue === 'now' ? moment() : moment(sMaxValue); | ||
| 1818 | - return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate : | ||
| 1819 | - commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf('day') > tDate.endOf('day'); | 2090 | + const tDate = this.props.showConfig.sMaxValue === "now" ? moment() : moment(sMaxValue); |
| 2091 | + return showtimeFormat | ||
| 2092 | + ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate | ||
| 2093 | + : commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf("day") > tDate.endOf("day"); | ||
| 1820 | } else { | 2094 | } else { |
| 1821 | - const tDate = this.props.showConfig.sMaxValue === 'now' ? moment() : moment(this.props.showConfig.sMaxValue); | ||
| 1822 | - return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate : | ||
| 1823 | - commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf('day') > tDate.endOf('day'); | 2095 | + const tDate = this.props.showConfig.sMaxValue === "now" ? moment() : moment(this.props.showConfig.sMaxValue); |
| 2096 | + return showtimeFormat | ||
| 2097 | + ? commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current > tDate | ||
| 2098 | + : commonUtils.isNotEmptyStr(this.props.showConfig.sMaxValue) && current.endOf("day") > tDate.endOf("day"); | ||
| 1824 | } | 2099 | } |
| 1825 | - } | 2100 | + }; |
| 1826 | 2101 | ||
| 1827 | /* 获取日期最小值 */ | 2102 | /* 获取日期最小值 */ |
| 1828 | - getDataMin = (current) => { | 2103 | + getDataMin = current => { |
| 1829 | const showtimeFormat = this.props.showConfig.sDateFormat?.length > 11; | 2104 | const showtimeFormat = this.props.showConfig.sDateFormat?.length > 11; |
| 1830 | - if (commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && this.props.showConfig.sMinValue.split('.').length > 1) { | ||
| 1831 | - const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMinValue }, '', {}); | 2105 | + if (commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && this.props.showConfig.sMinValue.split(".").length > 1) { |
| 2106 | + const conditionValues = this.props.getSqlCondition({ sSqlCondition: this.props.showConfig.sMinValue }, "", {}); | ||
| 1832 | const sMinValue = Object.keys(conditionValues).length > 0 ? conditionValues[Object.keys(conditionValues)[0]] : this.props.showConfig.sMinValue; | 2107 | const sMinValue = Object.keys(conditionValues).length > 0 ? conditionValues[Object.keys(conditionValues)[0]] : this.props.showConfig.sMinValue; |
| 1833 | - const tDate = this.props.showConfig.sMinValue === 'now' ? moment() : moment(sMinValue); | ||
| 1834 | - return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate : | ||
| 1835 | - commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf('day') < tDate.endOf('day'); | 2108 | + const tDate = this.props.showConfig.sMinValue === "now" ? moment() : moment(sMinValue); |
| 2109 | + return showtimeFormat | ||
| 2110 | + ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate | ||
| 2111 | + : commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf("day") < tDate.endOf("day"); | ||
| 1836 | } else { | 2112 | } else { |
| 1837 | - const tDate = this.props.showConfig.sMinValue === 'now' ? moment() : moment(this.props.showConfig.sMinValue); | ||
| 1838 | - return showtimeFormat ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate : | ||
| 1839 | - commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf('day') < tDate.endOf('day'); | 2113 | + const tDate = this.props.showConfig.sMinValue === "now" ? moment() : moment(this.props.showConfig.sMinValue); |
| 2114 | + return showtimeFormat | ||
| 2115 | + ? commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current < tDate | ||
| 2116 | + : commonUtils.isNotEmptyStr(this.props.showConfig.sMinValue) && current.endOf("day") < tDate.endOf("day"); | ||
| 1840 | } | 2117 | } |
| 1841 | - } | 2118 | + }; |
| 1842 | 2119 | ||
| 1843 | /* 获取时间innerinputprops对象(主) */ | 2120 | /* 获取时间innerinputprops对象(主) */ |
| 1844 | getDateInnerInputPropsMaster = () => { | 2121 | getDateInnerInputPropsMaster = () => { |
| 1845 | let { sDateFormat } = this.props.showConfig; | 2122 | let { sDateFormat } = this.props.showConfig; |
| 1846 | if (commonUtils.isEmptyStr(sDateFormat)) { | 2123 | if (commonUtils.isEmptyStr(sDateFormat)) { |
| 1847 | - if (this.firstDataIndex === 'm') { | ||
| 1848 | - sDateFormat = 'YYYY-MM'; | ||
| 1849 | - } else if (this.firstDataIndex === 'y') { | ||
| 1850 | - sDateFormat = 'YYYY'; | 2124 | + if (this.firstDataIndex === "m") { |
| 2125 | + sDateFormat = "YYYY-MM"; | ||
| 2126 | + } else if (this.firstDataIndex === "y") { | ||
| 2127 | + sDateFormat = "YYYY"; | ||
| 1851 | } else { | 2128 | } else { |
| 1852 | sDateFormat = this.props.getDateFormat(); | 2129 | sDateFormat = this.props.getDateFormat(); |
| 1853 | } | 2130 | } |
| @@ -1861,17 +2138,17 @@ export default class CommonComponent extends Component { | @@ -1861,17 +2138,17 @@ export default class CommonComponent extends Component { | ||
| 1861 | } | 2138 | } |
| 1862 | // 2021-6-5日修改,生产排程日期选择精确到小时 | 2139 | // 2021-6-5日修改,生产排程日期选择精确到小时 |
| 1863 | const obj = { | 2140 | const obj = { |
| 1864 | - placeholder: '', /* 时间的提示信息 */ | ||
| 1865 | - disabled: !this.state.enabled, /* 是否可编辑 */ | ||
| 1866 | - style: { width: '100%' }, /* 样式 */ | 2141 | + placeholder: "" /* 时间的提示信息 */, |
| 2142 | + disabled: !this.state.enabled /* 是否可编辑 */, | ||
| 2143 | + style: { width: "100%" } /* 样式 */, | ||
| 1867 | // showTime: this.props.showTime ? { format: 'HH:mm', defaultValue: [moment('00:00', 'HH:mm'), moment('00:00', 'HH:mm')] } : '', | 2144 | // showTime: this.props.showTime ? { format: 'HH:mm', defaultValue: [moment('00:00', 'HH:mm'), moment('00:00', 'HH:mm')] } : '', |
| 1868 | // showTime: this.props.showTime, | 2145 | // showTime: this.props.showTime, |
| 1869 | showTime: showtimeFormat, | 2146 | showTime: showtimeFormat, |
| 1870 | - format: this.props.showTime ? 'YYYY-MM-DD HH:mm:ss' : sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */ | ||
| 1871 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | ||
| 1872 | - disabledDate: this.getDataMaxAndMin, /* 不可选日期 */ | 2147 | + format: this.props.showTime ? "YYYY-MM-DD HH:mm:ss" : sDateFormat, // this.props.getDateFormat(), /* 格式化规则 */ |
| 2148 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 2149 | + disabledDate: this.getDataMaxAndMin /* 不可选日期 */, | ||
| 1873 | onBlur: () => { | 2150 | onBlur: () => { |
| 1874 | - this.onExecInstructSet('blur'); | 2151 | + this.onExecInstructSet("blur"); |
| 1875 | }, | 2152 | }, |
| 1876 | }; | 2153 | }; |
| 1877 | // if (this.props.readOnly) { | 2154 | // if (this.props.readOnly) { |
| @@ -1885,9 +2162,9 @@ export default class CommonComponent extends Component { | @@ -1885,9 +2162,9 @@ export default class CommonComponent extends Component { | ||
| 1885 | /* 获取布尔innerinputprops对象(主) */ | 2162 | /* 获取布尔innerinputprops对象(主) */ |
| 1886 | getBooleanInnerInputPropsMaster = () => { | 2163 | getBooleanInnerInputPropsMaster = () => { |
| 1887 | const obj = { | 2164 | const obj = { |
| 1888 | - disabled: !this.state.enabled, /* 是否显示 */ | ||
| 1889 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | ||
| 1890 | - checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue), /* 是否选中 */ | 2165 | + disabled: !this.state.enabled /* 是否显示 */, |
| 2166 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, | ||
| 2167 | + checked: commonUtils.isUndefined(this.state.dataValue) ? false : commonUtils.converNumStrToBoolean(this.state.dataValue) /* 是否选中 */, | ||
| 1891 | }; | 2168 | }; |
| 1892 | // if (this.props.readOnly) { | 2169 | // if (this.props.readOnly) { |
| 1893 | // obj.readOnly = true; | 2170 | // obj.readOnly = true; |
| @@ -1897,17 +2174,18 @@ export default class CommonComponent extends Component { | @@ -1897,17 +2174,18 @@ export default class CommonComponent extends Component { | ||
| 1897 | return obj; | 2174 | return obj; |
| 1898 | }; | 2175 | }; |
| 1899 | // eslint-disable-next-line react/sort-comp | 2176 | // eslint-disable-next-line react/sort-comp |
| 1900 | - handleInputOnClick = (id) => { | 2177 | + handleInputOnClick = id => { |
| 1901 | // 判断是否是oee系统,否则不显示虚拟键盘 | 2178 | // 判断是否是oee系统,否则不显示虚拟键盘 |
| 1902 | - if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.indexOf('/indexOee') > -1) { | ||
| 1903 | - if (VirtualKeyboard.isKeyBoard()) { // 关闭上次键盘 | 2179 | + if (commonUtils.isNotEmptyObject(location.pathname) && location.pathname.indexOf("/indexOee") > -1) { |
| 2180 | + if (VirtualKeyboard.isKeyBoard()) { | ||
| 2181 | + // 关闭上次键盘 | ||
| 1904 | VirtualKeyboard.closeKeyboard(); | 2182 | VirtualKeyboard.closeKeyboard(); |
| 1905 | } | 2183 | } |
| 1906 | const keyboardValue = {}; | 2184 | const keyboardValue = {}; |
| 1907 | if (commonUtils.isNotEmptyObject(this.props.dataValue)) { | 2185 | if (commonUtils.isNotEmptyObject(this.props.dataValue)) { |
| 1908 | keyboardValue.value = this.props.dataValue; | 2186 | keyboardValue.value = this.props.dataValue; |
| 1909 | } else { | 2187 | } else { |
| 1910 | - keyboardValue.value = ''; | 2188 | + keyboardValue.value = ""; |
| 1911 | } | 2189 | } |
| 1912 | VirtualKeyboard.showKeyboardSetState(keyboardValue, this, id); | 2190 | VirtualKeyboard.showKeyboardSetState(keyboardValue, this, id); |
| 1913 | } | 2191 | } |
| @@ -1917,29 +2195,29 @@ export default class CommonComponent extends Component { | @@ -1917,29 +2195,29 @@ export default class CommonComponent extends Component { | ||
| 1917 | const rowId = this.props.record.sId; | 2195 | const rowId = this.props.record.sId; |
| 1918 | this.props.onInputClick(rowId, sName); | 2196 | this.props.onInputClick(rowId, sName); |
| 1919 | } | 2197 | } |
| 1920 | - } | 2198 | + }; |
| 1921 | 2199 | ||
| 1922 | /* 获取数字innerinputprops对象(主) */ | 2200 | /* 获取数字innerinputprops对象(主) */ |
| 1923 | getNumberInnerInputPropsMaster = () => { | 2201 | getNumberInnerInputPropsMaster = () => { |
| 1924 | /* 如果是浮点型并且有格式规定,display类型需要变为block */ | 2202 | /* 如果是浮点型并且有格式规定,display类型需要变为block */ |
| 1925 | - let display = 'inline-block'; | ||
| 1926 | - if (this.firstDataIndex === 'd' && this.floatNum !== 0) { | ||
| 1927 | - display = 'block'; | 2203 | + let display = "inline-block"; |
| 2204 | + if (this.firstDataIndex === "d" && this.floatNum !== 0) { | ||
| 2205 | + display = "block"; | ||
| 1928 | } | 2206 | } |
| 1929 | // const sInputId = `id${commonUtils.createSid()}`; | 2207 | // const sInputId = `id${commonUtils.createSid()}`; |
| 1930 | /* 返回值赋值 */ | 2208 | /* 返回值赋值 */ |
| 1931 | const obj = { | 2209 | const obj = { |
| 1932 | - id: `${this.props.showConfig.sName}${commonUtils.createSid()}`, /* 虚拟数字键盘使用id获取光标 */ | ||
| 1933 | - style: { width: 'auto', display, marginRight: 0 }, /* 样式 */ | 2210 | + id: `${this.props.showConfig.sName}${commonUtils.createSid()}` /* 虚拟数字键盘使用id获取光标 */, |
| 2211 | + style: { width: "auto", display, marginRight: 0 } /* 样式 */, | ||
| 1934 | // disabled: !this.state.enabled, /* 是否显示 */ | 2212 | // disabled: !this.state.enabled, /* 是否显示 */ |
| 1935 | - onChange: this.handleSelectOptionEvent, /* 数据改变回带到父组件 */ | ||
| 1936 | - parser: (oldValue) => { | 2213 | + onChange: this.handleSelectOptionEvent /* 数据改变回带到父组件 */, |
| 2214 | + parser: oldValue => { | ||
| 1937 | const value = this.handleCheckNumberInnerInput(oldValue); | 2215 | const value = this.handleCheckNumberInnerInput(oldValue); |
| 1938 | return value; | 2216 | return value; |
| 1939 | }, | 2217 | }, |
| 1940 | // eslint-disable-next-line no-return-assign | 2218 | // eslint-disable-next-line no-return-assign |
| 1941 | - ref: ref => this[this.props.showConfig.sName] = ref, /* 虚拟数字键盘获得光标需用 这里得ref中得变量必须是input得id */ | ||
| 1942 | - onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName), /* 虚拟数字键盘 第二个参数必须id */ | 2219 | + ref: ref => (this[this.props.showConfig.sName] = ref) /* 虚拟数字键盘获得光标需用 这里得ref中得变量必须是input得id */, |
| 2220 | + onClick: this.handleInputOnClick.bind(this, this.props.showConfig.sName) /* 虚拟数字键盘 第二个参数必须id */, | ||
| 1943 | }; | 2221 | }; |
| 1944 | if (this.props.readOnly) { | 2222 | if (this.props.readOnly) { |
| 1945 | obj.readOnly = true; | 2223 | obj.readOnly = true; |
| @@ -1947,12 +2225,17 @@ export default class CommonComponent extends Component { | @@ -1947,12 +2225,17 @@ export default class CommonComponent extends Component { | ||
| 1947 | obj.disabled = !this.state.enabled; | 2225 | obj.disabled = !this.state.enabled; |
| 1948 | } | 2226 | } |
| 1949 | /* 最大值最小值 */ | 2227 | /* 最大值最小值 */ |
| 1950 | - if (typeof commonUtils.convertStrToNumber(this.max) === 'number' && commonUtils.convertStrToNumber(this.max) !== 0 && this.max.indexOf('.d') === -1 && this.max.indexOf('.i') === -1) { | 2228 | + if ( |
| 2229 | + typeof commonUtils.convertStrToNumber(this.max) === "number" && | ||
| 2230 | + commonUtils.convertStrToNumber(this.max) !== 0 && | ||
| 2231 | + this.max.indexOf(".d") === -1 && | ||
| 2232 | + this.max.indexOf(".i") === -1 | ||
| 2233 | + ) { | ||
| 1951 | obj.max = this.max; /* 最大值 */ | 2234 | obj.max = this.max; /* 最大值 */ |
| 1952 | - } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf('.') > -1 && commonUtils.isNotEmptyObject(this.props.record)) { | ||
| 1953 | - obj.max = this.props.record[this.max.substring(this.max.indexOf('.') + 1)]; | 2235 | + } else if (!commonUtils.isEmpty(this.max) && this.max.indexOf(".") > -1 && commonUtils.isNotEmptyObject(this.props.record)) { |
| 2236 | + obj.max = this.props.record[this.max.substring(this.max.indexOf(".") + 1)]; | ||
| 1954 | } | 2237 | } |
| 1955 | - if (typeof commonUtils.convertStrToNumber(this.min) === 'number' && commonUtils.convertStrToNumber(this.min) !== 0) { | 2238 | + if (typeof commonUtils.convertStrToNumber(this.min) === "number" && commonUtils.convertStrToNumber(this.min) !== 0) { |
| 1956 | obj.min = this.min; /* 最小值 */ | 2239 | obj.min = this.min; /* 最小值 */ |
| 1957 | } | 2240 | } |
| 1958 | obj.placeholder = this.props.showConfig.placeholder; | 2241 | obj.placeholder = this.props.showConfig.placeholder; |
| @@ -1979,28 +2262,28 @@ export default class CommonComponent extends Component { | @@ -1979,28 +2262,28 @@ export default class CommonComponent extends Component { | ||
| 1979 | }; | 2262 | }; |
| 1980 | 2263 | ||
| 1981 | /* 获取省数据 */ | 2264 | /* 获取省数据 */ |
| 1982 | - getProvinceData = (options) => { | ||
| 1983 | - Provinces.forEach((childProvince) => { | 2265 | + getProvinceData = options => { |
| 2266 | + Provinces.forEach(childProvince => { | ||
| 1984 | options.push({ | 2267 | options.push({ |
| 1985 | - value: childProvince.name, /* 文字 */ | ||
| 1986 | - label: childProvince.name, /* 标签 */ | ||
| 1987 | - code: childProvince.code, /* 编码 */ | ||
| 1988 | - children: [], /* 子节点(city) */ | 2268 | + value: childProvince.name /* 文字 */, |
| 2269 | + label: childProvince.name /* 标签 */, | ||
| 2270 | + code: childProvince.code /* 编码 */, | ||
| 2271 | + children: [] /* 子节点(city) */, | ||
| 1989 | }); | 2272 | }); |
| 1990 | }); | 2273 | }); |
| 1991 | }; | 2274 | }; |
| 1992 | 2275 | ||
| 1993 | /* 获取市数据 */ | 2276 | /* 获取市数据 */ |
| 1994 | - getCityData = (options) => { | ||
| 1995 | - options.forEach((childProvince) => { | 2277 | + getCityData = options => { |
| 2278 | + options.forEach(childProvince => { | ||
| 1996 | const cities = Cities.filter(item => item.provinceCode === childProvince.code); | 2279 | const cities = Cities.filter(item => item.provinceCode === childProvince.code); |
| 1997 | if (cities.length > 0) { | 2280 | if (cities.length > 0) { |
| 1998 | - cities.forEach((childCity) => { | 2281 | + cities.forEach(childCity => { |
| 1999 | childProvince.children.push({ | 2282 | childProvince.children.push({ |
| 2000 | - value: childCity.name, /* 文字 */ | ||
| 2001 | - label: childCity.name, /* 标签 */ | ||
| 2002 | - code: childCity.code, /* 编码 */ | ||
| 2003 | - children: [], /* 子节点(area) */ | 2283 | + value: childCity.name /* 文字 */, |
| 2284 | + label: childCity.name /* 标签 */, | ||
| 2285 | + code: childCity.code /* 编码 */, | ||
| 2286 | + children: [] /* 子节点(area) */, | ||
| 2004 | }); | 2287 | }); |
| 2005 | }); | 2288 | }); |
| 2006 | } | 2289 | } |
| @@ -2008,17 +2291,17 @@ export default class CommonComponent extends Component { | @@ -2008,17 +2291,17 @@ export default class CommonComponent extends Component { | ||
| 2008 | }; | 2291 | }; |
| 2009 | 2292 | ||
| 2010 | /* 获取区数据 */ | 2293 | /* 获取区数据 */ |
| 2011 | - getAreaData = (options) => { | ||
| 2012 | - options.forEach((childProvince) => { | 2294 | + getAreaData = options => { |
| 2295 | + options.forEach(childProvince => { | ||
| 2013 | const cities = childProvince.children; | 2296 | const cities = childProvince.children; |
| 2014 | - cities.forEach((childCity) => { | ||
| 2015 | - const areas = Areas.filter((item => item.cityCode === childCity.code)); | 2297 | + cities.forEach(childCity => { |
| 2298 | + const areas = Areas.filter(item => item.cityCode === childCity.code); | ||
| 2016 | if (areas.length > 0) { | 2299 | if (areas.length > 0) { |
| 2017 | - areas.forEach((area) => { | 2300 | + areas.forEach(area => { |
| 2018 | childCity.children.push({ | 2301 | childCity.children.push({ |
| 2019 | - value: area.name, /* 文字 */ | ||
| 2020 | - label: area.name, /* 标签 */ | ||
| 2021 | - code: area.code, /* 编码 */ | 2302 | + value: area.name /* 文字 */, |
| 2303 | + label: area.name /* 标签 */, | ||
| 2304 | + code: area.code /* 编码 */, | ||
| 2022 | }); | 2305 | }); |
| 2023 | }); | 2306 | }); |
| 2024 | } | 2307 | } |
| @@ -2029,11 +2312,14 @@ export default class CommonComponent extends Component { | @@ -2029,11 +2312,14 @@ export default class CommonComponent extends Component { | ||
| 2029 | /* 获取formitemprops对象 */ | 2312 | /* 获取formitemprops对象 */ |
| 2030 | getOutFormItemProps = () => { | 2313 | getOutFormItemProps = () => { |
| 2031 | /* 主表和从表的formitemprops对象有区别 */ | 2314 | /* 主表和从表的formitemprops对象有区别 */ |
| 2032 | - if (!this.props.bTable) { /* 主表 */ | 2315 | + if (!this.props.bTable) { |
| 2316 | + /* 主表 */ | ||
| 2033 | return this.getOutFormItemPropsMaster(); | 2317 | return this.getOutFormItemPropsMaster(); |
| 2034 | - } else if (this.props.bViewTable) { /* 表格单行显示 */ | 2318 | + } else if (this.props.bViewTable) { |
| 2319 | + /* 表格单行显示 */ | ||
| 2035 | return this.getOutFormItemPropsViewSlave(); | 2320 | return this.getOutFormItemPropsViewSlave(); |
| 2036 | - } else { /* 从表 */ | 2321 | + } else { |
| 2322 | + /* 从表 */ | ||
| 2037 | return this.getOutFormItemPropsSlave(); | 2323 | return this.getOutFormItemPropsSlave(); |
| 2038 | } | 2324 | } |
| 2039 | }; | 2325 | }; |
| @@ -2042,36 +2328,40 @@ export default class CommonComponent extends Component { | @@ -2042,36 +2328,40 @@ export default class CommonComponent extends Component { | ||
| 2042 | getOutFormItemPropsMaster = () => { | 2328 | getOutFormItemPropsMaster = () => { |
| 2043 | /* 返回值声明 */ | 2329 | /* 返回值声明 */ |
| 2044 | let obj = {}; | 2330 | let obj = {}; |
| 2045 | - if (this.firstDataIndex === 'i' | ||
| 2046 | - || this.firstDataIndex === 'd' | ||
| 2047 | - || this.firstDataIndex === 'p' | ||
| 2048 | - || this.firstDataIndex === 't' | ||
| 2049 | - || this.firstDataIndex === 'm' | ||
| 2050 | - || this.firstDataIndex === 's' | ||
| 2051 | - || this.firstDataIndex === 'c') { /* 数字输入框(整形i和浮点型d), | 2331 | + if ( |
| 2332 | + this.firstDataIndex === "i" || | ||
| 2333 | + this.firstDataIndex === "d" || | ||
| 2334 | + this.firstDataIndex === "p" || | ||
| 2335 | + this.firstDataIndex === "t" || | ||
| 2336 | + this.firstDataIndex === "m" || | ||
| 2337 | + this.firstDataIndex === "s" || | ||
| 2338 | + this.firstDataIndex === "c" | ||
| 2339 | + ) { | ||
| 2340 | + /* 数字输入框(整形i和浮点型d), | ||
| 2052 | 时间选择框(时间类型t), | 2341 | 时间选择框(时间类型t), |
| 2053 | 文本输入框(文本s), | 2342 | 文本输入框(文本s), |
| 2054 | 地址联动框(联动下拉类型c) */ | 2343 | 地址联动框(联动下拉类型c) */ |
| 2055 | obj = { | 2344 | obj = { |
| 2056 | - label: this.props.showConfig.showName, /* 标签 */ | ||
| 2057 | - className: styles.formItemMargin, /* 样式名称 */ | ||
| 2058 | - ...this.formItemLayout, /* 主要是rowspan和colspan */ | 2345 | + label: this.props.showConfig.showName /* 标签 */, |
| 2346 | + className: styles.formItemMargin /* 样式名称 */, | ||
| 2347 | + ...this.formItemLayout /* 主要是rowspan和colspan */, | ||
| 2059 | }; | 2348 | }; |
| 2060 | - } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */ | 2349 | + } else if (this.firstDataIndex === "b") { |
| 2350 | + /* 选择框(布尔类型b) */ | ||
| 2061 | obj = { | 2351 | obj = { |
| 2062 | - label: this.props.showConfig.showName, /* 标签 */ | ||
| 2063 | - className: styles.formItemMag10, /* 样式名称 */ | ||
| 2064 | - ...this.formItemLayout, /* 主要是rowspan和colspan */ | 2352 | + label: this.props.showConfig.showName /* 标签 */, |
| 2353 | + className: styles.formItemMag10 /* 样式名称 */, | ||
| 2354 | + ...this.formItemLayout /* 主要是rowspan和colspan */, | ||
| 2065 | }; | 2355 | }; |
| 2066 | } | 2356 | } |
| 2067 | - if (this.props.itemLabel === 'hide') { | 2357 | + if (this.props.itemLabel === "hide") { |
| 2068 | delete obj.label; | 2358 | delete obj.label; |
| 2069 | } | 2359 | } |
| 2070 | /* 设置标题颜色 */ | 2360 | /* 设置标题颜色 */ |
| 2071 | if (this.props.showConfig.sFontColor) { | 2361 | if (this.props.showConfig.sFontColor) { |
| 2072 | // eslint-disable-next-line prefer-destructuring | 2362 | // eslint-disable-next-line prefer-destructuring |
| 2073 | const sFontColor = this.props.showConfig.sFontColor; | 2363 | const sFontColor = this.props.showConfig.sFontColor; |
| 2074 | - obj.labelCol.style = { color: sFontColor, fontWeight: 'bold', backgroundColor: '#BFEFFF' }; | 2364 | + obj.labelCol.style = { color: sFontColor, fontWeight: "bold", backgroundColor: "#BFEFFF" }; |
| 2075 | } | 2365 | } |
| 2076 | /* 返回值 */ | 2366 | /* 返回值 */ |
| 2077 | return obj; | 2367 | return obj; |
| @@ -2081,69 +2371,78 @@ export default class CommonComponent extends Component { | @@ -2081,69 +2371,78 @@ export default class CommonComponent extends Component { | ||
| 2081 | getOutFormItemPropsViewSlave = () => { | 2371 | getOutFormItemPropsViewSlave = () => { |
| 2082 | /* 返回值声明 */ | 2372 | /* 返回值声明 */ |
| 2083 | let obj = {}; | 2373 | let obj = {}; |
| 2084 | - if (this.firstDataIndex === 'i' | ||
| 2085 | - || this.firstDataIndex === 'd' | ||
| 2086 | - || this.firstDataIndex === 'p' | ||
| 2087 | - || this.firstDataIndex === 't' | ||
| 2088 | - || this.firstDataIndex === 'm' | ||
| 2089 | - || this.firstDataIndex === 's' | ||
| 2090 | - || this.firstDataIndex === 'c') { /* 数字输入框(整形i和浮点型d), | 2374 | + if ( |
| 2375 | + this.firstDataIndex === "i" || | ||
| 2376 | + this.firstDataIndex === "d" || | ||
| 2377 | + this.firstDataIndex === "p" || | ||
| 2378 | + this.firstDataIndex === "t" || | ||
| 2379 | + this.firstDataIndex === "m" || | ||
| 2380 | + this.firstDataIndex === "s" || | ||
| 2381 | + this.firstDataIndex === "c" | ||
| 2382 | + ) { | ||
| 2383 | + /* 数字输入框(整形i和浮点型d), | ||
| 2091 | 时间选择框(时间类型t), | 2384 | 时间选择框(时间类型t), |
| 2092 | 文本输入框(文本s), | 2385 | 文本输入框(文本s), |
| 2093 | 地址联动框(联动下拉类型c) */ | 2386 | 地址联动框(联动下拉类型c) */ |
| 2094 | obj = { | 2387 | obj = { |
| 2095 | - label: this.props.showConfig.showName, /* 标签 */ | ||
| 2096 | - className: styles.formItemMargin, /* 样式名称 */ | ||
| 2097 | - ...this.formItemLayout, /* 主要是rowspan和colspan */ | 2388 | + label: this.props.showConfig.showName /* 标签 */, |
| 2389 | + className: styles.formItemMargin /* 样式名称 */, | ||
| 2390 | + ...this.formItemLayout /* 主要是rowspan和colspan */, | ||
| 2098 | }; | 2391 | }; |
| 2099 | - } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */ | 2392 | + } else if (this.firstDataIndex === "b") { |
| 2393 | + /* 选择框(布尔类型b) */ | ||
| 2100 | obj = { | 2394 | obj = { |
| 2101 | - label: this.props.showConfig.showName, /* 标签 */ | ||
| 2102 | - className: styles.formItemMag10, /* 样式名称 */ | ||
| 2103 | - ...this.formItemLayout, /* 主要是rowspan和colspan */ | 2395 | + label: this.props.showConfig.showName /* 标签 */, |
| 2396 | + className: styles.formItemMag10 /* 样式名称 */, | ||
| 2397 | + ...this.formItemLayout /* 主要是rowspan和colspan */, | ||
| 2104 | }; | 2398 | }; |
| 2105 | } | 2399 | } |
| 2106 | - if (this.props.itemLabel === 'hide') { | 2400 | + if (this.props.itemLabel === "hide") { |
| 2107 | delete obj.label; | 2401 | delete obj.label; |
| 2108 | } | 2402 | } |
| 2109 | /* 设置标题颜色 */ | 2403 | /* 设置标题颜色 */ |
| 2110 | if (this.props.showConfig.sFontColor) { | 2404 | if (this.props.showConfig.sFontColor) { |
| 2111 | // eslint-disable-next-line prefer-destructuring | 2405 | // eslint-disable-next-line prefer-destructuring |
| 2112 | const sFontColor = this.props.showConfig.sFontColor; | 2406 | const sFontColor = this.props.showConfig.sFontColor; |
| 2113 | - obj.labelCol.style = { color: sFontColor, fontWeight: 'bold', backgroundColor: '#BFEFFF' }; | 2407 | + obj.labelCol.style = { color: sFontColor, fontWeight: "bold", backgroundColor: "#BFEFFF" }; |
| 2114 | } | 2408 | } |
| 2115 | /* 返回值 */ | 2409 | /* 返回值 */ |
| 2116 | return obj; | 2410 | return obj; |
| 2117 | }; | 2411 | }; |
| 2118 | 2412 | ||
| 2119 | - | ||
| 2120 | /* 获取formitemprops对象(从) */ | 2413 | /* 获取formitemprops对象(从) */ |
| 2121 | getOutFormItemPropsSlave = () => { | 2414 | getOutFormItemPropsSlave = () => { |
| 2122 | /* 返回值声明 */ | 2415 | /* 返回值声明 */ |
| 2123 | let obj = {}; | 2416 | let obj = {}; |
| 2124 | - if (this.firstDataIndex === 'i' | ||
| 2125 | - || this.firstDataIndex === 'd' | ||
| 2126 | - || this.firstDataIndex === 'c' | ||
| 2127 | - || this.props.showConfig.sDropDownType === 'sql' | ||
| 2128 | - || this.props.showConfig.sDropDownType === 'const') { /* 数字输入框(整形i和浮点型d), | 2417 | + if ( |
| 2418 | + this.firstDataIndex === "i" || | ||
| 2419 | + this.firstDataIndex === "d" || | ||
| 2420 | + this.firstDataIndex === "c" || | ||
| 2421 | + this.props.showConfig.sDropDownType === "sql" || | ||
| 2422 | + this.props.showConfig.sDropDownType === "const" | ||
| 2423 | + ) { | ||
| 2424 | + /* 数字输入框(整形i和浮点型d), | ||
| 2129 | 时间选择框(时间类型t), | 2425 | 时间选择框(时间类型t), |
| 2130 | 文本输入框(文本s), | 2426 | 文本输入框(文本s), |
| 2131 | 地址联动框(联动下拉类型c), | 2427 | 地址联动框(联动下拉类型c), |
| 2132 | 所有的下拉(从表只有文字下拉,分常量和sql两种) */ | 2428 | 所有的下拉(从表只有文字下拉,分常量和sql两种) */ |
| 2133 | obj = { | 2429 | obj = { |
| 2134 | - className: styles.formItemMargin0, /* 样式名称 */ | 2430 | + className: styles.formItemMargin0 /* 样式名称 */, |
| 2135 | }; | 2431 | }; |
| 2136 | - } else if (this.firstDataIndex === 'b') { /* 选择框(布尔类型b) */ | 2432 | + } else if (this.firstDataIndex === "b") { |
| 2433 | + /* 选择框(布尔类型b) */ | ||
| 2137 | obj = { | 2434 | obj = { |
| 2138 | - className: styles.tableCheckBox, /* 样式名称 */ | 2435 | + className: styles.tableCheckBox /* 样式名称 */, |
| 2139 | }; | 2436 | }; |
| 2140 | - } else if (this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 'm' || this.firstDataIndex === 'y') { /* 时间选择框(时间类型t) */ | 2437 | + } else if (this.firstDataIndex === "t" || this.firstDataIndex === "p" || this.firstDataIndex === "m" || this.firstDataIndex === "y") { |
| 2438 | + /* 时间选择框(时间类型t) */ | ||
| 2141 | obj = { | 2439 | obj = { |
| 2142 | - className: styles.tableDataPicker, /* 样式名称 */ | 2440 | + className: styles.tableDataPicker /* 样式名称 */, |
| 2143 | }; | 2441 | }; |
| 2144 | - } else if (this.firstDataIndex === 's') { /* 文本输入框(文本s) */ | 2442 | + } else if (this.firstDataIndex === "s") { |
| 2443 | + /* 文本输入框(文本s) */ | ||
| 2145 | obj = { | 2444 | obj = { |
| 2146 | - className: styles.editInput, /* 样式名称 */ | 2445 | + className: styles.editInput /* 样式名称 */, |
| 2147 | }; | 2446 | }; |
| 2148 | } | 2447 | } |
| 2149 | /* 返回值 */ | 2448 | /* 返回值 */ |
| @@ -2154,53 +2453,62 @@ export default class CommonComponent extends Component { | @@ -2154,53 +2453,62 @@ export default class CommonComponent extends Component { | ||
| 2154 | getFieldDecoratorProps = () => { | 2453 | getFieldDecoratorProps = () => { |
| 2155 | /* 返回值声明 */ | 2454 | /* 返回值声明 */ |
| 2156 | let obj = {}; | 2455 | let obj = {}; |
| 2157 | - if (this.firstDataIndex === 'i' || this.firstDataIndex === 'd' || this.firstDataIndex === 't' || this.firstDataIndex === 'p' || this.firstDataIndex === 's' || this.firstDataIndex === 'b') { /* 数字输入框(整形i和浮点型d),时间选择框(时间类型t),文本输入框(文本s),选择框(布尔类型b) */ | 2456 | + if ( |
| 2457 | + this.firstDataIndex === "i" || | ||
| 2458 | + this.firstDataIndex === "d" || | ||
| 2459 | + this.firstDataIndex === "t" || | ||
| 2460 | + this.firstDataIndex === "p" || | ||
| 2461 | + this.firstDataIndex === "s" || | ||
| 2462 | + this.firstDataIndex === "b" | ||
| 2463 | + ) { | ||
| 2464 | + /* 数字输入框(整形i和浮点型d),时间选择框(时间类型t),文本输入框(文本s),选择框(布尔类型b) */ | ||
| 2158 | obj = { rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }] }; | 2465 | obj = { rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }] }; |
| 2159 | - } else if (this.firstDataIndex === 'c') { /* 地址联动框(联动下拉类型c) */ | 2466 | + } else if (this.firstDataIndex === "c") { |
| 2467 | + /* 地址联动框(联动下拉类型c) */ | ||
| 2160 | obj = { | 2468 | obj = { |
| 2161 | - initialValue: ['北京市', '市辖区', '东城区'], /* 默认值 */ | ||
| 2162 | - rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }], /* 规则 */ | 2469 | + initialValue: ["北京市", "市辖区", "东城区"] /* 默认值 */, |
| 2470 | + rules: [{ required: this.props.showConfig.bNotEmpty, message: `${this.props.showConfig.showName}为必填项` }] /* 规则 */, | ||
| 2163 | }; | 2471 | }; |
| 2164 | } | 2472 | } |
| 2165 | /* 返回值 */ | 2473 | /* 返回值 */ |
| 2166 | return obj; | 2474 | return obj; |
| 2167 | }; | 2475 | }; |
| 2168 | - getPopupContainer = (triggerNode) => { | 2476 | + getPopupContainer = triggerNode => { |
| 2169 | const trigger = triggerNode; | 2477 | const trigger = triggerNode; |
| 2170 | if (commonUtils.isNotEmptyObject(trigger)) { | 2478 | if (commonUtils.isNotEmptyObject(trigger)) { |
| 2171 | return triggerNode; | 2479 | return triggerNode; |
| 2172 | } | 2480 | } |
| 2173 | - } | 2481 | + }; |
| 2174 | handleCancel = () => { | 2482 | handleCancel = () => { |
| 2175 | this.state.previewOpen = false; | 2483 | this.state.previewOpen = false; |
| 2176 | - } | 2484 | + }; |
| 2177 | handleSelectClick = () => { | 2485 | handleSelectClick = () => { |
| 2178 | if (this.bInputIn) { | 2486 | if (this.bInputIn) { |
| 2179 | this.setState({ bDropDownOpen: true }); | 2487 | this.setState({ bDropDownOpen: true }); |
| 2180 | } | 2488 | } |
| 2181 | - } | 2489 | + }; |
| 2182 | 2490 | ||
| 2183 | // 限制数字位数 | 2491 | // 限制数字位数 |
| 2184 | - handleCheckNumberInnerInput = (value) => { | 2492 | + handleCheckNumberInnerInput = value => { |
| 2185 | const { sDateFormat: sDateFormatOld, sFieldValidation: sFieldValidationOld, sName } = this.props.showConfig; | 2493 | const { sDateFormat: sDateFormatOld, sFieldValidation: sFieldValidationOld, sName } = this.props.showConfig; |
| 2186 | const { record = {}, app = {} } = this.props; | 2494 | const { record = {}, app = {} } = this.props; |
| 2187 | const { auxiliaryQty = {} } = app; | 2495 | const { auxiliaryQty = {} } = app; |
| 2188 | 2496 | ||
| 2189 | let sDateFormat = sDateFormatOld; | 2497 | let sDateFormat = sDateFormatOld; |
| 2190 | let sFieldValidation = sFieldValidationOld; | 2498 | let sFieldValidation = sFieldValidationOld; |
| 2191 | - if (sName === 'dAuxiliaryQty' && commonUtils.isNotEmptyObject(record.sAuxiliaryUnit)) { | 2499 | + if (sName === "dAuxiliaryQty" && commonUtils.isNotEmptyObject(record.sAuxiliaryUnit)) { |
| 2192 | const decimal = auxiliaryQty[record.sAuxiliaryUnit]; | 2500 | const decimal = auxiliaryQty[record.sAuxiliaryUnit]; |
| 2193 | if (decimal !== undefined) { | 2501 | if (decimal !== undefined) { |
| 2194 | - sDateFormat = 'decimalPoint'; | 2502 | + sDateFormat = "decimalPoint"; |
| 2195 | sFieldValidation = `,${decimal}`; | 2503 | sFieldValidation = `,${decimal}`; |
| 2196 | } | 2504 | } |
| 2197 | } | 2505 | } |
| 2198 | 2506 | ||
| 2199 | - if (sDateFormat !== 'decimalPoint' || sFieldValidation === undefined || value === null || (typeof value === 'string' && !value)) { | 2507 | + if (sDateFormat !== "decimalPoint" || sFieldValidation === undefined || value === null || (typeof value === "string" && !value)) { |
| 2200 | return value; | 2508 | return value; |
| 2201 | } | 2509 | } |
| 2202 | 2510 | ||
| 2203 | - const [length1, length2] = sFieldValidation.split(','); | 2511 | + const [length1, length2] = sFieldValidation.split(","); |
| 2204 | 2512 | ||
| 2205 | let newValue = value; | 2513 | let newValue = value; |
| 2206 | if (length2 !== undefined) { | 2514 | if (length2 !== undefined) { |
| @@ -2209,9 +2517,9 @@ export default class CommonComponent extends Component { | @@ -2209,9 +2517,9 @@ export default class CommonComponent extends Component { | ||
| 2209 | if (isNaN(newValue) || Object.is(newValue, -0)) { | 2517 | if (isNaN(newValue) || Object.is(newValue, -0)) { |
| 2210 | return value; | 2518 | return value; |
| 2211 | } | 2519 | } |
| 2212 | - if (length1 !== undefined && length1 !== '') { | 2520 | + if (length1 !== undefined && length1 !== "") { |
| 2213 | const str = newValue.toString(); | 2521 | const str = newValue.toString(); |
| 2214 | - const [integerPart, decimalPart] = str.split('.'); | 2522 | + const [integerPart, decimalPart] = str.split("."); |
| 2215 | if (integerPart.length > length1) { | 2523 | if (integerPart.length > length1) { |
| 2216 | const truncatedInteger = integerPart.slice(0, length1); | 2524 | const truncatedInteger = integerPart.slice(0, length1); |
| 2217 | if (decimalPart !== undefined) { | 2525 | if (decimalPart !== undefined) { |
| @@ -2223,9 +2531,9 @@ export default class CommonComponent extends Component { | @@ -2223,9 +2531,9 @@ export default class CommonComponent extends Component { | ||
| 2223 | } | 2531 | } |
| 2224 | 2532 | ||
| 2225 | return newValue; | 2533 | return newValue; |
| 2226 | - } | 2534 | + }; |
| 2227 | 2535 | ||
| 2228 | - selectTableChange = (pageNum) => { | 2536 | + selectTableChange = pageNum => { |
| 2229 | if (this.selectTableRef) { | 2537 | if (this.selectTableRef) { |
| 2230 | this.selectTableRef.focus(); | 2538 | this.selectTableRef.focus(); |
| 2231 | } | 2539 | } |
| @@ -2234,11 +2542,11 @@ export default class CommonComponent extends Component { | @@ -2234,11 +2542,11 @@ export default class CommonComponent extends Component { | ||
| 2234 | } else { | 2542 | } else { |
| 2235 | this.setState({ currentPage: pageNum, selectTableIndex: 0 }); | 2543 | this.setState({ currentPage: pageNum, selectTableIndex: 0 }); |
| 2236 | } | 2544 | } |
| 2237 | - this.selectTableRef1.querySelector('.ant-table-body').scrollTop = 0; | 2545 | + this.selectTableRef1.querySelector(".ant-table-body").scrollTop = 0; |
| 2238 | this.getDropDownData(pageNum, this.state.totalPageCount, this.state.searchValue); | 2546 | this.getDropDownData(pageNum, this.state.totalPageCount, this.state.searchValue); |
| 2239 | }; | 2547 | }; |
| 2240 | 2548 | ||
| 2241 | - selectTableSearch = (searchValue) => { | 2549 | + selectTableSearch = searchValue => { |
| 2242 | if (this.dropDownTimer) { | 2550 | if (this.dropDownTimer) { |
| 2243 | clearTimeout(this.dropDownTimer); | 2551 | clearTimeout(this.dropDownTimer); |
| 2244 | } | 2552 | } |
| @@ -2253,7 +2561,7 @@ export default class CommonComponent extends Component { | @@ -2253,7 +2561,7 @@ export default class CommonComponent extends Component { | ||
| 2253 | }, 500); | 2561 | }, 500); |
| 2254 | }; | 2562 | }; |
| 2255 | 2563 | ||
| 2256 | - toFamatter = (values) => { | 2564 | + toFamatter = values => { |
| 2257 | if (values !== 0 && commonUtils.isNotEmptyNumber(values) && values !== null) { | 2565 | if (values !== 0 && commonUtils.isNotEmptyNumber(values) && values !== null) { |
| 2258 | const { sDateFormat } = this.props.showConfig; | 2566 | const { sDateFormat } = this.props.showConfig; |
| 2259 | const { dNetMoney, dNetPrice } = this.props.app.decimals; | 2567 | const { dNetMoney, dNetPrice } = this.props.app.decimals; |
| @@ -2261,7 +2569,7 @@ export default class CommonComponent extends Component { | @@ -2261,7 +2569,7 @@ export default class CommonComponent extends Component { | ||
| 2261 | if (commonUtils.isNotEmptyObject(sDateFormat)) { | 2569 | if (commonUtils.isNotEmptyObject(sDateFormat)) { |
| 2262 | /* 取小数点位数 */ | 2570 | /* 取小数点位数 */ |
| 2263 | let point = 0; | 2571 | let point = 0; |
| 2264 | - const strIndex = sDateFormat.indexOf('.'); | 2572 | + const strIndex = sDateFormat.indexOf("."); |
| 2265 | if (strIndex > -1 && sDateFormat.length > 1) { | 2573 | if (strIndex > -1 && sDateFormat.length > 1) { |
| 2266 | point = sDateFormat.substring(strIndex + 1, sDateFormat.length).length; | 2574 | point = sDateFormat.substring(strIndex + 1, sDateFormat.length).length; |
| 2267 | if (commonUtils.isNotEmptyNumber(values) && values !== null) { | 2575 | if (commonUtils.isNotEmptyNumber(values) && values !== null) { |
| @@ -2271,14 +2579,16 @@ export default class CommonComponent extends Component { | @@ -2271,14 +2579,16 @@ export default class CommonComponent extends Component { | ||
| 2271 | } | 2579 | } |
| 2272 | } | 2580 | } |
| 2273 | } | 2581 | } |
| 2274 | - } else if (this.props.showConfig.sName.toLowerCase().endsWith('price')) { /* 单价格式化显示1 */ | 2582 | + } else if (this.props.showConfig.sName.toLowerCase().endsWith("price")) { |
| 2583 | + /* 单价格式化显示1 */ | ||
| 2275 | if (commonUtils.isNotEmptyNumber(values) && values !== null) { | 2584 | if (commonUtils.isNotEmptyNumber(values) && values !== null) { |
| 2276 | const dResult = commonUtils.convertFixNum(Number(values), dNetPrice).toFixed(dNetPrice); | 2585 | const dResult = commonUtils.convertFixNum(Number(values), dNetPrice).toFixed(dNetPrice); |
| 2277 | if (!isNaN(dResult)) { | 2586 | if (!isNaN(dResult)) { |
| 2278 | values = dResult; | 2587 | values = dResult; |
| 2279 | } | 2588 | } |
| 2280 | } | 2589 | } |
| 2281 | - } else if (this.props.showConfig.sName.toLowerCase().endsWith('money')) { /* 金额格式化显示 */ | 2590 | + } else if (this.props.showConfig.sName.toLowerCase().endsWith("money")) { |
| 2591 | + /* 金额格式化显示 */ | ||
| 2282 | if (commonUtils.isNotEmptyNumber(values) && values !== null) { | 2592 | if (commonUtils.isNotEmptyNumber(values) && values !== null) { |
| 2283 | const dResult = commonUtils.convertFixNum(Number(values), dNetMoney).toFixed(dNetMoney); | 2593 | const dResult = commonUtils.convertFixNum(Number(values), dNetMoney).toFixed(dNetMoney); |
| 2284 | if (!isNaN(dResult)) { | 2594 | if (!isNaN(dResult)) { |
| @@ -2290,7 +2600,7 @@ export default class CommonComponent extends Component { | @@ -2290,7 +2600,7 @@ export default class CommonComponent extends Component { | ||
| 2290 | } else { | 2600 | } else { |
| 2291 | return values; | 2601 | return values; |
| 2292 | } | 2602 | } |
| 2293 | - } | 2603 | + }; |
| 2294 | /** 处理下拉选择事件 */ | 2604 | /** 处理下拉选择事件 */ |
| 2295 | handleSelectOptionEvent = (newValue, dateString) => { | 2605 | handleSelectOptionEvent = (newValue, dateString) => { |
| 2296 | if (this.chineseInputting) { | 2606 | if (this.chineseInputting) { |
| @@ -2306,13 +2616,22 @@ export default class CommonComponent extends Component { | @@ -2306,13 +2616,22 @@ export default class CommonComponent extends Component { | ||
| 2306 | // return; | 2616 | // return; |
| 2307 | // } | 2617 | // } |
| 2308 | if (newValue === undefined) return; | 2618 | if (newValue === undefined) return; |
| 2309 | - if (newValue !== null && newValue.target && newValue.target.type !== 'checkbox') { | 2619 | + if (newValue !== null && newValue.target && newValue.target.type !== "checkbox") { |
| 2310 | newValue = newValue.target.value; | 2620 | newValue = newValue.target.value; |
| 2311 | } | 2621 | } |
| 2312 | /* 下拉新增单独处理 */ | 2622 | /* 下拉新增单独处理 */ |
| 2313 | - const dEmptyValue = this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth' ? newValue : null; /* 设置数值型为空值时 数据置为0 或空值 */ | ||
| 2314 | - let value = this.firstDataIndex === 's' && !this.props.textArea && commonUtils.isEmpty(newValue) ? newValue.replace('--', '') : | ||
| 2315 | - ['t', 'm'].includes(this.firstDataIndex) ? dateString : (this.firstDataIndex === 'd' || this.firstDataIndex === 'i') && commonUtils.isEmpty(newValue) ? dEmptyValue : newValue; | 2623 | + const dEmptyValue = |
| 2624 | + this.props.showConfig.sName === "dMachineLength" || this.props.showConfig.sName === "dMachineWidth" | ||
| 2625 | + ? newValue | ||
| 2626 | + : null; /* 设置数值型为空值时 数据置为0 或空值 */ | ||
| 2627 | + let value = | ||
| 2628 | + this.firstDataIndex === "s" && !this.props.textArea && commonUtils.isEmpty(newValue) | ||
| 2629 | + ? newValue.replace("--", "") | ||
| 2630 | + : ["t", "m"].includes(this.firstDataIndex) | ||
| 2631 | + ? dateString | ||
| 2632 | + : (this.firstDataIndex === "d" || this.firstDataIndex === "i") && commonUtils.isEmpty(newValue) | ||
| 2633 | + ? dEmptyValue | ||
| 2634 | + : newValue; | ||
| 2316 | value = this.props.showConfig.bMultipleChoice ? value.toString() : value; | 2635 | value = this.props.showConfig.bMultipleChoice ? value.toString() : value; |
| 2317 | // if (value === 0) { | 2636 | // if (value === 0) { |
| 2318 | // setTimeout(() => { | 2637 | // setTimeout(() => { |
| @@ -2322,24 +2641,24 @@ export default class CommonComponent extends Component { | @@ -2322,24 +2641,24 @@ export default class CommonComponent extends Component { | ||
| 2322 | // }, 51); | 2641 | // }, 51); |
| 2323 | // } | 2642 | // } |
| 2324 | this.isDropdownFilter = true; | 2643 | this.isDropdownFilter = true; |
| 2325 | - if (this.props.showConfig.sDropDownType === 'sql' && value === '@#*000@') { | 2644 | + if (this.props.showConfig.sDropDownType === "sql" && value === "@#*000@") { |
| 2326 | this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name); | 2645 | this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name); |
| 2327 | if (this.mounted) { | 2646 | if (this.mounted) { |
| 2328 | - this.setState({ dataValue: '' }); | 2647 | + this.setState({ dataValue: "" }); |
| 2329 | } | 2648 | } |
| 2330 | return; | 2649 | return; |
| 2331 | } | 2650 | } |
| 2332 | - if (this.props.showConfig.sDropDownType === 'sql' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2333 | - value = ''; | 2651 | + if (this.props.showConfig.sDropDownType === "sql" && value === "=+@") { |
| 2652 | + /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2653 | + value = ""; | ||
| 2334 | } | 2654 | } |
| 2335 | - if (this.props.showConfig.sDropDownType === 'const' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2336 | - value = ''; | 2655 | + if (this.props.showConfig.sDropDownType === "const" && value === "=+@") { |
| 2656 | + /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2657 | + value = ""; | ||
| 2337 | } | 2658 | } |
| 2338 | /* 回带值声明 */ | 2659 | /* 回带值声明 */ |
| 2339 | const returnValue = {}; | 2660 | const returnValue = {}; |
| 2340 | - const { | ||
| 2341 | - searchValue, searchDropDownData, dropDownData, selectTableData, | ||
| 2342 | - } = this.state; | 2661 | + const { searchValue, searchDropDownData, dropDownData, selectTableData } = this.state; |
| 2343 | let dropDownDataNew = []; | 2662 | let dropDownDataNew = []; |
| 2344 | /* 如果是表格下拉的话 */ | 2663 | /* 如果是表格下拉的话 */ |
| 2345 | if (commonUtils.isNotEmptyStr(this.props.showConfig?.sTableTitleSql) && this.props.showConfig?.iVisCount > 1) { | 2664 | if (commonUtils.isNotEmptyStr(this.props.showConfig?.sTableTitleSql) && this.props.showConfig?.iVisCount > 1) { |
| @@ -2347,8 +2666,8 @@ export default class CommonComponent extends Component { | @@ -2347,8 +2666,8 @@ export default class CommonComponent extends Component { | ||
| 2347 | } else { | 2666 | } else { |
| 2348 | dropDownDataNew = commonUtils.isEmptyArr(searchValue) ? dropDownData : searchDropDownData; | 2667 | dropDownDataNew = commonUtils.isEmptyArr(searchValue) ? dropDownData : searchDropDownData; |
| 2349 | } | 2668 | } |
| 2350 | - const getTValue = (value) => { | ||
| 2351 | - const { sDateFormat = 'YYYY-MM-DD' } = this.props.showConfig; | 2669 | + const getTValue = value => { |
| 2670 | + const { sDateFormat = "YYYY-MM-DD" } = this.props.showConfig; | ||
| 2352 | 2671 | ||
| 2353 | if (moment(value, sDateFormat, true).isValid()) return value; // 如果数据满足日期格式,则直接返回 | 2672 | if (moment(value, sDateFormat, true).isValid()) return value; // 如果数据满足日期格式,则直接返回 |
| 2354 | 2673 | ||
| @@ -2364,21 +2683,34 @@ export default class CommonComponent extends Component { | @@ -2364,21 +2683,34 @@ export default class CommonComponent extends Component { | ||
| 2364 | /* 回带值赋值(sName:value) */ | 2683 | /* 回带值赋值(sName:value) */ |
| 2365 | returnValue[this.props.showConfig.sName] = | 2684 | returnValue[this.props.showConfig.sName] = |
| 2366 | // this.firstDataIndex === 's' && this.props.textArea ? value.target.value : | 2685 | // this.firstDataIndex === 's' && this.props.textArea ? value.target.value : |
| 2367 | - this.firstDataIndex === 'i' ? commonUtils.isEmpty(value) ? undefined : this.props.showConfig.sName === 'iOrder' ? value : parseInt(value, 0) : | ||
| 2368 | - this.firstDataIndex === 'd' ? commonUtils.isEmpty(value) ? undefined : this.floatNumberCheck(value) : | ||
| 2369 | - this.firstDataIndex === 't' ? getTValue(value) : | ||
| 2370 | - this.firstDataIndex === 'b' ? value.target.checked : value === null ? undefined : value; | 2686 | + this.firstDataIndex === "i" |
| 2687 | + ? commonUtils.isEmpty(value) | ||
| 2688 | + ? undefined | ||
| 2689 | + : this.props.showConfig.sName === "iOrder" | ||
| 2690 | + ? value | ||
| 2691 | + : parseInt(value, 0) | ||
| 2692 | + : this.firstDataIndex === "d" | ||
| 2693 | + ? commonUtils.isEmpty(value) | ||
| 2694 | + ? undefined | ||
| 2695 | + : this.floatNumberCheck(value) | ||
| 2696 | + : this.firstDataIndex === "t" | ||
| 2697 | + ? getTValue(value) | ||
| 2698 | + : this.firstDataIndex === "b" | ||
| 2699 | + ? value.target.checked | ||
| 2700 | + : value === null | ||
| 2701 | + ? undefined | ||
| 2702 | + : value; | ||
| 2371 | if (!this.props.showConfig.bMultipleChoice) { | 2703 | if (!this.props.showConfig.bMultipleChoice) { |
| 2372 | const { sAssignField } = this.props.showConfig; | 2704 | const { sAssignField } = this.props.showConfig; |
| 2373 | const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(item.sSlaveId) ? item.sSlaveId : item.sId) === value.toString()); | 2705 | const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(item.sSlaveId) ? item.sSlaveId : item.sId) === value.toString()); |
| 2374 | if (!commonUtils.isEmpty(sAssignField)) { | 2706 | if (!commonUtils.isEmpty(sAssignField)) { |
| 2375 | /* 赋值数组 */ | 2707 | /* 赋值数组 */ |
| 2376 | - const sAssignFieldObj = sAssignField.split(','); | 2708 | + const sAssignFieldObj = sAssignField.split(","); |
| 2377 | if (commonUtils.isNotEmptyObject(changeData)) { | 2709 | if (commonUtils.isNotEmptyObject(changeData)) { |
| 2378 | for (const child of sAssignFieldObj) { | 2710 | for (const child of sAssignFieldObj) { |
| 2379 | - if (child.indexOf(':') > -1) { | ||
| 2380 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2381 | - const sValueName = child.split(':')[1].trim(); | 2711 | + if (child.indexOf(":") > -1) { |
| 2712 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2713 | + const sValueName = child.split(":")[1].trim(); | ||
| 2382 | // returnValue[sFieldName] = changeData[sValueName] || changeData.value; | 2714 | // returnValue[sFieldName] = changeData[sValueName] || changeData.value; |
| 2383 | returnValue[sFieldName] = changeData[sValueName] === 0 ? 0 : changeData[sValueName] || changeData.value; | 2715 | returnValue[sFieldName] = changeData[sValueName] === 0 ? 0 : changeData[sValueName] || changeData.value; |
| 2384 | } | 2716 | } |
| @@ -2386,26 +2718,28 @@ export default class CommonComponent extends Component { | @@ -2386,26 +2718,28 @@ export default class CommonComponent extends Component { | ||
| 2386 | } else if (!this.props.showConfig.bCanInput) { | 2718 | } else if (!this.props.showConfig.bCanInput) { |
| 2387 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 | 2719 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 |
| 2388 | for (const child of sAssignFieldObj) { | 2720 | for (const child of sAssignFieldObj) { |
| 2389 | - if (child.indexOf(':') > -1) { | ||
| 2390 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2391 | - returnValue[sFieldName] = ''; | 2721 | + if (child.indexOf(":") > -1) { |
| 2722 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2723 | + returnValue[sFieldName] = ""; | ||
| 2392 | } | 2724 | } |
| 2393 | } | 2725 | } |
| 2394 | } | 2726 | } |
| 2395 | } | 2727 | } |
| 2396 | } else { | 2728 | } else { |
| 2397 | const { sAssignField } = this.props.showConfig; | 2729 | const { sAssignField } = this.props.showConfig; |
| 2398 | - const changeData = dropDownDataNew.filter(item => (`,${value.toString()},`).includes((!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`))); | 2730 | + const changeData = dropDownDataNew.filter(item => |
| 2731 | + `,${value.toString()},`.includes(!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`) | ||
| 2732 | + ); | ||
| 2399 | if (!commonUtils.isEmpty(sAssignField)) { | 2733 | if (!commonUtils.isEmpty(sAssignField)) { |
| 2400 | /* 赋值数组 */ | 2734 | /* 赋值数组 */ |
| 2401 | - const sAssignFieldObj = sAssignField.split(','); | 2735 | + const sAssignFieldObj = sAssignField.split(","); |
| 2402 | if (commonUtils.isNotEmptyArr(changeData)) { | 2736 | if (commonUtils.isNotEmptyArr(changeData)) { |
| 2403 | for (const child of sAssignFieldObj) { | 2737 | for (const child of sAssignFieldObj) { |
| 2404 | - if (child.indexOf(':') > -1) { | ||
| 2405 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2406 | - const sValueName = child.split(':')[1].trim(); | 2738 | + if (child.indexOf(":") > -1) { |
| 2739 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2740 | + const sValueName = child.split(":")[1].trim(); | ||
| 2407 | const valueArr = []; | 2741 | const valueArr = []; |
| 2408 | - changeData.forEach((itemData) => { | 2742 | + changeData.forEach(itemData => { |
| 2409 | valueArr.push(itemData[sValueName]); | 2743 | valueArr.push(itemData[sValueName]); |
| 2410 | }); | 2744 | }); |
| 2411 | returnValue[sFieldName] = valueArr.toString(); | 2745 | returnValue[sFieldName] = valueArr.toString(); |
| @@ -2414,9 +2748,9 @@ export default class CommonComponent extends Component { | @@ -2414,9 +2748,9 @@ export default class CommonComponent extends Component { | ||
| 2414 | } else if (!this.props.showConfig.bCanInput) { | 2748 | } else if (!this.props.showConfig.bCanInput) { |
| 2415 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 | 2749 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 |
| 2416 | for (const child of sAssignFieldObj) { | 2750 | for (const child of sAssignFieldObj) { |
| 2417 | - if (child.indexOf(':') > -1) { | ||
| 2418 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2419 | - returnValue[sFieldName] = ''; | 2751 | + if (child.indexOf(":") > -1) { |
| 2752 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2753 | + returnValue[sFieldName] = ""; | ||
| 2420 | } | 2754 | } |
| 2421 | } | 2755 | } |
| 2422 | } | 2756 | } |
| @@ -2426,15 +2760,25 @@ export default class CommonComponent extends Component { | @@ -2426,15 +2760,25 @@ export default class CommonComponent extends Component { | ||
| 2426 | // 处理原因:如果已选数据不在下拉数据中时(比如懒加载模式),会过滤掉已选数据 | 2760 | // 处理原因:如果已选数据不在下拉数据中时(比如懒加载模式),会过滤掉已选数据 |
| 2427 | if (commonUtils.isNotEmptyArr(Object.keys(returnValue))) { | 2761 | if (commonUtils.isNotEmptyArr(Object.keys(returnValue))) { |
| 2428 | const [returnValueKey0, returnValueValue0] = [Object.keys(returnValue)[0], Object.values(returnValue)[0]]; | 2762 | const [returnValueKey0, returnValueValue0] = [Object.keys(returnValue)[0], Object.values(returnValue)[0]]; |
| 2429 | - if (returnValueValue0.split(',').length !== value.split(',').length || (returnValueValue0 === '' && value !== '')) { | 2763 | + if (returnValueValue0.split(",").length !== value.split(",").length || (returnValueValue0 === "" && value !== "")) { |
| 2430 | returnValue[returnValueKey0] = value; | 2764 | returnValue[returnValueKey0] = value; |
| 2431 | } | 2765 | } |
| 2432 | } | 2766 | } |
| 2433 | } | 2767 | } |
| 2434 | 2768 | ||
| 2435 | - if (this.state.searchPageNum !== 0 || this.state.searchTotalPageCount !== 1 || this.state.searchDropDownData !== [] || this.state.searchValue !== '' || this.state.spinState !== false) { | 2769 | + if ( |
| 2770 | + this.state.searchPageNum !== 0 || | ||
| 2771 | + this.state.searchTotalPageCount !== 1 || | ||
| 2772 | + this.state.searchDropDownData !== [] || | ||
| 2773 | + this.state.searchValue !== "" || | ||
| 2774 | + this.state.spinState !== false | ||
| 2775 | + ) { | ||
| 2436 | this.setState({ | 2776 | this.setState({ |
| 2437 | - searchPageNum: 0, searchTotalPageCount: 1, searchDropDownData: [], searchValue: '', spinState: false, | 2777 | + searchPageNum: 0, |
| 2778 | + searchTotalPageCount: 1, | ||
| 2779 | + searchDropDownData: [], | ||
| 2780 | + searchValue: "", | ||
| 2781 | + spinState: false, | ||
| 2438 | }); | 2782 | }); |
| 2439 | } | 2783 | } |
| 2440 | // /* 调用父组件的回带函数 */ | 2784 | // /* 调用父组件的回带函数 */ |
| @@ -2442,7 +2786,7 @@ export default class CommonComponent extends Component { | @@ -2442,7 +2786,7 @@ export default class CommonComponent extends Component { | ||
| 2442 | 2786 | ||
| 2443 | clearTimeout(this.onChangeTimer); | 2787 | clearTimeout(this.onChangeTimer); |
| 2444 | this.onChangeTimer = setTimeout(() => { | 2788 | this.onChangeTimer = setTimeout(() => { |
| 2445 | - this.onExecInstructSet('change'); | 2789 | + this.onExecInstructSet("change"); |
| 2446 | }, 500); | 2790 | }, 500); |
| 2447 | }; | 2791 | }; |
| 2448 | 2792 | ||
| @@ -2489,22 +2833,31 @@ export default class CommonComponent extends Component { | @@ -2489,22 +2833,31 @@ export default class CommonComponent extends Component { | ||
| 2489 | if (newValue === undefined) { | 2833 | if (newValue === undefined) { |
| 2490 | return; | 2834 | return; |
| 2491 | } | 2835 | } |
| 2492 | - if (newValue.target && newValue.target.type !== 'checkbox') { | 2836 | + if (newValue.target && newValue.target.type !== "checkbox") { |
| 2493 | newValue = newValue.target.value; | 2837 | newValue = newValue.target.value; |
| 2494 | } | 2838 | } |
| 2495 | /* 下拉新增单独处理 */ | 2839 | /* 下拉新增单独处理 */ |
| 2496 | - const dMachine = ['dMachineLength', 'dMachineWidth'].includes(this.props.showConfig.sName); | 2840 | + const dMachine = ["dMachineLength", "dMachineWidth"].includes(this.props.showConfig.sName); |
| 2497 | if (dMachine) { | 2841 | if (dMachine) { |
| 2498 | if (!/^\d+(\.\d+)?(\*\d+(\.\d+)?)?$/.test(newValue)) { | 2842 | if (!/^\d+(\.\d+)?(\*\d+(\.\d+)?)?$/.test(newValue)) { |
| 2499 | - newValue = ''; | 2843 | + newValue = ""; |
| 2500 | setTimeout(() => { | 2844 | setTimeout(() => { |
| 2501 | - this.setState({ searchValue: '' }); | 2845 | + this.setState({ searchValue: "" }); |
| 2502 | }, 1200); | 2846 | }, 1200); |
| 2503 | } | 2847 | } |
| 2504 | } | 2848 | } |
| 2505 | - const dEmptyValue = this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth' ? newValue : 0; /* 设置数值型为空值时 数据置为0 或空值 */ | ||
| 2506 | - let value = this.firstDataIndex === 's' && !this.props.textArea && commonUtils.isEmpty(newValue) ? newValue.replace('--', '') : | ||
| 2507 | - this.firstDataIndex === 't' ? dateString : (this.firstDataIndex === 'd' || this.firstDataIndex === 'i') && commonUtils.isEmpty(newValue) ? dEmptyValue : newValue; | 2849 | + const dEmptyValue = |
| 2850 | + this.props.showConfig.sName === "dMachineLength" || this.props.showConfig.sName === "dMachineWidth" | ||
| 2851 | + ? newValue | ||
| 2852 | + : 0; /* 设置数值型为空值时 数据置为0 或空值 */ | ||
| 2853 | + let value = | ||
| 2854 | + this.firstDataIndex === "s" && !this.props.textArea && commonUtils.isEmpty(newValue) | ||
| 2855 | + ? newValue.replace("--", "") | ||
| 2856 | + : this.firstDataIndex === "t" | ||
| 2857 | + ? dateString | ||
| 2858 | + : (this.firstDataIndex === "d" || this.firstDataIndex === "i") && commonUtils.isEmpty(newValue) | ||
| 2859 | + ? dEmptyValue | ||
| 2860 | + : newValue; | ||
| 2508 | value = this.props.showConfig.bMultipleChoice ? value.toString() : value; | 2861 | value = this.props.showConfig.bMultipleChoice ? value.toString() : value; |
| 2509 | 2862 | ||
| 2510 | // if (this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth') { /* 处理上机长宽 下拉数据 数据分割错误问题 */ | 2863 | // if (this.props.showConfig.sName === 'dMachineLength' || this.props.showConfig.sName === 'dMachineWidth') { /* 处理上机长宽 下拉数据 数据分割错误问题 */ |
| @@ -2512,18 +2865,20 @@ export default class CommonComponent extends Component { | @@ -2512,18 +2865,20 @@ export default class CommonComponent extends Component { | ||
| 2512 | // } | 2865 | // } |
| 2513 | 2866 | ||
| 2514 | this.isDropdownFilter = true; | 2867 | this.isDropdownFilter = true; |
| 2515 | - if (this.props.showConfig.sDropDownType === 'sql' && value === '@#*000@') { | 2868 | + if (this.props.showConfig.sDropDownType === "sql" && value === "@#*000@") { |
| 2516 | this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name); | 2869 | this.props.handleSqlDropDownNewRecord(this.props.showConfig, this.props.name); |
| 2517 | if (this.mounted) { | 2870 | if (this.mounted) { |
| 2518 | - this.setState({ dataValue: '' }); | 2871 | + this.setState({ dataValue: "" }); |
| 2519 | } | 2872 | } |
| 2520 | return; | 2873 | return; |
| 2521 | } | 2874 | } |
| 2522 | - if (this.props.showConfig.sDropDownType === 'sql' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2523 | - value = ''; | 2875 | + if (this.props.showConfig.sDropDownType === "sql" && value === "=+@") { |
| 2876 | + /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2877 | + value = ""; | ||
| 2524 | } | 2878 | } |
| 2525 | - if (this.props.showConfig.sDropDownType === 'const' && value === '=+@') { /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2526 | - value = ''; | 2879 | + if (this.props.showConfig.sDropDownType === "const" && value === "=+@") { |
| 2880 | + /* 如果是选择空值,则将特殊字符过滤为空值 */ | ||
| 2881 | + value = ""; | ||
| 2527 | } | 2882 | } |
| 2528 | 2883 | ||
| 2529 | /* 回带值声明 */ | 2884 | /* 回带值声明 */ |
| @@ -2533,56 +2888,75 @@ export default class CommonComponent extends Component { | @@ -2533,56 +2888,75 @@ export default class CommonComponent extends Component { | ||
| 2533 | /* 回带值赋值(sName:value) */ | 2888 | /* 回带值赋值(sName:value) */ |
| 2534 | returnValue[this.props.showConfig.sName] = | 2889 | returnValue[this.props.showConfig.sName] = |
| 2535 | // this.firstDataIndex === 's' && this.props.textArea ? value.target.value : | 2890 | // this.firstDataIndex === 's' && this.props.textArea ? value.target.value : |
| 2536 | - this.firstDataIndex === 'i' ? commonUtils.isEmpty(value) ? undefined : this.props.showConfig.sName === 'iOrder' ? value : parseInt(value, 0) : | ||
| 2537 | - this.firstDataIndex === 'd' ? commonUtils.isEmpty(value) ? dMachine ? '' : undefined : value : // this.floatNumberCheck(value) : | ||
| 2538 | - this.firstDataIndex === 't' ? commonUtils.isEmpty(value) ? null : value : | ||
| 2539 | - this.firstDataIndex === 'b' ? value.target.checked : value === null ? undefined : value; | 2891 | + this.firstDataIndex === "i" |
| 2892 | + ? commonUtils.isEmpty(value) | ||
| 2893 | + ? undefined | ||
| 2894 | + : this.props.showConfig.sName === "iOrder" | ||
| 2895 | + ? value | ||
| 2896 | + : parseInt(value, 0) | ||
| 2897 | + : this.firstDataIndex === "d" | ||
| 2898 | + ? commonUtils.isEmpty(value) | ||
| 2899 | + ? dMachine | ||
| 2900 | + ? "" | ||
| 2901 | + : undefined | ||
| 2902 | + : value // this.floatNumberCheck(value) : | ||
| 2903 | + : this.firstDataIndex === "t" | ||
| 2904 | + ? commonUtils.isEmpty(value) | ||
| 2905 | + ? null | ||
| 2906 | + : value | ||
| 2907 | + : this.firstDataIndex === "b" | ||
| 2908 | + ? value.target.checked | ||
| 2909 | + : value === null | ||
| 2910 | + ? undefined | ||
| 2911 | + : value; | ||
| 2540 | if (!this.props.showConfig.bMultipleChoice) { | 2912 | if (!this.props.showConfig.bMultipleChoice) { |
| 2541 | const { sAssignField } = this.props.showConfig; | 2913 | const { sAssignField } = this.props.showConfig; |
| 2542 | // const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(item.sSlaveId) ? item.sSlaveId : item.sId) === newKey.toString()); | 2914 | // const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(item.sSlaveId) ? item.sSlaveId : item.sId) === newKey.toString()); |
| 2543 | - let res = ''; | 2915 | + let res = ""; |
| 2544 | if (dropDownDataNew.length > 0) { | 2916 | if (dropDownDataNew.length > 0) { |
| 2545 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) { | 2917 | if (commonUtils.isNotEmptyStr(this.props.showConfig.sVisColumnName)) { |
| 2546 | res = this.props.showConfig.sVisColumnName; | 2918 | res = this.props.showConfig.sVisColumnName; |
| 2547 | } else { | 2919 | } else { |
| 2548 | - res = Object.keys(dropDownDataNew[0]).length > 0 ? Object.keys(dropDownDataNew[0])[0] : ''; | 2920 | + res = Object.keys(dropDownDataNew[0]).length > 0 ? Object.keys(dropDownDataNew[0])[0] : ""; |
| 2549 | } | 2921 | } |
| 2550 | } | 2922 | } |
| 2551 | const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(res) ? item[res] : item.sId) === value.toString()); | 2923 | const [changeData] = dropDownDataNew.filter(item => (!commonUtils.isEmpty(res) ? item[res] : item.sId) === value.toString()); |
| 2552 | if (!commonUtils.isEmpty(sAssignField)) { | 2924 | if (!commonUtils.isEmpty(sAssignField)) { |
| 2553 | /* 赋值数组 */ | 2925 | /* 赋值数组 */ |
| 2554 | - const sAssignFieldObj = sAssignField.split(','); | 2926 | + const sAssignFieldObj = sAssignField.split(","); |
| 2555 | if (commonUtils.isNotEmptyObject(changeData)) { | 2927 | if (commonUtils.isNotEmptyObject(changeData)) { |
| 2556 | for (const child of sAssignFieldObj) { | 2928 | for (const child of sAssignFieldObj) { |
| 2557 | - if (child.indexOf(':') > -1) { | ||
| 2558 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2559 | - const sValueName = child.split(':')[1].trim(); | 2929 | + if (child.indexOf(":") > -1) { |
| 2930 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2931 | + const sValueName = child.split(":")[1].trim(); | ||
| 2560 | returnValue[sFieldName] = changeData[sValueName] || changeData.value; | 2932 | returnValue[sFieldName] = changeData[sValueName] || changeData.value; |
| 2561 | } | 2933 | } |
| 2562 | } | 2934 | } |
| 2563 | } else if (!this.props.showConfig.bCanInput) { | 2935 | } else if (!this.props.showConfig.bCanInput) { |
| 2564 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 | 2936 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 |
| 2565 | for (const child of sAssignFieldObj) { | 2937 | for (const child of sAssignFieldObj) { |
| 2566 | - if (child.indexOf(':') > -1) { | ||
| 2567 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2568 | - returnValue[sFieldName] = ''; | 2938 | + if (child.indexOf(":") > -1) { |
| 2939 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2940 | + returnValue[sFieldName] = ""; | ||
| 2569 | } | 2941 | } |
| 2570 | } | 2942 | } |
| 2571 | } | 2943 | } |
| 2572 | } | 2944 | } |
| 2573 | } else { | 2945 | } else { |
| 2574 | const { sAssignField } = this.props.showConfig; | 2946 | const { sAssignField } = this.props.showConfig; |
| 2575 | - const changeData = dropDownDataNew.filter(item => (`,${value.toString()},`).includes((!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`))); | 2947 | + const changeData = dropDownDataNew.filter(item => |
| 2948 | + `,${value.toString()},`.includes(!commonUtils.isEmpty(item.sSlaveId) ? `,${item.sSlaveId},` : `,${item.sId},`) | ||
| 2949 | + ); | ||
| 2576 | if (!commonUtils.isEmpty(sAssignField)) { | 2950 | if (!commonUtils.isEmpty(sAssignField)) { |
| 2577 | /* 赋值数组 */ | 2951 | /* 赋值数组 */ |
| 2578 | - const sAssignFieldObj = sAssignField.split(','); | 2952 | + const sAssignFieldObj = sAssignField.split(","); |
| 2579 | if (commonUtils.isNotEmptyArr(changeData)) { | 2953 | if (commonUtils.isNotEmptyArr(changeData)) { |
| 2580 | for (const child of sAssignFieldObj) { | 2954 | for (const child of sAssignFieldObj) { |
| 2581 | - if (child.indexOf(':') > -1) { | ||
| 2582 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2583 | - const sValueName = child.split(':')[1].trim(); | 2955 | + if (child.indexOf(":") > -1) { |
| 2956 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2957 | + const sValueName = child.split(":")[1].trim(); | ||
| 2584 | const valueArr = []; | 2958 | const valueArr = []; |
| 2585 | - changeData.forEach((itemData) => { | 2959 | + changeData.forEach(itemData => { |
| 2586 | valueArr.push(itemData[sValueName]); | 2960 | valueArr.push(itemData[sValueName]); |
| 2587 | }); | 2961 | }); |
| 2588 | returnValue[sFieldName] = valueArr.toString(); | 2962 | returnValue[sFieldName] = valueArr.toString(); |
| @@ -2591,22 +2965,32 @@ export default class CommonComponent extends Component { | @@ -2591,22 +2965,32 @@ export default class CommonComponent extends Component { | ||
| 2591 | } else if (!this.props.showConfig.bCanInput) { | 2965 | } else if (!this.props.showConfig.bCanInput) { |
| 2592 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 | 2966 | // 下拉选择空时,需要, bCanInput一定要为false不然印件名称输入时也被置空了 |
| 2593 | for (const child of sAssignFieldObj) { | 2967 | for (const child of sAssignFieldObj) { |
| 2594 | - if (child.indexOf(':') > -1) { | ||
| 2595 | - const sFieldName = child.split(':')[0].trim() === 'self' ? this.props.showConfig.sName : child.split(':')[0].trim(); | ||
| 2596 | - returnValue[sFieldName] = ''; | 2968 | + if (child.indexOf(":") > -1) { |
| 2969 | + const sFieldName = child.split(":")[0].trim() === "self" ? this.props.showConfig.sName : child.split(":")[0].trim(); | ||
| 2970 | + returnValue[sFieldName] = ""; | ||
| 2597 | } | 2971 | } |
| 2598 | } | 2972 | } |
| 2599 | } | 2973 | } |
| 2600 | } | 2974 | } |
| 2601 | } | 2975 | } |
| 2602 | - if (this.state.searchPageNum !== 0 || this.state.searchTotalPageCount !== 1 || this.state.searchDropDownData !== [] || this.state.searchValue !== '' || this.state.spinState !== false) { | 2976 | + if ( |
| 2977 | + this.state.searchPageNum !== 0 || | ||
| 2978 | + this.state.searchTotalPageCount !== 1 || | ||
| 2979 | + this.state.searchDropDownData !== [] || | ||
| 2980 | + this.state.searchValue !== "" || | ||
| 2981 | + this.state.spinState !== false | ||
| 2982 | + ) { | ||
| 2603 | this.setState({ | 2983 | this.setState({ |
| 2604 | - searchPageNum: 0, searchTotalPageCount: 1, searchDropDownData: [], searchValue: '', spinState: false, | 2984 | + searchPageNum: 0, |
| 2985 | + searchTotalPageCount: 1, | ||
| 2986 | + searchDropDownData: [], | ||
| 2987 | + searchValue: "", | ||
| 2988 | + spinState: false, | ||
| 2605 | }); | 2989 | }); |
| 2606 | } | 2990 | } |
| 2607 | // /* 调用父组件的回带函数 */ | 2991 | // /* 调用父组件的回带函数 */ |
| 2608 | let bSpecial = true; | 2992 | let bSpecial = true; |
| 2609 | - if (location.pathname && location.pathname.includes('ResearchTableTree')) { | 2993 | + if (location.pathname && location.pathname.includes("ResearchTableTree")) { |
| 2610 | bSpecial = false; | 2994 | bSpecial = false; |
| 2611 | } | 2995 | } |
| 2612 | if (bSpecial && this.state.dataValue === returnValue[this.props.showConfig.sName]) { | 2996 | if (bSpecial && this.state.dataValue === returnValue[this.props.showConfig.sName]) { |
| @@ -2625,7 +3009,7 @@ export default class CommonComponent extends Component { | @@ -2625,7 +3009,7 @@ export default class CommonComponent extends Component { | ||
| 2625 | 3009 | ||
| 2626 | clearTimeout(this.onChangeTimer); | 3010 | clearTimeout(this.onChangeTimer); |
| 2627 | this.onChangeTimer = setTimeout(() => { | 3011 | this.onChangeTimer = setTimeout(() => { |
| 2628 | - this.onExecInstructSet('change'); | 3012 | + this.onExecInstructSet("change"); |
| 2629 | }, 500); | 3013 | }, 500); |
| 2630 | }; | 3014 | }; |
| 2631 | // handleCompleteOptionEvent = (newValue, dateString) => { | 3015 | // handleCompleteOptionEvent = (newValue, dateString) => { |
| @@ -2740,64 +3124,65 @@ export default class CommonComponent extends Component { | @@ -2740,64 +3124,65 @@ export default class CommonComponent extends Component { | ||
| 2740 | filterOption = (input, option) => { | 3124 | filterOption = (input, option) => { |
| 2741 | const { pageNum, totalPageCount } = this.state; | 3125 | const { pageNum, totalPageCount } = this.state; |
| 2742 | const newInput = input.toString().trim(); /* 下拉框默认为空 不需要替换'--’ */ | 3126 | const newInput = input.toString().trim(); /* 下拉框默认为空 不需要替换'--’ */ |
| 2743 | - if (pageNum <= totalPageCount && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { | 3127 | + if (pageNum <= totalPageCount && this.props.showConfig.sDropDownType === "sql" && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { |
| 2744 | return true; | 3128 | return true; |
| 2745 | } else if (commonUtils.isNotEmptyObject(option.props.children)) { | 3129 | } else if (commonUtils.isNotEmptyObject(option.props.children)) { |
| 2746 | try { | 3130 | try { |
| 2747 | - return (!this.isDropdownFilter && this.props.showConfig.bCanInput) ? true : (option.props.children.toLowerCase().indexOf(newInput.toLowerCase()) >= 0); | 3131 | + return !this.isDropdownFilter && this.props.showConfig.bCanInput |
| 3132 | + ? true | ||
| 3133 | + : option.props.children.toLowerCase().indexOf(newInput.toLowerCase()) >= 0; | ||
| 2748 | } catch (error) { | 3134 | } catch (error) { |
| 2749 | return false; | 3135 | return false; |
| 2750 | } | 3136 | } |
| 2751 | } | 3137 | } |
| 2752 | }; | 3138 | }; |
| 2753 | 3139 | ||
| 2754 | - | ||
| 2755 | /** | 3140 | /** |
| 2756 | * 小数校验 | 3141 | * 小数校验 |
| 2757 | */ | 3142 | */ |
| 2758 | - floatNumberCheck = (num) => { | 3143 | + floatNumberCheck = num => { |
| 2759 | const dNetPrice = this.props.app?.decimals?.dNetPrice; | 3144 | const dNetPrice = this.props.app?.decimals?.dNetPrice; |
| 2760 | - const Maximum = commonFunc.showLocalMessage(this.props, 'Maximum', '最多输入${digit}位小数'); | 3145 | + const Maximum = commonFunc.showLocalMessage(this.props, "Maximum", "最多输入${digit}位小数"); |
| 2761 | const { showConfig } = this.props; | 3146 | const { showConfig } = this.props; |
| 2762 | const { sName, showName } = showConfig; | 3147 | const { sName, showName } = showConfig; |
| 2763 | - const digit = sName.includes('Price') && dNetPrice ? dNetPrice : 6; | ||
| 2764 | - const Maximun = Maximum.replace('${digit}', digit); | ||
| 2765 | - if (typeof num === 'string') { | ||
| 2766 | - num = num.replace('*', ''); | 3148 | + const digit = sName.includes("Price") && dNetPrice ? dNetPrice : 6; |
| 3149 | + const Maximun = Maximum.replace("${digit}", digit); | ||
| 3150 | + if (typeof num === "string") { | ||
| 3151 | + num = num.replace("*", ""); | ||
| 2767 | } | 3152 | } |
| 2768 | const checkRule = new RegExp(`^(-?\\d+)(\\.?)(\\d{1,${digit}})?$`); | 3153 | const checkRule = new RegExp(`^(-?\\d+)(\\.?)(\\d{1,${digit}})?$`); |
| 2769 | - if (!checkRule.test(num) && num && num !== '-' && num !== '.') { | 3154 | + if (!checkRule.test(num) && num && num !== "-" && num !== ".") { |
| 2770 | message.warning(`【${showName}】【${sName}】${Maximun}`); | 3155 | message.warning(`【${showName}】【${sName}】${Maximun}`); |
| 2771 | return undefined; | 3156 | return undefined; |
| 2772 | } else { | 3157 | } else { |
| 2773 | return num; | 3158 | return num; |
| 2774 | } | 3159 | } |
| 2775 | - } | 3160 | + }; |
| 2776 | 3161 | ||
| 2777 | /** 小数位控制 noinspection JSAnnotator控制 string | number */ | 3162 | /** 小数位控制 noinspection JSAnnotator控制 string | number */ |
| 2778 | - limitDecimals = (values) => { | ||
| 2779 | - let reg = ''; | 3163 | + limitDecimals = values => { |
| 3164 | + let reg = ""; | ||
| 2780 | if (this.floatNum > 0) { | 3165 | if (this.floatNum > 0) { |
| 2781 | reg = `^(\\d+).(${this.floatPrice})*$`; | 3166 | reg = `^(\\d+).(${this.floatPrice})*$`; |
| 2782 | } else { | 3167 | } else { |
| 2783 | - reg = '^(\\d+).(\\d\\d\\d\\d\\d\\d)*$'; | 3168 | + reg = "^(\\d+).(\\d\\d\\d\\d\\d\\d)*$"; |
| 2784 | } | 3169 | } |
| 2785 | - if (typeof values === 'string') { | ||
| 2786 | - if (values !== undefined && values.indexOf('.') <= -1) { | ||
| 2787 | - reg = '^(\\d+)*$'; | ||
| 2788 | - return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1') : ''; | 3170 | + if (typeof values === "string") { |
| 3171 | + if (values !== undefined && values.indexOf(".") <= -1) { | ||
| 3172 | + reg = "^(\\d+)*$"; | ||
| 3173 | + return !isNaN(Number(values)) ? values.replace(new RegExp(reg), "$1") : ""; | ||
| 2789 | } else { | 3174 | } else { |
| 2790 | - return !isNaN(Number(values)) ? values.replace(new RegExp(reg), '$1.$2') : ''; | 3175 | + return !isNaN(Number(values)) ? values.replace(new RegExp(reg), "$1.$2") : ""; |
| 2791 | } | 3176 | } |
| 2792 | - } else if (typeof values === 'number') { | ||
| 2793 | - if (values !== undefined && String(values).indexOf('.') <= -1) { | ||
| 2794 | - reg = '^(\\d+)*$'; | ||
| 2795 | - return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1') : ''; | 3177 | + } else if (typeof values === "number") { |
| 3178 | + if (values !== undefined && String(values).indexOf(".") <= -1) { | ||
| 3179 | + reg = "^(\\d+)*$"; | ||
| 3180 | + return !isNaN(values) ? String(values).replace(new RegExp(reg), "$1") : ""; | ||
| 2796 | } else { | 3181 | } else { |
| 2797 | - return !isNaN(values) ? String(values).replace(new RegExp(reg), '$1.$2') : ''; | 3182 | + return !isNaN(values) ? String(values).replace(new RegExp(reg), "$1.$2") : ""; |
| 2798 | } | 3183 | } |
| 2799 | } else { | 3184 | } else { |
| 2800 | - return ''; | 3185 | + return ""; |
| 2801 | } | 3186 | } |
| 2802 | }; | 3187 | }; |
| 2803 | 3188 | ||
| @@ -2806,46 +3191,59 @@ export default class CommonComponent extends Component { | @@ -2806,46 +3191,59 @@ export default class CommonComponent extends Component { | ||
| 2806 | const { sControlName, sActiveKey } = showConfig; /* 弹出标志,弹出界面对应数据主字段 */ | 3191 | const { sControlName, sActiveKey } = showConfig; /* 弹出标志,弹出界面对应数据主字段 */ |
| 2807 | if (commonUtils.isNotEmptyObject(sControlName) && commonUtils.isNotEmptyObject(sActiveKey)) { | 3192 | if (commonUtils.isNotEmptyObject(sControlName) && commonUtils.isNotEmptyObject(sActiveKey)) { |
| 2808 | const printPdf = sControlName; | 3193 | const printPdf = sControlName; |
| 2809 | - if (commonUtils.isNotEmptyObject(printPdf) && printPdf === 'printPdf' && commonUtils.isNotEmptyObject(sActiveKey)) { | 3194 | + if (commonUtils.isNotEmptyObject(printPdf) && printPdf === "printPdf" && commonUtils.isNotEmptyObject(sActiveKey)) { |
| 2810 | const { token } = app; | 3195 | const { token } = app; |
| 2811 | - const sActiveId = this.props.showConfig.sActiveId === '1' ? commonUtils.isEmpty(record.sFormId) ? record.sSrcFormId : record.sFormId : this.props.showConfig.sActiveId; | 3196 | + const sActiveId = |
| 3197 | + this.props.showConfig.sActiveId === "1" | ||
| 3198 | + ? commonUtils.isEmpty(record.sFormId) | ||
| 3199 | + ? record.sSrcFormId | ||
| 3200 | + : record.sFormId | ||
| 3201 | + : this.props.showConfig.sActiveId; | ||
| 2812 | const printsId = record[sActiveKey]; | 3202 | const printsId = record[sActiveKey]; |
| 2813 | - const urlPrint = `${commonConfig.file_host}printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`; | 3203 | + const urlPrint = `${ |
| 3204 | + commonConfig.file_host | ||
| 3205 | + }printReport/printPdfByFromDataId/${printsId}.pdf?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`; | ||
| 2814 | // const urlPrint = `${commonConfig.file_host}printReport/printPdfByFromDataId?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`; | 3206 | // const urlPrint = `${commonConfig.file_host}printReport/printPdfByFromDataId?sModelsId=${sActiveId}&sId=${printsId}&token=${encodeURIComponent(token)}`; |
| 2815 | window.open(urlPrint); | 3207 | window.open(urlPrint); |
| 2816 | - } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes('picarrmodal')) { /* 蓝色链接跳转用Modal呈现 */ | 3208 | + } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes("picarrmodal")) { |
| 3209 | + /* 蓝色链接跳转用Modal呈现 */ | ||
| 2817 | // this.props.onTabModalClick(name, sName, record, index, showConfig, configName); | 3210 | // this.props.onTabModalClick(name, sName, record, index, showConfig, configName); |
| 2818 | this.props.onTabModalClick(this.props.name, this.props.showConfig.sName, record, undefined, showConfig, this.props.sName); | 3211 | this.props.onTabModalClick(this.props.name, this.props.showConfig.sName, record, undefined, showConfig, this.props.sName); |
| 2819 | } else { | 3212 | } else { |
| 2820 | this.props.onViewClick(this.props.name, this.props.showConfig.sName, this.props.record); | 3213 | this.props.onViewClick(this.props.name, this.props.showConfig.sName, this.props.record); |
| 2821 | } | 3214 | } |
| 2822 | - } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes('picarrmodal')) { /* 蓝色链接跳转用Modal呈现 */ | 3215 | + } else if (showConfig.sDropDownType && showConfig.sDropDownType.toLowerCase().includes("picarrmodal")) { |
| 3216 | + /* 蓝色链接跳转用Modal呈现 */ | ||
| 2823 | // this.props.onTabModalClick(name, sName, record, index, showConfig, configName); | 3217 | // this.props.onTabModalClick(name, sName, record, index, showConfig, configName); |
| 2824 | this.props.onTabModalClick(this.props.name, this.props.showConfig.sName, record, undefined, showConfig, this.props.sName); | 3218 | this.props.onTabModalClick(this.props.name, this.props.showConfig.sName, record, undefined, showConfig, this.props.sName); |
| 2825 | } else { | 3219 | } else { |
| 2826 | this.props.onViewClick(this.props.name, this.props.showConfig.sName, this.props.record); | 3220 | this.props.onViewClick(this.props.name, this.props.showConfig.sName, this.props.record); |
| 2827 | } | 3221 | } |
| 2828 | - } | 3222 | + }; |
| 2829 | 3223 | ||
| 2830 | /* 打开新窗口查看SQL编辑器 */ | 3224 | /* 打开新窗口查看SQL编辑器 */ |
| 2831 | handleOpenWin = () => { | 3225 | handleOpenWin = () => { |
| 2832 | const { dataValue, showConfig, record } = this.props; | 3226 | const { dataValue, showConfig, record } = this.props; |
| 2833 | // eslint-disable-next-line prefer-destructuring | 3227 | // eslint-disable-next-line prefer-destructuring |
| 2834 | const sBtnName = showConfig.sName; | 3228 | const sBtnName = showConfig.sName; |
| 2835 | - const sBtnContent = commonUtils.isNotEmptyObject(dataValue) ? encodeURIComponent(dataValue) : ''; | ||
| 2836 | - const sBtnControlName = commonUtils.isNotEmptyObject(showConfig.sName) ? showConfig.sName : ''; | 3229 | + const sBtnContent = commonUtils.isNotEmptyObject(dataValue) ? encodeURIComponent(dataValue) : ""; |
| 3230 | + const sBtnControlName = commonUtils.isNotEmptyObject(showConfig.sName) ? showConfig.sName : ""; | ||
| 2837 | if (commonUtils.isNotEmptyObject(sBtnContent) && commonUtils.isNotEmptyObject(record)) { | 3231 | if (commonUtils.isNotEmptyObject(sBtnContent) && commonUtils.isNotEmptyObject(record)) { |
| 2838 | - const sFormId = commonUtils.isNotEmptyObject(record.sParentId) ? record.sParentId : ''; | 3232 | + const sFormId = commonUtils.isNotEmptyObject(record.sParentId) ? record.sParentId : ""; |
| 2839 | const urlPrint = `${commonConfig.server_host}template/getSql/${sBtnName}/?sBtnContent=${sBtnContent}&sBtnControlName=${sBtnControlName}&sFormId=${sFormId}`; | 3233 | const urlPrint = `${commonConfig.server_host}template/getSql/${sBtnName}/?sBtnContent=${sBtnContent}&sBtnControlName=${sBtnControlName}&sFormId=${sFormId}`; |
| 2840 | const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; | 3234 | const w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; |
| 2841 | const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; | 3235 | const h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; |
| 2842 | // const newWin = window.open('','_blank'); | 3236 | // const newWin = window.open('','_blank'); |
| 2843 | - const features = `width=${w + 350},height=${h + 300}, top=0, left=0, toolbar=no, menubar=no,scrollbars=no,resizable=no, location =no, status=no`; | ||
| 2844 | - const newWin = window.open('', 'SQL查看器', features); | ||
| 2845 | - newWin.document.write(`<body scroll="no" style="margin: 0px;padding: 0px;border:0px;overflow:hidden;"><iframe style="margin: 0px;padding: 0px;border: 0px;width:100%;height:100%" src="${urlPrint}"></iframe></body>`); | 3237 | + const features = `width=${w + 350},height=${ |
| 3238 | + h + 300 | ||
| 3239 | + }, top=0, left=0, toolbar=no, menubar=no,scrollbars=no,resizable=no, location =no, status=no`; | ||
| 3240 | + const newWin = window.open("", "SQL查看器", features); | ||
| 3241 | + newWin.document.write( | ||
| 3242 | + `<body scroll="no" style="margin: 0px;padding: 0px;border:0px;overflow:hidden;"><iframe style="margin: 0px;padding: 0px;border: 0px;width:100%;height:100%" src="${urlPrint}"></iframe></body>` | ||
| 3243 | + ); | ||
| 2846 | // window.open(urlPrint); | 3244 | // window.open(urlPrint); |
| 2847 | } else { | 3245 | } else { |
| 2848 | - message.error('未找到对应过程名'); | 3246 | + message.error("未找到对应过程名"); |
| 2849 | } | 3247 | } |
| 2850 | }; | 3248 | }; |
| 2851 | 3249 | ||
| @@ -2855,34 +3253,36 @@ export default class CommonComponent extends Component { | @@ -2855,34 +3253,36 @@ export default class CommonComponent extends Component { | ||
| 2855 | const { name, record, showConfig } = this.props; | 3253 | const { name, record, showConfig } = this.props; |
| 2856 | this.props.onRightArrow(name, showConfig.sName, record, undefined, showConfig); | 3254 | this.props.onRightArrow(name, showConfig.sName, record, undefined, showConfig); |
| 2857 | } | 3255 | } |
| 2858 | - } | 3256 | + }; |
| 2859 | 3257 | ||
| 2860 | handlePreviewImage = (e, dataUrl) => { | 3258 | handlePreviewImage = (e, dataUrl) => { |
| 2861 | e.stopPropagation(); | 3259 | e.stopPropagation(); |
| 2862 | this.props.onPreviewImage(e, dataUrl); | 3260 | this.props.onPreviewImage(e, dataUrl); |
| 2863 | - } | 3261 | + }; |
| 2864 | handleViewChoose = () => { | 3262 | handleViewChoose = () => { |
| 2865 | - const bGycs = this.props.showConfig?.showName?.includes('工艺参数'); | 3263 | + const bGycs = this.props.showConfig?.showName?.includes("工艺参数"); |
| 2866 | if (this.state.enabled || bGycs) this.props.onViewChoose(this.props.name, this.props.showConfig.sName, this.props.record); | 3264 | if (this.state.enabled || bGycs) this.props.onViewChoose(this.props.name, this.props.showConfig.sName, this.props.record); |
| 2867 | - } | ||
| 2868 | - handleMemoShow= () => { | 3265 | + }; |
| 3266 | + handleMemoShow = () => { | ||
| 2869 | this.props.onMemoShow(this.props.name, this.props.showConfig.sName, this.props.record, 0, this.props.showConfig); | 3267 | this.props.onMemoShow(this.props.name, this.props.showConfig.sName, this.props.record, 0, this.props.showConfig); |
| 2870 | - } | 3268 | + }; |
| 2871 | 3269 | ||
| 2872 | - handlePreviewOffice = (dataUrl) => { | 3270 | + handlePreviewOffice = dataUrl => { |
| 2873 | this.props.onPreviewOffice(dataUrl); | 3271 | this.props.onPreviewOffice(dataUrl); |
| 2874 | - } | 3272 | + }; |
| 2875 | 3273 | ||
| 2876 | - handlePopupScroll = (e) => { | 3274 | + handlePopupScroll = e => { |
| 2877 | e.persist(); | 3275 | e.persist(); |
| 2878 | const { target } = e; | 3276 | const { target } = e; |
| 2879 | - if (Math.ceil(target.scrollTop + target.offsetHeight) >= target.scrollHeight && this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { | ||
| 2880 | - const { | ||
| 2881 | - pageNum, searchPageNum, searchTotalPageCount, searchValue, totalPageCount, | ||
| 2882 | - } = this.state; | 3277 | + if ( |
| 3278 | + Math.ceil(target.scrollTop + target.offsetHeight) >= target.scrollHeight && | ||
| 3279 | + this.props.showConfig.sDropDownType === "sql" && | ||
| 3280 | + commonUtils.isEmptyArr(this.props.showConfig.dropDownData) | ||
| 3281 | + ) { | ||
| 3282 | + const { pageNum, searchPageNum, searchTotalPageCount, searchValue, totalPageCount } = this.state; | ||
| 2883 | const nextPageNum = pageNum + 1; | 3283 | const nextPageNum = pageNum + 1; |
| 2884 | const nextSearchPageNum = searchPageNum + 1; | 3284 | const nextSearchPageNum = searchPageNum + 1; |
| 2885 | - if (searchValue !== '') { | 3285 | + if (searchValue !== "") { |
| 2886 | this.getDropDownData(nextSearchPageNum, searchTotalPageCount, searchValue); | 3286 | this.getDropDownData(nextSearchPageNum, searchTotalPageCount, searchValue); |
| 2887 | } else { | 3287 | } else { |
| 2888 | this.getDropDownData(nextPageNum, totalPageCount, searchValue); | 3288 | this.getDropDownData(nextPageNum, totalPageCount, searchValue); |
| @@ -2890,12 +3290,12 @@ export default class CommonComponent extends Component { | @@ -2890,12 +3290,12 @@ export default class CommonComponent extends Component { | ||
| 2890 | } | 3290 | } |
| 2891 | }; | 3291 | }; |
| 2892 | 3292 | ||
| 2893 | - handleSearch = (value) => { | 3293 | + handleSearch = value => { |
| 2894 | if (this.dropDownTimer) { | 3294 | if (this.dropDownTimer) { |
| 2895 | clearTimeout(this.dropDownTimer); | 3295 | clearTimeout(this.dropDownTimer); |
| 2896 | } | 3296 | } |
| 2897 | this.dropDownTimer = setTimeout(() => { | 3297 | this.dropDownTimer = setTimeout(() => { |
| 2898 | - if (this.props.showConfig.sDropDownType === 'sql' && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { | 3298 | + if (this.props.showConfig.sDropDownType === "sql" && commonUtils.isEmptyArr(this.props.showConfig.dropDownData)) { |
| 2899 | this.setState({ spinState: true }); | 3299 | this.setState({ spinState: true }); |
| 2900 | this.getDropDownData(1, 1, value); | 3300 | this.getDropDownData(1, 1, value); |
| 2901 | } | 3301 | } |
| @@ -2913,67 +3313,95 @@ export default class CommonComponent extends Component { | @@ -2913,67 +3313,95 @@ export default class CommonComponent extends Component { | ||
| 2913 | const btCostomIndex = gdsconfigformslave.findIndex(item => item.sControlName === `BtnCustom.${sName}`); | 3313 | const btCostomIndex = gdsconfigformslave.findIndex(item => item.sControlName === `BtnCustom.${sName}`); |
| 2914 | 3314 | ||
| 2915 | /* 获取innerinput控件 */ | 3315 | /* 获取innerinput控件 */ |
| 2916 | - const innerInput = btPopIndex > -1 && btCostomIndex > -1 ? ( | ||
| 2917 | - <Space className={styles.commonAntSpace} size={3}> | ||
| 2918 | - {this.getInnerInput(innerInputProps)} | ||
| 2919 | - {this.getInnerButton()} | ||
| 2920 | - {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])} | ||
| 2921 | - <div /> | ||
| 2922 | - </Space> | ||
| 2923 | - ) : btPopIndex !== -1 ? ( | ||
| 2924 | - <Space className={styles.commonAntSpace} size={3}> | ||
| 2925 | - {this.getInnerInput(innerInputProps)} | ||
| 2926 | - {this.getInnerButton()} | ||
| 2927 | - <div /> | ||
| 2928 | - </Space> | ||
| 2929 | - ) : btCostomIndex !== -1 ? ( | ||
| 2930 | - <Space className={styles.commonAntSpace} size={3}> | ||
| 2931 | - {this.getInnerInput(innerInputProps)} | ||
| 2932 | - {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])} | ||
| 2933 | - <div /> | ||
| 2934 | - </Space> | ||
| 2935 | - ) : this.getInnerInput(innerInputProps); | ||
| 2936 | - | ||
| 2937 | - let viewInfo = ''; | ||
| 2938 | - if (this.props.showConfig.sDropDownType !== 'popup' && !commonUtils.isEmpty(this.props.showConfig.sActiveId) && !commonUtils.isEmpty(this.props.showConfig.sActiveKey) && (commonUtils.isNotEmptyObject(this.props.dataValue) || commonUtils.isNotEmptyNumber(this.props.dataValue))) { | 3316 | + const innerInput = |
| 3317 | + btPopIndex > -1 && btCostomIndex > -1 ? ( | ||
| 3318 | + <Space className={styles.commonAntSpace} size={3}> | ||
| 3319 | + {this.getInnerInput(innerInputProps)} | ||
| 3320 | + {this.getInnerButton()} | ||
| 3321 | + {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])} | ||
| 3322 | + <div /> | ||
| 3323 | + </Space> | ||
| 3324 | + ) : btPopIndex !== -1 ? ( | ||
| 3325 | + <Space className={styles.commonAntSpace} size={3}> | ||
| 3326 | + {this.getInnerInput(innerInputProps)} | ||
| 3327 | + {this.getInnerButton()} | ||
| 3328 | + <div /> | ||
| 3329 | + </Space> | ||
| 3330 | + ) : btCostomIndex !== -1 ? ( | ||
| 3331 | + <Space className={styles.commonAntSpace} size={3}> | ||
| 3332 | + {this.getInnerInput(innerInputProps)} | ||
| 3333 | + {this.getInnerButtonCostom(gdsconfigformslave[btCostomIndex])} | ||
| 3334 | + <div /> | ||
| 3335 | + </Space> | ||
| 3336 | + ) : ( | ||
| 3337 | + this.getInnerInput(innerInputProps) | ||
| 3338 | + ); | ||
| 3339 | + | ||
| 3340 | + let viewInfo = ""; | ||
| 3341 | + if ( | ||
| 3342 | + this.props.showConfig.sDropDownType !== "popup" && | ||
| 3343 | + !commonUtils.isEmpty(this.props.showConfig.sActiveId) && | ||
| 3344 | + !commonUtils.isEmpty(this.props.showConfig.sActiveKey) && | ||
| 3345 | + (commonUtils.isNotEmptyObject(this.props.dataValue) || commonUtils.isNotEmptyNumber(this.props.dataValue)) | ||
| 3346 | + ) { | ||
| 2939 | viewInfo = ( | 3347 | viewInfo = ( |
| 2940 | <div | 3348 | <div |
| 2941 | - className={this.state.sActiveDisplay ? 'sActiveIdStyle sActiveIdStyleBlock' : 'sActiveIdStyle sActiveIdStyleNone'} | 3349 | + className={this.state.sActiveDisplay ? "sActiveIdStyle sActiveIdStyleBlock" : "sActiveIdStyle sActiveIdStyleNone"} |
| 2942 | title={this.props.dataValue} | 3350 | title={this.props.dataValue} |
| 2943 | style={{ | 3351 | style={{ |
| 2944 | - display: this.state.sActiveDisplay ? 'block' : 'none', | 3352 | + display: this.state.sActiveDisplay ? "block" : "none", |
| 2945 | // top: this.props.name === 'slaveInfo' ? '1px' : '', | 3353 | // top: this.props.name === 'slaveInfo' ? '1px' : '', |
| 2946 | // left: this.props.name === 'slaveInfo' ? '2px' : this.props.name === 'master' ? '1px' : '', | 3354 | // left: this.props.name === 'slaveInfo' ? '2px' : this.props.name === 'master' ? '1px' : '', |
| 2947 | - position: 'absolute', | ||
| 2948 | - height: '100%', | ||
| 2949 | - overflow: 'hidden', | 3355 | + position: "absolute", |
| 3356 | + height: "100%", | ||
| 3357 | + overflow: "hidden", | ||
| 2950 | }} | 3358 | }} |
| 2951 | > | 3359 | > |
| 2952 | <span | 3360 | <span |
| 2953 | onClick={this.handleViewClick} | 3361 | onClick={this.handleViewClick} |
| 2954 | className="masterLinkSpan" | 3362 | className="masterLinkSpan" |
| 2955 | style={{ | 3363 | style={{ |
| 2956 | - transform: 'none', | 3364 | + transform: "none", |
| 2957 | top: 0, | 3365 | top: 0, |
| 2958 | }} | 3366 | }} |
| 2959 | > | 3367 | > |
| 2960 | {this.props.dataValue} | 3368 | {this.props.dataValue} |
| 2961 | </span> | 3369 | </span> |
| 2962 | - </div>); | 3370 | + </div> |
| 3371 | + ); | ||
| 2963 | } | 3372 | } |
| 2964 | - const sModelsType = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : ''; | ||
| 2965 | - const pleaseSelect = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'pleaseSelect') : '请选择' ; | ||
| 2966 | - const combinedInfo = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'CombinedInfo') : '合版信息' ; | 3373 | + const sModelsType = |
| 3374 | + commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? this.props.app.currentPane.sModelsType : ""; | ||
| 3375 | + const pleaseSelect = | ||
| 3376 | + commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) | ||
| 3377 | + ? commonFunc.showMessage(this.props.app.commonConst, "pleaseSelect") | ||
| 3378 | + : "请选择"; | ||
| 3379 | + const combinedInfo = | ||
| 3380 | + commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) | ||
| 3381 | + ? commonFunc.showMessage(this.props.app.commonConst, "CombinedInfo") | ||
| 3382 | + : "合版信息"; | ||
| 2967 | let bParamColor = false; | 3383 | let bParamColor = false; |
| 2968 | - if (this.props && sName === 'sParamValue' && this.props.dataValue) { | ||
| 2969 | - if (this.props.dataValue === '选择色序' || this.props.record.sParamKey === 'sParam1001') { | 3384 | + if (this.props && sName === "sParamValue" && this.props.dataValue) { |
| 3385 | + if (this.props.dataValue === "选择色序" || this.props.record.sParamKey === "sParam1001") { | ||
| 2970 | bParamColor = true; | 3386 | bParamColor = true; |
| 2971 | } | 3387 | } |
| 2972 | } | 3388 | } |
| 2973 | - if (sName === 'sCombinedMemo' || sName === 'sColorSerialMemo' || bSColorSerialMemo || bParamColor || sName === 'sPositiveColor' || sName === 'sOppositeColor' || sName === 'sCombineProductNameNew' || sName === 'sParams' || sName === 'sParamsNew' || sName === 'sQuoParams' || (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes('Set') && sName === 'sCombinePartsNameNew')) { | ||
| 2974 | - let sValue = ''; | 3389 | + if ( |
| 3390 | + sName === "sCombinedMemo" || | ||
| 3391 | + sName === "sColorSerialMemo" || | ||
| 3392 | + bSColorSerialMemo || | ||
| 3393 | + bParamColor || | ||
| 3394 | + sName === "sPositiveColor" || | ||
| 3395 | + sName === "sOppositeColor" || | ||
| 3396 | + sName === "sCombineProductNameNew" || | ||
| 3397 | + sName === "sParams" || | ||
| 3398 | + sName === "sParamsNew" || | ||
| 3399 | + sName === "sQuoParams" || | ||
| 3400 | + (commonUtils.isNotEmptyObject(sModelsType) && !sModelsType.includes("Set") && sName === "sCombinePartsNameNew") | ||
| 3401 | + ) { | ||
| 3402 | + let sValue = ""; | ||
| 2975 | /* 将合版信息json解析成需要的字符串形式 */ | 3403 | /* 将合版信息json解析成需要的字符串形式 */ |
| 2976 | - if (sName === 'sCombinedMemo') { | 3404 | + if (sName === "sCombinedMemo") { |
| 2977 | let JsonData = []; | 3405 | let JsonData = []; |
| 2978 | if (commonUtils.isNotEmptyObject(this.props.dataValue)) { | 3406 | if (commonUtils.isNotEmptyObject(this.props.dataValue)) { |
| 2979 | try { | 3407 | try { |
| @@ -2983,10 +3411,10 @@ export default class CommonComponent extends Component { | @@ -2983,10 +3411,10 @@ export default class CommonComponent extends Component { | ||
| 2983 | } | 3411 | } |
| 2984 | } | 3412 | } |
| 2985 | if (commonUtils.isNotEmptyArr(JsonData)) { | 3413 | if (commonUtils.isNotEmptyArr(JsonData)) { |
| 2986 | - JsonData.forEach((item) => { | 3414 | + JsonData.forEach(item => { |
| 2987 | sValue += `${item.sProductNo}:排${item.dCombineQty}个,`; | 3415 | sValue += `${item.sProductNo}:排${item.dCombineQty}个,`; |
| 2988 | }); | 3416 | }); |
| 2989 | - sValue = commonUtils.isNotEmptyObject(sValue) ? sValue.substr(0, sValue.length - 1) : ''; | 3417 | + sValue = commonUtils.isNotEmptyObject(sValue) ? sValue.substr(0, sValue.length - 1) : ""; |
| 2990 | } | 3418 | } |
| 2991 | } else if (sName === "sColorSerialMemo" || bSColorSerialMemo || sName === "sPositiveColor" || sName === "sOppositeColor" || bParamColor) { | 3419 | } else if (sName === "sColorSerialMemo" || bSColorSerialMemo || sName === "sPositiveColor" || sName === "sOppositeColor" || bParamColor) { |
| 2992 | let JsonData = []; | 3420 | let JsonData = []; |
| @@ -3034,8 +3462,8 @@ export default class CommonComponent extends Component { | @@ -3034,8 +3462,8 @@ export default class CommonComponent extends Component { | ||
| 3034 | className="sActiveIdStyle sActiveIdStyle_viewChooseSpan" | 3462 | className="sActiveIdStyle sActiveIdStyle_viewChooseSpan" |
| 3035 | title={sValue} | 3463 | title={sValue} |
| 3036 | style={{ | 3464 | style={{ |
| 3037 | - display: 'block', | ||
| 3038 | - position: 'relative', | 3465 | + display: "block", |
| 3466 | + position: "relative", | ||
| 3039 | // top: this.props.name === 'slaveInfo' ? '1px' : '', | 3467 | // top: this.props.name === 'slaveInfo' ? '1px' : '', |
| 3040 | // left: this.props.name === 'slaveInfo' ? '2px' : this.props.name === 'master' ? '1px' : '', | 3468 | // left: this.props.name === 'slaveInfo' ? '2px' : this.props.name === 'master' ? '1px' : '', |
| 3041 | }} | 3469 | }} |
| @@ -3044,47 +3472,72 @@ export default class CommonComponent extends Component { | @@ -3044,47 +3472,72 @@ export default class CommonComponent extends Component { | ||
| 3044 | onClick={this.handleViewChoose} | 3472 | onClick={this.handleViewChoose} |
| 3045 | className="viewChooseSpan" | 3473 | className="viewChooseSpan" |
| 3046 | style={{ | 3474 | style={{ |
| 3047 | - width: '100%', overflow: 'hidden', color: '#2f54eb', background: 'transparent', | 3475 | + width: "100%", |
| 3476 | + overflow: "hidden", | ||
| 3477 | + color: "#2f54eb", | ||
| 3478 | + background: "transparent", | ||
| 3048 | }} | 3479 | }} |
| 3049 | - > {commonUtils.isNotEmptyObject(sValue) ? sValue : sName === 'sCombinedMemo' ? combinedInfo : pleaseSelect} | 3480 | + > |
| 3481 | + {" "} | ||
| 3482 | + {commonUtils.isNotEmptyObject(sValue) ? sValue : sName === "sCombinedMemo" ? combinedInfo : pleaseSelect} | ||
| 3050 | </span> | 3483 | </span> |
| 3051 | - </div>); | 3484 | + </div> |
| 3485 | + ); | ||
| 3052 | } | 3486 | } |
| 3053 | /* commonClassify 制单日期、制单人员新增时设置保存时自动生成 */ | 3487 | /* commonClassify 制单日期、制单人员新增时设置保存时自动生成 */ |
| 3054 | - let speacilNote = ''; | 3488 | + let speacilNote = ""; |
| 3055 | const { record } = this.props; | 3489 | const { record } = this.props; |
| 3056 | - const afterSave = commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) ? commonFunc.showMessage(this.props.app.commonConst, 'afterSave') : '保存后自动生成'; | ||
| 3057 | - if (commonUtils.isNotEmptyObject(record) && commonUtils.isEmptyObject(record[sName]) && commonUtils.isNotEmptyObject(sName) && (sName === 'tCreateDate' || sName === 'sMakePerson')) { | ||
| 3058 | - speacilNote = (<div className="speacialNote" style={{ position: 'absolute', padding: '0px 4px' }}> {afterSave}</div>); | 3490 | + const afterSave = |
| 3491 | + commonUtils.isNotEmptyObject(this.props) && commonUtils.isNotEmptyObject(this.props.app) | ||
| 3492 | + ? commonFunc.showMessage(this.props.app.commonConst, "afterSave") | ||
| 3493 | + : "保存后自动生成"; | ||
| 3494 | + if ( | ||
| 3495 | + commonUtils.isNotEmptyObject(record) && | ||
| 3496 | + commonUtils.isEmptyObject(record[sName]) && | ||
| 3497 | + commonUtils.isNotEmptyObject(sName) && | ||
| 3498 | + (sName === "tCreateDate" || sName === "sMakePerson") | ||
| 3499 | + ) { | ||
| 3500 | + speacilNote = ( | ||
| 3501 | + <div className="speacialNote" style={{ position: "absolute", padding: "0px 4px" }}> | ||
| 3502 | + {" "} | ||
| 3503 | + {afterSave} | ||
| 3504 | + </div> | ||
| 3505 | + ); | ||
| 3059 | } | 3506 | } |
| 3060 | 3507 | ||
| 3061 | - const bShowMemo = false && commonUtils.isNotEmptyObject(sName) && sName.indexOf('sMemo') > -1 && !sName.includes('ProcessMemo'); /* 非编辑状态下 备注以蓝色链接呈现 */ | 3508 | + const bShowMemo = |
| 3509 | + false && | ||
| 3510 | + commonUtils.isNotEmptyObject(sName) && | ||
| 3511 | + sName.indexOf("sMemo") > -1 && | ||
| 3512 | + !sName.includes("ProcessMemo"); /* 非编辑状态下 备注以蓝色链接呈现 */ | ||
| 3062 | /* 如果是图片类型 ,加载图片 */ | 3513 | /* 如果是图片类型 ,加载图片 */ |
| 3063 | - let imgBox = ''; | ||
| 3064 | - if (commonUtils.isNotEmptyObject(sName) && sName.indexOf('picture') > -1) { | ||
| 3065 | - const picAddr = commonUtils.isNotEmptyObject(record[sName]) ? record[sName].split(',') : ''; | 3514 | + let imgBox = ""; |
| 3515 | + if (commonUtils.isNotEmptyObject(sName) && sName.indexOf("picture") > -1) { | ||
| 3516 | + const picAddr = commonUtils.isNotEmptyObject(record[sName]) ? record[sName].split(",") : ""; | ||
| 3066 | if (commonUtils.isNotEmptyObject(picAddr)) { | 3517 | if (commonUtils.isNotEmptyObject(picAddr)) { |
| 3067 | const { token } = this.props.app; | 3518 | const { token } = this.props.app; |
| 3068 | - const dataUrl = picAddr[0].includes('xlyerpfiles') ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` : picAddr[0]; /* 缩略图 */ | 3519 | + const dataUrl = picAddr[0].includes("xlyerpfiles") |
| 3520 | + ? `${commonConfig.file_host}file/download?savePathStr=${picAddr[0]}&scale=0.1&sModelsId=100&token=${token}` | ||
| 3521 | + : picAddr[0]; /* 缩略图 */ | ||
| 3069 | // const dataPriviewUrl = `${commonConfig.server_host}file/download?savePathStr=${picAddr}&width=800&&height=500&sModelsId=100&token=${token}`; /* 预览 */ | 3522 | // const dataPriviewUrl = `${commonConfig.server_host}file/download?savePathStr=${picAddr}&width=800&&height=500&sModelsId=100&token=${token}`; /* 预览 */ |
| 3070 | - const officeFileTypeList = ['PDF', 'DOCX', 'XLSX']; | ||
| 3071 | - const imgTypeList = ['PNG', 'SVG', 'JPG', 'JPEG', 'GIF', 'BMP', 'TIFF', 'ICO']; | ||
| 3072 | - const officeFileType = picAddr[0].split('.').pop().toUpperCase(); | 3523 | + const officeFileTypeList = ["PDF", "DOCX", "XLSX"]; |
| 3524 | + const imgTypeList = ["PNG", "SVG", "JPG", "JPEG", "GIF", "BMP", "TIFF", "ICO"]; | ||
| 3525 | + const officeFileType = picAddr[0].split(".").pop().toUpperCase(); | ||
| 3073 | let fileIcon = <FilePdfOutlined />; | 3526 | let fileIcon = <FilePdfOutlined />; |
| 3074 | - if (officeFileType === 'DOCX') { | 3527 | + if (officeFileType === "DOCX") { |
| 3075 | fileIcon = <FileWordOutlined />; | 3528 | fileIcon = <FileWordOutlined />; |
| 3076 | - } else if (officeFileType === 'XLSX') { | 3529 | + } else if (officeFileType === "XLSX") { |
| 3077 | fileIcon = <FileExcelOutlined />; | 3530 | fileIcon = <FileExcelOutlined />; |
| 3078 | } | 3531 | } |
| 3079 | - let imgBox1 = ''; | 3532 | + let imgBox1 = ""; |
| 3080 | if (officeFileTypeList.includes(officeFileType)) { | 3533 | if (officeFileTypeList.includes(officeFileType)) { |
| 3081 | imgBox1 = ( | 3534 | imgBox1 = ( |
| 3082 | <span | 3535 | <span |
| 3083 | style={{ | 3536 | style={{ |
| 3084 | - width: '100%', | ||
| 3085 | - overflow: 'hidden', | ||
| 3086 | - background: 'transparent', | ||
| 3087 | - cursor: 'pointer', | 3537 | + width: "100%", |
| 3538 | + overflow: "hidden", | ||
| 3539 | + background: "transparent", | ||
| 3540 | + cursor: "pointer", | ||
| 3088 | paddingTop: 14, | 3541 | paddingTop: 14, |
| 3089 | }} | 3542 | }} |
| 3090 | onClick={() => { | 3543 | onClick={() => { |
| @@ -3098,28 +3551,23 @@ export default class CommonComponent extends Component { | @@ -3098,28 +3551,23 @@ export default class CommonComponent extends Component { | ||
| 3098 | imgBox1 = ( | 3551 | imgBox1 = ( |
| 3099 | <span | 3552 | <span |
| 3100 | style={{ | 3553 | style={{ |
| 3101 | - width: '100%', | ||
| 3102 | - overflow: 'hidden', | ||
| 3103 | - background: 'transparent', | ||
| 3104 | - cursor: 'pointer', | 3554 | + width: "100%", |
| 3555 | + overflow: "hidden", | ||
| 3556 | + background: "transparent", | ||
| 3557 | + cursor: "pointer", | ||
| 3105 | }} | 3558 | }} |
| 3106 | onClick={e => this.handlePreviewImage(e, picAddr)} | 3559 | onClick={e => this.handlePreviewImage(e, picAddr)} |
| 3107 | > | 3560 | > |
| 3108 | - <img | ||
| 3109 | - src={dataUrl} | ||
| 3110 | - alt="img" | ||
| 3111 | - onFocus={() => 0} | ||
| 3112 | - style={{ width: '30px', height: '20px' }} | ||
| 3113 | - /> | 3561 | + <img src={dataUrl} alt="img" onFocus={() => 0} style={{ width: "30px", height: "20px" }} /> |
| 3114 | </span> | 3562 | </span> |
| 3115 | ); | 3563 | ); |
| 3116 | } else { | 3564 | } else { |
| 3117 | imgBox1 = ( | 3565 | imgBox1 = ( |
| 3118 | <span | 3566 | <span |
| 3119 | style={{ | 3567 | style={{ |
| 3120 | - width: '100%', | ||
| 3121 | - overflow: 'hidden', | ||
| 3122 | - background: 'transparent', | 3568 | + width: "100%", |
| 3569 | + overflow: "hidden", | ||
| 3570 | + background: "transparent", | ||
| 3123 | paddingTop: 14, | 3571 | paddingTop: 14, |
| 3124 | }} | 3572 | }} |
| 3125 | > | 3573 | > |
| @@ -3132,46 +3580,68 @@ export default class CommonComponent extends Component { | @@ -3132,46 +3580,68 @@ export default class CommonComponent extends Component { | ||
| 3132 | className="sActiveIdStyle" | 3580 | className="sActiveIdStyle" |
| 3133 | title={this.props.dataValue} | 3581 | title={this.props.dataValue} |
| 3134 | style={{ | 3582 | style={{ |
| 3135 | - position: 'absolute', | ||
| 3136 | - padding: '0px 11px 0 4px', | ||
| 3137 | - width: '97%', | ||
| 3138 | - height: '93%', | ||
| 3139 | - fontSize: '12px', | ||
| 3140 | - zIndex: '10', | ||
| 3141 | - whiteSpace: 'nowrap', | ||
| 3142 | - textOverflow: 'ellipsis', | ||
| 3143 | - overflow: 'hidden', | ||
| 3144 | - backgroundColor: '#fff', | 3583 | + position: "absolute", |
| 3584 | + padding: "0px 11px 0 4px", | ||
| 3585 | + width: "97%", | ||
| 3586 | + height: "93%", | ||
| 3587 | + fontSize: "12px", | ||
| 3588 | + zIndex: "10", | ||
| 3589 | + whiteSpace: "nowrap", | ||
| 3590 | + textOverflow: "ellipsis", | ||
| 3591 | + overflow: "hidden", | ||
| 3592 | + backgroundColor: "#fff", | ||
| 3145 | marginTop: 1, | 3593 | marginTop: 1, |
| 3146 | - boxShadow: 'none', | 3594 | + boxShadow: "none", |
| 3147 | }} | 3595 | }} |
| 3148 | > | 3596 | > |
| 3149 | {imgBox1} | 3597 | {imgBox1} |
| 3150 | - </div>); | ||
| 3151 | - } | ||
| 3152 | - } else if (this.props.name === 'master' && sName !== 'sQualityRequirementsMemo' && !this.props.enabled && commonUtils.isNotEmptyObject(sName) && bShowMemo) { /* 所有备注非编辑状态下点击链接可以弹出备注窗体 */ | 3598 | + </div> |
| 3599 | + ); | ||
| 3600 | + } | ||
| 3601 | + } else if ( | ||
| 3602 | + this.props.name === "master" && | ||
| 3603 | + sName !== "sQualityRequirementsMemo" && | ||
| 3604 | + !this.props.enabled && | ||
| 3605 | + commonUtils.isNotEmptyObject(sName) && | ||
| 3606 | + bShowMemo | ||
| 3607 | + ) { | ||
| 3608 | + /* 所有备注非编辑状态下点击链接可以弹出备注窗体 */ | ||
| 3153 | imgBox = ( | 3609 | imgBox = ( |
| 3154 | <div | 3610 | <div |
| 3155 | className={`sActiveIdStyle sActiveIdStyle-${this.props.showConfig.sName} masterMemo`} | 3611 | className={`sActiveIdStyle sActiveIdStyle-${this.props.showConfig.sName} masterMemo`} |
| 3156 | title={this.props.dataValue} | 3612 | title={this.props.dataValue} |
| 3157 | style={{ | 3613 | style={{ |
| 3158 | - position: 'absolute', padding: '0px 4px', width: '100%', height: '100%', fontSize: '12px', zIndex: '10', whiteSpace: 'nowrap', textOverflow: 'ellipsis', overflow: 'hidden', | 3614 | + position: "absolute", |
| 3615 | + padding: "0px 4px", | ||
| 3616 | + width: "100%", | ||
| 3617 | + height: "100%", | ||
| 3618 | + fontSize: "12px", | ||
| 3619 | + zIndex: "10", | ||
| 3620 | + whiteSpace: "nowrap", | ||
| 3621 | + textOverflow: "ellipsis", | ||
| 3622 | + overflow: "hidden", | ||
| 3159 | }} | 3623 | }} |
| 3160 | > | 3624 | > |
| 3161 | <span | 3625 | <span |
| 3162 | onClick={this.handleMemoShow} | 3626 | onClick={this.handleMemoShow} |
| 3163 | style={{ | 3627 | style={{ |
| 3164 | - width: '100%', overflow: 'hidden', color: '#2f54eb', background: 'transparent', | 3628 | + width: "100%", |
| 3629 | + overflow: "hidden", | ||
| 3630 | + color: "#2f54eb", | ||
| 3631 | + background: "transparent", | ||
| 3165 | }} | 3632 | }} |
| 3166 | - > <pre>{this.props.dataValue} </pre> | 3633 | + > |
| 3634 | + {" "} | ||
| 3635 | + <pre>{this.props.dataValue} </pre> | ||
| 3167 | </span> | 3636 | </span> |
| 3168 | - </div>); | 3637 | + </div> |
| 3638 | + ); | ||
| 3169 | // 富文本处理 | 3639 | // 富文本处理 |
| 3170 | // if (this.props.showConfig.bEditor) { | 3640 | // if (this.props.showConfig.bEditor) { |
| 3171 | // imgBox = (<></>); | 3641 | // imgBox = (<></>); |
| 3172 | // } | 3642 | // } |
| 3173 | - if (this.props.showConfig.sName && this.props.showConfig.sName.toLowerCase().includes('fullmemo')) { | ||
| 3174 | - imgBox = (<></>); | 3643 | + if (this.props.showConfig.sName && this.props.showConfig.sName.toLowerCase().includes("fullmemo")) { |
| 3644 | + imgBox = <></>; | ||
| 3175 | } | 3645 | } |
| 3176 | } | 3646 | } |
| 3177 | /* 获取outformitem控件参数 */ | 3647 | /* 获取outformitem控件参数 */ |
| @@ -3179,13 +3649,25 @@ export default class CommonComponent extends Component { | @@ -3179,13 +3649,25 @@ export default class CommonComponent extends Component { | ||
| 3179 | /* 获取fieldDecorator参数 */ | 3649 | /* 获取fieldDecorator参数 */ |
| 3180 | const fieldDecoratorProps = this.getFieldDecoratorProps(); | 3650 | const fieldDecoratorProps = this.getFieldDecoratorProps(); |
| 3181 | /* 通用组件(主表存在getFieldDecorator表单验证,而从表则不需要) */ | 3651 | /* 通用组件(主表存在getFieldDecorator表单验证,而从表则不需要) */ |
| 3182 | - const commonAssembly = (<FormItem {...outFormItemProps} required={this.props.showConfig.bNotEmpty}> {speacilNote}{imgBox}{!this.props.bTable ? this.getFieldDecorator(this.props.showConfig.sName, fieldDecoratorProps)(innerInput) : innerInput}{viewInfo} </FormItem>); | 3652 | + const commonAssembly = ( |
| 3653 | + <FormItem {...outFormItemProps} required={this.props.showConfig.bNotEmpty}> | ||
| 3654 | + {" "} | ||
| 3655 | + {speacilNote} | ||
| 3656 | + {imgBox} | ||
| 3657 | + {!this.props.bTable ? this.getFieldDecorator(this.props.showConfig.sName, fieldDecoratorProps)(innerInput) : innerInput} | ||
| 3658 | + {viewInfo}{" "} | ||
| 3659 | + </FormItem> | ||
| 3660 | + ); | ||
| 3183 | const { iColValue, showConfig } = this.props; | 3661 | const { iColValue, showConfig } = this.props; |
| 3184 | - const readonlyStyle = showConfig.bReadonly || showConfig.iTag === 1 ? 'readonlyStyle' : ''; | ||
| 3185 | - const costomStyle = showConfig.costomStyle || ''; | 3662 | + const readonlyStyle = showConfig.bReadonly || showConfig.iTag === 1 ? "readonlyStyle" : ""; |
| 3663 | + const costomStyle = showConfig.costomStyle || ""; | ||
| 3186 | /* 页面输出 */ | 3664 | /* 页面输出 */ |
| 3187 | return ( | 3665 | return ( |
| 3188 | - <div ref={this.myRef} className={iColValue === 24 ? 'input24' : iColValue === 18 ? 'input18' : iColValue === 12 ? 'input12' : 'changeClassName'} key={this.state.key}> | 3666 | + <div |
| 3667 | + ref={this.myRef} | ||
| 3668 | + className={iColValue === 24 ? "input24" : iColValue === 18 ? "input18" : iColValue === 12 ? "input12" : "changeClassName"} | ||
| 3669 | + key={this.state.key} | ||
| 3670 | + > | ||
| 3189 | <div className={`${this.props.className} ${readonlyStyle} ${costomStyle}`} onClick={this.props.onCostomClick?.bind(this, showConfig)}> | 3671 | <div className={`${this.props.className} ${readonlyStyle} ${costomStyle}`} onClick={this.props.onCostomClick?.bind(this, showConfig)}> |
| 3190 | {commonAssembly} | 3672 | {commonAssembly} |
| 3191 | </div> | 3673 | </div> |
src/mobile/quotation/detailNew.jsx
| @@ -915,9 +915,9 @@ const QuickQuoteEvent = props => { | @@ -915,9 +915,9 @@ const QuickQuoteEvent = props => { | ||
| 915 | 915 | ||
| 916 | const result = await props.handleCalculation( | 916 | const result = await props.handleCalculation( |
| 917 | false, | 917 | false, |
| 918 | - { ...masterProps, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData }, | 918 | + { ...masterProps, ...newState, manyqtysConfig: state.manyConfig, manyqtysData: state.manyData ,state}, |
| 919 | true, | 919 | true, |
| 920 | - props | 920 | + {...props, state} |
| 921 | ); | 921 | ); |
| 922 | 922 | ||
| 923 | if (commonUtils.isEmptyObject(result)) { | 923 | if (commonUtils.isEmptyObject(result)) { |
| @@ -1080,11 +1080,10 @@ const QuotationDetail = props => { | @@ -1080,11 +1080,10 @@ const QuotationDetail = props => { | ||
| 1080 | if (!masterConfig) return ""; | 1080 | if (!masterConfig) return ""; |
| 1081 | const ableConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName && item.bVisible); | 1081 | const ableConfigs = masterConfig.gdsconfigformslave.filter(item => item.sName && item.bVisible); |
| 1082 | // 处理长宽样式 | 1082 | // 处理长宽样式 |
| 1083 | - const viewConfigs = | ||
| 1084 | - selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sTypeKey !== "不干胶" | ||
| 1085 | - ? ableConfigs | ||
| 1086 | - : ableConfigs.filter(x => x.sName !== "dHeight"); | ||
| 1087 | - if (selectedNode?.bBox && selectedNode.sTypeKey !== "kapai" && selectedNode?.bBox && selectedNode.sProductType !== "不干胶") { | 1083 | + const { sStripType = 0 } = selectedNode; |
| 1084 | + const viewConfigs = Number(sStripType) === 0 ? ableConfigs : ableConfigs.filter(x => x.sName !== "dHeight"); | ||
| 1085 | + const lengthData = viewConfigs.find(x => x.sName === "dLength"); | ||
| 1086 | + if (Number(sStripType) === 0) { | ||
| 1088 | viewConfigs.forEach(item => { | 1087 | viewConfigs.forEach(item => { |
| 1089 | if (item.sName === "dLength" || item.sName === "dWidth") { | 1088 | if (item.sName === "dLength" || item.sName === "dWidth") { |
| 1090 | item.iColValue = 4; | 1089 | item.iColValue = 4; |
| @@ -1095,7 +1094,6 @@ const QuotationDetail = props => { | @@ -1095,7 +1094,6 @@ const QuotationDetail = props => { | ||
| 1095 | item.iColValue = viewConfigs[0].iColValue; | 1094 | item.iColValue = viewConfigs[0].iColValue; |
| 1096 | }); | 1095 | }); |
| 1097 | } | 1096 | } |
| 1098 | - const lengthData = viewConfigs.find(x => x.sName === "dLength"); | ||
| 1099 | if (selectedNode.sTypeKey !== "danye") { | 1097 | if (selectedNode.sTypeKey !== "danye") { |
| 1100 | if (lengthData) { | 1098 | if (lengthData) { |
| 1101 | lengthData.showName = "高(D)"; | 1099 | lengthData.showName = "高(D)"; |
| @@ -1573,6 +1571,9 @@ const BoxComponent = props => { | @@ -1573,6 +1571,9 @@ const BoxComponent = props => { | ||
| 1573 | if (selectedNode.bPartsDimension === false && (item.sName === "dPartsLength" || item.sName === "dPartsWidth")) { | 1571 | if (selectedNode.bPartsDimension === false && (item.sName === "dPartsLength" || item.sName === "dPartsWidth")) { |
| 1574 | return false; | 1572 | return false; |
| 1575 | } | 1573 | } |
| 1574 | + if (!selectedNode.bBleed && item.sName === "dBleed") { | ||
| 1575 | + return false; | ||
| 1576 | + } | ||
| 1576 | return item.iTag === iTag; | 1577 | return item.iTag === iTag; |
| 1577 | }); | 1578 | }); |
| 1578 | let boxConfigList = []; | 1579 | let boxConfigList = []; |
| @@ -1634,7 +1635,7 @@ const filterConditions = { | @@ -1634,7 +1635,7 @@ const filterConditions = { | ||
| 1634 | x.sName === "dRowGap" || | 1635 | x.sName === "dRowGap" || |
| 1635 | x.sName === "dColGap" || | 1636 | x.sName === "dColGap" || |
| 1636 | x.sName === "sPaperDirection", | 1637 | x.sName === "sPaperDirection", |
| 1637 | - default: x => x.sName === "sMagnification" || x.sName === "dPartsLength" || x.sName === "dPartsWidth" || x.sName === "dSumPQty", | 1638 | + default: x => x.sName === "dBleed" || x.sName === "sMagnification" || x.sName === "dPartsLength" || x.sName === "dPartsWidth" || x.sName === "dSumPQty", |
| 1638 | }; | 1639 | }; |
| 1639 | if (upViewProps12 && selectedNode.sProductType === "不干胶") { | 1640 | if (upViewProps12 && selectedNode.sProductType === "不干胶") { |
| 1640 | upViewProps12.viewConfigs = upViewProps12?.viewConfigs.filter(filterConditions.juantong); | 1641 | upViewProps12.viewConfigs = upViewProps12?.viewConfigs.filter(filterConditions.juantong); |
| @@ -1728,7 +1729,7 @@ const filterConditions = { | @@ -1728,7 +1729,7 @@ const filterConditions = { | ||
| 1728 | const [materialLength, setMaterialLength] = useState(0); | 1729 | const [materialLength, setMaterialLength] = useState(0); |
| 1729 | const [materialWidth, setMaterialWidth] = useState(0); | 1730 | const [materialWidth, setMaterialWidth] = useState(0); |
| 1730 | // 使用 useCallback 确保回调函数的稳定性 | 1731 | // 使用 useCallback 确保回调函数的稳定性 |
| 1731 | - const handleSaveState = ( | 1732 | + const handleSaveState = |
| 1732 | ( | 1733 | ( |
| 1733 | length, | 1734 | length, |
| 1734 | width, | 1735 | width, |
| @@ -1815,9 +1816,8 @@ const filterConditions = { | @@ -1815,9 +1816,8 @@ const filterConditions = { | ||
| 1815 | 1816 | ||
| 1816 | setMaterialLength(length); | 1817 | setMaterialLength(length); |
| 1817 | setMaterialWidth(width); | 1818 | setMaterialWidth(width); |
| 1818 | - }, | ||
| 1819 | - [] | ||
| 1820 | - ); | 1819 | + } |
| 1820 | + ; | ||
| 1821 | const onSaveDPartsLength = useCallback((innerWidth, innerHeight, slaveData) => { | 1821 | const onSaveDPartsLength = useCallback((innerWidth, innerHeight, slaveData) => { |
| 1822 | const { selectedNode } = props.state; | 1822 | const { selectedNode } = props.state; |
| 1823 | const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); | 1823 | const index = slaveData?.findIndex(x => x.sTreeNodeName === selectedNode.showName && x.sBoxModel === props.boxModel); |
src/mobile/quotation/master.jsx
| @@ -361,8 +361,8 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => { | @@ -361,8 +361,8 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => { | ||
| 361 | packConfig, | 361 | packConfig, |
| 362 | packDelData, | 362 | packDelData, |
| 363 | manyDataCache = [], | 363 | manyDataCache = [], |
| 364 | - dQuickQuoteProductQty, | ||
| 365 | } = nextProps; | 364 | } = nextProps; |
| 365 | + const { dQuickQuoteProductQty } = props.state; | ||
| 366 | let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps; | 366 | let { slaveData, controlData, materialsData, processData, masterData, manyqtysData, packData } = nextProps; |
| 367 | const sMakePerson = masterData.sMakePerson; | 367 | const sMakePerson = masterData.sMakePerson; |
| 368 | const data = []; | 368 | const data = []; |
| @@ -426,6 +426,12 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => { | @@ -426,6 +426,12 @@ const handleCalculation = async (bSave, nextProps, isWait, props) => { | ||
| 426 | slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`].map(item => { | 426 | slaveData = valueReturn[`${slaveConfig.sTbName.toLowerCase()}_tmp`].map(item => { |
| 427 | item.handleType = dQuickQuoteProductQty ? "update" : item.handleType; | 427 | item.handleType = dQuickQuoteProductQty ? "update" : item.handleType; |
| 428 | item.sId = commonUtils.createSid(); | 428 | item.sId = commonUtils.createSid(); |
| 429 | + if (dQuickQuoteProductQty) { | ||
| 430 | + item.dProductQty = dQuickQuoteProductQty; | ||
| 431 | + } | ||
| 432 | + // 这里需要改变数量 看看是否是多数量报价dProductQty | ||
| 433 | + console.log(props,nextProps, "dQuickQuoteProductQty"); | ||
| 434 | + | ||
| 429 | return item; | 435 | return item; |
| 430 | }); | 436 | }); |
| 431 | 437 |