Commit d488865786b247902d052947f651e62064be92f6
1 parent
43b4b35a
tab页面
Showing
170 changed files
with
48317 additions
and
182 deletions
Too many changes to show.
To preserve performance only 8 of 170 files are displayed.
src/components/AuditInformation/AuditInformation.js
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | import React, { Component } from 'react'; |
| 7 | 7 | import { Form } from '@ant-design/compatible'; |
| 8 | 8 | import '@ant-design/compatible/assets/index.css'; |
| 9 | -import { Layout, Spin, Tabs, Avatar, message, Select, Input, Button } from 'antd'; | |
| 9 | +import { Layout, Spin, Tabs, Avatar, message, Select, Input, Button } from 'antd-v4'; | |
| 10 | 10 | import * as commonFunc from './../Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ |
| 11 | 11 | import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */ |
| 12 | 12 | import styles from './../../index.less'; | ... | ... |
src/components/Charts/Pie/index.js
| 1 | 1 | /* eslint-disable no-undef, jsx-a11y/no-noninteractive-element-interactions */ |
| 2 | 2 | import React, { Component } from 'react'; |
| 3 | 3 | import G2 from '@antv/g2'; |
| 4 | -import { Divider } from 'antd'; | |
| 4 | +import { Divider } from 'antd-v4'; | |
| 5 | 5 | import classNames from 'classnames'; |
| 6 | 6 | import ReactFitText from 'react-fittext'; |
| 7 | 7 | import Debounce from 'lodash-decorators/debounce'; | ... | ... |
src/components/Charts/PieGroup/index.js
src/components/Charts/TimeLineGroup/index.js
| 1 | 1 | /* eslint-disable object-curly-newline */ |
| 2 | 2 | import React, { Component } from 'react'; |
| 3 | -import { Row, Col, Tabs } from 'antd'; | |
| 3 | +import { Row, Col, Tabs } from 'antd-v4'; | |
| 4 | 4 | import TimeLineChart from '../TimelineChart'; |
| 5 | 5 | import NumberInfo from '../../NumberInfo'; |
| 6 | 6 | import Pie from '../Pie'; | ... | ... |
src/components/Common/AntdDraggableModal.js
src/components/Common/AssignmentField.js
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | */ |
| 4 | 4 | /* eslint-disable no-undef,import/first,prefer-destructuring,jsx-a11y/alt-text */ |
| 5 | 5 | import React, { Component } from 'react'; |
| 6 | -import { Modal } from 'antd'; | |
| 6 | +import { Modal } from 'antd-v4'; | |
| 7 | 7 | import styles from '@/index.less'; |
| 8 | 8 | import * as commonUtils from '@/utils/utils'; |
| 9 | 9 | import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */ | ... | ... |
src/components/Common/CommonBill/index.js
| ... | ... | @@ -17,7 +17,7 @@ import { |
| 17 | 17 | Upload, |
| 18 | 18 | Input, |
| 19 | 19 | Modal |
| 20 | -} from 'antd'; | |
| 20 | +} from 'antd-v4'; | |
| 21 | 21 | import { message } from '@/utils/common/message'; |
| 22 | 22 | import CommonSales from '@/components/Common/CommonBillEvent';/* 继承销售模块业务功能 */ |
| 23 | 23 | import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ | ... | ... |
src/components/Common/CommonBillDeliver.js
0 → 100644
| 1 | +/* eslint-disable prefer-destructuring */ | |
| 2 | + | |
| 3 | +import React, { Component } from 'react'; | |
| 4 | +import { UploadOutlined } from '@ant-design/icons'; | |
| 5 | +import { Form } from '@ant-design/compatible'; | |
| 6 | +import '@ant-design/compatible/assets/index.css'; | |
| 7 | +import { Row, Col, Checkbox, Layout, Spin, Tabs, Avatar, Button, message, Table, Input, Upload } from 'antd-v4'; | |
| 8 | +import * as commonFunc from '@/components/Common/commonFunc';/* 通用单据方法 */ /* 通用单据方法 */ | |
| 9 | +import Toolbar from '@/components/Common/ToolBar/ToolBarNew'; | |
| 10 | +import StaticEditTable from '@/components/Common/CommonTable';/* 可编辑表格 */ | |
| 11 | +import styles from '@/index.less'; | |
| 12 | +import CommonView from '@/components/Common/CommonView'; | |
| 13 | +import CommonBase from '@/components/Common/CommonBase';/* 获取配置及数据 */ | |
| 14 | +import * as commonBusiness from '@/components/Common/commonBusiness';/* 单据业务功能 */ | |
| 15 | +import commonConfig from '@/utils/config'; | |
| 16 | +import * as commonUtils from '@/utils/utils';/* 通用方法 */ | |
| 17 | +import * as commonServices from '@/services/services';/* 服务类 */ | |
| 18 | + | |
| 19 | +import AddIcon from '@/assets/add.svg'; | |
| 20 | +import DisableAddIcon from '@/assets/disableadd.svg'; | |
| 21 | +import CopyIcon from '@/assets/copy.svg'; | |
| 22 | +import CopyAllIcon from '@/assets/copyall.svg'; | |
| 23 | +import DisableCopyIcon from '@/assets/disablecopy.svg'; | |
| 24 | +import DisableCopyAllIcon from '@/assets/disablecopyall.svg'; | |
| 25 | +import DelIcon from '@/assets/delete.svg'; | |
| 26 | +import DisableDelIcon from '@/assets/disabledelete.svg';/* 获取配置及数据 */ | |
| 27 | +import MaterialRemarkIcon from '@/assets/materialremark.svg'; | |
| 28 | +import DisMaRemarklIcon from '@/assets/disablematerialremark.svg'; | |
| 29 | +import ProcessIcon from '@/assets/process.svg'; | |
| 30 | +import DisableProcessIcon from '@/assets/disableprocess.svg'; | |
| 31 | +import MateriallIcon from '@/assets/material.svg'; | |
| 32 | +import DisableMateriallIcon from '@/assets/disablematerial.svg'; | |
| 33 | +import AntdDraggableModal from '@/components/Common/AntdDraggableModal'; | |
| 34 | +import CommonListSelect from '@/components/Common/CommonListSelect'; | |
| 35 | +import CommonListSelectTree from '@/components/Common/CommonListSelectTree'; | |
| 36 | + | |
| 37 | +import StaticEditTree from '@/components/Common/Tree/StaticTree'; | |
| 38 | +import AddChildIcon from '@/assets/addChild.svg'; | |
| 39 | +import DisableAddChildIcon from '@/assets/disableaddChild.svg'; | |
| 40 | +import ContextMenuModal from '@/components/Common/ContextMenuModal'; | |
| 41 | +import CommonDeliverSales from '@/components/Common/CommonBillDeliverEvent'; | |
| 42 | + | |
| 43 | +/* 继承销售模块业务功能 */ | |
| 44 | +const width = '18px'; | |
| 45 | +const height = '18px'; | |
| 46 | +const setAdd = { | |
| 47 | + title: '增加', | |
| 48 | + width: { width }, | |
| 49 | + height: { height }, | |
| 50 | + img: <img src={AddIcon} alt="添加" width={width} height={height} />, | |
| 51 | + disableimg: <img src={DisableAddIcon} alt="删除" width={width} height={height} />, | |
| 52 | +}; | |
| 53 | +const setAddChild = { | |
| 54 | + title: '增加', | |
| 55 | + width: { width }, | |
| 56 | + height: { height }, | |
| 57 | + img: <img src={AddChildIcon} alt="添加" width={width} height={height} />, | |
| 58 | + disableimg: <img src={DisableAddChildIcon} alt="添加" width={width} height={height} />, | |
| 59 | +}; | |
| 60 | +const setCopy = { | |
| 61 | + title: '复制', | |
| 62 | + width: { width }, | |
| 63 | + height: { height }, | |
| 64 | + img: <img src={CopyIcon} alt="复制" width="20px" height="20px" />, | |
| 65 | + disableimg: <img src={DisableCopyIcon} alt="复制" width="20px" height="20px" />, | |
| 66 | +}; | |
| 67 | +const setCopyAll = { | |
| 68 | + title: '复制部件', | |
| 69 | + width: { width }, | |
| 70 | + height: { height }, | |
| 71 | + img: <img src={CopyAllIcon} alt="复制部件" width="16px" height="16px" />, | |
| 72 | + disableimg: <img src={DisableCopyAllIcon} alt="复制部件" width="16px" height="16px" />, | |
| 73 | +}; | |
| 74 | +const setDelete = { | |
| 75 | + title: '删除', | |
| 76 | + width: { width }, | |
| 77 | + height: { height }, | |
| 78 | + img: <img src={DelIcon} alt="删除" width={width} height={height} />, | |
| 79 | + disableimg: <img src={DisableDelIcon} alt="删除" width={width} height={height} />, | |
| 80 | +}; | |
| 81 | +const setProcess = { | |
| 82 | + title: '工序', | |
| 83 | + width: { width }, | |
| 84 | + height: { height }, | |
| 85 | + img: <img src={ProcessIcon} alt="选择工序" width="16px" height="16px" />, | |
| 86 | + disableimg: <img src={DisableProcessIcon} alt="删除" width="16px" height="16px" />, | |
| 87 | +}; | |
| 88 | +const setMaterial = { | |
| 89 | + title: '材料', | |
| 90 | + width: { width }, | |
| 91 | + height: { height }, | |
| 92 | + img: <img src={MateriallIcon} alt="选择材料" width="22px" height="22px" />, | |
| 93 | + disableimg: <img src={DisableMateriallIcon} alt="选择材料" width="22px" height="22px" />, | |
| 94 | +}; | |
| 95 | + | |
| 96 | + | |
| 97 | +const { Header, Content, Sider } = Layout; | |
| 98 | +const { TabPane } = Tabs; | |
| 99 | +// const { confirm } = Modal; | |
| 100 | +class CommonBillDeliver extends Component { | |
| 101 | + constructor(props) { | |
| 102 | + super(props); | |
| 103 | + this.state = { | |
| 104 | + }; | |
| 105 | + } | |
| 106 | + /** 行选择 */ | |
| 107 | + onRowClick = (name, record) => { | |
| 108 | + if (name === 'control') { | |
| 109 | + this.props.onTableSelectRowChange(name, [record.sId]); | |
| 110 | + } | |
| 111 | + }; | |
| 112 | + | |
| 113 | + onChange = (checkedValues) => { | |
| 114 | + this.props.onSaveState({ | |
| 115 | + dataPersonArray: checkedValues, | |
| 116 | + }); | |
| 117 | + }; | |
| 118 | + getMenuStatus = (menu) => { | |
| 119 | + if (menu.sControlName === 'BtnImport') { | |
| 120 | + return !this.props.enabled; | |
| 121 | + } | |
| 122 | + }; | |
| 123 | + /** 上传后执行函数 */ | |
| 124 | + handleUploadChangeFile = async (info) => { | |
| 125 | + const { file } = info; | |
| 126 | + const { | |
| 127 | + masterData, sModelsId, app, token, sModelsType, slaveConfig, slaveData, | |
| 128 | + } = this.props; | |
| 129 | + if (file.response) { | |
| 130 | + if (file.response.code === 1) { | |
| 131 | + /* 数据查询成功 */ | |
| 132 | + const errorInfo = file.response.dataset.rows[0].nocanbeInsert; | |
| 133 | + if (commonUtils.isNotEmptyObject(errorInfo)) { | |
| 134 | + message.error(errorInfo[0].sReason); | |
| 135 | + return; | |
| 136 | + } | |
| 137 | + /* 把之前存放的数据删除 */ | |
| 138 | + const slaveDelData = []; | |
| 139 | + if (commonUtils.isNotEmptyArr(slaveData)) { | |
| 140 | + slaveData.forEach((item) => { | |
| 141 | + if (commonUtils.isEmptyObject(item.handleType)) { | |
| 142 | + item.handleType = 'del'; | |
| 143 | + slaveDelData.push(item); | |
| 144 | + } | |
| 145 | + }); | |
| 146 | + } | |
| 147 | + const returnData = file.response.dataset.rows[0].canbeInsert; | |
| 148 | + let iCount = 0; | |
| 149 | + let productIdDropDown; | |
| 150 | + if (productIdDropDown === undefined && commonUtils.isNotEmptyArr(returnData)) { /* 无论导入多少条数据 都只调用1次接口,获取产品下拉数据集 */ | |
| 151 | + const iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 152 | + if (iIndex > -1) { | |
| 153 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[iIndex], returnData[0]); | |
| 154 | + productIdDropDown = sqlDropDownData.dropDownData; | |
| 155 | + } | |
| 156 | + } | |
| 157 | + await returnData.forEach(async (tableDataRow) => { | |
| 158 | + tableDataRow.handleType = 'add'; | |
| 159 | + tableDataRow.sId = commonUtils.createSid(); | |
| 160 | + tableDataRow.sParentId = masterData.sId; | |
| 161 | + tableDataRow.key = tableDataRow.sId; | |
| 162 | + /* 若导入模板没有序号,则序号从1自增 */ | |
| 163 | + if (commonUtils.isEmptyObject(tableDataRow.iOrder)) { | |
| 164 | + iCount += 1; | |
| 165 | + tableDataRow.iOrder = iCount; | |
| 166 | + } | |
| 167 | + for (const child of Object.keys(tableDataRow)) { | |
| 168 | + const index = child.indexOf('_sRealValue_'); | |
| 169 | + if (index > -1) { | |
| 170 | + const property = child.substring(0, child.length - 12); | |
| 171 | + tableDataRow[property] = tableDataRow[child]; | |
| 172 | + } | |
| 173 | + } | |
| 174 | + if (productIdDropDown !== undefined) { | |
| 175 | + const iProductIdIndex = productIdDropDown.findIndex(item => item.sId === tableDataRow.sProductId); | |
| 176 | + if (iProductIdIndex === -1 && commonUtils.isNotEmptyObject(sModelsType) && sModelsType.includes('sales/salesOrder')) { /* 只有销售模块生成新产品 盘点 ,期间 不生成新的产品 */ | |
| 177 | + tableDataRow.sProductId = tableDataRow.sProductName; | |
| 178 | + tableDataRow.sProductInfo = JSON.stringify({ | |
| 179 | + sProductId: tableDataRow.sProductName, | |
| 180 | + sProductName: tableDataRow.sProductName, | |
| 181 | + sProductStyle: tableDataRow.sProductStyle, | |
| 182 | + sProductUnit: tableDataRow.sProductUnit, | |
| 183 | + sProductNo: tableDataRow.sProductNo, | |
| 184 | + sCustomerProductNo: tableDataRow.sCustomerProductNo, | |
| 185 | + sProductClassifyId: tableDataRow.sProductClassifyId, | |
| 186 | + sProductClassifyName: tableDataRow.sProductClassifyName, | |
| 187 | + }); | |
| 188 | + } | |
| 189 | + } | |
| 190 | + if (!tableDataRow.dNProductPrice) { | |
| 191 | + tableDataRow.dNProductPrice = tableDataRow.dProductForeignPrice; | |
| 192 | + } | |
| 193 | + const models = sModelsType.includes('sales/') || sModelsType.includes('manufacture/') || sModelsType.includes('quotation/') || sModelsType.includes('productStock/') ? 'Product' : 'Materials'; | |
| 194 | + if (sModelsType.includes('purchase/') || sModelsType.includes('quotation/') || sModelsType.includes('manufacture/') || sModelsType.includes('materialsStock/') || sModelsType.includes('outside/')) { | |
| 195 | + tableDataRow = await this.props.onMaterialsChange(tableDataRow, sModelsId, masterData, {}, 'dAuxiliaryQty', app, token, models); | |
| 196 | + tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dAuxiliaryQty', masterData, tableDataRow); | |
| 197 | + } else { | |
| 198 | + tableDataRow = commonBusiness.getCalculateAllMoney(app, models, 'dProductQty', masterData, tableDataRow); | |
| 199 | + } | |
| 200 | + }); | |
| 201 | + this.props.onSaveState({ slaveData: returnData, slaveDelData }); | |
| 202 | + } else { /* 失败s */ | |
| 203 | + this.props.getServiceError(file.response); | |
| 204 | + } | |
| 205 | + } | |
| 206 | + }; | |
| 207 | + handleUploadPropsSales = () => { | |
| 208 | + const { masterData, sModelsType } = this.props; | |
| 209 | + if (commonUtils.isNotEmptyObject(masterData)) { | |
| 210 | + const sCustomerId = commonUtils.isEmptyStr(masterData.sCustomerId) ? undefined : masterData.sCustomerId; | |
| 211 | + let existCustomerId = false; | |
| 212 | + if (sModelsType.includes('sales/') && commonUtils.isNotEmptyStr(sCustomerId)) { | |
| 213 | + existCustomerId = true; | |
| 214 | + } else if (!sModelsType.includes('sales/')) { | |
| 215 | + existCustomerId = true; | |
| 216 | + } | |
| 217 | + return { | |
| 218 | + disabled: !this.props.enabled || !existCustomerId, /* 是否可用 */ | |
| 219 | + style: { display: commonUtils.convertBooleanToDisplayBlock(true) }, /* 是否显示 */ | |
| 220 | + }; | |
| 221 | + } | |
| 222 | + }; | |
| 223 | + | |
| 224 | + /** 上传后执行函数 */ | |
| 225 | + handleBeforeUpload = () => { | |
| 226 | + // const isLt10M = file.size / 1024 / 1024 < 10; | |
| 227 | + // if (!isLt10M) { | |
| 228 | + // message.error(commonFunc.showMessage(this.props.app.commonConst, 'picMax'));/* 图片大小需小于10MB! */ | |
| 229 | + // } | |
| 230 | + }; | |
| 231 | + /** 图片上传后执行函数 */ | |
| 232 | + handleUploadChange = (info, name) => { | |
| 233 | + const { file } = info; | |
| 234 | + if (file.response && file.response.code === 1) { | |
| 235 | + const sPicturePath = file.response.dataset.rows[0].savePathStr; | |
| 236 | + const uploadInfo = { | |
| 237 | + sPicturePath, | |
| 238 | + sFileName: file.name, | |
| 239 | + }; | |
| 240 | + const { [`${name}Column`]: tableColumn, masterData, [`${name}Data`]: tableData } = this.props; | |
| 241 | + if (commonUtils.isNotEmptyArr(tableData) && commonUtils.isEmpty(tableData[tableData.length - 1].sPicturePath)) { | |
| 242 | + tableData[tableData.length - 1].sPicturePath = uploadInfo.sPicturePath; | |
| 243 | + tableData[tableData.length - 1] = { ...tableData[tableData.length - 1], sPicturePath: uploadInfo.sPicturePath, sFileName: uploadInfo.sFileName }; | |
| 244 | + } else { | |
| 245 | + const tableDataRow = this.props.onDataRowAdd(name, true); | |
| 246 | + tableColumn.forEach((slaveChild) => { | |
| 247 | + const ckey = slaveChild.dataIndex; | |
| 248 | + if (ckey === 'sProductNo' || ckey === 'sProductName') { | |
| 249 | + tableDataRow[ckey] = masterData[ckey] !== undefined ? masterData[ckey] : ''; | |
| 250 | + } else if (ckey === 'iOrder') { | |
| 251 | + tableDataRow[ckey] = ''; | |
| 252 | + } else if (file.response && file.response.code === 1) { | |
| 253 | + if (uploadInfo[ckey] !== undefined) { | |
| 254 | + tableDataRow[ckey] = uploadInfo[ckey]; | |
| 255 | + } | |
| 256 | + } | |
| 257 | + }); | |
| 258 | + tableData.push(tableDataRow); | |
| 259 | + } | |
| 260 | + this.props.onSaveState({ [`${name}Data`]: tableData, enabled: true }); | |
| 261 | + } else if (file.response && file.response.code === -1) { | |
| 262 | + message.error(file.response.msg); | |
| 263 | + } | |
| 264 | + }; | |
| 265 | + handleOk = async (flag, tmpCheck, isWait) => { | |
| 266 | + const { | |
| 267 | + sModelsId, masterData, app, checkConditions, sCheckModelId, checkPersonData, currentId, masterConfig, slaveConfig, checkConfig, sCheckRemark, | |
| 268 | + } = this.props; | |
| 269 | + const { currentPane } = app; | |
| 270 | + const bCkxTmpCheck = app.systemData.filter(item => item.sName === 'CkxTmpCheck')[0].sValue; | |
| 271 | + if (bCkxTmpCheck === '1') { | |
| 272 | + const returnData = await this.props.onDataAudit(flag, tmpCheck, isWait); | |
| 273 | + if (returnData.code === 1) { | |
| 274 | + if (returnData.dataset.rows[0].dataSet.outData[0].sCode === 1) { | |
| 275 | + this.props.onGetData(masterConfig, slaveConfig, checkConfig); | |
| 276 | + message.success(returnData.msg); | |
| 277 | + } else { | |
| 278 | + message.error(returnData.dataset.rows[0].dataSet.outData[0].sReturn); | |
| 279 | + } | |
| 280 | + } else { /* 失败 */ | |
| 281 | + this.props.getServiceError(returnData); | |
| 282 | + } | |
| 283 | + } else { | |
| 284 | + const dataPersonArray = commonUtils.isEmptyObject(this.props.dataPersonArray) ? [] : this.props.dataPersonArray; | |
| 285 | + if (commonUtils.isEmptyObject(dataPersonArray)) { | |
| 286 | + checkPersonData.forEach((item) => { | |
| 287 | + dataPersonArray.push(item.sUserId); | |
| 288 | + }); | |
| 289 | + } | |
| 290 | + const dataPersonString = dataPersonArray.join(','); | |
| 291 | + const url = `${commonConfig.server_host}business/getProData?sModelsId=${sModelsId}`; | |
| 292 | + const value = { | |
| 293 | + sProName: 'Sp_System_AutoSendCheckMsg', | |
| 294 | + paramsMap: { | |
| 295 | + sFormGuid: sModelsId, | |
| 296 | + sBillKey: currentPane.sProcName, | |
| 297 | + sTbName: masterConfig.sTbName, | |
| 298 | + sGuid: masterData.sId, | |
| 299 | + sBillNo: masterData.sBillNo, | |
| 300 | + sCheckCondition: checkConditions, | |
| 301 | + sMemo: sCheckRemark, | |
| 302 | + sCheckModelGuid: sCheckModelId, | |
| 303 | + sCheckPerson: dataPersonString, | |
| 304 | + }, | |
| 305 | + }; | |
| 306 | + | |
| 307 | + const returnData = (await commonServices.postValueService(app.token, value, url)).data; | |
| 308 | + if (returnData.code === 1) { | |
| 309 | + const noCheckMsg = commonFunc.showMessage(app.commonConst, 'NoCheckMsg'); /* 您有消息待审核 */ | |
| 310 | + if (returnData.dataset.rows[0].dataSet.outData[0].sCode === 1) { | |
| 311 | + this.props.handleSendSocketMessage('examine', 'showImg', currentId, dataPersonString, noCheckMsg, null); | |
| 312 | + const urlCanCheckBill = `${commonConfig.server_host}checkModel/getCanCheckBill?sModelsId=${sModelsId}`; | |
| 313 | + const valueCanCheckBill = { sCheckModelId, checkPersonData, sBillId: masterData.sId }; | |
| 314 | + const returnCanCheckBill = (await commonServices.postValueService(app.token, valueCanCheckBill, urlCanCheckBill)).data; | |
| 315 | + if (returnCanCheckBill.code === 1) { | |
| 316 | + if (returnCanCheckBill.dataset.rows[0].iCount === 1) { | |
| 317 | + this.props.onDataAudit(1, 1); | |
| 318 | + this.props.onSaveState({ | |
| 319 | + visible: false, | |
| 320 | + }); | |
| 321 | + return; | |
| 322 | + } | |
| 323 | + } else { /* 失败 */ | |
| 324 | + this.props.getServiceError(returnCanCheckBill); | |
| 325 | + } | |
| 326 | + this.props.handleSendSocketMessage('reflush', 'showImg', currentId, dataPersonString, noCheckMsg, null); | |
| 327 | + message.success(returnData.msg); | |
| 328 | + } else { | |
| 329 | + message.error(returnData.dataset.rows[0].dataSet.outData[0].sReturn); | |
| 330 | + } | |
| 331 | + } else { /* 失败 */ | |
| 332 | + this.props.getServiceError(returnData); | |
| 333 | + } | |
| 334 | + } | |
| 335 | + this.props.onSaveState({ | |
| 336 | + visible: false, | |
| 337 | + }); | |
| 338 | + }; | |
| 339 | + | |
| 340 | + handleCancel = () => { | |
| 341 | + this.props.onSaveState({ | |
| 342 | + visible: false, | |
| 343 | + }); | |
| 344 | + }; | |
| 345 | + handleTableModal = async () => { | |
| 346 | + const { | |
| 347 | + sModelsId, controlData, masterData, slaveData, controlConfig, slaveSelectedRowKeys, enabled, slaveConfig, sModelsType, | |
| 348 | + } = this.props; | |
| 349 | + const addState = {}; | |
| 350 | + let treeState = {}; | |
| 351 | + if (this.props.sModelsType.includes('sales/salesOrder')) { | |
| 352 | + const iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); | |
| 353 | + const iIndex = controlData.findIndex(item => item.sSlaveId === slaveSelectedRowKeys[0]); | |
| 354 | + if (iIndex === -1 && iSlaveIndex > -1 && enabled) { | |
| 355 | + const allTableData = {}; | |
| 356 | + allTableData.master = masterData; | |
| 357 | + allTableData.slaveData = slaveData; | |
| 358 | + let dropdownProductClassifyId; | |
| 359 | + const iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductClassifyId'); | |
| 360 | + if (iIndex > -1) { | |
| 361 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[iIndex]); | |
| 362 | + dropdownProductClassifyId = sqlDropDownData.dropDownData; | |
| 363 | + } | |
| 364 | + if (commonUtils.isEmptyArr(dropdownProductClassifyId)) { | |
| 365 | + const iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductClassifyName'); | |
| 366 | + if (iIndex > -1) { | |
| 367 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[iIndex]); | |
| 368 | + dropdownProductClassifyId = sqlDropDownData.dropDownData; | |
| 369 | + } | |
| 370 | + } | |
| 371 | + if (commonUtils.isNotEmptyArr(dropdownProductClassifyId)) { | |
| 372 | + const iProductClassifyIdIndex = dropdownProductClassifyId.findIndex(item => item.sId === slaveData[iSlaveIndex].sProductClassifyId); | |
| 373 | + if (commonUtils.isNotEmptyObject(dropdownProductClassifyId[iProductClassifyIdIndex])) { | |
| 374 | + const sAllPartsName = dropdownProductClassifyId[iProductClassifyIdIndex].sAllPartsName; | |
| 375 | + if (commonUtils.isNotEmptyStr(sAllPartsName)) { | |
| 376 | + const sAssignFieldObj = sAllPartsName.split(','); | |
| 377 | + for (const child of sAssignFieldObj) { | |
| 378 | + const tableDataRowAdd = commonFunc.getDefaultData(controlConfig, allTableData); | |
| 379 | + tableDataRowAdd.handleType = 'add'; | |
| 380 | + tableDataRowAdd.sId = commonUtils.createSid(); | |
| 381 | + tableDataRowAdd.sParentId = masterData && masterData.sId ? masterData.sId : null; | |
| 382 | + tableDataRowAdd.sSlaveId = slaveSelectedRowKeys[0]; | |
| 383 | + tableDataRowAdd.key = tableDataRowAdd.sId; | |
| 384 | + tableDataRowAdd.bDefault = false; | |
| 385 | + tableDataRowAdd.iOrder = 0; | |
| 386 | + tableDataRowAdd.sPartsName = child; | |
| 387 | + tableDataRowAdd.dPartsQty = commonUtils.isNull(slaveData[iSlaveIndex].dProductQty, 0) + commonUtils.isNull(slaveData[iSlaveIndex].dGiveQty, 0) + commonUtils.isNull(slaveData[iSlaveIndex].dStockupQty, 0); | |
| 388 | + tableDataRowAdd.sAllId = tableDataRowAdd.sId; | |
| 389 | + tableDataRowAdd.sControlParentId = ''; | |
| 390 | + controlData.push(tableDataRowAdd); | |
| 391 | + } | |
| 392 | + } | |
| 393 | + } | |
| 394 | + } | |
| 395 | + addState.controlData = controlData; | |
| 396 | + } | |
| 397 | + | |
| 398 | + if (controlData !== undefined) { | |
| 399 | + const iControlIndex = controlData.findIndex(item => item.sSlaveId === slaveSelectedRowKeys[0]); | |
| 400 | + if (iControlIndex > -1) { | |
| 401 | + addState.controlSelectedRowKeys = [controlData[iControlIndex].sId]; | |
| 402 | + } | |
| 403 | + } | |
| 404 | + if (sModelsType === 'sales/salesOrderPack') { | |
| 405 | + const sSlaveId = slaveSelectedRowKeys[0]; | |
| 406 | + if (commonUtils.isNotEmptyObject(sSlaveId)) { | |
| 407 | + treeState = this.props.onGetControlTreeData(controlData, true, sSlaveId); | |
| 408 | + } | |
| 409 | + } | |
| 410 | + } | |
| 411 | + | |
| 412 | + this.props.onSaveState({ | |
| 413 | + visibleModal: true, | |
| 414 | + ...addState, | |
| 415 | + ...treeState, | |
| 416 | + }); | |
| 417 | + }; | |
| 418 | + handleTableChooseProcess = () => { | |
| 419 | + const { processConfig } = this.props; | |
| 420 | + const iIndex = processConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseProcess'); | |
| 421 | + | |
| 422 | + if (iIndex > -1) { | |
| 423 | + this.props.onBtnChoose('process', 'BtnChooseProcess', processConfig.gdsconfigformslave[iIndex]); | |
| 424 | + } | |
| 425 | + }; | |
| 426 | + handleCancelModal = (modelVisible) => { | |
| 427 | + this.props.onSaveState({ | |
| 428 | + [modelVisible]: false, | |
| 429 | + }); | |
| 430 | + }; | |
| 431 | + handleOkModal = async () => { | |
| 432 | + const { | |
| 433 | + controlData, materialsData, processData, slaveData, slaveSelectedRowKeys, | |
| 434 | + } = this.props; | |
| 435 | + const ctData = controlData.filter(item => item.handleType !== 'del' && item.sSlaveId === slaveSelectedRowKeys[0]); | |
| 436 | + const mtData = materialsData.filter(item => item.handleType !== 'del' && item.sSlaveId === slaveSelectedRowKeys[0]); | |
| 437 | + const pData = processData.filter(item => item.handleType !== 'del' && item.sSlaveId === slaveSelectedRowKeys[0] && item.sType !== '3'); | |
| 438 | + const p3Data = processData.filter(item => item.handleType !== 'del' && item.sSlaveId === slaveSelectedRowKeys[0] && item.sType === '3'); /* 成品工序 */ | |
| 439 | + if (commonUtils.isNotEmptyArr(ctData)) { | |
| 440 | + let mDetail = ''; | |
| 441 | + let pDetail = ''; | |
| 442 | + const slaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); | |
| 443 | + await ctData.forEach((controlItem, n) => { | |
| 444 | + if (commonUtils.isNotEmptyObject(controlItem.sPartsName)) { | |
| 445 | + const qz = n === 0 ? '' : ' '; | |
| 446 | + if (commonUtils.isNotEmptyObject(controlItem.sPartsName)) { | |
| 447 | + const yDetail = `${mDetail}${qz}#${controlItem.sPartsName}:`; | |
| 448 | + const gDetail = `${pDetail}${qz}#${controlItem.sPartsName}:`; | |
| 449 | + let imDetail = ''; | |
| 450 | + let ipDetail = ''; | |
| 451 | + const materials = mtData.filter(materialsItem => (materialsItem.sControlId === controlItem.sId)); | |
| 452 | + // let materialsIdDropDown; | |
| 453 | + // const materialsIndex = materialsConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMaterialsName'); | |
| 454 | + // if (materialsIndex > -1) { | |
| 455 | + // const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'materials', materialsConfig.gdsconfigformslave[materialsIndex]); | |
| 456 | + // materialsIdDropDown = sqlDropDownData.dropDownData; | |
| 457 | + // } | |
| 458 | + materials.forEach((mItem, i) => { | |
| 459 | + const fh = i === 0 ? '' : ','; | |
| 460 | + imDetail = `${imDetail}${fh} ${mItem.sMaterialsName}`; | |
| 461 | + }); | |
| 462 | + // processPropsType | |
| 463 | + const process = pData.filter(processItem => (processItem.sControlId === controlItem.sId)); | |
| 464 | + // let processIdDropDown; | |
| 465 | + // const processIndex = processConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProcessName'); | |
| 466 | + // if (processIndex > -1) { | |
| 467 | + // const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'process', processConfig.gdsconfigformslave[processIndex]); | |
| 468 | + // processIdDropDown = sqlDropDownData.dropDownData; | |
| 469 | + // } | |
| 470 | + // const processIdDropDown = commonUtils.getStoreDropDownData(sModelsId, 'process', 'sProcessName'); | |
| 471 | + process.forEach((pItem, i) => { | |
| 472 | + const fh = i === 0 ? '' : ','; | |
| 473 | + ipDetail = `${ipDetail}${fh} ${pItem.sProcessName}`; | |
| 474 | + }); | |
| 475 | + if (commonUtils.isNotEmptyObject(imDetail)) { | |
| 476 | + mDetail = `${yDetail}${imDetail}`; | |
| 477 | + } | |
| 478 | + if (commonUtils.isNotEmptyObject(ipDetail)) { | |
| 479 | + pDetail = `${gDetail}${ipDetail}`; | |
| 480 | + } | |
| 481 | + } | |
| 482 | + } | |
| 483 | + }); | |
| 484 | + /* 成品工序 */ | |
| 485 | + let ip3Detail = ''; | |
| 486 | + if (commonUtils.isNotEmptyArr(p3Data)) { | |
| 487 | + p3Data.forEach((pItem, i) => { | |
| 488 | + const fh = i === 0 ? '' : ','; | |
| 489 | + ip3Detail = `${ip3Detail}${fh} ${pItem.sProcessName}`; | |
| 490 | + }); | |
| 491 | + } | |
| 492 | + if (commonUtils.isNotEmptyObject(ip3Detail)) { | |
| 493 | + if (commonUtils.isNotEmptyObject(pDetail)) { | |
| 494 | + pDetail = `${pDetail},${ip3Detail}`; | |
| 495 | + } else { | |
| 496 | + pDetail = ip3Detail; | |
| 497 | + } | |
| 498 | + } | |
| 499 | + slaveData[slaveIndex].sMaterialsMemo = mDetail; | |
| 500 | + slaveData[slaveIndex].sProcessMemo = pDetail; | |
| 501 | + slaveData[slaveIndex].handleType = commonUtils.isEmpty(slaveData[slaveIndex].handleType) ? 'update' : slaveData[slaveIndex].handleType; | |
| 502 | + } else if (commonUtils.isNotEmptyArr(controlData) && commonUtils.isEmptyArr(ctData)) { | |
| 503 | + const sSlaveId = controlData[0].sSlaveId; | |
| 504 | + const slaveIndex = slaveData.findIndex(item => item.sId === sSlaveId); | |
| 505 | + slaveData[slaveIndex].sMaterialsMemo = ''; | |
| 506 | + slaveData[slaveIndex].sProcessMemo = ''; | |
| 507 | + slaveData[slaveIndex].handleType = commonUtils.isEmpty(slaveData[slaveIndex].handleType) ? 'update' : slaveData[slaveIndex].handleType; | |
| 508 | + } | |
| 509 | + this.props.onSaveState({ | |
| 510 | + visibleModal: false, | |
| 511 | + controlData, | |
| 512 | + materialsData, | |
| 513 | + processData, | |
| 514 | + slaveData, | |
| 515 | + }); | |
| 516 | + }; | |
| 517 | + /** 控制选择控制表时,显示部件工序与成品工序 */ | |
| 518 | + handleFilterSlaveData = (name, dataIndex, value, record) => { | |
| 519 | + return (commonUtils.isNotEmptyStr(record.sSlaveId) && record.sSlaveId.toString().toLowerCase().includes(value.toLowerCase())); | |
| 520 | + }; | |
| 521 | + /** 控制选择控制表时,显示部件工序与成品工序 */ | |
| 522 | + handleFilterData = (name, dataIndex, value, record) => { | |
| 523 | + const { slaveSelectedRowKeys } = this.props; | |
| 524 | + if (name === 'process') { | |
| 525 | + return (commonUtils.isNotEmptyStr(record.sType) && record.sType === '3' && | |
| 526 | + commonUtils.isNotEmptyStr(record.sSlaveId) && record.sSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString().toLowerCase())) || | |
| 527 | + (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase()) && | |
| 528 | + commonUtils.isNotEmptyStr(record.sSlaveId) && record.sSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString().toLowerCase())); | |
| 529 | + } else if (name === 'slaveChild') { | |
| 530 | + return commonUtils.isNotEmptyStr(record.sDelivergooodSlaveId) && record.sDelivergooodSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString().toLowerCase()); | |
| 531 | + } else { | |
| 532 | + return (commonUtils.isNotEmptyStr(record.sType) && record.sType === '2' && | |
| 533 | + commonUtils.isNotEmptyStr(record.sSlaveId) && record.sSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString().toLowerCase())) || | |
| 534 | + (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase()) && | |
| 535 | + commonUtils.isNotEmptyStr(record.sSlaveId) && record.sSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString().toLowerCase())); | |
| 536 | + } | |
| 537 | + // (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase())); | |
| 538 | + }; | |
| 539 | + /* 控制表过滤材料表 工序表数据 */ | |
| 540 | + handleGetFilterData = (name) => { | |
| 541 | + const { [`${name}Data`]: data, controlSelectedRowKeys, slaveSelectedRowKeys } = this.props; | |
| 542 | + if (data !== undefined) { | |
| 543 | + const newArr = data.filter((item) => { | |
| 544 | + if (name === 'control') { | |
| 545 | + return (commonUtils.isNotEmptyStr(item.sSlaveId) && item.sSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString())); | |
| 546 | + } else { | |
| 547 | + return (commonUtils.isNotEmptyStr(item.sControlId) && item.sControlId.toString().toLowerCase().includes(controlSelectedRowKeys.toString()) && | |
| 548 | + commonUtils.isNotEmptyStr(item.sSlaveId) && item.sSlaveId.toString().toLowerCase().includes(slaveSelectedRowKeys.toString())); | |
| 549 | + } | |
| 550 | + }); | |
| 551 | + return newArr.length; | |
| 552 | + } | |
| 553 | + }; | |
| 554 | + /* 包装工单过滤行 */ /** 控制选择控制表时,显示部件工序与成品工序 */ | |
| 555 | + handleFilterDataPack = (name, dataIndex, value, record) => { | |
| 556 | + if (name === 'process') { | |
| 557 | + return (commonUtils.isNotEmptyStr(record.sType) && record.sType === '3') || | |
| 558 | + (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase())); | |
| 559 | + } else { | |
| 560 | + return (commonUtils.isNotEmptyStr(record.sType) && record.sType === '2') || | |
| 561 | + (commonUtils.isNotEmptyStr(record.sControlId) && record.sControlId.toString().toLowerCase().includes(value.toLowerCase())); | |
| 562 | + } | |
| 563 | + }; | |
| 564 | + /* 控制表过滤材料表 工序表数据 */ | |
| 565 | + handleGetFilterDataPack = (name) => { | |
| 566 | + const { [`${name}Data`]: data, controlSelectedRowKeys } = this.props; | |
| 567 | + if (data !== undefined && commonUtils.isNotEmptyArr(controlSelectedRowKeys)) { | |
| 568 | + const newArr = data.filter((item) => { | |
| 569 | + return (commonUtils.isNotEmptyStr(item.sControlId) && item.sControlId.toString().toLowerCase().includes(controlSelectedRowKeys.toString())); | |
| 570 | + }); | |
| 571 | + return newArr.length; | |
| 572 | + } | |
| 573 | + }; | |
| 574 | + /** 添加表格空行 */ | |
| 575 | + handleTableAdd = async (name, flag, bchild) => { | |
| 576 | + /* 外置处理业务 */ | |
| 577 | + const { | |
| 578 | + sModelsId, sModelsType, gdsformconst, slaveData, controlData, controlSelectedRowKeys, [`${name}Data`]: tableData, slaveSelectedRowKeys, slaveConfig, | |
| 579 | + } = this.props; | |
| 580 | + let tableDataRow = {}; | |
| 581 | + if (name === 'control') { | |
| 582 | + const { | |
| 583 | + [`${name}SelectedRowKeys`]: treeSelectedKeys, | |
| 584 | + } = this.props; | |
| 585 | + if ((bchild === 'childNode' || bchild === 'sameNode') && (commonUtils.isEmptyArr(treeSelectedKeys) || commonUtils.isEmptyArr(controlSelectedRowKeys))) { | |
| 586 | + message.warn('请选择部件!'); // 请选择部件 | |
| 587 | + return; | |
| 588 | + } | |
| 589 | + tableDataRow = this.props.onDataRowAdd(name, true); | |
| 590 | + if (commonUtils.isEmptyObject(tableDataRow)) { | |
| 591 | + return; | |
| 592 | + } | |
| 593 | + let dPartsQty = 0; | |
| 594 | + if (commonUtils.isNotEmptyArr(slaveData)) { | |
| 595 | + slaveData.forEach((item) => { | |
| 596 | + dPartsQty += commonUtils.isNull(item.dProductQty, 0) + commonUtils.isNull(item.dGiveQty, 0) + commonUtils.isNull(item.dStockupQty, 0); | |
| 597 | + }); | |
| 598 | + let productIdDropDown; | |
| 599 | + const slaveIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sName === 'sProductName'); | |
| 600 | + if (slaveIndex > -1) { | |
| 601 | + const sqlDropDownData = await this.props.getSqlDropDownData(sModelsId, 'slave', slaveConfig.gdsconfigformslave[slaveIndex]); | |
| 602 | + productIdDropDown = sqlDropDownData.dropDownData; | |
| 603 | + } | |
| 604 | + if (productIdDropDown) { | |
| 605 | + const iProductIdIndex = productIdDropDown.findIndex(item => item.sId === slaveData[0].sProductId); | |
| 606 | + if (iProductIdIndex > -1) { | |
| 607 | + tableDataRow.sPartsName = productIdDropDown[iProductIdIndex].sProductName; | |
| 608 | + } | |
| 609 | + } | |
| 610 | + } | |
| 611 | + const iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); | |
| 612 | + if (iSlaveIndex > -1) { | |
| 613 | + if (sModelsType.includes('sales/salesOrder')) { | |
| 614 | + if (!commonUtils.isEmpty(slaveData[iSlaveIndex].dProductQty)) { | |
| 615 | + tableDataRow.dPartsQty = commonUtils.isNull(slaveData[iSlaveIndex].dProductQty, 0) + commonUtils.isNull(slaveData[iSlaveIndex].dGiveQty, 0); | |
| 616 | + } | |
| 617 | + } else { | |
| 618 | + tableDataRow.dPartsQty = dPartsQty; | |
| 619 | + } | |
| 620 | + tableDataRow.sSlaveId = slaveData[iSlaveIndex].sId; | |
| 621 | + } | |
| 622 | + /* 树形部件节点增加同级部件、增加子级部件 */ | |
| 623 | + if (sModelsType === 'sales/salesOrderPack') { | |
| 624 | + if (bchild === 'sameNode') { /* 添加同级 */ | |
| 625 | + const iIndex = controlData.findIndex(item => item.sId === treeSelectedKeys[0]); | |
| 626 | + /* 找到同级子元素的sControlParentId */ | |
| 627 | + if (iIndex > -1) { | |
| 628 | + tableDataRow.sControlParentId = controlData[iIndex].sControlParentId; | |
| 629 | + /* 找到同级父级sAllId */ | |
| 630 | + const pId = controlData[iIndex].sControlParentId; | |
| 631 | + const sControlParentId = controlData.findIndex(item => item.sId === pId); | |
| 632 | + if (sControlParentId > -1) { | |
| 633 | + const sAllId = controlData[sControlParentId].sAllId; | |
| 634 | + if (commonUtils.isEmptyObject(sAllId)) { | |
| 635 | + message.warn('部件数据生成错误![sAllId为空]'); | |
| 636 | + return; | |
| 637 | + } | |
| 638 | + tableDataRow.sAllId = `${controlData[sControlParentId].sAllId},${tableDataRow.sId}`; | |
| 639 | + } else { | |
| 640 | + tableDataRow.sAllId = tableDataRow.sId; | |
| 641 | + } | |
| 642 | + } | |
| 643 | + } | |
| 644 | + if (bchild === 'childNode') { /* 添加子级 */ | |
| 645 | + tableDataRow.sControlParentId = treeSelectedKeys[0]; | |
| 646 | + const iIndex = controlData.findIndex(item => item.sId === treeSelectedKeys[0]); | |
| 647 | + if (iIndex > -1) { | |
| 648 | + const sAllId = controlData[iIndex].sAllId; | |
| 649 | + if (commonUtils.isEmptyObject(sAllId)) { | |
| 650 | + message.warn('子部件数据生成错误![sAllId为空]'); // 获取父节点的sAllId | |
| 651 | + return; | |
| 652 | + } | |
| 653 | + tableDataRow.sAllId = `${controlData[iIndex].sAllId},${tableDataRow.sId}`; | |
| 654 | + } | |
| 655 | + } | |
| 656 | + } | |
| 657 | + tableData.push(tableDataRow); | |
| 658 | + let treeState = []; | |
| 659 | + if (sModelsType === 'sales/salesOrderPack') { | |
| 660 | + treeState = this.props.onGetControlTreeData(tableData, true, tableDataRow.sSlaveId); | |
| 661 | + } | |
| 662 | + this.props.onSaveState({ [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: [tableDataRow.sId], ...treeState }); | |
| 663 | + } else if (name === 'materials' || name === 'process') { | |
| 664 | + tableDataRow = this.props.onDataRowAdd(name, true); | |
| 665 | + if (commonUtils.isEmptyArr(controlSelectedRowKeys)) { | |
| 666 | + const msg = commonFunc.showMessage(gdsformconst, 'pleaseChooseParts'); | |
| 667 | + message.warn(msg === '' ? '请选择部件' : msg); // 请选择部件 | |
| 668 | + return; | |
| 669 | + } | |
| 670 | + const iIndex = controlData.findIndex(item => item.sId === controlSelectedRowKeys[0]); | |
| 671 | + const iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); | |
| 672 | + if (iIndex > -1 && iSlaveIndex > -1) { | |
| 673 | + if (commonUtils.isEmpty(controlData[iIndex].sPartsName) === '') { | |
| 674 | + message.warn(commonFunc.showMessage(gdsformconst, 'partsNameNotNull')); // 部件名称不能为空 | |
| 675 | + return; | |
| 676 | + } | |
| 677 | + tableDataRow.sSlaveId = slaveData[iSlaveIndex].sId; | |
| 678 | + tableDataRow.sControlId = controlData[iIndex].sId; | |
| 679 | + tableDataRow.sPartsName = controlData[iIndex].sPartsName; | |
| 680 | + } | |
| 681 | + tableData.push(tableDataRow); | |
| 682 | + this.props.onSaveState({ [`${name}Data`]: tableData, [`${name}SelectedRowKeys`]: [tableDataRow.sId] }); | |
| 683 | + } else { | |
| 684 | + this.props.onDataRowAdd(name, flag); | |
| 685 | + } | |
| 686 | + }; | |
| 687 | + /** 删除表格数据 */ | |
| 688 | + otherTableDel = (name, tableSelectedRowKeys) => { | |
| 689 | + const tableData = this.props[`${name}Data`]; | |
| 690 | + let tableDelData = this.props[`${name}DelData`]; | |
| 691 | + tableDelData = commonUtils.isEmptyArr(tableDelData) ? [] : tableDelData; | |
| 692 | + for (const sId of tableSelectedRowKeys) { | |
| 693 | + /* 看看删除集合和从表中是否都存在该条数据 */ | |
| 694 | + let tableDataIndex = tableData.findIndex(item => item.sControlId === sId); | |
| 695 | + while (tableDataIndex > -1) { | |
| 696 | + /* 删除从表中的数据并存入删除集合中 */ | |
| 697 | + const slaveDataFilter = tableData[tableDataIndex]; | |
| 698 | + tableData.splice(tableDataIndex, 1); | |
| 699 | + slaveDataFilter.handleType = 'del'; | |
| 700 | + tableDelData.push(slaveDataFilter); | |
| 701 | + tableDataIndex = tableData.findIndex(item => item.sControlId === sId); | |
| 702 | + } | |
| 703 | + } | |
| 704 | + return { [`${name}Data`]: tableData, [`${name}DelData`]: tableDelData, [`${name}SelectedRowKeys`]: [] }; | |
| 705 | + }; | |
| 706 | + otherDeliverTableDel = (name, tableSelectedRowKeys) => { | |
| 707 | + const tableData = this.props[`${name}Data`]; | |
| 708 | + let tableDelData = this.props[`${name}DelData`]; | |
| 709 | + tableDelData = commonUtils.isEmptyArr(tableDelData) ? [] : tableDelData; | |
| 710 | + for (const sId of tableSelectedRowKeys) { | |
| 711 | + /* 看看删除集合和从表中是否都存在该条数据 */ | |
| 712 | + let tableDataIndex = tableData.findIndex(item => item.sDelivergooodSlaveId === sId); | |
| 713 | + while (tableDataIndex > -1) { | |
| 714 | + /* 删除从表中的数据并存入删除集合中 */ | |
| 715 | + const slaveDataFilter = tableData[tableDataIndex]; | |
| 716 | + tableData.splice(tableDataIndex, 1); | |
| 717 | + slaveDataFilter.handleType = 'del'; | |
| 718 | + tableDelData.push(slaveDataFilter); | |
| 719 | + tableDataIndex = tableData.findIndex(item => item.sDelivergooodSlaveId === sId); | |
| 720 | + } | |
| 721 | + } | |
| 722 | + return { [`${name}Data`]: tableData, [`${name}DelData`]: tableDelData, [`${name}SelectedRowKeys`]: [] }; | |
| 723 | + }; | |
| 724 | + /** 删除表格数据 */ | |
| 725 | + handleTableDel = (name, isWait, tableSelectedRowKeys, isTree) => { | |
| 726 | + const { | |
| 727 | + sModelsType, slaveSelectedRowKeys, slaveData, | |
| 728 | + } = this.props; | |
| 729 | + if (name === 'control') { | |
| 730 | + // const tableSelectedRowKeys = this.props[`${name}SelectedRowKeys`]; /* 删除时,选中行取删除参数传过来的 */ | |
| 731 | + const { | |
| 732 | + controlData, treeSelectedKeys, [`${name}SelectedRowKeys`]: tableSelectedRowKeys, | |
| 733 | + } = this.props; | |
| 734 | + if (isTree) { | |
| 735 | + /* 删除该节点及所有子节点 */ | |
| 736 | + const controlChildData = controlData.filter(item => commonUtils.isNotEmptyObject(item.sAllId) && item.sAllId.indexOf(treeSelectedKeys[0]) > -1 && item.sId !== treeSelectedKeys[0]); | |
| 737 | + if (commonUtils.isNotEmptyArr(controlData)) { | |
| 738 | + controlChildData.forEach((itemNew) => { | |
| 739 | + tableSelectedRowKeys.push(itemNew.sId); | |
| 740 | + }); | |
| 741 | + } | |
| 742 | + } | |
| 743 | + if (commonUtils.isNotEmptyArr(tableSelectedRowKeys)) { | |
| 744 | + const materialsReturnData = this.otherTableDel('materials', tableSelectedRowKeys); | |
| 745 | + const processReturnData = this.otherTableDel('process', tableSelectedRowKeys); | |
| 746 | + const controlReturnData = this.props.onDataRowDel(name, isWait, tableSelectedRowKeys); | |
| 747 | + let treeState = []; | |
| 748 | + if (sModelsType === 'sales/salesOrderPack') { | |
| 749 | + const iSlaveIndex = slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]); | |
| 750 | + if (iSlaveIndex > -1) { | |
| 751 | + const sSlaveId = slaveData[iSlaveIndex].sId; | |
| 752 | + treeState = this.props.onGetControlTreeData(controlReturnData.controlData, true, sSlaveId); | |
| 753 | + } | |
| 754 | + } | |
| 755 | + this.props.onSaveState({ | |
| 756 | + ...materialsReturnData, | |
| 757 | + ...processReturnData, | |
| 758 | + ...controlReturnData, | |
| 759 | + ...treeState, | |
| 760 | + }); | |
| 761 | + return true; | |
| 762 | + } else { | |
| 763 | + message.warn('请选择要删除的部件!'); | |
| 764 | + return false; | |
| 765 | + } | |
| 766 | + } else if (name === 'slave' && sModelsType === 'sales/salesSgoods') { | |
| 767 | + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { | |
| 768 | + const slaveChildReturnData = this.otherDeliverTableDel('slaveChild', slaveSelectedRowKeys); | |
| 769 | + const slaveReturnData = this.props.onDataRowDel(name, isWait, slaveSelectedRowKeys); | |
| 770 | + this.props.onSaveState({ | |
| 771 | + ...slaveChildReturnData, | |
| 772 | + ...slaveReturnData, | |
| 773 | + }); | |
| 774 | + return true; | |
| 775 | + } | |
| 776 | + } else { | |
| 777 | + return this.props.onDataRowDel(name, isWait, tableSelectedRowKeys); | |
| 778 | + } | |
| 779 | + }; | |
| 780 | + /** 销售订单删除从表数据时也删除控制材料工序表数据 */ | |
| 781 | + handleSlaveTableDel = (name, isWait, tableSelectedRowKeys) => { | |
| 782 | + const { | |
| 783 | + sModelsType, controlData, processData, materialsData, | |
| 784 | + } = this.props; | |
| 785 | + if (sModelsType === 'sales/salesOrder' && name === 'slave') { | |
| 786 | + const controlDataDel = controlData.filter(item => item.sSlaveId === tableSelectedRowKeys[0]); | |
| 787 | + const controlDataSelectedRowKeys = []; | |
| 788 | + if (!commonUtils.isEmpty(controlDataDel)) { | |
| 789 | + for (const item of controlDataDel) { | |
| 790 | + const materialsDataSelectedRowKey = item.sId; | |
| 791 | + controlDataSelectedRowKeys.push(materialsDataSelectedRowKey); | |
| 792 | + } | |
| 793 | + if (commonUtils.isNotEmptyArr(controlDataSelectedRowKeys)) { | |
| 794 | + this.props.onDataRowDel('control', isWait, controlDataSelectedRowKeys, true); | |
| 795 | + } | |
| 796 | + const materialsDataDel = materialsData.filter(item => item.sSlaveId === tableSelectedRowKeys[0]); | |
| 797 | + const materialsDataSelectedRowKeys = []; | |
| 798 | + if (!commonUtils.isEmpty(materialsDataDel)) { | |
| 799 | + for (const item of materialsDataDel) { | |
| 800 | + const materialsDataSelectedRowKey = item.sId; | |
| 801 | + materialsDataSelectedRowKeys.push(materialsDataSelectedRowKey); | |
| 802 | + } | |
| 803 | + } | |
| 804 | + if (commonUtils.isNotEmptyArr(materialsDataSelectedRowKeys)) { | |
| 805 | + this.props.onDataRowDel('materials', isWait, materialsDataSelectedRowKeys, true); | |
| 806 | + } | |
| 807 | + const processDataDel = processData.filter(item => item.sSlaveId === tableSelectedRowKeys[0]); | |
| 808 | + const processDataSelectedRowKeys = []; | |
| 809 | + if (!commonUtils.isEmpty(processDataDel)) { | |
| 810 | + for (const item of processDataDel) { | |
| 811 | + const processDataSelectedRowKey = item.sId; | |
| 812 | + processDataSelectedRowKeys.push(processDataSelectedRowKey); | |
| 813 | + } | |
| 814 | + } | |
| 815 | + if (commonUtils.isNotEmptyArr(processDataSelectedRowKeys)) { | |
| 816 | + this.props.onDataRowDel('process', isWait, processDataSelectedRowKeys, true); | |
| 817 | + } | |
| 818 | + } | |
| 819 | + } | |
| 820 | + return this.props.onDataRowDel(name, isWait, tableSelectedRowKeys); | |
| 821 | + }; | |
| 822 | + handleSelect = async (name, selectConfig, selectData) => { | |
| 823 | + const { | |
| 824 | + [`${name}Data`]: tableData, [`${name}Config`]: tableConfig, masterData, masterConfig, controlSelectedRowKeys, sModelsId, token, app, tableName, sModelsType, | |
| 825 | + } = this.props; | |
| 826 | + const tableSelectedRowKeys = []; | |
| 827 | + if (name === 'productProcessInfo') { | |
| 828 | + if (commonUtils.isNotEmptyArr(selectData)) { | |
| 829 | + let slaveData = []; | |
| 830 | + let controlData = []; | |
| 831 | + let materialsData = []; | |
| 832 | + let processData = []; | |
| 833 | + let sConfigMasterIdSlave = ''; | |
| 834 | + let sConfigMasterIdControl = ''; | |
| 835 | + let sConfigMasterIdMaterials = ''; | |
| 836 | + let sConfigMasterIdProcess = ''; | |
| 837 | + const selectRowData = selectData[0]; | |
| 838 | + const sConfigIdString = masterConfig.gdsconfigformslave.filter(item => item.sName === 'sConfigId')[0].showDropDown; | |
| 839 | + if (commonUtils.isNotEmptyStr(sConfigIdString)) { | |
| 840 | + const sConfigId = JSON.parse(sConfigIdString); | |
| 841 | + sConfigMasterIdSlave = sConfigId.sConfigMasterIdSlave; | |
| 842 | + sConfigMasterIdControl = sConfigId.sConfigMasterIdControl; | |
| 843 | + sConfigMasterIdMaterials = sConfigId.sConfigMasterIdMaterials; | |
| 844 | + sConfigMasterIdProcess = sConfigId.sConfigMasterIdProcess; | |
| 845 | + } | |
| 846 | + if (commonUtils.isEmptyStr(sConfigMasterIdSlave)) { | |
| 847 | + message.warning(commonFunc.showMessage(app.commonConst, 'slaveParameterErro')); | |
| 848 | + } | |
| 849 | + if (commonUtils.isEmptyStr(sConfigMasterIdControl)) { | |
| 850 | + message.warning(commonFunc.showMessage(app.commonConst, 'controlParameterErro')); | |
| 851 | + } | |
| 852 | + if (commonUtils.isEmptyStr(sConfigMasterIdMaterials)) { | |
| 853 | + message.warning(commonFunc.showMessage(app.commonConst, 'materialsParameterErro')); | |
| 854 | + } | |
| 855 | + if (commonUtils.isEmptyStr(sConfigMasterIdProcess)) { | |
| 856 | + message.warning(commonFunc.showMessage(app.commonConst, 'processParameterErro')); | |
| 857 | + } | |
| 858 | + const slaveUrl = `${commonConfig.server_host}business/getBusinessDataByFormcustomId/${sConfigMasterIdSlave}?sModelsId=${sModelsId}`; | |
| 859 | + const value = { sSqlCondition: { sParentId: selectRowData.sId } }; | |
| 860 | + const slaveReturnData = (await commonServices.postValueService(token, value, slaveUrl)).data; | |
| 861 | + if (slaveReturnData.code === 1) { | |
| 862 | + slaveData = slaveReturnData.dataset.rows[0].dataSet; | |
| 863 | + slaveData.forEach((item) => { | |
| 864 | + item.handleType = 'add'; | |
| 865 | + item.sId = commonUtils.createSid(); | |
| 866 | + item.sParentId = masterData.sId; | |
| 867 | + }); | |
| 868 | + } else { | |
| 869 | + this.props.getServiceError(slaveReturnData); | |
| 870 | + } | |
| 871 | + | |
| 872 | + const controlUrl = `${commonConfig.server_host}business/getBusinessDataByFormcustomId/${sConfigMasterIdControl}?sModelsId=${sModelsId}`; | |
| 873 | + const controlReturnData = (await commonServices.postValueService(token, value, controlUrl)).data; | |
| 874 | + if (controlReturnData.code === 1) { | |
| 875 | + controlData = controlReturnData.dataset.rows[0].dataSet; | |
| 876 | + controlData.forEach((item) => { | |
| 877 | + item.handleType = 'add'; | |
| 878 | + item.sId = commonUtils.createSid(); | |
| 879 | + item.sParentId = masterData.sId; | |
| 880 | + }); | |
| 881 | + } else { | |
| 882 | + this.props.getServiceError(controlReturnData); | |
| 883 | + } | |
| 884 | + const materialsUrl = `${commonConfig.server_host}business/getBusinessDataByFormcustomId/${sConfigMasterIdMaterials}?sModelsId=${sModelsId}`; | |
| 885 | + const materialsReturnData = (await commonServices.postValueService(token, value, materialsUrl)).data; | |
| 886 | + if (materialsReturnData.code === 1) { | |
| 887 | + materialsData = materialsReturnData.dataset.rows[0].dataSet; | |
| 888 | + materialsData.forEach((item) => { | |
| 889 | + item.handleType = 'add'; | |
| 890 | + item.sId = commonUtils.createSid(); | |
| 891 | + item.sParentId = masterData.sId; | |
| 892 | + }); | |
| 893 | + } else { | |
| 894 | + this.props.getServiceError(materialsReturnData); | |
| 895 | + } | |
| 896 | + const processUrl = `${commonConfig.server_host}business/getBusinessDataByFormcustomId/${sConfigMasterIdProcess}?sModelsId=${sModelsId}`; | |
| 897 | + const processReturnData = (await commonServices.postValueService(token, value, processUrl)).data; | |
| 898 | + if (processReturnData.code === 1) { | |
| 899 | + processData = processReturnData.dataset.rows[0].dataSet; | |
| 900 | + processData.forEach((item) => { | |
| 901 | + item.handleType = 'add'; | |
| 902 | + item.sId = commonUtils.createSid(); | |
| 903 | + item.sParentId = masterData.sId; | |
| 904 | + }); | |
| 905 | + } else { | |
| 906 | + this.props.getServiceError(processReturnData); | |
| 907 | + } | |
| 908 | + this.props.onSaveState({ | |
| 909 | + processData, materialsData, controlData, slaveData, [`${name}ChooseVisible`]: false, [`${name}SelectedRowKeys`]: tableSelectedRowKeys, | |
| 910 | + }); | |
| 911 | + } | |
| 912 | + } else if (tableName === 'slave' && selectConfig.sControlName === 'BtnChooseMaterials') { | |
| 913 | + this.props.onSelect('slave', selectConfig, selectData); | |
| 914 | + } else if (sModelsType.includes('cashier/') && selectConfig.sControlName === 'BtnImportFormData') { | |
| 915 | + const { slaveData } = this.props; | |
| 916 | + let tableDataNew = []; | |
| 917 | + if (commonUtils.isNotEmptyArr(slaveData)) { | |
| 918 | + tableDataNew = slaveData; | |
| 919 | + tableDataNew.forEach((item, index) => { | |
| 920 | + const handleType = item.handleType; | |
| 921 | + if (commonUtils.isEmptyObject(handleType) || handleType === 'update') { | |
| 922 | + tableDataNew[index] = { ...item, handleType: 'del' }; | |
| 923 | + } | |
| 924 | + }); | |
| 925 | + } | |
| 926 | + if (commonUtils.isNotEmptyArr(selectData)) { | |
| 927 | + selectData.forEach((item) => { | |
| 928 | + let tableDataRow = {}; // 取默认值 | |
| 929 | + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item) }; // 取赋值字段 | |
| 930 | + tableDataRow.handleType = 'add'; | |
| 931 | + tableDataRow.sId = commonUtils.createSid(); | |
| 932 | + tableDataRow.sParentId = masterData.sId; | |
| 933 | + tableDataNew.push(tableDataRow); | |
| 934 | + }); | |
| 935 | + this.props.onSaveState({ slaveData: tableDataNew, importFormDataVisible: false }); | |
| 936 | + } | |
| 937 | + } else { | |
| 938 | + const { controlData, slaveData, slaveSelectedRowKeys } = this.props; | |
| 939 | + const iIndex = commonUtils.isNotEmptyArr(controlSelectedRowKeys) ? controlData.findIndex(item => item.sId === controlSelectedRowKeys[0]) : -1; | |
| 940 | + if (commonUtils.isNotEmptyArr(selectData)) { | |
| 941 | + selectData.forEach((item) => { | |
| 942 | + const newCopyTo = {}; | |
| 943 | + newCopyTo.master = masterData; | |
| 944 | + if (iIndex > -1) { | |
| 945 | + newCopyTo.control = controlData[iIndex]; | |
| 946 | + } | |
| 947 | + let tableDataRow = commonFunc.getDefaultData(tableConfig, newCopyTo); // 取默认值 | |
| 948 | + tableDataRow = { ...tableDataRow, ...commonFunc.getAssignFieldValue(selectConfig.sAssignField, item, newCopyTo) }; // 取赋值字段 | |
| 949 | + tableDataRow.handleType = 'add'; | |
| 950 | + tableDataRow.sId = commonUtils.createSid(); | |
| 951 | + tableDataRow.sParentId = masterData.sId; | |
| 952 | + if (this.props.sModelsType.includes('sales/salesOrder')) { | |
| 953 | + const iSlaveIndex = commonUtils.isNotEmptyArr(slaveSelectedRowKeys) ? slaveData.findIndex(item => item.sId === slaveSelectedRowKeys[0]) : -1; | |
| 954 | + if (iSlaveIndex > -1) { | |
| 955 | + tableDataRow.sSlaveId = slaveData[iSlaveIndex].sId; | |
| 956 | + } | |
| 957 | + } | |
| 958 | + if (iIndex > -1 && tableDataRow.sType !== '3') { | |
| 959 | + tableDataRow.sControlId = controlData[iIndex].sId; | |
| 960 | + tableDataRow.sPartsName = controlData[iIndex].sPartsName; | |
| 961 | + tableData.push(tableDataRow); | |
| 962 | + } else if (tableDataRow.sType === '3') { | |
| 963 | + tableData.push(tableDataRow); | |
| 964 | + } | |
| 965 | + tableSelectedRowKeys.push(tableDataRow.sId); | |
| 966 | + }); | |
| 967 | + } | |
| 968 | + const tableDataNew = this.sortData(controlData, tableData); | |
| 969 | + this.props.onSaveState({ [`${name}Data`]: tableDataNew, [`${name}ChooseVisible`]: false, [`${name}SelectedRowKeys`]: tableSelectedRowKeys }); | |
| 970 | + } | |
| 971 | + }; | |
| 972 | + | |
| 973 | + /** 树节点选中 */ | |
| 974 | + handleTreeSelect = (name, checkedKeys, e) => { | |
| 975 | + let { controlSelectedRowKeys } = this.props; | |
| 976 | + controlSelectedRowKeys = checkedKeys; /* 把树形选中节点赋值给表格部件选中节点 */ | |
| 977 | + this.props.onTreeSelect(name, checkedKeys, e); | |
| 978 | + this.props.onSaveState({ | |
| 979 | + controlSelectedRowKeys, | |
| 980 | + }); | |
| 981 | + }; | |
| 982 | + | |
| 983 | + sortData = (tableData, processData) => { | |
| 984 | + processData.sort((g1, g2) => { | |
| 985 | + const iIndex1 = tableData.findIndex(item => item.sId === g1.sControlId) === -1 ? 999 : tableData.findIndex(item => item.sId === g1.sControlId); | |
| 986 | + let sPartOrder1 = `0000${iIndex1}`; | |
| 987 | + sPartOrder1 = sPartOrder1.substring(sPartOrder1.length - 3); | |
| 988 | + let sOrder1 = `000${g1.iOrder}`; | |
| 989 | + sOrder1 = sOrder1.substring(sOrder1.length - 3); | |
| 990 | + | |
| 991 | + const iIndex2 = tableData.findIndex(item => item.sId === g2.sControlId) === -1 ? 999 : tableData.findIndex(item => item.sId === g2.sControlId); | |
| 992 | + let sPartOrder2 = `0000${iIndex2}`; | |
| 993 | + sPartOrder2 = sPartOrder2.substring(sPartOrder2.length - 3); | |
| 994 | + let sOrder2 = `000${g2.iOrder}`; | |
| 995 | + sOrder2 = sOrder2.substring(sOrder2.length - 3); | |
| 996 | + return parseInt(sPartOrder1 + g1.sType + sOrder1, 10) - parseInt(sPartOrder2 + g2.sType + sOrder2, 10); | |
| 997 | + }); | |
| 998 | + return processData; | |
| 999 | + }; | |
| 1000 | + handleGetDataOk = () => { | |
| 1001 | + this.props.onDataImport('zero'); | |
| 1002 | + } | |
| 1003 | + handleGetDataCancel = () => { | |
| 1004 | + this.props.onDataImport('all'); | |
| 1005 | + } | |
| 1006 | + colseGetDataVisible = () => { | |
| 1007 | + this.props.onSaveState({ isGetDataVisible: false }); | |
| 1008 | + } | |
| 1009 | + | |
| 1010 | + /* 审核备注文本框改变事件 */ | |
| 1011 | + textChange= (e, record) => { | |
| 1012 | + const sCheckRemark = commonUtils.isNotEmptyObject(record) && commonUtils.isNotEmptyObject(e.target.value) ? e.target.value : ''; | |
| 1013 | + this.props.onSaveState({ sCheckRemark });/* 审核备注 */ | |
| 1014 | + } | |
| 1015 | + // ----------------------------数据修改回带end ---------------------------- // | |
| 1016 | + | |
| 1017 | + render() { | |
| 1018 | + const { | |
| 1019 | + pageLoading, masterConfig, visible, checkConditions, checkPersonData, visibleModal, processChooseVisible, materialsChooseVisible, app, sTabId, sModelsType, enabled, slaveSelectedRowKeys, | |
| 1020 | + } = this.props; | |
| 1021 | + const checkCondition = commonFunc.showMessage(app.commonConst, 'checkCondition');/* 审核条件 */ | |
| 1022 | + const checkSmemo = commonFunc.showMessage(app.commonConst, 'checkSmemo');/* 备注 */ | |
| 1023 | + const columns = [{ | |
| 1024 | + title: checkCondition, | |
| 1025 | + dataIndex: 'condition', | |
| 1026 | + key: 'condition', | |
| 1027 | + }, { | |
| 1028 | + title: checkSmemo, | |
| 1029 | + dataIndex: 'sMemo', | |
| 1030 | + key: 'sMemo', | |
| 1031 | + render: (text, record) => { | |
| 1032 | + return ( | |
| 1033 | + <Form> | |
| 1034 | + <Input onChange={(e) => { this.textChange(e, record); }} /> | |
| 1035 | + </Form> | |
| 1036 | + ); | |
| 1037 | + }, | |
| 1038 | + }]; | |
| 1039 | + let chooseProcessConfig; | |
| 1040 | + let onChooseProcessIndex; | |
| 1041 | + /* 获取toolbar 选择工序 */ | |
| 1042 | + if (commonUtils.isNotEmptyObject(masterConfig)) { | |
| 1043 | + onChooseProcessIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseProcess'); | |
| 1044 | + if (onChooseProcessIndex > -1) { | |
| 1045 | + chooseProcessConfig = this.props.masterConfig.gdsconfigformslave[onChooseProcessIndex]; | |
| 1046 | + } | |
| 1047 | + } | |
| 1048 | + /* 获取toolbar 选择材料 */ | |
| 1049 | + let chooseMaterialsConfig; | |
| 1050 | + const modalWidth = '1132'; | |
| 1051 | + const fixedAutoHeight = sModelsType === 'sales/salesOrderPack' ? 120 : 66; | |
| 1052 | + if (commonUtils.isNotEmptyObject(masterConfig)) { | |
| 1053 | + const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseMaterials'); | |
| 1054 | + if (iIndex > -1) { | |
| 1055 | + chooseMaterialsConfig = masterConfig.gdsconfigformslave[iIndex]; | |
| 1056 | + } | |
| 1057 | + } | |
| 1058 | + /* 若销售订单从表选中行被工单或其他调用 则材料与工艺只能查看不能操作 */ | |
| 1059 | + let bUsed = enabled; | |
| 1060 | + if (sModelsType.includes('sales/salesOrder') && enabled && commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) { | |
| 1061 | + const { slaveData } = this.props; | |
| 1062 | + const iSlaveDataIndex = slaveData.findIndex(item => slaveSelectedRowKeys.includes(item.sId)); | |
| 1063 | + if (iSlaveDataIndex > -1) { | |
| 1064 | + const sWorkOrderUsed = slaveData[iSlaveDataIndex].sWorkOrderUsed; | |
| 1065 | + if (commonUtils.isNotEmptyObject(sWorkOrderUsed)) { | |
| 1066 | + bUsed = false; | |
| 1067 | + } | |
| 1068 | + } | |
| 1069 | + } | |
| 1070 | + | |
| 1071 | + const controlPropsType = { | |
| 1072 | + ...commonBusiness.getTableTypes('control', this.props), | |
| 1073 | + tableProps: { | |
| 1074 | + CalLastWidth: modalWidth, AutoTableHeight: fixedAutoHeight, setCopyAll, setProcess, setMaterial, chooseProcessConfigRow: chooseProcessConfig, chooseMaterialsConfigRow: chooseMaterialsConfig, onRow: (record) => { return { onClick: () => { this.onRowClick('control', record); } }; }, | |
| 1075 | + }, | |
| 1076 | + filteredValue: this.props.slaveSelectedRowKeys, | |
| 1077 | + onFilterData: this.handleFilterSlaveData, | |
| 1078 | + OnGetFilterData: this.handleGetFilterData, | |
| 1079 | + onAddRow: this.handleTableAdd, | |
| 1080 | + onKeyDown: this.props.onKeyDown, | |
| 1081 | + onDelRow: this.handleTableDel, | |
| 1082 | + enabled: bUsed, | |
| 1083 | + }; | |
| 1084 | + const name = 'controlTree'; | |
| 1085 | + const treeProps = { | |
| 1086 | + ...commonBusiness.getTreeTypes('tree', this.props), | |
| 1087 | + isSearch: false, | |
| 1088 | + checkable: false, | |
| 1089 | + disabled: false, | |
| 1090 | + checkedAll: false, | |
| 1091 | + unChecked: false, | |
| 1092 | + [`${name}Column`]: this.props[`${name}Column`], | |
| 1093 | + [`${name}Config`]: this.props[`${name}Config`], | |
| 1094 | + [`${name}Data`]: this.props[`${name}Data`], | |
| 1095 | + getFloatNum: this.props.getFloatNum, | |
| 1096 | + getSqlDropDownData: this.props.getSqlDropDownData, | |
| 1097 | + getSqlCondition: this.props.getSqlCondition, | |
| 1098 | + handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord, | |
| 1099 | + getDateFormat: this.props.getDateFormat, | |
| 1100 | + onDoubleClick: this.props.onDoubleClick, | |
| 1101 | + onSelect: this.handleTreeSelect, | |
| 1102 | + expandedKeys: this.props.expandedKeys, | |
| 1103 | + showLine: true, | |
| 1104 | + }; | |
| 1105 | + const materialsPropsType = { | |
| 1106 | + ...commonBusiness.getTableTypes('materials', this.props), | |
| 1107 | + tableProps: { CalLastWidth: modalWidth, AutoTableHeight: fixedAutoHeight }, | |
| 1108 | + filteredValue: this.props.controlSelectedRowKeys, | |
| 1109 | + onFilterData: this.handleFilterData, | |
| 1110 | + OnGetFilterData: this.handleGetFilterData, | |
| 1111 | + onAddRow: this.handleTableAdd, | |
| 1112 | + onKeyDown: this.props.onKeyDown, | |
| 1113 | + enabled: bUsed, | |
| 1114 | + }; | |
| 1115 | + const processPropsType = { | |
| 1116 | + ...commonBusiness.getTableTypes('process', this.props), | |
| 1117 | + tableProps: { CalLastWidth: modalWidth, AutoTableHeight: 132 }, | |
| 1118 | + filteredValue: this.props.controlSelectedRowKeys, | |
| 1119 | + onFilterData: this.handleFilterData, | |
| 1120 | + OnGetFilterData: this.handleGetFilterData, | |
| 1121 | + onAddRow: this.handleTableAdd, | |
| 1122 | + onChooseProcessRow: this.handleTableChooseProcess, | |
| 1123 | + onKeyDown: this.props.onKeyDown, | |
| 1124 | + enabled: bUsed, | |
| 1125 | + }; | |
| 1126 | + let searchProcessType = {}; | |
| 1127 | + // let chooseProcessConfig = {}; | |
| 1128 | + if (commonUtils.isNotEmptyObject(this.props.processChooseData)) { | |
| 1129 | + // const iIndex = this.props.processConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseProcess'); | |
| 1130 | + // if (iIndex > -1) { | |
| 1131 | + // chooseProcessConfig = this.props.processConfig.gdsconfigformslave[iIndex]; | |
| 1132 | + // } | |
| 1133 | + | |
| 1134 | + searchProcessType = { | |
| 1135 | + app: { | |
| 1136 | + ...this.props.app, | |
| 1137 | + currentPane: { | |
| 1138 | + name: 'process', | |
| 1139 | + config: chooseProcessConfig, | |
| 1140 | + conditonValues: this.props.getSqlCondition(chooseProcessConfig), | |
| 1141 | + title: this.props.processChooseData.sMenuName, | |
| 1142 | + route: this.props.processChooseData.sName, | |
| 1143 | + formId: this.props.processChooseData.sId, | |
| 1144 | + key: this.props.sModelsId + this.props.processChooseData.sId, | |
| 1145 | + sModelsType: this.props.processChooseData.sModelType, | |
| 1146 | + select: this.handleSelect, | |
| 1147 | + selectCancel: this.props.onSelectCancel, | |
| 1148 | + }, | |
| 1149 | + }, | |
| 1150 | + dispatch: this.props.dispatch, | |
| 1151 | + content: this.props.content, | |
| 1152 | + id: new Date().getTime().toString(), | |
| 1153 | + realizeHeight: this.props.realizeHeight, /* 拖动偏移高度 */ | |
| 1154 | + }; | |
| 1155 | + } | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + let searchMaterialsType = {}; | |
| 1159 | + // let chooseMaterialsConfig = {}; | |
| 1160 | + if (commonUtils.isNotEmptyObject(this.props.materialsChooseData) && this.props.tableName !== 'slave') { | |
| 1161 | + // const iIndex = this.props.materialsConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseMaterials'); | |
| 1162 | + // if (iIndex > -1) { | |
| 1163 | + // chooseMaterialsConfig = this.props.materialsConfig.gdsconfigformslave[iIndex]; | |
| 1164 | + // } | |
| 1165 | + | |
| 1166 | + searchMaterialsType = { | |
| 1167 | + app: { | |
| 1168 | + ...this.props.app, | |
| 1169 | + currentPane: { | |
| 1170 | + name: 'materials', | |
| 1171 | + config: chooseMaterialsConfig, | |
| 1172 | + conditonValues: this.props.getSqlCondition(chooseMaterialsConfig), | |
| 1173 | + title: this.props.materialsChooseData.sMenuName, | |
| 1174 | + route: this.props.materialsChooseData.sName, | |
| 1175 | + formId: this.props.materialsChooseData.sId, | |
| 1176 | + key: this.props.sModelsId + this.props.materialsChooseData.sId, | |
| 1177 | + sModelsType: this.props.materialsChooseData.sModelsType, | |
| 1178 | + select: this.handleSelect, | |
| 1179 | + selectCancel: this.props.onSelectCancel, | |
| 1180 | + }, | |
| 1181 | + }, | |
| 1182 | + dispatch: this.props.dispatch, | |
| 1183 | + content: this.props.content, | |
| 1184 | + id: new Date().getTime().toString(), | |
| 1185 | + realizeHeight: this.props.realizeHeight, | |
| 1186 | + }; | |
| 1187 | + } | |
| 1188 | + const pane = app.panes.filter(paneTmp => paneTmp.key === sTabId)[0]; | |
| 1189 | + const setMaterailRemark = commonFunc.showMessage(app.commonConst, 'setMaterailRemark');/* 选择材料与工艺 */ | |
| 1190 | + const setProcessTitle = commonFunc.showMessage(app.commonConst, 'setProcess');/* 选择工序标题 */ | |
| 1191 | + const setMaterialTitle = commonFunc.showMessage(app.commonConst, 'setMaterial');/* 选择材料标题 */ | |
| 1192 | + const btnSure = commonFunc.showMessage(app.commonConst, 'btnSure');/* 确认 */ | |
| 1193 | + const check = commonFunc.showMessage(app.commonConst, 'check');/* 审核 */ | |
| 1194 | + const BtnClose = commonFunc.showMessage(app.commonConst, 'BtnClose');/* 关闭 */ | |
| 1195 | + const checkPerson = commonFunc.showMessage(app.commonConst, 'checkPerson');/* 审核人 */ | |
| 1196 | + // eslint-disable-next-line jsx-a11y/anchor-is-valid | |
| 1197 | + const operateAdd = <a title="添加同级" alt="" onClick={this.props.enabled ? this.handleTableAdd.bind(this, 'control', false, 'sameNode') : null}>{this.props.enabled ? setAdd.img : setAdd.disableimg} </a>; | |
| 1198 | + // eslint-disable-next-line jsx-a11y/anchor-is-valid | |
| 1199 | + const operateAddChild = <a title="添加子级" onClick={this.props.enabled ? this.handleTableAdd.bind(this, 'control', false, 'childNode') : null}>{this.props.enabled ? setAddChild.img : setAddChild.disableimg }</a>; | |
| 1200 | + // eslint-disable-next-line jsx-a11y/anchor-is-valid | |
| 1201 | + const operateCopy = <a title="复制" onClick={this.props.enabled ? this.props.onDataRowCopy.bind(this, 'control', false, true) : null}>{this.props.enabled ? setCopy.img : setCopy.disableimg}</a>; | |
| 1202 | + // eslint-disable-next-line jsx-a11y/anchor-is-valid | |
| 1203 | + const operateUpdate = <a title="复制全部" onClick={this.props.enabled ? this.props.onDataRowCopyAll.bind(this, 'control', false, true) : null}>{this.props.enabled ? setCopyAll.img : setCopyAll.disableimg }</a>; | |
| 1204 | + // eslint-disable-next-line jsx-a11y/anchor-is-valid | |
| 1205 | + const operateDel = <a title="删除" onClick={this.props.enabled ? this.handleTableDel.bind(this, 'control', true, '', true) : null}>{this.props.enabled ? setDelete.img : setDelete.disableimg}</a>; | |
| 1206 | + return ( | |
| 1207 | + <div> | |
| 1208 | + <Spin spinning={pageLoading}> | |
| 1209 | + <div> | |
| 1210 | + <BillDeliverComponent | |
| 1211 | + {...this.props} | |
| 1212 | + {...this.state} | |
| 1213 | + onUploadChangeFile={this.handleUploadChangeFile} /* xls文件导入 */ | |
| 1214 | + onUploadChange={this.handleUploadChange} /* 表格图片上传 */ | |
| 1215 | + onBeforeUpload={this.handleBeforeUpload} | |
| 1216 | + onGetDataCancel={this.handleGetDataCancel} | |
| 1217 | + onGetDataOk={this.handleGetDataOk} | |
| 1218 | + colseGetDataVisible={this.colseGetDataVisible} | |
| 1219 | + getMenuStatus={this.getMenuStatus} | |
| 1220 | + onUploadPropsSales={this.handleUploadPropsSales} | |
| 1221 | + onDataRowModal={this.handleTableModal} | |
| 1222 | + onDataRowDel={this.handleSlaveTableDel} | |
| 1223 | + onDoubleClick={this.onDoubleClick} | |
| 1224 | + onSelectTree={this.handleTreeSelect} | |
| 1225 | + handleCancelModal={this.handleCancelModal} | |
| 1226 | + setMaterialTitle={setMaterialTitle} | |
| 1227 | + onSelect={this.handleSelect} | |
| 1228 | + onFilterData={this.handleFilterData} | |
| 1229 | + onDelRow={this.handleTableDel} | |
| 1230 | + /> | |
| 1231 | + { | |
| 1232 | + visible ? | |
| 1233 | + <AntdDraggableModal | |
| 1234 | + title={check} | |
| 1235 | + visible={visible} | |
| 1236 | + onCancel={this.handleCancel} | |
| 1237 | + onSaveState={this.props.onSaveState} | |
| 1238 | + footer={[ | |
| 1239 | + <Button key="back" onClick={this.handleCancel}>{BtnClose}</Button>, | |
| 1240 | + <Button key="submit" type="primary" onClick={this.handleOk.bind(this, 1, 1, true)}> | |
| 1241 | + {btnSure} | |
| 1242 | + </Button>, | |
| 1243 | + ]} | |
| 1244 | + > | |
| 1245 | + <Table columns={columns} dataSource={checkConditions} bordered pagination={false} className={styles.checkTable} /> | |
| 1246 | + <div style={{ float: 'left', width: '15%' }}>{checkPerson}</div> | |
| 1247 | + <div style={{ float: 'left', width: '60%' }}> | |
| 1248 | + <Checkbox.Group style={{ width: '100%' }} onChange={this.onChange}> | |
| 1249 | + <Row> | |
| 1250 | + { commonUtils.isNotEmptyObject(checkPersonData) ? | |
| 1251 | + checkPersonData.map((item) => { | |
| 1252 | + return ( | |
| 1253 | + <Col span={8}> | |
| 1254 | + <Checkbox value={item.sUserId}>{item.sUserName}</Checkbox> | |
| 1255 | + </Col> | |
| 1256 | + ); | |
| 1257 | + }) | |
| 1258 | + : '' | |
| 1259 | + } | |
| 1260 | + </Row> | |
| 1261 | + </Checkbox.Group> | |
| 1262 | + </div> | |
| 1263 | + </AntdDraggableModal> | |
| 1264 | + : '' | |
| 1265 | + } | |
| 1266 | + { | |
| 1267 | + visibleModal ? | |
| 1268 | + <AntdDraggableModal | |
| 1269 | + title={setMaterailRemark} | |
| 1270 | + width="1200" | |
| 1271 | + bodyStyle={{ paddingBottom: 0, zIndex: 1000 }} | |
| 1272 | + visible={pane.notCurrentPane ? false : visibleModal} | |
| 1273 | + onCancel={this.handleCancelModal.bind(this, 'visibleModal')} | |
| 1274 | + onSaveState={this.props.onSaveState} | |
| 1275 | + forbidResize | |
| 1276 | + footer={[ | |
| 1277 | + <Button key="back" onClick={this.handleCancelModal.bind(this, 'visibleModal')}>{BtnClose}</Button>, | |
| 1278 | + <Button key="submit" type="primary" onClick={this.handleOkModal.bind(this)}> | |
| 1279 | + {btnSure} | |
| 1280 | + </Button>, | |
| 1281 | + ]} | |
| 1282 | + > | |
| 1283 | + { | |
| 1284 | + (pane.notCurrentPane ? false : processChooseVisible) ? | |
| 1285 | + <AntdDraggableModal | |
| 1286 | + width={1100} | |
| 1287 | + className="MProcess" | |
| 1288 | + bodyStyle={{ paddingBottom: 0, maxHeight: 520, zIndex: 2000 }} | |
| 1289 | + title={commonUtils.isEmptyObject(searchProcessType) ? setProcessTitle : searchProcessType.app.currentPane.title} | |
| 1290 | + onCancel={this.handleCancelModal.bind(this, 'processChooseVisible')} | |
| 1291 | + visible={pane.notCurrentPane ? false : processChooseVisible} | |
| 1292 | + onSaveState={this.props.onSaveState} | |
| 1293 | + footer={null} | |
| 1294 | + > | |
| 1295 | + <CommonListSelectTree {...searchProcessType} /> | |
| 1296 | + </AntdDraggableModal> | |
| 1297 | + : '' | |
| 1298 | + } | |
| 1299 | + { | |
| 1300 | + (pane.notCurrentPane ? false : materialsChooseVisible) ? | |
| 1301 | + <AntdDraggableModal | |
| 1302 | + bodyStyle={{ paddingBottom: 0, maxHeight: 520, zIndex: 2000 }} | |
| 1303 | + className="MProcess" | |
| 1304 | + width={1100} | |
| 1305 | + title={commonUtils.isEmptyObject(searchMaterialsType) ? setMaterialTitle : searchMaterialsType.app.currentPane.title} | |
| 1306 | + onCancel={this.handleCancelModal.bind(this, 'materialsChooseVisible')} | |
| 1307 | + visible={pane.notCurrentPane ? false : materialsChooseVisible} | |
| 1308 | + onSaveState={this.props.onSaveState} | |
| 1309 | + footer={null} | |
| 1310 | + > | |
| 1311 | + <CommonListSelect {...searchMaterialsType} /> | |
| 1312 | + </AntdDraggableModal> | |
| 1313 | + : '' | |
| 1314 | + } | |
| 1315 | + <div id="ModalMaterialRemark" > | |
| 1316 | + { | |
| 1317 | + sModelsType === 'sales/salesOrderPack' ? | |
| 1318 | + <div style={{ | |
| 1319 | + marginTop: 0, height: '180px', overflowY: 'hidden', overflowX: 'hidden', | |
| 1320 | +}} | |
| 1321 | + > | |
| 1322 | + <div className="xly-bill-pack"> | |
| 1323 | + <Sider className="controlhandcover"> | |
| 1324 | + <div className="xly-control"> | |
| 1325 | + <div style={{ backgroundColor: '#f5f5f5', height: '30px' }} /> | |
| 1326 | + <div className="xly-control-tree"><StaticEditTree {...treeProps} /></div> | |
| 1327 | + <div className="xly-control-operate" > | |
| 1328 | + <span>{operateAdd}</span> | |
| 1329 | + <span>{operateAddChild}</span> | |
| 1330 | + <span>{operateCopy}</span> | |
| 1331 | + <span>{operateUpdate}</span> | |
| 1332 | + <span>{operateDel}</span> | |
| 1333 | + </div> | |
| 1334 | + </div> | |
| 1335 | + </Sider> | |
| 1336 | + <div style={{ overflowX: 'auto', overflowY: 'hidden' }}> | |
| 1337 | + <StaticEditTable {...controlPropsType} footer="hidden" setOpterationColumn="Y" /> | |
| 1338 | + </div> | |
| 1339 | + </div> | |
| 1340 | + </div> : | |
| 1341 | + <div style={{ marginTop: 0, overflowY: 'hidden' }} > | |
| 1342 | + <StaticEditTable {...controlPropsType} footer="hidden" setOpterationColumn="Y" /> | |
| 1343 | + </div> | |
| 1344 | + } | |
| 1345 | + <div style={{ marginTop: 0, overflowY: 'hidden' }}> | |
| 1346 | + <StaticEditTable {...materialsPropsType} footer="hidden" setOpterationColumn="Y" /> | |
| 1347 | + </div> | |
| 1348 | + <div style={{ marginTop: 0, overflowY: 'hidden' }} id="chooseProcessModal"> | |
| 1349 | + <StaticEditTable {...processPropsType} footer="hidden" setOpterationColumn="Y" /> | |
| 1350 | + </div> | |
| 1351 | + </div> | |
| 1352 | + </AntdDraggableModal> | |
| 1353 | + : ''} | |
| 1354 | + </div> | |
| 1355 | + </Spin> | |
| 1356 | + </div> | |
| 1357 | + ); | |
| 1358 | + } | |
| 1359 | +} | |
| 1360 | + | |
| 1361 | +const BillDeliverComponent = Form.create({ | |
| 1362 | + mapPropsToFields(props) { | |
| 1363 | + const { masterData, masterConfig } = props; | |
| 1364 | + const obj = commonFunc.mapPropsToFields(masterData, Form, masterConfig); | |
| 1365 | + return obj; | |
| 1366 | + }, | |
| 1367 | +})((props) => { | |
| 1368 | + const { | |
| 1369 | + form, | |
| 1370 | + onReturnForm, | |
| 1371 | + slaveData, | |
| 1372 | + slavePagination, | |
| 1373 | + onlyMaster, | |
| 1374 | + AutoTableHeight, | |
| 1375 | + sModelsId, | |
| 1376 | + app, | |
| 1377 | + onlyMasterAndSlave, | |
| 1378 | + masterConfig, | |
| 1379 | + slaveConfig, | |
| 1380 | + isSmall, | |
| 1381 | + isGetDataVisible, | |
| 1382 | + onGetDataCancel, | |
| 1383 | + onGetDataOk, | |
| 1384 | + colseGetDataVisible, | |
| 1385 | + sModelsType, | |
| 1386 | + masterData, | |
| 1387 | + } = props; | |
| 1388 | + /* 回带表单 */ | |
| 1389 | + onReturnForm(form); | |
| 1390 | + const pagination = { | |
| 1391 | + pageSize: commonConfig.pageSize, | |
| 1392 | + total: commonUtils.isEmptyArr(slaveData) ? 0 : slaveData.length, | |
| 1393 | + current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current, | |
| 1394 | + ...slavePagination, | |
| 1395 | + // size: 'large', | |
| 1396 | + | |
| 1397 | + // showQuickJumper: true, | |
| 1398 | + hideOnSinglePage: false, | |
| 1399 | + size: isSmall ? 'small' : 'large', | |
| 1400 | + pageSizeOptions: commonConfig.pageSizeOptions, | |
| 1401 | + showSizeChanger: !isSmall, | |
| 1402 | + showQuickJumper: !isSmall, | |
| 1403 | + }; | |
| 1404 | + const templateProps = props.formData.filter(item => item.sGrd === 'importTemplate')[0]; | |
| 1405 | + let setMaterialRemark = { | |
| 1406 | + title: '材料与工艺', | |
| 1407 | + width: { width }, | |
| 1408 | + height: { height }, | |
| 1409 | + img: <img src={MaterialRemarkIcon} alt="材料与工艺" width={width} height={height} />, | |
| 1410 | + disableimg: <img src={DisMaRemarklIcon} alt="材料与工艺不可用" width={width} height={height} />, | |
| 1411 | + }; | |
| 1412 | + /* 获取toolbar 选择材料 */ | |
| 1413 | + let searchMaterialsType = {}; | |
| 1414 | + let chooseMaterialsConfig = {}; | |
| 1415 | + if (commonUtils.isNotEmptyObject(slaveConfig)) { | |
| 1416 | + const iIndex = slaveConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnChooseMaterials'); | |
| 1417 | + if (iIndex > -1) { | |
| 1418 | + chooseMaterialsConfig = slaveConfig.gdsconfigformslave[iIndex]; | |
| 1419 | + } | |
| 1420 | + } | |
| 1421 | + if (commonUtils.isNotEmptyObject(props.materialsChooseData)) { | |
| 1422 | + searchMaterialsType = { | |
| 1423 | + app: { | |
| 1424 | + ...props.app, | |
| 1425 | + currentPane: { | |
| 1426 | + name: 'materials', | |
| 1427 | + config: chooseMaterialsConfig, | |
| 1428 | + conditonValues: props.getSqlCondition(chooseMaterialsConfig), | |
| 1429 | + title: props.materialsChooseData.sMenuName, | |
| 1430 | + route: props.materialsChooseData.sName, | |
| 1431 | + formId: props.materialsChooseData.sId, | |
| 1432 | + key: sModelsId + props.materialsChooseData.sId, | |
| 1433 | + sModelsType: props.materialsChooseData.sModelType, | |
| 1434 | + select: props.onSelect, | |
| 1435 | + selectCancel: props.onSelectCancel, | |
| 1436 | + }, | |
| 1437 | + }, | |
| 1438 | + dispatch: props.dispatch, | |
| 1439 | + content: props.content, | |
| 1440 | + id: new Date().getTime().toString(), | |
| 1441 | + realizeHeight: props.realizeHeight, /* 拖动偏移高度 */ | |
| 1442 | + }; | |
| 1443 | + } | |
| 1444 | + | |
| 1445 | + /* 导入收付款未清数据 */ | |
| 1446 | + let importPopupProps = {}; | |
| 1447 | + let importPopupTitle = '导入未清数据'; | |
| 1448 | + if (commonUtils.isNotEmptyObject(props)) { | |
| 1449 | + let importPopupConfig = {}; | |
| 1450 | + const { | |
| 1451 | + masterConfig, sModelsId, | |
| 1452 | + } = props; | |
| 1453 | + if (commonUtils.isNotEmptyObject(masterConfig)) { | |
| 1454 | + const iIndex = masterConfig.gdsconfigformslave.findIndex(item => item.sControlName === 'BtnImportFormData' && item.bVisible); | |
| 1455 | + if (iIndex > -1) { | |
| 1456 | + importPopupConfig = masterConfig.gdsconfigformslave[iIndex]; | |
| 1457 | + importPopupTitle = commonUtils.isNotEmptyObject(importPopupConfig) && commonUtils.isNotEmptyObject(importPopupConfig.sActiveName) ? importPopupConfig.sActiveName : importPopupTitle; | |
| 1458 | + importPopupProps = { | |
| 1459 | + app: { | |
| 1460 | + ...props.app, | |
| 1461 | + currentPane: { | |
| 1462 | + name: 'commonPopup', | |
| 1463 | + config: importPopupConfig, | |
| 1464 | + conditonValues: {}, | |
| 1465 | + title: importPopupTitle, | |
| 1466 | + route: '/indexPage/commonList', | |
| 1467 | + formRoute: '/indexPage/commonList', | |
| 1468 | + formId: importPopupConfig.sActiveId, | |
| 1469 | + key: sModelsId + importPopupConfig.sId, | |
| 1470 | + sModelsType: 'search/importFormData', | |
| 1471 | + select: props.onSelect, | |
| 1472 | + selectCancel: props.handleCancelModal.bind(this, 'importFormDataVisible'), | |
| 1473 | + bFilterProName: props.bFilterProName, /* 存储过程查询ID */ | |
| 1474 | + bFilterProValue: props.bFilterProValue, /* 存储过程查询VALUE */ | |
| 1475 | + }, | |
| 1476 | + }, | |
| 1477 | + dispatch: props.dispatch, | |
| 1478 | + content: props.content, | |
| 1479 | + id: new Date().getTime().toString(), | |
| 1480 | + realizeHeight: props.realizeHeight, /* 拖动偏移高度 */ | |
| 1481 | + }; | |
| 1482 | + } | |
| 1483 | + } | |
| 1484 | + } | |
| 1485 | + | |
| 1486 | + // const saleOrder = commonFunc.showMessage(app.commonConst, 'saleOrder');/* 销售订单 */ | |
| 1487 | + setMaterialRemark = props.sModelsType !== undefined && props.sModelsType.includes('sales/salesOrder') ? setMaterialRemark : null; | |
| 1488 | + const autoHeight = AutoTableHeight - 90; | |
| 1489 | + const slaveTableProps = { | |
| 1490 | + ...commonBusiness.getTableTypes('slave', props), | |
| 1491 | + tableProps: { | |
| 1492 | + setAdd, setCopy, setCopyAll, setDelete, setMaterialRemark, setMaterial, chooseMaterialsConfigRow: chooseMaterialsConfig, pagination, onChange: props.onTitleChange, AutoTableHeight: autoHeight, | |
| 1493 | + }, | |
| 1494 | + templateProps, | |
| 1495 | + /* | |
| 1496 | + 修改日期:2021-03-18 | |
| 1497 | + 修改人:吕杰 | |
| 1498 | + 区域:以下一行 | |
| 1499 | + 说明:添加keyDown事件透传 | |
| 1500 | + */ | |
| 1501 | + onKeyDown: props.onKeyDown, | |
| 1502 | + onContextMenu: props.onContextMenu, | |
| 1503 | + masterData: props.masterData, // 为通用弹窗提供主表数据(孟总需求:产品新增需要带上客户信息) | |
| 1504 | + onDelRow: props.onDelRow, | |
| 1505 | + }; | |
| 1506 | + | |
| 1507 | + const slaveChildTableProps = { | |
| 1508 | + ...commonBusiness.getTableTypes('slaveChild', props), | |
| 1509 | + filteredValue: props.slaveSelectedRowKeys, | |
| 1510 | + onFilterData: props.onFilterData, | |
| 1511 | + tableProps: { | |
| 1512 | + setAdd, setCopy, setDelete, pagination, onChange: props.onTitleChange, | |
| 1513 | + }, | |
| 1514 | + templateProps, | |
| 1515 | + bRowClick: true, | |
| 1516 | + /* | |
| 1517 | + 修改日期:2021-03-18 | |
| 1518 | + 修改人:吕杰 | |
| 1519 | + 区域:以下一行 | |
| 1520 | + 说明:添加keyDown事件透传 | |
| 1521 | + */ | |
| 1522 | + onKeyDown: props.onKeyDown, | |
| 1523 | + onContextMenu: props.onContextMenu, | |
| 1524 | + masterData: props.masterData, // 为通用弹窗提供主表数据(孟总需求:产品新增需要带上客户信息) | |
| 1525 | + }; | |
| 1526 | + | |
| 1527 | + let gdsconfigformmasterId = ''; | |
| 1528 | + if (templateProps !== undefined) { | |
| 1529 | + gdsconfigformmasterId = templateProps.sId; | |
| 1530 | + } | |
| 1531 | + | |
| 1532 | + const sNotEmpty = 'sParentId,sProductId'; | |
| 1533 | + let uploadUrl = `${commonConfig.server_host}import/checkExcel?sModelsId=${sModelsId}&gdsconfigformmasterId=${gdsconfigformmasterId}&sNotEmpty=${sNotEmpty}&token=${app.token}`; | |
| 1534 | + /* 送货单需要传客户id */ | |
| 1535 | + if (commonUtils.isNotEmptyObject(sModelsType) && sModelsType === 'sales/salesSgoods' && commonUtils.isNotEmptyObject(masterData)) { | |
| 1536 | + const sCustomerId = masterData.sCustomerId; | |
| 1537 | + if (commonUtils.isNotEmptyObject(sCustomerId)) { | |
| 1538 | + uploadUrl = `${commonConfig.server_host}import/checkExcel?sModelsId=${sModelsId}&gdsconfigformmasterId=${gdsconfigformmasterId}&sNotEmpty=${sNotEmpty}&sCustomerId=${sCustomerId}&token=${app.token}`; | |
| 1539 | + } | |
| 1540 | + } | |
| 1541 | + const outProps = { | |
| 1542 | + action: uploadUrl, | |
| 1543 | + onChange: props.onUploadChangeFile, /* 文件上传 */ | |
| 1544 | + accept: 'xls/*', | |
| 1545 | + showUploadList: false, | |
| 1546 | + beforeUpload: () => { | |
| 1547 | + /* 查看时不可上传 */ | |
| 1548 | + if (!props.enabled) return false; | |
| 1549 | + }, | |
| 1550 | + }; | |
| 1551 | + const uploadPropsSales = props.onUploadPropsSales(); | |
| 1552 | + const MainContent = commonFunc.showMessage(app.commonConst, 'MainContent');/* 主体内容 */ | |
| 1553 | + const isGetData = commonFunc.showMessage(app.commonConst, 'isGetData');/* 确认获取库存为零的数据吗 */ | |
| 1554 | + const isFilterGetDataZero = commonFunc.showMessage(app.commonConst, 'isFilterGetDataZero'); | |
| 1555 | + const isAllGetData = commonFunc.showMessage(app.commonConst, 'isAllGetData'); | |
| 1556 | + const CheckInfo = commonFunc.showMessage(app.commonConst, 'CheckInfo');/* 审批信息 */ | |
| 1557 | + const BtnimportData = commonFunc.showMessage(app.commonConst, 'importData');/* 导入数据 */ | |
| 1558 | + const ImportData = commonUtils.isNotEmptyObject(masterConfig) ? masterConfig.gdsconfigformslave.filter(item => item.sControlName.includes('ImportData') && item.bVisible) : '';/* 后台是否配置导入 */ | |
| 1559 | + /* | |
| 1560 | + if (props.sModelsType === 'sales/salesOrder') { | |
| 1561 | + const btnUpload = ( | |
| 1562 | + <Upload {...outProps}> | |
| 1563 | + <Button {...uploadPropsSales}> | |
| 1564 | + <Icon type="upload" /> 导入数据 | |
| 1565 | + </Button> | |
| 1566 | + </Upload>); | |
| 1567 | + slaveTableProps.tableProps.newButton = btnUpload; | |
| 1568 | + } | |
| 1569 | + */ | |
| 1570 | + | |
| 1571 | + return ( | |
| 1572 | + <Form style={{ backgroundColor: '#e3e3e3' }}> | |
| 1573 | + <Layout> | |
| 1574 | + <Header className={styles.header}> | |
| 1575 | + <div className="billToolBar"> | |
| 1576 | + <Toolbar {...props} className="billBtnGroup btnGroupHasImport" style={{ backgroundColor: '#646464', color: 'rgb(255,255,255)' }} pageFrom="billList" /> | |
| 1577 | + { commonUtils.isNotEmptyArr(ImportData) ? | |
| 1578 | + <div id="btnImportData" className={`importData ${props.enabled}`} > | |
| 1579 | + <Upload {...outProps}><UploadOutlined />{BtnimportData} | |
| 1580 | + <Button {...uploadPropsSales} /> | |
| 1581 | + </Upload> | |
| 1582 | + </div> : ''} | |
| 1583 | + </div> | |
| 1584 | + </Header> | |
| 1585 | + <Layout className={styles.clayout}> | |
| 1586 | + <Content className={styles.content} > | |
| 1587 | + <div style={{ | |
| 1588 | + border: '1px solid #c2c3c5', | |
| 1589 | + margin: '0 10px', | |
| 1590 | + marginTop: 8, | |
| 1591 | + backgroundColor: '#fff', | |
| 1592 | + }} | |
| 1593 | + > | |
| 1594 | + <div className="bill-search-group" > | |
| 1595 | + <CommonView {...props} /> | |
| 1596 | + </div> | |
| 1597 | + </div> | |
| 1598 | + { onlyMaster ? | |
| 1599 | + <div id="slaveTabs" className={styles.bShow}> | |
| 1600 | + <div> | |
| 1601 | + <Avatar src={props.imgSrc} /> | |
| 1602 | + </div> | |
| 1603 | + </div> : | |
| 1604 | + <div id="slaveTabs" className={styles.bShow}> | |
| 1605 | + <div> | |
| 1606 | + <Avatar src={props.imgSrc} /> | |
| 1607 | + </div> | |
| 1608 | + <Tabs className={styles.slaveTabs} tabBarStyle={{ margin: '0 10px' }} > | |
| 1609 | + <TabPane tab={MainContent} key={2} className="xly-bill-list"> | |
| 1610 | + <div className="TabPaneStyle"> | |
| 1611 | + <StaticEditTable {...slaveTableProps} noVlist setOpterationColumn={props.sModelsType !== 'cost/cosexpenseshare' ? 'Y' : ''} /> | |
| 1612 | + </div> | |
| 1613 | + </TabPane> | |
| 1614 | + <TabPane tab={CheckInfo} key={3} className="xly-bill-list"> | |
| 1615 | + <div className="TabPaneStyle"> | |
| 1616 | + <StaticEditTable {...commonBusiness.getTableTypes('check', props)} tableProps={{ AutoTableHeight: autoHeight || 250 }} noVlist setOpterationColumn="Y" /> | |
| 1617 | + </div> | |
| 1618 | + </TabPane> | |
| 1619 | + </Tabs> | |
| 1620 | + </div> } | |
| 1621 | + { onlyMasterAndSlave ? | |
| 1622 | + <div id="slaveTabs" className={styles.bShow}> | |
| 1623 | + <div> | |
| 1624 | + <Avatar src={props.imgSrc} /> | |
| 1625 | + </div> | |
| 1626 | + <Tabs className={styles.slaveTabs} style={{ margin: '0px!important', height: AutoTableHeight, overflow: 'hidden' }} tabBarStyle={{ margin: '0 10px' }} > | |
| 1627 | + <TabPane tab={MainContent} key={2} className="xly-bill-list"> | |
| 1628 | + <StaticEditTable {...slaveTableProps} setOpterationColumn={props.sModelsType !== 'cashier/receipt' && props.sModelsType !== 'cashier/payment' ? 'Y' : ''} /> | |
| 1629 | + </TabPane> | |
| 1630 | + </Tabs> | |
| 1631 | + </div> : '' } | |
| 1632 | + <div className="xly-tab-table" style={{ marginTop: '5px' }}> | |
| 1633 | + <StaticEditTable {...slaveChildTableProps} setOpterationColumn="Y" /> | |
| 1634 | + </div> | |
| 1635 | + </Content> | |
| 1636 | + </Layout> | |
| 1637 | + </Layout> | |
| 1638 | + { | |
| 1639 | + isGetDataVisible ? | |
| 1640 | + <AntdDraggableModal | |
| 1641 | + visible={isGetDataVisible} | |
| 1642 | + title="获取数据" | |
| 1643 | + onOk={onGetDataOk} | |
| 1644 | + onCancel={colseGetDataVisible} | |
| 1645 | + footer={[ | |
| 1646 | + <Button key="back" onClick={onGetDataCancel}> | |
| 1647 | + {isAllGetData} | |
| 1648 | + </Button>, | |
| 1649 | + <Button key="submit" type="primary" onClick={onGetDataOk}> | |
| 1650 | + {isFilterGetDataZero} | |
| 1651 | + </Button>, | |
| 1652 | + ]} | |
| 1653 | + > | |
| 1654 | + <p>{isGetData}</p> | |
| 1655 | + </AntdDraggableModal> | |
| 1656 | + : '' | |
| 1657 | + } | |
| 1658 | + { | |
| 1659 | + props.materialsChooseVisible && !props.visibleModal ? | |
| 1660 | + <AntdDraggableModal | |
| 1661 | + width={1300} | |
| 1662 | + title={props.setMaterialTitle} | |
| 1663 | + visible={props.materialsChooseVisible} | |
| 1664 | + onCancel={props.handleCancelModal.bind(this, 'materialsChooseVisible')} | |
| 1665 | + onSaveState={props.onSaveState} | |
| 1666 | + footer={null} | |
| 1667 | + > | |
| 1668 | + <CommonListSelect {...searchMaterialsType} /> | |
| 1669 | + </AntdDraggableModal> | |
| 1670 | + : '' | |
| 1671 | + } | |
| 1672 | + { | |
| 1673 | + props.importFormDataVisible ? | |
| 1674 | + <AntdDraggableModal | |
| 1675 | + width={1300} | |
| 1676 | + zIndex={1000} | |
| 1677 | + title={importPopupTitle} | |
| 1678 | + visible={props.importFormDataVisible} | |
| 1679 | + onCancel={props.handleCancelModal.bind(this, 'importFormDataVisible')} | |
| 1680 | + onSaveState={props.onSaveState} | |
| 1681 | + footer={null} | |
| 1682 | + > | |
| 1683 | + <CommonListSelect {...importPopupProps} /> | |
| 1684 | + </AntdDraggableModal> | |
| 1685 | + : '' | |
| 1686 | + } | |
| 1687 | + { | |
| 1688 | + props.contextMenuModalVisible ? | |
| 1689 | + <ContextMenuModal {...props} /> | |
| 1690 | + : '' | |
| 1691 | + } | |
| 1692 | + </Form> | |
| 1693 | + ); | |
| 1694 | +}); | |
| 1695 | + | |
| 1696 | +export default CommonBase(CommonDeliverSales(CommonBillDeliver)); | ... | ... |