Commit c0c647aa6dee64c397c7f02e6f6ccee77ce7fe4c

Authored by 陈鑫涛
1 parent d631f64f

新增

.umirc.ts
... ... @@ -43,6 +43,8 @@ export default defineConfig({
43 43 { path: '/indexPage/processCardPack'},
44 44 { path: '/indexPage/processCardPackTableTree'},
45 45 { path: '/indexPage/processCardPackTableTreeNew'},
  46 + { path: '/indexPage/workOrderPackTableTreeNew'},
  47 + { path: '/indexPage/productionPlan'},
46 48 ],
47 49 },
48 50 ],
... ...
src/components/Common/commonFunc.js
... ... @@ -42,6 +42,9 @@ export function getConfig(type, name, config, gdsformconst, gdsjurisdiction, sDe
42 42 return returnConfig;
43 43 }
44 44  
  45 +export function getControlConfig() {
  46 + return ''
  47 +}
45 48 export function getDateFormat(systemData) {
46 49 const iIndex = systemData.findIndex(item => (item.sName === 'CbxDateTime'));
47 50 const sCbxDateTime = iIndex > -1 ?
... ...
src/components/Manufacture/WorkOrderPackTableTreeNew/index.js
... ... @@ -10,7 +10,7 @@ import { CommonPackEvent, CommonModal } from "../CommonPackEvent";
10 10 import * as commonBusiness from "@/components/Common/commonBusiness";
11 11 import * as commonUtils from "@/utils/utils";
12 12 import * as commonFunc from "@/components/Common/commonFunc";
13   -import * as commonConfig from "@/utils/config";
  13 +import commonConfig from "@/utils/config";
14 14 import * as commonServices from "@/services/services";
15 15 import Toolbar from "@/components/Common/ToolBar/ToolBarNew";
16 16 import CommonView from "@/components/Common/CommonView";
... ... @@ -4549,7 +4549,7 @@ const MaterialsComponent = props => {
4549 4549 // 限制编辑-劲嘉定制
4550 4550 if (index === 0 || index === 3) {
4551 4551 materialsOtherPropsType.otherlimitDisabled = params => {
4552   - const { enabledNew, record, sName } = params;
  4552 + let { enabledNew, record, sName } = params;
4553 4553 if (!["101251240115016082594412050"].includes(props.sModelsId)) return enabledNew;
4554 4554 if (enabledNew && ["dAuxiThousheetQty"].includes(sName) && record.dPackageQty > 0) {
4555 4555 enabledNew = false;
... ...
src/components/ProductionPlan/ProductionPlan.js 0 → 100644
  1 +/* eslint-disable react/jsx-indent */
  2 +
  3 +import React, { Component } from 'react';
  4 +import { SearchOutlined, SettingOutlined } from '@ant-design/icons';
  5 +import { Form } from '@ant-design/compatible';
  6 +import '@ant-design/compatible/assets/index.css';
  7 +import {
  8 + message,
  9 + Layout,
  10 + Switch,
  11 + DatePicker,
  12 + Radio,
  13 + Input,
  14 + Button,
  15 + Select,
  16 + Row,
  17 + Col,
  18 +} from 'antd';
  19 +import moment from 'moment';
  20 +import * as thisUtils from './ProductionPlanUtils';/* 单据业务功能 */
  21 +import styles1 from './index.less';
  22 +import CommonBase from '../Common/CommonBase';/* 获取配置及数据 */
  23 +import * as commonUtils from '../../utils/utils';/* 通用方法 */
  24 +import * as commonFunc from '../../components/Common/commonFunc';
  25 +import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
  26 +import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
  27 +import AntdDraggableModal from '../Common/AntdDraggableModal';
  28 +
  29 +const {
  30 + Header, Content, Footer, Sider,
  31 +} = Layout;
  32 +const { RangePicker } = DatePicker;
  33 +const RadioGroup = Radio.Group;
  34 +const { Option } = Select;
  35 +const InputGroup = Input.Group;
  36 +const FormItem = Form.Item;
  37 +
  38 +
  39 +// const printItem = (
  40 +// <Menu onClick={this.handlePrintChange}>
  41 +// <Menu.Item key="1">印刷排程</Menu.Item>
  42 +// <Menu.Item key="2">印后排程</Menu.Item>
  43 +// </Menu>
  44 +// )
  45 +class ProductionPlan extends Component {
  46 + constructor(props) {
  47 + super(props);
  48 + this.state = {
  49 + enabled: true,
  50 + planTop: styles1.top,
  51 + radiovalue: 0,
  52 + sSqlCondition: '',
  53 + inputCondition: '1',
  54 + inputText: '',
  55 + searchText: '',
  56 + dataFrom: moment().startOf('day').subtract(100, 'days'),
  57 + dataTo: moment().endOf('day'),
  58 + processTableVisable: false,
  59 + processTableLoding: false,
  60 + curProductName: '',
  61 + // selectedRowKeys: [], // Check here to configure the default column
  62 + // selectedMachineRowKeys: [], // Check here to configure the default column
  63 + changeMachine: true,
  64 + sChangeTeamId: '',
  65 + sChangeMachineId: '',
  66 + loading: false,
  67 + filterListData: [{
  68 + key: '1',
  69 + value: '工单号',
  70 + }, {
  71 + key: '2',
  72 + value: '订单号',
  73 + }, {
  74 + key: '3',
  75 + value: '客户名称',
  76 + }, {
  77 + key: '4',
  78 + value: '印件名称',
  79 + }],
  80 + teamData: [],
  81 + DropDownlistMachineData: [],
  82 + // ArrangeColumns: [{
  83 + // title: '工单号',
  84 + // dataIndex: 'sOrderNo',
  85 + // width: 300,
  86 + // ...this.getColumnSearchProps('sOrderNo'),
  87 + // render: (text, record) =>
  88 + // <button onClick={() => this.queryBillProcess(record.key, record.sProductName)}>{text}</button>,
  89 + // }, {
  90 + // title: '工序名称',
  91 + // dataIndex: 'sProcessName',
  92 + // width: 150,
  93 + // ...this.getColumnSearchProps('sProcessName'),
  94 + // }, {
  95 + // title: '客户',
  96 + // dataIndex: 'sCustomerName',
  97 + // width: 200,
  98 + // }, {
  99 + // title: '印件',
  100 + // dataIndex: 'sProductName',
  101 + // width: 200,
  102 + // }, {
  103 + // title: '数量',
  104 + // dataIndex: 'dProductQty',
  105 + // width: 200,
  106 + // }, {
  107 + // title: '班组',
  108 + // dataIndex: 'sTeamName',
  109 + // width: 200,
  110 + // }],
  111 + // ArrangeData: [],
  112 + };
  113 + this.dscrollY = 'calc(100vh - 423px - 35px)';
  114 + this.form = {};
  115 + this.handleList(0, 0, '', '1 = 1'); // 工作中心
  116 + // this.handleList(1, 0, '', '1 = 1'); // 排程数据
  117 + }
  118 + componentWillReceiveProps(nextProps) {
  119 + let {
  120 + workCenterColumn,
  121 + machineColumn,
  122 + arrangeColumn,
  123 + constFind,
  124 + constReset,
  125 + constScheduling,
  126 + constOutProcessing,
  127 + constRelease,
  128 + constSuspend,
  129 + constCancelSuspend,
  130 + constReturn,
  131 + constChangeTeam,
  132 + constChangeMachine,
  133 + constConfirm,
  134 + constSave,
  135 + constPrint,
  136 + constOutExcel,
  137 + constCloseDrag,
  138 + constOpenDrag,
  139 + constRdoStatus,
  140 + constCondition,
  141 + constKeyWord,
  142 + } = nextProps;
  143 + const { formData } = nextProps;
  144 + if (commonUtils.isEmptyArr(workCenterColumn) && formData.length > 0) {
  145 + const workCenterConfig = formData.filter(item => item.sTbName.toUpperCase() === 'sisworkcenter'.toUpperCase())[0];
  146 + workCenterColumn = commonFunc.getHeaderConfig(workCenterConfig, workCenterColumn);
  147 + const tableConfig = workCenterConfig.gdsconfigformslave;
  148 + const column = [];
  149 + for (const child of tableConfig) {
  150 + if (child.bVisible && child.sControlName !== '') {
  151 + let sDropDown = [];
  152 + if (child.sChineseDropDown !== '' && child.sChineseDropDown.indexOf(',') > 0) {
  153 + sDropDown = child.sChineseDropDown.split(',');
  154 + }
  155 + column.push({
  156 + sControlName: child.sControlName,
  157 + sChinese: child.sChinese,
  158 + sChineseDropDown: sDropDown,
  159 + });
  160 + }
  161 + }
  162 + constFind = commonFunc.getControlConfig('BtnFind', column);
  163 + constReset = commonFunc.getControlConfig('BtnReset', column);
  164 + constScheduling = commonFunc.getControlConfig('BtnScheduling', column);
  165 + constOutProcessing = commonFunc.getControlConfig('BtnOutProcessing', column);
  166 + constRelease = commonFunc.getControlConfig('BtnRelease', column);
  167 + constSuspend = commonFunc.getControlConfig('BtnSuspend', column);
  168 + constCancelSuspend = commonFunc.getControlConfig('BtnCancelSuspend', column);
  169 + constReturn = commonFunc.getControlConfig('BtnReturn', column);
  170 + constChangeTeam = commonFunc.getControlConfig('EdtChangeTeam', column);
  171 + constChangeMachine = commonFunc.getControlConfig('EdtChangeMachine', column);
  172 + constConfirm = commonFunc.getControlConfig('BtnConfirm', column);
  173 + constSave = commonFunc.getControlConfig('BtnSave', column);
  174 + constPrint = commonFunc.getControlConfig('BtnPrint', column);
  175 + constOutExcel = commonFunc.getControlConfig('BtnOutExcel', column);
  176 + constCloseDrag = commonFunc.getControlConfig('bCloseDrag', column);
  177 + constOpenDrag = commonFunc.getControlConfig('bOpenDrag', column);
  178 + constRdoStatus = commonFunc.getControlConfig('RdoStatus', column);
  179 + constCondition = commonFunc.getControlConfig('LstCondition', column);
  180 + constKeyWord = commonFunc.getControlConfig('EdtKeyWord', column);
  181 + // constFind = column.
  182 + // constFind: '查找',
  183 + // constReset: '重置',
  184 + // constScheduling: '生产排程',
  185 + // constOutProcessing: '发外加工',
  186 + // constRelease: '下达',
  187 + // constSuspend: '暂停',
  188 + // constCancelSuspend: '取消下达',
  189 + // constReturn: '返回重排',
  190 + // constChangeTeam: '换班组',
  191 + // constChangeMachine: '换机台',
  192 + // constConfirm: '确认更换',
  193 + // constSave: '保存',
  194 + // constPrint: '打印',
  195 + // constOutExcel: '导出',
  196 + // constDrag: '是否拖动',
  197 + // constRdoStatus: '未排程,已排程,已下达,正在生产,已暂停,冻结,已完工,全部',
  198 + // constCondition: '工单号,订单号,客户名称,印件名称',
  199 + // constKeyWord: '关键字',
  200 +
  201 + const machineConfig = formData.filter(item => item.sTbName.toUpperCase() === 'elemachine'.toUpperCase())[0];
  202 + machineColumn = commonFunc.getHeaderConfig(machineConfig, machineColumn);
  203 + const arrangeConfig = formData.filter(item => item.sTbName.toUpperCase() === 'mftproductionplanslave'.toUpperCase())[0];
  204 + arrangeColumn = commonFunc.getHeaderConfig(arrangeConfig, arrangeColumn);
  205 + this.props.onSaveState({
  206 + workCenterConfig,
  207 + workCenterColumn,
  208 + machineConfig,
  209 + machineColumn,
  210 + arrangeConfig,
  211 + arrangeColumn,
  212 + constFind,
  213 + constReset,
  214 + constScheduling,
  215 + constOutProcessing,
  216 + constRelease,
  217 + constSuspend,
  218 + constCancelSuspend,
  219 + constReturn,
  220 + constChangeTeam,
  221 + constChangeMachine,
  222 + constConfirm,
  223 + constSave,
  224 + constPrint,
  225 + constOutExcel,
  226 + constCloseDrag,
  227 + constOpenDrag,
  228 + constRdoStatus,
  229 + constCondition,
  230 + constKeyWord,
  231 + });
  232 + }
  233 + }
  234 + componentWillUpdate() {
  235 + }
  236 +
  237 + getColumnSearchProps = dataIndex => ({
  238 + filterDropdown: ({
  239 + setSelectedKeys, selectedKeys, confirm, clearFilters,
  240 + }) => (
  241 +
  242 + <div style={{ padding: 8, background: '#fff', borderRadius: 4 }}>
  243 + <Input
  244 + ref={(node) => { this.searchInput = node; }}
  245 + placeholder={` ${dataIndex}`}
  246 + value={selectedKeys[0]}
  247 + onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
  248 + onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
  249 + style={{ width: 188, marginBottom: 8, display: 'block' }}
  250 + />
  251 + <Button
  252 + type="primary"
  253 + onClick={() => this.handleSearch(selectedKeys, confirm)}
  254 + icon={<SearchOutlined />}
  255 + size="small"
  256 + style={{ width: 90, marginRight: 8 }}
  257 + >
  258 + 查找
  259 + </Button>
  260 + <Button
  261 + onClick={() => this.handleReset(clearFilters)}
  262 + size="small"
  263 + style={{ width: 90 }}
  264 + >
  265 + 重置
  266 + </Button>
  267 + </div>
  268 + ),
  269 + filterIcon: filtered => <SearchOutlined style={{ color: filtered ? '#1890ff' : undefined }} />,
  270 + onFilter: (value, record) => record[dataIndex].toString().toLowerCase().includes(value.toLowerCase()),
  271 + onFilterDropdownVisibleChange: (visible) => {
  272 + if (visible) {
  273 + setTimeout(() => this.searchInput.select());
  274 + }
  275 + },
  276 + render: text => (text),
  277 + })
  278 +
  279 + getInputSqlCondition = (i) => {
  280 + switch (i) {
  281 + case '1':
  282 + return 'M.sWorkOrderId like ';
  283 + case '2':
  284 + return 'M.sOrderNo like ';
  285 + case '3':
  286 + return 'EM.sCustomerName like ';
  287 + default:
  288 + return 'ET.sProductName like ';
  289 + }
  290 + }
  291 + handleSelectMachineChange = (name, selectedMachineRowKeys) => {
  292 + if (this.state.radiovalue > 0) {
  293 + this.handleList(1, -1, selectedMachineRowKeys[0], `M.sMachineId =''${selectedMachineRowKeys[0]}''`); // 排程数据
  294 + }
  295 + this.props.onSaveState({
  296 + [`${name}SelectedRowKeys`]: selectedMachineRowKeys,
  297 + sChangeTeamId: '',
  298 + teamData: [],
  299 + });
  300 + }
  301 + handleSelectChange = (name, selectedRowKeys) => {
  302 + const selectedData = this.props.arrangeData.filter(item => selectedRowKeys.indexOf(item.key) > -1);
  303 + this.props.onSaveState({
  304 + [`${name}SelectedRowKeys`]: selectedRowKeys,
  305 + });
  306 + this.setState({
  307 + changeMachine: true,
  308 + sChangeMachineId: '',
  309 + DropDownlistMachineData: [],
  310 + });
  311 + // 去重复
  312 + const res = new Map();
  313 + if (selectedData.filter(a => !res.has(a.sProcessName) && res.set(a.sProcessName, 1)).length > 1) {
  314 + this.setState({ changeMachine: false });
  315 + }
  316 + }
  317 + handleTeamChange =(value) => {
  318 + this.setState({
  319 + sChangeTeamId: value,
  320 + });
  321 + }
  322 + handleMachineChange =(value) => {
  323 + this.setState({
  324 + sChangeMachineId: value,
  325 + });
  326 + }
  327 + handleRangePickerChange=(date) => {
  328 + this.setState({
  329 + dataFrom: date[0],
  330 + dataTo: date[1],
  331 + });
  332 + }
  333 +
  334 + handleListConditionChange= (value) => {
  335 + this.setState({
  336 + inputCondition: value,
  337 + });
  338 + }
  339 + handleInputChange = (e) => {
  340 + this.setState({
  341 + inputText: e.target.value,
  342 + });
  343 + }
  344 +
  345 + handlePrintChange = () => {
  346 + }
  347 + queryBillProcess = (key, value) => {
  348 + this.setState({
  349 + processTableVisable: true,
  350 + curProductName: value,
  351 + processTableLoding: true,
  352 + });
  353 + this.handleList(0, -1, '', '1 = 1'); // 工作中心
  354 + }
  355 +
  356 + handleUserSet = () => {
  357 + }
  358 + handleSearch = (selectedKeys, confirm) => {
  359 + confirm();
  360 + this.setState({ searchText: selectedKeys[0] });
  361 + }
  362 +
  363 + handleRadioChange =(e) => {
  364 + this.setState({
  365 + radiovalue: e.target.value,
  366 + });
  367 + const radioValue = e.target.value;
  368 + if (radioValue < 6) {
  369 + this.handleList(0, radioValue, '', '1 = 1'); // 工作中心 无条件查
  370 + // this.handleList(1, radioValue, '', '1 = 1'); // 排程数据 无条件查
  371 + } else {
  372 + this.handleList(0, radioValue, '', ''); // 工作中心 根据条件查
  373 + // this.handleList(1, radioValue, '', ''); // 排程数据 根据条件查
  374 + }
  375 + }
  376 + handleReset = (clearFilters) => {
  377 + clearFilters();
  378 + this.setState({ searchText: '' });
  379 + }
  380 +
  381 + async handleList(iOperType, radioValue, sWorkCenterId, sSqlCondition, sIds, sMachineIds, sTeamId) {
  382 + const { app } = this.props;
  383 + const params = {
  384 + token: app.token,
  385 + value: {
  386 + sProName: 'Sp_Manufacture_ProducttionPlan_List',
  387 + paramsMap: {
  388 + iStates: radioValue >= 0 ? radioValue + 1 : this.state.radiovalue + 1,
  389 + iOperType,
  390 + sWorkCenterId,
  391 + sIds: sIds === undefined ? [''] : sIds.toString(),
  392 + sMachineId: sMachineIds === undefined ? [''] : sMachineIds.toString(),
  393 + sTeamId: sTeamId === undefined ? '' : sTeamId,
  394 + sSqlCondition: sSqlCondition !== '' ? sSqlCondition : `M.tStartDate >= "${this.state.dataFrom.format('YYYY-MM-DD')
  395 + }" and M.tStartDate <= "${this.state.dataTo.format('YYYY-MM-DD')}" and ${this.getInputSqlCondition(this.state.inputCondition)
  396 + }"%${this.state.inputText}%"`,
  397 + },
  398 + },
  399 + };
  400 + const returnData = await thisUtils.handleGetDataSetByName(params);
  401 + const { proData, msgs } = returnData;
  402 + if (returnData !== undefined) {
  403 + if (iOperType === 0) {
  404 + this.props.onSaveState({
  405 + workCenterData: proData,
  406 + machineData: [],
  407 + arrangeData: [],
  408 + machineSelectedRowKeys: [],
  409 + arrangeSelectedRowKeys: [],
  410 + DropDownlistMachineData: [],
  411 + teamData: [],
  412 + processTableLoding: false,
  413 + });
  414 + // if (proData.length > 0) {
  415 + // this.handleList(2, -1, proData[0].sId);
  416 + // }
  417 + } else if (iOperType === 2) {
  418 + this.props.onSaveState({
  419 + machineData: proData,
  420 + selectedRowKeys: [],
  421 + DropDownlistMachineData: [],
  422 + teamData: [],
  423 + });
  424 + } else if (iOperType === 100) { // 换班组时,取班组;
  425 + this.setState({ teamData: proData });
  426 + } else if (iOperType === 101) { // 取机台时,取机台;
  427 + this.setState({ DropDownlistMachineData: proData });
  428 + } else {
  429 + this.props.onSaveState({ arrangeData: proData, selectedRowKeys: [] });
  430 + }
  431 + } else {
  432 + message.error(msgs);
  433 + }
  434 + }
  435 + handleSubmit = async (e) => {
  436 + e.preventDefault();
  437 + this.form.validateFields(async (err) => {
  438 + if (!err) {
  439 + this.handleList(1, -1, '', '');
  440 + }
  441 + });
  442 + };
  443 + handleForm = (form) => {
  444 + this.form = form;
  445 + };
  446 + handleWorkCenterClick = (record) => {
  447 + const newKey = record.key;
  448 + this.handleList(1, -1, newKey, `M.sWorkCenterId =''${newKey}''`); // 排程数据
  449 + this.handleList(2, -1, newKey, '1 = 1'); // 机器数据
  450 + this.props.onSaveState({
  451 + machineSelectedRowKeys: [],
  452 + });
  453 + };
  454 + // start = () => {
  455 + // this.setState({ loading: true });
  456 + // // ajax request after empty completing
  457 + // setTimeout(() => {
  458 + // this.setState({
  459 + // selectedRowKeys: [],
  460 + // loading: false,
  461 + // });
  462 + // }, 1000);
  463 + // }
  464 +
  465 + processTableOk = () => {
  466 + this.setState({
  467 + processTableVisable: false,
  468 + });
  469 + }
  470 +
  471 + processTableCancel = () => {
  472 + this.setState({
  473 + processTableVisable: false,
  474 + });
  475 + }
  476 +
  477 + handleTeamDropdown = (e) => {
  478 + if (e && this.props.machineSelectedRowKeys.length > 0) {
  479 + this.handleList(100, -1, '', '', '', this.props.machineSelectedRowKeys);
  480 + }
  481 + }
  482 + handleMachineDropdown = (e) => {
  483 + if (e && this.props.arrangeSelectedRowKeys.length > 0) {
  484 + this.handleList(101, -1, '', '', this.props.arrangeSelectedRowKeys[0], '');
  485 + }
  486 + }
  487 +
  488 + handleButtonClick = (e) => {
  489 + if (this.props.arrangeSelectedRowKeys.length < 1) {
  490 + message.info('排程数据不为空');
  491 + return;
  492 + }
  493 + if (e === 3 && this.props.machineSelectedRowKeys.length < 1) { // 生产排单
  494 + message.info('请选择机台');
  495 + return;
  496 + }
  497 + if (e === 11) { // 更换机台 + 班组
  498 + if (this.state.sChangeMachineId !== '' && this.state.sChangeTeamId !== '') {
  499 + this.handleList(20, 0, '', '', this.props.arrangeSelectedRowKeys, this.state.sChangeMachineId, this.state.sChangeTeamId);
  500 + } else if (this.state.sChangeMachineId !== '') {
  501 + this.handleList(21, 0, '', '', this.props.arrangeSelectedRowKeys, this.state.sChangeMachineId, '');
  502 + } else if (this.state.sChangeTeamId !== '') {
  503 + this.handleList(22, 0, '', '', this.props.arrangeSelectedRowKeys, '', this.state.sChangeTeamId);
  504 + }
  505 + } else {
  506 + this.handleList(e, 0, '', '', this.props.arrangeSelectedRowKeys, this.props.machineSelectedRowKeys);
  507 + }
  508 + }
  509 +
  510 + render() {
  511 + const { workCenterColumn } = this.props;
  512 + return (
  513 + <div>
  514 + {commonUtils.isNotEmptyArr(workCenterColumn) ?
  515 + <ProductionPlanComponent
  516 + {...this.props}
  517 + {...this.state}
  518 + onSelectChange={this.handleSelectChange}
  519 + onSelectMachineChange={this.handleSelectMachineChange}
  520 + dscrollY={this.dscrollY}
  521 + printItem={this.printItem}
  522 + onRadioChange={this.handleRadioChange}
  523 + onTeamChange={this.handleTeamChange}
  524 + onRangePickerChange={this.handleRangePickerChange}
  525 + onListConditionChange={this.handleListConditionChange}
  526 + onInputChange={this.handleInputChange}
  527 + onUserSet={this.handleUserSet}
  528 + onColResize={this.handleResize}
  529 + onSubmit={this.handleSubmit}
  530 + onReturnForm={this.handleForm}
  531 + onWorkCenterClick={this.handleWorkCenterClick}
  532 + onProcessTableCancel={this.processTableCancel}
  533 + onProcessTableOk={this.processTableOk}
  534 + onButtonClick={this.handleButtonClick}
  535 + onTeamDropdown={this.handleTeamDropdown}
  536 + onMachineChange={this.handleMachineChange}
  537 + onMachineDropdown={this.handleMachineDropdown}
  538 + />
  539 + : ''}
  540 + </div>
  541 + );
  542 + }
  543 +}
  544 +
  545 +const ProductionPlanComponent = Form.create({
  546 +})((props) => {
  547 + const {
  548 + form,
  549 + planTop,
  550 + radiovalue,
  551 + dataFrom,
  552 + dataTo,
  553 + teamData,
  554 + DropDownlistMachineData,
  555 + onRadioChange,
  556 + onTeamChange,
  557 + onMachineChange,
  558 + onRangePickerChange,
  559 + onListConditionChange,
  560 + onInputChange,
  561 + onUserSet,
  562 + filterListData,
  563 + dscrollY,
  564 + onSubmit,
  565 + onReturnForm,
  566 + onWorkCenterClick,
  567 + onSelectChange,
  568 + onSelectMachineChange,
  569 + processTableVisable,
  570 + processTableLoding,
  571 + curProductName,
  572 + // processTableOk,
  573 + onProcessTableCancel,
  574 + onProcessTableOk,
  575 + onButtonClick,
  576 + changeMachine,
  577 + onTeamDropdown,
  578 + onMachineDropdown,
  579 + constFind,
  580 + // constReset,
  581 + constScheduling,
  582 + constOutProcessing,
  583 + constRelease,
  584 + constSuspend,
  585 + constCancelSuspend,
  586 + constReturn,
  587 + constChangeTeam,
  588 + constChangeMachine,
  589 + constConfirm,
  590 + constSave,
  591 + constPrint,
  592 + constOutExcel,
  593 + constCloseDrag,
  594 + constOpenDrag,
  595 + constRdoStatus,
  596 + constCondition,
  597 + constKeyWord,
  598 + } = props;
  599 + // const dscrollRight = 'calc(100vh - 193px - 35px)';
  600 + const { getFieldDecorator } = form;
  601 + /* 回带表单 */
  602 + onReturnForm(form);
  603 + const left1props = {
  604 + ...commonBusiness.getTableTypes('workCenter', props),
  605 + tableProps: {
  606 + rowSelection: null,
  607 + bordered: false,
  608 + loading: processTableLoding,
  609 + className: styles1.border,
  610 + scroll: { x: 270, y: 201 },
  611 + onRow: (record) => { return { onClick: () => { onWorkCenterClick(record); } }; },
  612 + },
  613 + };
  614 +
  615 + const left2props = {
  616 + ...commonBusiness.getTableTypes('machine', props),
  617 + rowSelectionType: 'radio',
  618 + onSelectRowChange: onSelectMachineChange,
  619 + tableProps: {
  620 + bordered: false,
  621 + className: styles1.border,
  622 + scroll: { x: 270, y: dscrollY },
  623 + },
  624 + };
  625 + const rightprops = {
  626 + ...commonBusiness.getTableTypes('arrange', props),
  627 + rowSelectionType: 'checkbox',
  628 + onSelectRowChange: onSelectChange,
  629 + tableProps: {
  630 + bordered: true,
  631 + className: styles1.border,
  632 + // scroll: { x: 3000, y: dscrollRight },
  633 + },
  634 + };
  635 +
  636 + return (
  637 + <Form onSubmit={onSubmit}>
  638 + <Layout>
  639 + <Header className={styles1.header}>
  640 + <div className={planTop}>
  641 + <Row>
  642 + <Col span={12} >
  643 + <FormItem>
  644 + {getFieldDecorator('productionProcess', {
  645 + initialValue: radiovalue,
  646 + })(<RadioGroup onChange={onRadioChange}>
  647 + { constRdoStatus.sChineseDropDown.map((o, i) =>
  648 + <Radio value={i}>{o}</Radio>)
  649 + }
  650 + </RadioGroup>)}
  651 + </FormItem>
  652 + </Col>
  653 + <Col span={5}>
  654 + <FormItem>
  655 + {getFieldDecorator('productionTime', {
  656 + initialValue: [dataFrom, dataTo],
  657 + })(<RangePicker onChange={onRangePickerChange} />)}
  658 + </FormItem>
  659 + </Col>
  660 + <Col span={5}>
  661 + <InputGroup compact>
  662 + <FormItem>
  663 + {getFieldDecorator('productionSQl', {
  664 + })(<Select placeholder={constCondition.sChinese} onChange={onListConditionChange} style={{ width: 100 }}>
  665 + { filterListData.map(child =>
  666 + <Option value={child.key}>{child.value}</Option>)
  667 + }
  668 + </Select>)}
  669 + </FormItem>
  670 + <FormItem>
  671 + {getFieldDecorator('productionSQlKey', {
  672 + })(<Input style={{ width: 170 }} onChange={onInputChange} placeholder={constKeyWord.sChinese} />)}
  673 + </FormItem>
  674 + </InputGroup>
  675 + </Col>
  676 + <Col span={2}>
  677 + <Button type="primary" htmlType="submit" style={{ margin: 2 }}>{constFind.sChinese}</Button>
  678 + <div className={styles1.affixMenu}>
  679 + <SettingOutlined onClick={onUserSet} />
  680 + </div>
  681 + </Col>
  682 + </Row>
  683 + </div>
  684 + </Header>
  685 + <div>
  686 + {
  687 + processTableVisable ?
  688 + <AntdDraggableModal
  689 + title={`${curProductName}`}
  690 + visible={processTableVisable}
  691 + onOk={onProcessTableOk}
  692 + onCancel={onProcessTableCancel}
  693 + >
  694 + <StaticEditTable {...left1props} />
  695 + </AntdDraggableModal>
  696 + : ''
  697 + }
  698 + </div>
  699 + <Layout>
  700 + <Content className={styles1.content}>
  701 + <Layout>
  702 + <Sider className={styles1.left}>
  703 + <div className={styles1.left1}>
  704 + <StaticEditTable {...left1props} />
  705 + </div>
  706 + <div className={styles1.left2}>
  707 + <StaticEditTable {...left2props} />
  708 + </div>
  709 + </Sider>
  710 + <Content className={styles1.right}>
  711 + <StaticEditTable {...rightprops} />
  712 + </Content>
  713 + </Layout>
  714 + </Content>
  715 + <Footer className={planTop} style={{ marginTop: 0 }}>
  716 + <Row>
  717 + <Col span={4} >
  718 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 3)} disabled={radiovalue !== 0}style={{ margin: 2 }}>{constScheduling.sChinese}</Button>
  719 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 4)} disabled={radiovalue !== 0} style={{ margin: 2 }}>{constOutProcessing.sChinese}</Button>
  720 + </Col>
  721 + <Col span={14}>
  722 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 5)} disabled={(radiovalue === 0 || radiovalue >= 3)} style={{ margin: 2, display: radiovalue !== 2 ? 'inline-block' : 'none' }}>{constRelease.sChinese}</Button>
  723 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 6)} disabled={(radiovalue === 0 || radiovalue >= 3)} style={{ margin: 2, display: radiovalue === 2 ? 'inline-block' : 'none' }}>{constCancelSuspend.sChinese}</Button>
  724 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 7)} disabled={(radiovalue === 0 || radiovalue >= 4)} style={{ margin: 2, display: radiovalue !== 4 ? 'inline-block' : 'none' }}>{constSuspend.sChinese}</Button>
  725 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 8)} disabled={radiovalue === 0} style={{ margin: 2, display: radiovalue === 5 ? 'inline-block' : 'none' }}>恢复生产</Button>
  726 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 9)} disabled={(radiovalue === 0 || radiovalue >= 3)} style={{ margin: 2 }}>{constReturn.sChinese}</Button>
  727 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 10)} disabled={(radiovalue === 0 || radiovalue >= 4)} style={{ margin: 2 }}>加工完成</Button>
  728 + <Select defaultValue={constChangeTeam.sChinese} style={{ width: 100 }} onDropdownVisibleChange={onTeamDropdown} onChange={onTeamChange}>
  729 + { teamData.map(child =>
  730 + <Option key={child.key}>{child.sTeamName}</Option>)
  731 + }
  732 + </Select>
  733 + <Select defaultValue={constChangeMachine.sChinese} style={{ width: 140 }} onDropdownVisibleChange={onMachineDropdown} onChange={onMachineChange}>
  734 + { DropDownlistMachineData.map(child =>
  735 + <Option key={child.key}>{child.sMachineName}</Option>)
  736 + }
  737 + </Select>
  738 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 11)} disabled={(radiovalue === 0 || !changeMachine || radiovalue >= 3)} style={{ margin: 4 }}>{constConfirm.sChinese}</Button>
  739 + </Col>
  740 + <Col span={4}>
  741 + <Button type="primary" htmlType="button" onClick={onButtonClick.bind(this, 12)} style={{ margin: 2 }}>{constSave.sChinese}</Button>
  742 + {/* <Dropdown overlay={printItem}> */}
  743 + {/* <Button> */}
  744 + {/* Actions <Icon type="down" /> */}
  745 + {/* </Button> */}
  746 + {/* </Dropdown> */}
  747 + <Button type="primary" htmlType="button" style={{ margin: 2 }}>{constPrint.sChinese}</Button>
  748 + <Button type="primary" htmlType="button" style={{ margin: 2 }}>{constOutExcel.sChinese}</Button>
  749 + </Col>
  750 + <Col span={2}>
  751 + <Switch checkedChildren={constCloseDrag.sChinese} unCheckedChildren={constOpenDrag.sChinese} defaultChecked={false} />
  752 + </Col>
  753 + </Row>
  754 + </Footer>
  755 + </Layout>
  756 + </Layout>
  757 + </Form>
  758 + );
  759 +});
  760 +export default CommonBase(ProductionPlan);
... ...
src/components/ProductionPlan/ProductionPlanUtils.js 0 → 100644
  1 +/* 用于存放业务逻辑 */
  2 +import config from '../../utils/config';
  3 +import * as commonServices from '../../services/services';
  4 +
  5 +/* 上一条、下一条、首条、末条从表刷新 */
  6 +export function setprops(props) {
  7 + props.ref = '';
  8 + return props;
  9 +}
  10 +
  11 +export async function handleGetDataSetByName(params) {
  12 + const { token, value } = params;
  13 + const { mastersId, sModelsId } = value.paramsMap;
  14 + // const url = `${config.server_host}business/getProData?sModelsId=${sModelsId}`;
  15 + const url = `${config.server_host}treegrid/getTreeGridByPro/${mastersId}?sModelsId=${sModelsId}`;
  16 + const oReturn = (await commonServices.postValueService(token, value, url)).data;
  17 + const msgs = oReturn.msg;
  18 + if (oReturn.code === 1) { /* 成功 */
  19 + const { proData } = oReturn.dataset.rows[0].dataSet;
  20 + for (const each of proData) {
  21 + each.key = each.sId;
  22 + }
  23 + return { proData, msgs };
  24 + } else { /* 失败 */
  25 + return { undefined, msgs };
  26 + }
  27 +}
... ...
src/components/ProductionPlan/index.less 0 → 100644
  1 +.header {
  2 + width: 100%;
  3 + padding: 10px 0 0 0!important;
  4 + height: auto!important;
  5 + line-height: inherit!important;
  6 + background: #f0f2f5!important;
  7 +}
  8 +.top {
  9 + margin: 81px 10px 0 10px;
  10 + background: #fff;
  11 + border: 1px solid #ccc;
  12 + height: 46px;
  13 + line-height: 46px;
  14 + padding: 0 10px;
  15 + :global {
  16 + .ant-form-item {
  17 + margin-bottom: 0!important;
  18 + line-height: inherit!important;
  19 + }
  20 + .ant-form-item-control {
  21 + line-height: inherit!important;
  22 + }
  23 + }
  24 + }
  25 +.content {
  26 + height: calc(~'100vh - 193px');
  27 + background: #fff!important;
  28 + margin: 0 10px 0 10px;
  29 + border: 1px solid #ccc;
  30 + border-top: 0;
  31 +}
  32 +
  33 +.left1 {
  34 + height: 230px;
  35 + overflow: hidden;
  36 + background: #fff!important;
  37 + border: 1px solid #ccc;
  38 + border-left: 0;
  39 + border-top: 0;
  40 + :global {
  41 + .ant-input-disabled {
  42 + cursor: default;
  43 + }
  44 + .ant-input-number-input {
  45 + cursor: default;
  46 + }
  47 + }
  48 +}
  49 +.left2 {
  50 + height: calc(~'100vh - 423px');
  51 + overflow: hidden;
  52 + background: #fff!important;
  53 + border: 1px solid #ccc;
  54 + border-left: 0;
  55 + border-top: 0;
  56 +}
  57 +.border {
  58 + border: 0;
  59 + padding: 1px 1px!important;
  60 +}
  61 +
  62 +.left {
  63 + flex: 0 0 270px!important;
  64 + width: 270px!important;
  65 + max-width: 270px!important;
  66 + }
  67 +.right {
  68 + height: calc(~'100vh - 193px');
  69 + background: #fff!important;
  70 + margin: 0;
  71 + border: 1px solid #ccc;
  72 + border-top: 0;
  73 + overflow: hidden;
  74 + :global {
  75 + .topTable {
  76 + .ant-table-body {
  77 + margin-bottom: 0px!important;
  78 + padding-bottom: 0;
  79 + }
  80 + }
  81 + }
  82 +}
  83 +/* 界面设定图标 */
  84 +.affixMenu {
  85 + cursor: pointer;
  86 + position: fixed;
  87 + font-size: 20px;
  88 + right: 25px;
  89 + top: 90px;
  90 +}
  91 +
  92 +.left, .right {
  93 + :global {
  94 + .ant-table-thead tr th {
  95 + padding:4px 2px!important;
  96 + }
  97 + }
  98 +}
  99 +
  100 +
... ...
src/components/productionPlanInfo/productionHeader.js 0 → 100644
  1 +/**
  2 + * Created by mar105 on 2019-02-27.
  3 + */
  4 +/* eslint-disable object-curly-newline,prefer-destructuring */
  5 +import React, { Component } from 'react';
  6 +import { ExportOutlined, PrinterOutlined, SaveOutlined } from '@ant-design/icons';
  7 +import { Row, Col } from 'antd';
  8 +import styles from '../Common/ToolBar/index.less';
  9 +import ShowType from '../Common/CommonComponent';
  10 +import * as commonUtils from '../../utils/utils';/* 通用方法 */
  11 +import AffixMenu from '../../routes/common/AffixMenu';
  12 +import ProductionPlan1 from '../../assets/ProductionPlan-1.svg';
  13 +import ProductionPlan2 from '../../assets/ProductionPlan-2.svg';
  14 +import ProductionPlan7 from '../../assets/ProductionPlan-7.svg';
  15 +import ProductionPlan8 from '../../assets/ProductionPlan-8.svg';
  16 +import ProductionPlan11 from '../../assets/ProductionPlan-11.svg';
  17 +
  18 +export default class productionHeader extends Component {
  19 + /** 构造函数 */
  20 + constructor(props) {
  21 + super(props);
  22 + this.state = {
  23 + enabled: props.enabled,
  24 + masterConfig: props.masterConfig,
  25 + stateValue: props.stateValue,
  26 + masterData: props.masterData,
  27 + };
  28 + }
  29 +
  30 + /** 渲染前只执行一次 */
  31 + componentWillMount() {
  32 + /* state和this属性赋值 */
  33 + this.assignmentWillProps(this.props);
  34 + }
  35 +
  36 + /** props改变的时候触发 */
  37 + componentWillReceiveProps(nextProps) {
  38 + /* state和this属性赋值 */
  39 + this.assignmentWillProps(nextProps);
  40 + }
  41 +
  42 + /** 返回true执行渲染,返回false不渲染 */
  43 + shouldComponentUpdate(nextProps, nextState) {
  44 + const {
  45 + masterConfig, stateValue, enabled, masterData,
  46 + } = this.state;
  47 + const ret = enabled !== nextState.enabled || JSON.stringify(masterConfig) !== JSON.stringify(nextState.masterConfig) ||
  48 + JSON.stringify(masterData) !== JSON.stringify(nextState.masterData) ||
  49 + JSON.stringify(stateValue) !== JSON.stringify(nextState.stateValue);
  50 + return ret;
  51 + }
  52 +
  53 + assignmentWillProps = (props) => {
  54 + this.setState({
  55 + enabled: props.enabled,
  56 + masterConfig: props.masterConfig,
  57 + masterData: props.masterData,
  58 + stateValue: props.stateValue,
  59 + });
  60 + }
  61 + // 获取header按钮状态 stateValue
  62 + HandlerHeaderButtonShowState = (props) => {
  63 + const { masterData, searchSolution } = props;
  64 + let filterCondition = [];
  65 + let stateValue = 99;
  66 + if (commonUtils.isNotEmptyObject(masterData) && commonUtils.isNotEmptyObject(masterData.sSearchSolutionId)) {
  67 + const iIndex = searchSolution.findIndex(item => item.sId === masterData.sSearchSolutionId);
  68 + if (iIndex > -1) {
  69 + filterCondition = JSON.parse(searchSolution[iIndex].sCondition);
  70 + let state = '';
  71 + let frozen = '';
  72 + filterCondition.forEach((item) => {
  73 + if (item.bFilterName === 'sState') {
  74 + state = item.bFilterValue;
  75 + }
  76 + if (item.bFilterName === 'bFrozen') {
  77 + frozen = item.bFilterValue;
  78 + }
  79 + });
  80 +
  81 + if (commonUtils.isEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
  82 + if (state === '未排程') {
  83 + stateValue = 0;
  84 + } else if (state === '未下达' || state === '已排程') {
  85 + stateValue = 1;
  86 + } else if (state === '已下达') {
  87 + stateValue = 2;
  88 + } else if (state === '已暂停') {
  89 + stateValue = 3;
  90 + } else if (state === '已完成') {
  91 + stateValue = 5;
  92 + }
  93 + } else if (commonUtils.isNotEmptyObject(frozen)) {
  94 + stateValue = 4;
  95 + } else if (commonUtils.isNotEmptyObject(frozen) && commonUtils.isNotEmptyObject(state)) {
  96 + stateValue = 99;
  97 + }
  98 + }
  99 + }
  100 + return { stateValue };
  101 + }
  102 + handleClick = (iTag) => {
  103 + this.props.onButtonClick(iTag);
  104 + }
  105 +
  106 + handleSwitchChange = (value) => {
  107 + this.props.onSwitchChange(value);
  108 + }
  109 + rowReturnType = (child, i) => {
  110 + const { enabled, stateValue } = this.state;
  111 + const sMemo = child.sName.toLowerCase().endsWith('memo');
  112 + const iColValue = sMemo ? 21 : child.iColValue * 2;
  113 + const iOrder = sMemo ? 100 : child.iOrder > 100 ? 100 : child.iOrder;
  114 + const enabledNew = (enabled && !child.bReadonly && !child.specialControl);
  115 + const type = commonUtils.isNotEmptyObject(child.sControlName) && child.sControlName.toLowerCase().startsWith('btn');
  116 +
  117 + let showTypeProps = {};
  118 + if (!type) {
  119 + const switchBtn = child.sControlName.toLowerCase().startsWith('switch');
  120 + if (!switchBtn) {
  121 + showTypeProps = {
  122 + name: 'master',
  123 + form: this.props.form,
  124 + formId: this.props.sModelsId,
  125 + getSqlDropDownData: this.props.getSqlDropDownData,
  126 + getSqlCondition: this.props.getSqlCondition,
  127 + handleSqlDropDownNewRecord: this.props.handleSqlDropDownNewRecord,
  128 + getFloatNum: this.props.getFloatNum,
  129 + getDateFormat: this.props.getDateFormat,
  130 + onChange: this.props.onChange,
  131 + showConfig: child,
  132 + textArea: sMemo,
  133 + enabled: enabledNew,
  134 + dataValue: commonUtils.isNotEmptyObject(this.props.masterData) ? this.props.masterData[child.sName] : '',
  135 + bTable: false,
  136 + };
  137 + return (
  138 + <Col key={i} span={iColValue} order={iOrder} style={{ margin: 1, backgroundColor: 'rgb(100, 100, 100)', color: '#fff' }}>
  139 + <ShowType {...showTypeProps} style={{ height: 20, lineHeight: '20px' }} />
  140 + </Col>
  141 + );
  142 + } else {
  143 + return '';
  144 + }
  145 + } else {
  146 + let displayFlag = false;
  147 + let disabledFlag = true;
  148 + if ((stateValue === '0' && child.iTag === 3) || (stateValue === '1' && child.iTag === 5)
  149 + || (stateValue === '0' && child.iTag === 5) || (stateValue === '2' && child.iTag === 4)
  150 + || (stateValue === '2' && child.iTag === 5)
  151 + || (stateValue === '2' && child.iTag === 17)
  152 + || (stateValue === '3' && child.iTag === 6)
  153 + || (child.iTag === 1) || (child.iTag === 2)
  154 + || (child.iTag === 7) || (child.iTag === 8) || (child.iTag === 11)
  155 + || (child.iTag === 12) || (child.iTag === 13) || (child.iTag === 14) || (child.iTag === 15) || (child.iTag === 16)
  156 + ) {
  157 + displayFlag = true;
  158 + }
  159 + if ((child.iTag === 1 && (stateValue === '0' || stateValue === '1')) ||
  160 + (child.iTag === 2 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
  161 + (child.iTag === 3 && (stateValue === '0' || stateValue === '1')) ||
  162 + (child.iTag === 4 && stateValue === '2') ||
  163 + (child.iTag === 5 && stateValue === '2') ||
  164 + (child.iTag === 6 && stateValue === '3') ||
  165 + (child.iTag === 7 && stateValue === '2') ||
  166 + (child.iTag === 8 && stateValue === '2') ||
  167 + (child.iTag === 11 && (stateValue === '0' || stateValue === '1' || stateValue === '2')) ||
  168 + ((child.iTag === 12 || child.iTag === 13 || child.iTag === 14) && stateValue !== '99')
  169 + ) {
  170 + disabledFlag = false;
  171 + }
  172 + // console.log(child.showName, ' disabledFlag:', disabledFlag, 'displayFlag:', displayFlag);
  173 + return displayFlag ? (
  174 + <span key={i} order={iOrder} style={{ margin: '0 15px', float: 'left', display: displayFlag ? 'inline-block' : 'none', color: '#fff', lineHeight: '30px' }} disabled={disabledFlag}onClick={this.handleClick.bind(this, child.iTag)} >
  175 + {(() => {
  176 + switch (child.iTag) {
  177 + case 1: return <img src={ProductionPlan1} disabled={disabledFlag} alt="" />;
  178 + case 2: return <img src={ProductionPlan2} disabled={disabledFlag} style={{ width: '13px', height: '13px' }} alt="" />;
  179 + case 7: return <img src={ProductionPlan7} disabled={disabledFlag} alt="" />;
  180 + case 8: return <img src={ProductionPlan8} disabled={disabledFlag} alt="" />;
  181 + case 11: return <img src={ProductionPlan11} disabled={disabledFlag} style={{ width: '15px', height: '15px' }} alt="" />;
  182 + case 12: return <SaveOutlined disabled={disabledFlag} />;
  183 + case 13: return <PrinterOutlined disabled={disabledFlag} />;
  184 + case 14: return <ExportOutlined disabled={disabledFlag} />;
  185 + default: return null;
  186 + }
  187 + }
  188 + )()}
  189 + {child.showName}
  190 + </span>
  191 + ) : '';
  192 + }
  193 + }
  194 +
  195 + render() {
  196 + const { masterConfig } = this.state;
  197 + const teamMachineProps = masterConfig === undefined ? undefined : masterConfig.gdsconfigformslave;
  198 + return (
  199 + <div className={styles.toolBar}>
  200 + <Row style={{ backgroundColor: 'rgb(100, 100, 100)', margin: '0 10px', height: 30 }} id="product-info-header">
  201 + {
  202 + commonUtils.isNotEmptyObject(teamMachineProps) ? teamMachineProps.map((child, i) => {
  203 + return this.rowReturnType(child, i);
  204 + }) : ''
  205 + }
  206 + </Row>
  207 + <AffixMenu {...this.props} />
  208 + </div>
  209 + );
  210 + }
  211 +}
... ...
src/components/productionPlanInfo/productionPlanChangeMacheInfo.js 0 → 100644
  1 +/* eslint-disable array-callback-return,no-undef */
  2 +import React, { Component } from 'react';
  3 +import { Form } from '@ant-design/compatible';
  4 +import '@ant-design/compatible/assets/index.css';
  5 +import { Layout, Spin, Button, Row, Col } from 'antd';
  6 +import CommonListEvent from './CommonListEvent';/* 继承销售模块业务功能 */
  7 +import * as commonFunc from './commonFunc';/* 通用单据方法 */ /* 通用单据方法 */
  8 +import StaticEditTable from './CommonTable';/* 可编辑表格 */
  9 +import CommonBase from './CommonBase';/* 获取配置及数据 */
  10 +import * as commonBusiness from './commonBusiness';/* 单据业务功能 */
  11 +import SearchComponent from './SearchComponent';/* 搜索组件 */
  12 +import commonConfig from '../../utils/config';
  13 +
  14 +const { Content } = Layout;
  15 +
  16 +class ProductionPlanChangeMachineInfoComponent extends Component {
  17 + constructor(props) {
  18 + super(props);
  19 + this.state = {
  20 + };
  21 + }
  22 + /** 确认下单 */
  23 + handleSelect = () => {
  24 + const { slaveSelectedData, app } = this.props;
  25 + this.props.app.currentPane.select(app.currentPane.name, app.currentPane.config, slaveSelectedData);
  26 + this.props.app.currentPane.selectCancel(app.currentPane.name);
  27 + };
  28 + /** 关闭 */
  29 + handleCancelModal = () => {
  30 + const { app } = this.props;
  31 + this.props.app.currentPane.selectCancel(app.currentPane.name);
  32 + };
  33 + // ----------------------------数据修改回带end ---------------------------- //
  34 +
  35 + render() {
  36 + const { pageLoading } = this.props;
  37 + return (
  38 + <div style={{ height: '100%' }}>
  39 + <Spin spinning={pageLoading}>
  40 + <div style={{ height: '100%' }}>
  41 + <CommonListComponent
  42 + {...this.props}
  43 + {...this.state}
  44 + onSelect={this.handleSelect}
  45 + onCancel={this.handleCancelModal}
  46 + onDoubleClick={this.handleSelect}
  47 + />
  48 + </div>
  49 + </Spin>
  50 + </div>
  51 + );
  52 + }
  53 +}
  54 +
  55 +const CommonListComponent = Form.create({
  56 + mapPropsToFields(props) {
  57 + const { masterData } = props;
  58 + const obj = commonFunc.mapPropsToFields(masterData, Form);
  59 + return obj;
  60 + },
  61 +})((props) => {
  62 + const { form, onReturnForm, slavePagination } = props;
  63 + /* 回带表单 */
  64 + onReturnForm(form);
  65 + const pagination = {
  66 + ...slavePagination,
  67 + size: 'large',
  68 + pageSize: commonConfig.pageSize,
  69 + showQuickJumper: true,
  70 + hideOnSinglePage: true,
  71 + };
  72 + const tableProps = {
  73 + ...commonBusiness.getTableTypes('slave', props),
  74 + tableProps: { rowKey: 'sId', pagination, onChange: props.onTitleChange },
  75 + };
  76 + const teamProps = {
  77 + ...commonBusiness.getTableTypes('team', props),
  78 + tableProps: { rowKey: 'sId', pagination, onChange: props.onTitleChange },
  79 + };
  80 + return (
  81 + <Form >
  82 + <Layout>
  83 + <Layout>
  84 + <div id="modalChooseProcess">
  85 + <div style={{ maxHeight: '100%', zIndex: 20 }}>
  86 + <SearchComponent {...props} />
  87 + </div>
  88 + <Content className="xly-normal-list">
  89 + <Row>
  90 + <Col span={24} key="{groupProps.name}Col" >
  91 + <StaticEditTable {...tableProps} footer="hidden" tableBelone="list" showConfig={props.showConfig} />
  92 + </Col>
  93 + <Col span={24} key="{groupProps.name}Col" >
  94 + <StaticEditTable {...teamProps} footer="hidden" tableBelone="list" showConfig={props.showConfig} />
  95 + </Col>
  96 + </Row>
  97 + </Content>
  98 + </div>
  99 + </Layout>
  100 + <div style={{ textAlign: 'right', marginRight: '9px', marginBottom: '9px' }}>
  101 + <Button key="back" style={{ marginRight: '8px' }} onClick={props.onCancel}>取消</Button>
  102 + <Button type="primary" onClick={props.onSelect}>确认</Button>
  103 + </div>
  104 + </Layout>
  105 + </Form>
  106 + );
  107 +});
  108 +
  109 +export default CommonBase(CommonListEvent(ProductionPlanChangeMachineInfoComponent));
... ...
src/components/productionPlanInfo/productionPlanInfo.js 0 → 100644
  1 +/* eslint-disable array-callback-return,no-undef,object-curly-newline,prefer-destructuring,no-unused-vars */
  2 +import React, { Component } from 'react';
  3 +import { Form } from '@ant-design/compatible';
  4 +import '@ant-design/compatible/assets/index.css';
  5 +import { Modal, Layout, Spin, Card, Row, Col } from 'antd'; // Switch Select, Tabs,
  6 +import styles from '../../index.less';
  7 +import selfstyles from '../productionMainPlan/index.less';
  8 +import * as commonFunc from '../Common/commonFunc';
  9 +import CommonBase from '../Common/CommonBase';
  10 +import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
  11 +import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
  12 +import CommonProductionPlanEvent from '../Common/CommonProductionPlanEvent';
  13 +import Toolbar from '../Common/ToolBar/ToolBarNew';
  14 +import MoveUp from '../../assets/processUp.svg';
  15 +import MoveDown from '../../assets/processDown.svg';
  16 +import DisableMoveUp from '../../assets/disableprocessUp.svg';
  17 +import DisableMoveDown from '../../assets/disableprocessDown.svg';
  18 +import MoveTop from '../../assets/processTop.svg';
  19 +import DisableMoveTop from '../../assets/disableprocessTop.svg';
  20 +import MoveBottom from '../../assets/processBottom.svg';
  21 +import DisableMoveBottom from '../../assets/disableprocessBottom.svg';
  22 +import ChangeMachine from '../../assets/changeMachine.svg';
  23 +import DisableChangeMachine from '../../assets/disablechangeMachine.svg';
  24 +import Reset from '../../assets/reset.svg';
  25 +import DisableReset from '../../assets/disablereset.svg';
  26 +import * as commonUtils from '../../utils/utils';
  27 +import ShowType from '../Common/CommonComponent';
  28 +import commonConfig from '../../utils/config';
  29 +import AntdDraggableModal from '../Common/AntdDraggableModal';
  30 +
  31 +// const { Option } = Select;
  32 +const { Header, Content, Sider } = Layout;
  33 +// const { TabPane } = Tabs;
  34 +
  35 +class ProductionPlanInfoComponentInfo extends Component {
  36 + constructor(props) {
  37 + super(props);
  38 + this.state = {};
  39 + this.form = {}; /* 表单对象 */
  40 + }
  41 +
  42 + shouldComponentUpdate(nextProps) {
  43 + const { slaveColumn, masterConfig } = nextProps;
  44 + return commonUtils.isNotEmptyArr(slaveColumn) || commonUtils.isNotEmptyObject(masterConfig);
  45 + }
  46 + // onRowMouseEnter = (name, record) => {
  47 + // console.log('record:', record);
  48 + // }
  49 + onDoubleClick = (name, record) => {
  50 + if (this.props.onDoubleClick !== undefined) {
  51 + this.props.onDoubleClick(record);
  52 + }
  53 + };
  54 + onRowClick = (name, record, bRowClick) => {
  55 + const { slaveData } = this.props;
  56 + let { slaveSelectedRowKeys, slaveInfoSelectedRowKeys } = this.props;
  57 + slaveInfoSelectedRowKeys = commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) ? slaveInfoSelectedRowKeys : [];
  58 + if (name === 'slave') {
  59 + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
  60 + const keys = [];
  61 + keys.push(record.sSlaveId);
  62 + slaveSelectedRowKeys = keys;
  63 + const sIds = record.sSlaveId.split('-');
  64 + slaveInfoSelectedRowKeys.push(...sIds);
  65 + } else {
  66 + const indexKey = slaveSelectedRowKeys.indexOf(record.sSlaveId);
  67 + if (indexKey === -1) {
  68 + slaveSelectedRowKeys.push(record.sSlaveId);
  69 + const sIds = record.sSlaveId.split('-');
  70 + slaveInfoSelectedRowKeys.push(...sIds);
  71 + sIds.forEach((item) => {
  72 + const iIndex = slaveInfoSelectedRowKeys.findIndex(e => e === item);
  73 + if (iIndex === -1) {
  74 + slaveInfoSelectedRowKeys.push(item);
  75 + }
  76 + });
  77 + } else if (indexKey !== -1) {
  78 + if (!bRowClick) {
  79 + slaveSelectedRowKeys.splice(indexKey, 1);
  80 + }
  81 + const sIds = record.sSlaveId.split('-');
  82 + sIds.forEach((item) => {
  83 + const index = slaveInfoSelectedRowKeys.findIndex(e => e === item);
  84 + if (!bRowClick) {
  85 + slaveInfoSelectedRowKeys.splice(index, 1);
  86 + }
  87 + });
  88 + }
  89 + }
  90 + } else if (name === 'slaveInfo') {
  91 + if (commonUtils.isEmptyArr(slaveInfoSelectedRowKeys)) {
  92 + const keys = [];
  93 + keys.push(record.sId);
  94 + slaveInfoSelectedRowKeys = keys;
  95 + const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
  96 + if (commonUtils.isNotEmptyArr(slaveDataNews)) {
  97 + slaveSelectedRowKeys = [slaveDataNews[0].sSlaveId];
  98 + }
  99 + } else {
  100 + const indexKey = slaveInfoSelectedRowKeys.indexOf(record.sId);
  101 + if (indexKey === -1) {
  102 + slaveInfoSelectedRowKeys.push(record.sId);
  103 + const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
  104 + if (commonUtils.isNotEmptyArr(slaveDataNews)) {
  105 + const iIndex = slaveSelectedRowKeys.findIndex(item => item === slaveDataNews[0].sSlaveId);
  106 + if (iIndex === -1) {
  107 + slaveSelectedRowKeys.push(slaveDataNews[0].sSlaveId);
  108 + }
  109 + }
  110 + } else if (indexKey !== -1) {
  111 + /* 可输入行,行内点击时 不去除selectedRowKeys */
  112 + if (!bRowClick) {
  113 + slaveInfoSelectedRowKeys.splice(indexKey, 1);
  114 + }
  115 + const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
  116 + if (commonUtils.isNotEmptyArr(slaveDataNews)) {
  117 + const sSlaveIds = slaveDataNews[0].sSlaveId.split('-');
  118 + if (slaveInfoSelectedRowKeys.length === 0 || sSlaveIds.length === 1) {
  119 + const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
  120 + slaveSelectedRowKeys.splice(iIndex, 1);
  121 + } else {
  122 + let bdel = true;
  123 + for (const sId of sSlaveIds) {
  124 + if (slaveInfoSelectedRowKeys.findIndex(item => item === sId && item !== record.sId)) {
  125 + bdel = false;
  126 + break;
  127 + }
  128 + }
  129 + if (bdel) {
  130 + const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
  131 + slaveSelectedRowKeys.splice(iIndex, 1);
  132 + }
  133 + }
  134 + }
  135 + }
  136 + }
  137 + }
  138 + let machineEnabled = false;
  139 + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
  140 + const currSlave = slaveData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0])[0];
  141 + const processSlave = slaveData.filter(item => item.sProcessId === currSlave.sProcessId && slaveSelectedRowKeys.includes(item.sSlaveId));
  142 + if (processSlave.length === slaveSelectedRowKeys.length) {
  143 + machineEnabled = true;
  144 + }
  145 + }
  146 + const { sModelsId } = this.props;
  147 + commonUtils.setStoreDropDownData(sModelsId, 'master', 'sMachineId', []);
  148 + this.props.onSaveState({ slaveSelectedRowKeys, slaveInfoSelectedRowKeys, machineEnabled });
  149 + };
  150 +
  151 + onCloseChangeMachine = () => {
  152 + const { masterData } = this.props;
  153 + delete masterData.tStartDate;
  154 + delete masterData.iSplitNum;
  155 + delete masterData.bSplit;
  156 + this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sMachineId: '', sTeamId: '' } });
  157 + }
  158 +
  159 + onTableSelectRowChange = (name, selectedRowKeys) => {
  160 + if (name === 'slave') {
  161 + const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true);
  162 + const slaveInfoSelectedRowKeys = [];
  163 + if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
  164 + selectedRowKeys.forEach((selectedRow) => {
  165 + const sIds = selectedRow.split('-');
  166 + slaveInfoSelectedRowKeys.push(...sIds);
  167 + });
  168 + }
  169 + addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
  170 + this.props.onSaveState({ ...addState });
  171 + } else {
  172 + this.props.onTableSelectRowChange(name, selectedRowKeys);
  173 + }
  174 + // let record = {};
  175 + // let key;
  176 + // if (name === 'slave') {
  177 + // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length === 1) {
  178 + // key = selectedRowKeys[0];
  179 + // } else if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveSelectedRowKeys.length === 1) {
  180 + // key = slaveSelectedRowKeys[0];
  181 + // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length > slaveSelectedRowKeys.length) {
  182 + // key = selectedRowKeys.filter(item => !slaveSelectedRowKeys.includes(item))[0];
  183 + // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveSelectedRowKeys) && selectedRowKeys.length < slaveSelectedRowKeys.length) {
  184 + // key = slaveSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
  185 + // }
  186 + // record = tableData.filter(item => key === item.sSlaveId)[0];
  187 + // this.onRowClick(name, record);
  188 + // } else if (name === 'slaveInfo') {
  189 + // if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length === 1) {
  190 + // key = selectedRowKeys[0];
  191 + // } else if (commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && commonUtils.isEmptyArr(selectedRowKeys) && slaveInfoSelectedRowKeys.length === 1) {
  192 + // key = slaveInfoSelectedRowKeys[0];
  193 + // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length > slaveInfoSelectedRowKeys.length) {
  194 + // key = selectedRowKeys.filter(item => !slaveInfoSelectedRowKeys.includes(item))[0];
  195 + // } else if (commonUtils.isNotEmptyArr(selectedRowKeys) && commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) && selectedRowKeys.length < slaveInfoSelectedRowKeys.length) {
  196 + // key = slaveInfoSelectedRowKeys.filter(item => !selectedRowKeys.includes(item))[0];
  197 + // }
  198 + // record = tableData.filter(item => key === item.sId)[0];
  199 + // this.onRowClick(name, record);
  200 + // } else {
  201 + // this.props.onTableSelectRowChange(name, selectedRowKeys);
  202 + // }
  203 + };
  204 +
  205 + /** 处理选择行发生改变 */
  206 + handleTableFilterData = (name, data, record) => {
  207 + /* 外置处理业务 */
  208 + if (name === 'slave') {
  209 + let slaveInfoDataNew = [];
  210 + if (commonUtils.isNotEmptyArr(data)) {
  211 + slaveInfoDataNew = data.filter(item => record.sSlaveId.split('-').includes(item.sId));
  212 + }
  213 + return slaveInfoDataNew;
  214 + }
  215 + };
  216 +
  217 + // 根据配置解析拼接具体参数
  218 + handleProParams = (sKey, arr) => {
  219 + const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
  220 + const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
  221 + if (commonUtils.isNotEmptyArr(keyData)) {
  222 + const addState = {};
  223 + addState.key = sKey;
  224 + const val = [];
  225 + keyData.forEach((currData) => {
  226 + const currVal = {};
  227 + arr.forEach((filed) => {
  228 + currVal[`${filed}`] = currData[`${filed}`];
  229 + });
  230 + val.push(currVal);
  231 + });
  232 + addState.value = val;
  233 + return addState;
  234 + } else {
  235 + return undefined;
  236 + }
  237 + };
  238 +
  239 + sortData = (tempData) => {
  240 + tempData.sort((g1, g2) => {
  241 + return g1.iOrder - g2.iOrder;
  242 + });
  243 + return tempData;
  244 + };
  245 +
  246 + /* 控制排序 */
  247 + orderData = (e, name, type) => {
  248 + const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
  249 + let { [`${name}Data`]: currentData } = this.props;
  250 + if (name === 'slave') {
  251 + if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
  252 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
  253 + return;
  254 + }
  255 + if (commonUtils.isEmptyArr(currentData)) {
  256 + message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
  257 + return;
  258 + }
  259 + const tempNew = currentData.filter((item) => { /* 获取勾选数据集 */
  260 + return tableselectedRowKeys.indexOf(item.sSlaveId) > -1;
  261 + });
  262 + if (commonUtils.isEmptyArr(tempNew)) {
  263 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
  264 + return;
  265 + }
  266 + const len = currentData.length;
  267 + const newLen = tempNew.length;
  268 + let num = 0.01;/* 循环增加体 */
  269 + let targetiOrder = -1;
  270 + if (type === 1) { /* 上移 */
  271 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
  272 + if (iIndex === 0) {
  273 + if (newLen === 1) {
  274 + message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
  275 + return;
  276 + } else {
  277 + targetiOrder = 0;
  278 + }
  279 + } else {
  280 + targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
  281 + }
  282 + } else if (type === 2) { /* 下移 */
  283 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
  284 + if (iIndex === len - 1) {
  285 + if (newLen === 1) {
  286 + message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
  287 + return;
  288 + } else {
  289 + targetiOrder = currentData[iIndex].iOrder;
  290 + }
  291 + } else {
  292 + targetiOrder = currentData[iIndex + 1].iOrder;
  293 + }
  294 + } else if (type === 0) { /* 置顶 */
  295 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
  296 + if (iIndex === 0) {
  297 + if (newLen === 1) {
  298 + message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
  299 + return;
  300 + } else {
  301 + targetiOrder = currentData[iIndex].iOrder;
  302 + }
  303 + } else {
  304 + targetiOrder = currentData[0].iOrder - 1;
  305 + }
  306 + } else if (type === 3) { /* 置底 */
  307 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
  308 + if (iIndex === len - 1) {
  309 + if (newLen === 1) {
  310 + message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
  311 + return;
  312 + } else {
  313 + targetiOrder = currentData[iIndex].iOrder;
  314 + }
  315 + } else {
  316 + targetiOrder = currentData[len - 1].iOrder + 1;
  317 + }
  318 + }
  319 + tempNew.forEach((item) => {
  320 + const index1 = currentData.findIndex(item1 => item1.sSlaveId === item.sSlaveId);
  321 + currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
  322 + num += 0.01;
  323 + });
  324 + currentData = this.sortData(currentData);
  325 + currentData = this.orderNum(currentData);
  326 + const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
  327 + const slavePagination = { ...slavePaginationOld };
  328 + slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
  329 + this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
  330 + } else if (name === 'slaveInfo') {
  331 + this.props.onSaveState({ isChangeMachine: true });
  332 + }
  333 + };
  334 +
  335 + /* 自定义排序号 */
  336 + orderNum = (tableData) => {
  337 + tableData.forEach((item, index) => {
  338 + item.iOrder = index + 1;
  339 + item.handleType = 'update';
  340 + });
  341 + return tableData;
  342 + };
  343 +
  344 + /** 处理选择行发生改变 */
  345 + // handleTableFilterData = (name, data, record) => {
  346 + // /* 外置处理业务 */
  347 + // if (name === 'slave') {
  348 + // let slaveInfoDataNew = '';
  349 + // slaveInfoDataNew = data.filter(item => record.sSlaveId.split(',').includes(item.sId));
  350 + // return slaveInfoDataNew;
  351 + // }
  352 + // };
  353 + /** 处理card点击事件 */
  354 + handleTabsCallback = (child) => {
  355 + if (commonUtils.isNotEmptyArr(this.props.teamData)) {
  356 + child.cardSelectedColor = '#fff7e6';
  357 + const iIndex = this.props.teamData.findIndex(item => item.sId === child.sId);
  358 + const teamDataNew = this.props.teamData;
  359 + teamDataNew.forEach((item, index) => {
  360 + if (index !== iIndex) { item.cardSelectedColor = ''; }
  361 + });
  362 + }
  363 + this.props.onSaveState({ Loading: true });
  364 + this.props.onTabsCallback(child);
  365 + };
  366 + // renderCards = (data) => {
  367 + // let showInfo = '';
  368 + // data.map((item) => {
  369 + // showInfo += (
  370 + // <Col span={4}>
  371 + // <Card title={item.sTeamName} bordered={false}>
  372 + // {item.sTeamName} {item.dHour} {'30%'}
  373 + // </Card>
  374 + // </Col>
  375 + // );
  376 + // });
  377 + // return showInfo;
  378 + // }
  379 + render() {
  380 + const { pageLoading } = this.props;
  381 + return (
  382 + <div className="product-plan-info-box">
  383 + <Spin spinning={pageLoading} style={{ height: '100%' }}>
  384 + <div style={{ height: '100%' }}>
  385 + <ProductionPlanComponent
  386 + style={{ height: '100%' }}
  387 + {...this.props}
  388 + {...this.state}
  389 + onTableFilterData={this.handleTableFilterData}
  390 + onRowClick={this.onRowClick}
  391 + onDoubleClick={this.onDoubleClick}
  392 + // onRowMouseEnter={this.onRowMouseEnter}
  393 + orderData={this.orderData}
  394 + onCloseChangeMachine={this.onCloseChangeMachine}
  395 + onTabsCallback={this.handleTabsCallback}
  396 + onTableSelectRowChange={this.onTableSelectRowChange}
  397 + />
  398 + </div>
  399 + </Spin>
  400 + </div>
  401 + );
  402 + }
  403 +}
  404 +
  405 +const ProductionPlanComponent = Form.create({
  406 + mapPropsToFields(props) {
  407 + const { masterData } = props;
  408 + const obj = commonFunc.mapPropsToFields(masterData, Form);
  409 + return obj;
  410 + },
  411 +})((props) => {
  412 + const {
  413 + form, onReturnForm, app, masterData, sModelsId, masterConfig, teamSelectedRowKeys, clearArray, slavePagination, planLoadingSate,
  414 + Loading } = props;
  415 + // console.log('props:===', props);
  416 + /* 回带表单 */
  417 + onReturnForm(form);
  418 + // const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
  419 + const pagination = {
  420 + pageSize: commonConfig.pageSize,
  421 + ...slavePagination,
  422 + size: 'large',
  423 + pageSizeOptions: commonConfig.pageSizeOptions,
  424 + // showQuickJumper: true,
  425 + hideOnSinglePage: false,
  426 + showSizeChanger: true,
  427 + current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
  428 + };
  429 + const width = '18px';
  430 + const height = '18px';
  431 + const moveUp = {
  432 + title: '上移',
  433 + width: { width },
  434 + height: { height },
  435 + img: <img src={MoveUp} alt="上移" width="16px" height="16px" />,
  436 + disableimg: <img src={DisableMoveUp} alt="上移" width="16px" height="16px" />,
  437 + };
  438 + const moveDown = {
  439 + title: '下移',
  440 + width: { width },
  441 + height: { height },
  442 + img: <img src={MoveDown} alt="下移" width="16px" height="16px" />,
  443 + disableimg: <img src={DisableMoveDown} alt="下移" width="16px" height="16px" />,
  444 + };
  445 + const moveTop = {
  446 + title: '置顶',
  447 + width: { width },
  448 + height: { height },
  449 + img: <img src={MoveTop} alt="置顶" width="16px" height="16px" />,
  450 + disableimg: <img src={DisableMoveTop} alt="置顶" width="16px" height="16px" />,
  451 + };
  452 + const moveBottom = {
  453 + title: '置底',
  454 + width: { width },
  455 + height: { height },
  456 + img: <img src={MoveBottom} alt="置底" width="16px" height="16px" />,
  457 + disableimg: <img src={DisableMoveBottom} alt="置底" width="16px" height="16px" />,
  458 + };
  459 + const changeMachine = {
  460 + title: '更换机台',
  461 + width: { width },
  462 + height: { height },
  463 + img: <img src={ChangeMachine} alt="更换机台" width="20px" height="20px" />,
  464 + disableimg: <img src={DisableChangeMachine} alt="更换机台" width="20px" height="20px" />,
  465 + };
  466 + const resetSearch = {
  467 + title: '重置搜索',
  468 + width: { width },
  469 + height: { height },
  470 + img: <img src={Reset} alt="重置搜索" width="18px" height="18px" />,
  471 + disableimg: <img src={DisableReset} alt="重置搜索" width="18px" height="18px" />,
  472 + };
  473 + const addProps = {};
  474 + const tableProps = {
  475 + ...commonBusiness.getTableTypes('slave', props),
  476 + onTableFilterData: props.onTableFilterData,
  477 + tableProps: {
  478 + rowKey: 'sSlaveId',
  479 + pagination,
  480 + sortSelf: true,
  481 + onRow: (record) => {
  482 + return {
  483 + onClick: () => { props.onRowClick('slave', record, true); },
  484 + onDoubleClick: () => { props.onDoubleClick('slave', record); },
  485 + // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
  486 + };
  487 + },
  488 + onChange: props.onTitleChange.bind(this, 'slave'),
  489 + },
  490 + clearArray: props.clearArray,
  491 + };
  492 +
  493 + const tableInfoProps = {
  494 + ...commonBusiness.getTableTypes('slaveInfo', props),
  495 + tableProps: {
  496 + rowKey: 'sId',
  497 + pagination,
  498 + planLoadingSate,
  499 + onRow: (record) => {
  500 + return {
  501 + onClick: () => { props.onRowClick('slaveInfo', record, true); },
  502 + onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
  503 + // onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
  504 + };
  505 + },
  506 + onChange: props.onTitleChange.bind(this, 'slaveInfo'),
  507 + },
  508 + // data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
  509 + };
  510 + const gridStyle = {
  511 + width: '100%',
  512 + textAlign: 'left',
  513 + };
  514 + const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
  515 + const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
  516 + const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
  517 + const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
  518 + const setMachine = commonFunc.showMessage(app.commonConst, 'changeMachine');/* 置底 */
  519 + const setResetSearch = commonFunc.showMessage(app.commonConst, 'setResetSearch');/* 重置搜索 */
  520 + const resetSearchEnabled = clearArray.length > 0;
  521 +
  522 + const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineId');
  523 + const machineShowTypeProps = {
  524 + app,
  525 + record: masterData,
  526 + name: 'master',
  527 + form: props.form,
  528 + formId: sModelsId,
  529 + getSqlDropDownData: props.getSqlDropDownData,
  530 + getSqlCondition: props.getSqlCondition,
  531 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  532 + getFloatNum: props.getFloatNum,
  533 + getDateFormat: props.getDateFormat,
  534 + onChange: props.onChange,
  535 + showConfig: iMachineIndex > -1 ? masterConfig.gdsconfigformslave[iMachineIndex] : {},
  536 + formItemLayout: {},
  537 + enabled: true,
  538 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sMachineId,
  539 + bTable: false,
  540 + onFilterDropDownData: props.onFilterDropDownData,
  541 + };
  542 + const iTeamIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sTeamId');
  543 + const teamShowTypeProps = {
  544 + app,
  545 + record: masterData,
  546 + name: 'master',
  547 + form: props.form,
  548 + formId: sModelsId,
  549 + getSqlDropDownData: props.getSqlDropDownData,
  550 + getSqlCondition: props.getSqlCondition,
  551 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  552 + getFloatNum: props.getFloatNum,
  553 + getDateFormat: props.getDateFormat,
  554 + onChange: props.onChange,
  555 + showConfig: iTeamIndex > -1 ? masterConfig.gdsconfigformslave[iTeamIndex] : {},
  556 + formItemLayout: {},
  557 + enabled: true,
  558 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sTeamId,
  559 + bTable: false,
  560 + onFilterDropDownData: props.onFilterDropDownData,
  561 + };
  562 + const iStartIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'tStartDate');
  563 + const startShowTypeProps = {
  564 + app,
  565 + record: masterData,
  566 + name: 'master',
  567 + form: props.form,
  568 + formId: sModelsId,
  569 + getSqlDropDownData: props.getSqlDropDownData,
  570 + getSqlCondition: props.getSqlCondition,
  571 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  572 + getFloatNum: props.getFloatNum,
  573 + getDateFormat: props.getDateFormat,
  574 + onChange: props.onChange,
  575 + showConfig: iStartIndex > -1 ? masterConfig.gdsconfigformslave[iStartIndex] : {},
  576 + formItemLayout: {},
  577 + enabled: true,
  578 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.tStartDate,
  579 + bTable: false,
  580 + onFilterDropDownData: props.onFilterDropDownData,
  581 + };
  582 +
  583 + const bSplitIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'bSplit');
  584 + const splitShowTypeProps = {
  585 + app,
  586 + record: masterData,
  587 + name: 'master',
  588 + form: props.form,
  589 + formId: sModelsId,
  590 + getSqlDropDownData: props.getSqlDropDownData,
  591 + getSqlCondition: props.getSqlCondition,
  592 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  593 + getFloatNum: props.getFloatNum,
  594 + getDateFormat: props.getDateFormat,
  595 + onChange: props.onChange,
  596 + showConfig: bSplitIndex > -1 ? masterConfig.gdsconfigformslave[bSplitIndex] : {},
  597 + formItemLayout: {},
  598 + enabled: true,
  599 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.bSplit,
  600 + bTable: false,
  601 + onFilterDropDownData: props.onFilterDropDownData,
  602 + };
  603 +
  604 + const iSplitNumIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'iSplitNum');
  605 + const splitNumShowTypeProps = {
  606 + app,
  607 + record: masterData,
  608 + name: 'master',
  609 + form: props.form,
  610 + formId: sModelsId,
  611 + getSqlDropDownData: props.getSqlDropDownData,
  612 + getSqlCondition: props.getSqlCondition,
  613 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  614 + getFloatNum: props.getFloatNum,
  615 + getDateFormat: props.getDateFormat,
  616 + onChange: props.onChange,
  617 + showConfig: iSplitNumIndex > -1 ? masterConfig.gdsconfigformslave[iSplitNumIndex] : {},
  618 + formItemLayout: {},
  619 + enabled: true,
  620 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.iSplitNum,
  621 + bTable: false,
  622 + onFilterDropDownData: props.onFilterDropDownData,
  623 + };
  624 +
  625 + let selectedRowKey = {};
  626 + if (commonUtils.isNotEmptyArr(teamSelectedRowKeys)) {
  627 + selectedRowKey = teamSelectedRowKeys[0];
  628 + }
  629 +
  630 + let teamDataNum = 0;
  631 + if (commonUtils.isNotEmptyArr(props.teamData)) {
  632 + // 取得导航按钮的行数
  633 + if (props.teamData.length % 8 === 0) {
  634 + teamDataNum = (props.teamData.length / 8) - 1;
  635 + } else {
  636 + teamDataNum = Math.floor(props.teamData.length / 8);
  637 + }
  638 + }
  639 + return (
  640 + <Form style={{ height: '100%' }}>
  641 + <Layout style={{ height: '100%' }} className="xly-productionPlan-list">
  642 + <Header className={styles.header} style={{ backgroundColor: 'rgb(100, 100, 100)' }}>
  643 + <Toolbar {...props} className="billBtnGroup" style={{ backgroundColor: '#646464', color: 'rgb(255,255,255)' }} />
  644 + </Header>
  645 + <Layout className={styles.clayout} style={{ height: '100%' }} >
  646 + <div className="productionCard">
  647 + <Spin spinning={Loading === undefined ? false : Loading}>
  648 + <Card bordered={false}>
  649 + <Row gutter={16}>
  650 + {
  651 + commonUtils.isNotEmptyArr(props.teamData) ? props.teamData.map((child) => {
  652 + const sType = commonUtils.isNotEmptyNumber(child.sType) ? child.sType.toString() : '';/* 0 - 全部单据 1-未排程 2- 已排程 */
  653 + const cardColor = sType === '0' ? 'allCard' : sType === '1' ? 'unCard' : 'defaultCard';
  654 + return (
  655 + <Col span={3} style={{ padding: '0px' }} className={selectedRowKey === child.sId ? 'cardSelectedColor' : commonUtils.isNotEmptyObject(child.cardSelectedColor) ? 'cardSelectedColor' : cardColor} >
  656 + <Card.Grid hoverable={false}style={gridStyle} onClick={props.onTabsCallback.bind(this, child)}>
  657 + <div className="card_left">
  658 + <div className="card_top">
  659 + <div className="card_left1" >{child.tStartDate}</div>
  660 + <div className="card_left2" style={{ color: '#ff0000' }} >{`${child.dHour}h`} </div>
  661 + </div>
  662 + <div className="card_mid">{child.sMachineName}</div>
  663 + </div>
  664 + </Card.Grid>
  665 + </Col>);
  666 + }) : ''
  667 + }
  668 + </Row>
  669 + </Card>
  670 + </Spin>
  671 + </div>
  672 + <div className={selfstyles.mainPlan}>
  673 + <Layout className={['processList', 'processListTable']}>
  674 + <Sider className="process">
  675 + <a title={setResetSearch} {...addProps} onClick={resetSearchEnabled ? e => props.onResetTableSearch() : null}>{ resetSearchEnabled ? resetSearch.img : resetSearch.disableimg}</a>&nbsp;
  676 + <a title={setTop} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 0) : null}>{ props.moveEnabled ? moveTop.img : moveTop.disableimg}</a>
  677 + <a title={setUp} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 1) : null}>{ props.moveEnabled ? moveUp.img : moveUp.disableimg }</a>
  678 + <a title={setDown} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 2) : null}>{props.moveEnabled ? moveDown.img : moveDown.disableimg }</a>
  679 + <a title={setBottom} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 3) : null}>{props.moveEnabled ? moveBottom.img : moveBottom.disableimg }</a>&nbsp;&nbsp;
  680 + <a title={setMachine} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slaveInfo', 0) : null}>{props.moveEnabled ? changeMachine.img : changeMachine.disableimg }</a>
  681 + </Sider>
  682 + <Content
  683 + className="xly-normal-list productPlan"
  684 + style={{ height: `calc( 100vh - 10px - ${teamDataNum * 45}px)` }}
  685 + >
  686 + <StaticEditTable {...tableProps} slaveInfo={tableInfoProps} setExpandedRowRender="Y" />
  687 + </Content>
  688 + </Layout>
  689 + </div>
  690 + </Layout>
  691 + {
  692 + props.isChangeMachine ?
  693 + <AntdDraggableModal
  694 + width={500}
  695 + title="换机台"
  696 + visible={props.isChangeMachine}
  697 + onCancel={props.onCloseChangeMachine}
  698 + onOk={props.onChangeMachine}
  699 + okButtonProps={commonUtils.isNotEmptyObject(masterData) && (commonUtils.isNotEmptyStr(masterData.sMachineId) || (masterData.bSplit && commonUtils.isNotEmptyStr(masterData.iSplitNum))) ? { disabled: false } : { disabled: true }}
  700 + >
  701 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...machineShowTypeProps} /> }
  702 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...teamShowTypeProps} /> }
  703 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...startShowTypeProps} /> }
  704 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...splitShowTypeProps} /> }
  705 + { commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData) && masterData.bSplit ? <ShowType {...splitNumShowTypeProps} /> : '' }
  706 + </AntdDraggableModal>
  707 + : ''
  708 + }
  709 + </Layout>
  710 + </Form>
  711 + );
  712 +});
  713 +
  714 +export default CommonBase(CommonProductionPlanEvent(ProductionPlanInfoComponentInfo));
... ...
src/components/productionPlanInfo/productionPlanInfo2.js 0 → 100644
  1 +/* eslint-disable array-callback-return,no-undef */
  2 +import React, { Component } from 'react';
  3 +import { Form } from '@ant-design/compatible';
  4 +import '@ant-design/compatible/assets/index.css';
  5 +import { Layout, Spin, Select } from 'antd'; // Switch
  6 +import styles from '../../index.less';
  7 +import * as commonFunc from '../Common/commonFunc';
  8 +import CommonBase from '../Common/CommonBase';
  9 +import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
  10 +import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
  11 +import SearchComponent from '../Common/SearchComponent';/* 搜索组件 */
  12 +import CommonProductionPlanEvent from '../Common/CommonProductionPlanEvent';
  13 +import config from '../../utils/config';
  14 +import ProductionHeader from './productionHeader';/* 可编辑表格 */
  15 +
  16 +const { Option } = Select;
  17 +const { Header, Content, Sider } = Layout;
  18 +
  19 +class ProductionPlanInfoComponentInfo2 extends Component {
  20 + constructor(props) {
  21 + super(props);
  22 + this.state = {};
  23 + this.form = {}; /* 表单对象 */
  24 + }
  25 + render() {
  26 + const { pageLoading } = this.props;
  27 + return (
  28 + <div className="product-plan-info-box">
  29 + <Spin spinning={pageLoading} style={{ height: '100%' }}>
  30 + <div style={{ height: '100%' }}>
  31 + <ProductionPlanComponent
  32 + style={{ height: '100%' }}
  33 + {...this.props}
  34 + {...this.state}
  35 + />
  36 + </div>
  37 + </Spin>
  38 + </div>
  39 + );
  40 + }
  41 +}
  42 +const ProductionPlanComponent = Form.create({
  43 + mapPropsToFields(props) {
  44 + const { masterData } = props;
  45 + const obj = commonFunc.mapPropsToFields(masterData, Form);
  46 + return obj;
  47 + },
  48 +})((props) => {
  49 + const {
  50 + form, onReturnForm, onSelectChange, sStateSelect, isDragAndDrop, stateOption,
  51 + } = props;
  52 +
  53 + /* 回带表单 */
  54 + onReturnForm(form);
  55 + const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
  56 + const workTeamProps = {
  57 + ...commonBusiness.getTableTypes('workCenter', props),
  58 + tableProps: { rowKey: 'sWorkCenterId' },
  59 + isKeyUsesId: false,
  60 + enabled: false,
  61 + };
  62 +
  63 + const machineProps = {
  64 + ...commonBusiness.getTableTypes(sStateSelect === '0' ? 'unMachine' : 'machine', props),
  65 + tableProps: { rowKey: 'sMachineId' },
  66 + isKeyUsesId: false,
  67 + enabled: false,
  68 + };
  69 +
  70 + const pagination = {
  71 + onChange: props.onPaginationChange,
  72 + size: 'large',
  73 + pageSize: config.pageSize,
  74 + pageNum: config.pageNum,
  75 + showQuickJumper: true,
  76 + };
  77 +
  78 + const processProps = {
  79 + ...commonBusiness.getTableTypes('slave', props),
  80 + tableProps: { pagination: pageFlag ? false : pagination },
  81 + scrollX: 3,
  82 + isDragAndDrop,
  83 + };
  84 +
  85 + return (
  86 + <Form style={{ height: '100%' }}>
  87 + <Layout style={{ height: '100%' }}>
  88 + <Header className={styles.header} style={{ backgroundColor: 'rgb(100, 100, 100)' }}>
  89 + <ProductionHeader {...props} />
  90 + </Header>
  91 + <Layout className={styles.clayout} style={{ height: '100%' }} >
  92 + <div className={styles.content} style={{ height: '100%' }} >
  93 + <Layout
  94 + className="product-plain-container-layout"
  95 + style={{
  96 + margin: '5px 10px', height: '100%', flexDirection: 'row', backgroundColor: '#fff',
  97 +}}
  98 + >
  99 + <Sider className="product-plan-sider" width="340px">
  100 + <div>
  101 + <Select style={{ padding: '10px 11px' }} onChange={onSelectChange} value={sStateSelect} defaultValue={stateOption ? stateOption[0].key : sStateSelect}>
  102 + {
  103 + stateOption ? stateOption.map((item) => {
  104 + return (<Option key={item.key}>{item.value}</Option>);
  105 + }) : ''
  106 + }
  107 + <Option value="99" >全部数据</Option>
  108 + </Select>
  109 + </div>
  110 + <div>
  111 + <StaticEditTable {...workTeamProps} />
  112 + </div>
  113 + <div style={{ backgroundColor: '#fff' }}>
  114 + <StaticEditTable {...machineProps} />
  115 + </div>
  116 + </Sider>
  117 + <Content
  118 + style={{
  119 + backgroundColor: '#fff', height: '100vh', overflowY: 'hidden', borderRight: '1px solid #ddd', borderLeft: '1px solid #ddd',
  120 + }}
  121 + className="xly-normal-list"
  122 + >
  123 + <div style={{ maxHeight: '100%', zIndex: 20 }}>
  124 + <SearchComponent {...props} />
  125 + </div>
  126 + <StaticEditTable {...processProps} style={{ width: '100%' }} />
  127 + </Content>
  128 + </Layout>
  129 + </div>
  130 + </Layout>
  131 + </Layout>
  132 + </Form>
  133 + );
  134 +});
  135 +
  136 +export default CommonBase(CommonProductionPlanEvent(ProductionPlanInfoComponentInfo2));
... ...
src/components/productionPlanInfo/productionPlanOutside.js 0 → 100644
  1 +/* eslint-disable array-callback-return,no-undef,object-curly-newline,prefer-destructuring,no-unused-vars */
  2 +import React, { Component } from 'react';
  3 +import { Form } from '@ant-design/compatible';
  4 +import '@ant-design/compatible/assets/index.css';
  5 +import { Modal, Layout, Spin, Card, Row, Col, message } from 'antd'; // Switch Select, Tabs,
  6 +import styles from '../../index.less';
  7 +import selfstyles from '../productionMainPlan/index.less';
  8 +import * as commonFunc from '../Common/commonFunc';
  9 +import CommonBase from '../Common/CommonBase';
  10 +import * as commonBusiness from '../Common/commonBusiness';/* 单据业务功能 */
  11 +import StaticEditTable from '../Common/CommonTable';/* 可编辑表格 */
  12 +import CommonProductionPlanEvent from '../Common/CommonProductionPlanEvent';
  13 +import Toolbar from '../Common/ToolBar/ToolBarNew';
  14 +import MoveUp from '../../assets/processUp.svg';
  15 +import MoveDown from '../../assets/processDown.svg';
  16 +import DisableMoveUp from '../../assets/disableprocessUp.svg';
  17 +import DisableMoveDown from '../../assets/disableprocessDown.svg';
  18 +import MoveTop from '../../assets/processTop.svg';
  19 +import DisableMoveTop from '../../assets/disableprocessTop.svg';
  20 +import MoveBottom from '../../assets/processBottom.svg';
  21 +import DisableMoveBottom from '../../assets/disableprocessBottom.svg';
  22 +import ChangeMachine from '../../assets/changeMachine.svg';
  23 +import DisableChangeMachine from '../../assets/disablechangeMachine.svg';
  24 +import Reset from '../../assets/reset.svg';
  25 +import DisableReset from '../../assets/disablereset.svg';
  26 +import * as commonUtils from '../../utils/utils';
  27 +import ShowType from '../Common/CommonComponent';
  28 +import commonConfig from '../../utils/config';
  29 +import AntdDraggableModal from '../Common/AntdDraggableModal';
  30 +import CommonProductionPlanOutsideEvent from '../Common/CommonProductionPlanOutsideEvent';
  31 +
  32 +
  33 +// const { Option } = Select;
  34 +const { Header, Content, Sider } = Layout;
  35 +// const { TabPane } = Tabs;
  36 +
  37 +class ProductionPlanOutside extends Component {
  38 + constructor(props) {
  39 + super(props);
  40 + this.state = {};
  41 + this.form = {}; /* 表单对象 */
  42 + }
  43 +
  44 + shouldComponentUpdate(nextProps) {
  45 + const { slaveColumn, masterConfig } = nextProps;
  46 + return commonUtils.isNotEmptyArr(slaveColumn) || commonUtils.isNotEmptyObject(masterConfig);
  47 + }
  48 + // onRowMouseEnter = (name, record) => {
  49 + // console.log('record:', record);
  50 + // }
  51 + onDoubleClick = (name, record) => {
  52 + if (this.props.onDoubleClick !== undefined) {
  53 + this.props.onDoubleClick(record);
  54 + }
  55 + };
  56 + onRowClick = (name, record, bRowClick) => {
  57 + const { slaveData } = this.props;
  58 + let { slaveSelectedRowKeys, slaveInfoSelectedRowKeys } = this.props;
  59 + slaveInfoSelectedRowKeys = commonUtils.isNotEmptyArr(slaveInfoSelectedRowKeys) ? slaveInfoSelectedRowKeys : [];
  60 + if (name === 'slave') {
  61 + if (commonUtils.isEmptyArr(slaveSelectedRowKeys)) {
  62 + const keys = [];
  63 + keys.push(record.sSlaveId);
  64 + slaveSelectedRowKeys = keys;
  65 + const sIds = record.sSlaveId.split('-');
  66 + slaveInfoSelectedRowKeys.push(...sIds);
  67 + } else {
  68 + const indexKey = slaveSelectedRowKeys.indexOf(record.sSlaveId);
  69 + if (indexKey === -1) {
  70 + slaveSelectedRowKeys.push(record.sSlaveId);
  71 + const sIds = record.sSlaveId.split('-');
  72 + slaveInfoSelectedRowKeys.push(...sIds);
  73 + sIds.forEach((item) => {
  74 + const iIndex = slaveInfoSelectedRowKeys.findIndex(e => e === item);
  75 + if (iIndex === -1) {
  76 + slaveInfoSelectedRowKeys.push(item);
  77 + }
  78 + });
  79 + } else if (indexKey !== -1) {
  80 + if (!bRowClick) {
  81 + slaveSelectedRowKeys.splice(indexKey, 1);
  82 + }
  83 + const sIds = record.sSlaveId.split('-');
  84 + sIds.forEach((item) => {
  85 + const index = slaveInfoSelectedRowKeys.findIndex(e => e === item);
  86 + if (!bRowClick) {
  87 + slaveInfoSelectedRowKeys.splice(index, 1);
  88 + }
  89 + });
  90 + }
  91 + }
  92 + } else if (name === 'slaveInfo') {
  93 + if (commonUtils.isEmptyArr(slaveInfoSelectedRowKeys)) {
  94 + const keys = [];
  95 + keys.push(record.sId);
  96 + slaveInfoSelectedRowKeys = keys;
  97 + const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
  98 + if (commonUtils.isNotEmptyArr(slaveDataNews)) {
  99 + slaveSelectedRowKeys = [slaveDataNews[0].sSlaveId];
  100 + }
  101 + } else {
  102 + const indexKey = slaveInfoSelectedRowKeys.indexOf(record.sId);
  103 + if (indexKey === -1) {
  104 + slaveInfoSelectedRowKeys.push(record.sId);
  105 + const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
  106 + if (commonUtils.isNotEmptyArr(slaveDataNews)) {
  107 + const iIndex = slaveSelectedRowKeys.findIndex(item => item === slaveDataNews[0].sSlaveId);
  108 + if (iIndex === -1) {
  109 + slaveSelectedRowKeys.push(slaveDataNews[0].sSlaveId);
  110 + }
  111 + }
  112 + } else if (indexKey !== -1) {
  113 + /* 可输入行,行内点击时 不去除selectedRowKeys */
  114 + if (!bRowClick) {
  115 + slaveInfoSelectedRowKeys.splice(indexKey, 1);
  116 + }
  117 + const slaveDataNews = slaveData.filter(item => item.sSlaveId.split('-').includes(record.sId));
  118 + if (commonUtils.isNotEmptyArr(slaveDataNews)) {
  119 + const sSlaveIds = slaveDataNews[0].sSlaveId.split('-');
  120 + if (slaveInfoSelectedRowKeys.length === 0 || sSlaveIds.length === 1) {
  121 + const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
  122 + slaveSelectedRowKeys.splice(iIndex, 1);
  123 + } else {
  124 + let bdel = true;
  125 + for (const sId of sSlaveIds) {
  126 + if (slaveInfoSelectedRowKeys.findIndex(item => item === sId && item !== record.sId)) {
  127 + bdel = false;
  128 + break;
  129 + }
  130 + }
  131 + if (bdel) {
  132 + const iIndex = slaveSelectedRowKeys.indexOf(item => slaveDataNew[0].sSlaveId === item);
  133 + slaveSelectedRowKeys.splice(iIndex, 1);
  134 + }
  135 + }
  136 + }
  137 + }
  138 + }
  139 + }
  140 + let machineEnabled = false;
  141 + if (commonUtils.isNotEmptyArr(slaveSelectedRowKeys)) {
  142 + const currSlave = slaveData.filter(item => item.sSlaveId === slaveSelectedRowKeys[0])[0];
  143 + const processSlave = slaveData.filter(item => item.sProcessId === currSlave.sProcessId && slaveSelectedRowKeys.includes(item.sSlaveId));
  144 + if (processSlave.length === slaveSelectedRowKeys.length) {
  145 + machineEnabled = true;
  146 + }
  147 + }
  148 + const { sModelsId } = this.props;
  149 + commonUtils.setStoreDropDownData(sModelsId, 'master', 'sMachineId', []);
  150 + this.props.onSaveState({ slaveSelectedRowKeys, slaveInfoSelectedRowKeys, machineEnabled });
  151 + };
  152 +
  153 + onCloseChangeMachine = () => {
  154 + const { masterData } = this.props;
  155 + delete masterData.tStartDate;
  156 + delete masterData.iSplitNum;
  157 + delete masterData.bSplit;
  158 + this.props.onSaveState({ isChangeMachine: false, masterData: { ...masterData, sMachineId: '', sTeamId: '' } });
  159 + }
  160 +
  161 + onTableSelectRowChange = (name, selectedRowKeys) => {
  162 + if (name === 'slave') {
  163 + const addState = this.props.onTableSelectRowChange(name, selectedRowKeys, true);
  164 + const slaveInfoSelectedRowKeys = [];
  165 + if (commonUtils.isNotEmptyArr(selectedRowKeys)) {
  166 + selectedRowKeys.forEach((selectedRow) => {
  167 + const sIds = selectedRow.split('-');
  168 + slaveInfoSelectedRowKeys.push(...sIds);
  169 + });
  170 + }
  171 + addState.slaveInfoSelectedRowKeys = slaveInfoSelectedRowKeys;
  172 + this.props.onSaveState({ ...addState });
  173 + } else {
  174 + this.props.onTableSelectRowChange(name, selectedRowKeys);
  175 + }
  176 + };
  177 +
  178 + /** 处理选择行发生改变 */
  179 + handleTableFilterData = (name, data, record) => {
  180 + /* 外置处理业务 */
  181 + if (name === 'slave') {
  182 + let slaveInfoDataNew = [];
  183 + if (commonUtils.isNotEmptyArr(data)) {
  184 + slaveInfoDataNew = data.filter(item => record.sSlaveId.split('-').includes(item.sId));
  185 + }
  186 + return slaveInfoDataNew;
  187 + }
  188 + };
  189 +
  190 + // 根据配置解析拼接具体参数
  191 + handleProParams = (sKey, arr) => {
  192 + const { [`${sKey}Data`]: tableData, [`${sKey}SelectedRowKeys`]: selectedRowKeys } = this.props;
  193 + const keyData = tableData.filter(item => selectedRowKeys.includes(item.sId) || selectedRowKeys.includes(item.sSlaveId));
  194 + if (commonUtils.isNotEmptyArr(keyData)) {
  195 + const addState = {};
  196 + addState.key = sKey;
  197 + const val = [];
  198 + keyData.forEach((currData) => {
  199 + const currVal = {};
  200 + arr.forEach((filed) => {
  201 + currVal[`${filed}`] = currData[`${filed}`];
  202 + });
  203 + val.push(currVal);
  204 + });
  205 + addState.value = val;
  206 + return addState;
  207 + } else {
  208 + return undefined;
  209 + }
  210 + };
  211 +
  212 + sortData = (tempData) => {
  213 + tempData.sort((g1, g2) => {
  214 + return g1.iOrder - g2.iOrder;
  215 + });
  216 + return tempData;
  217 + };
  218 +
  219 + /* 控制排序 */
  220 + orderData = (e, name, type) => {
  221 + const { [`${name}SelectedRowKeys`]: tableselectedRowKeys, app, slavePagination: slavePaginationOld } = this.props;
  222 + let { [`${name}Data`]: currentData } = this.props;
  223 + if (name === 'slave') {
  224 + if (commonUtils.isEmptyArr(tableselectedRowKeys)) {
  225 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请勾选要移动数据 */
  226 + return;
  227 + }
  228 + if (commonUtils.isEmptyArr(currentData)) {
  229 + message.warn(commonFunc.showMessage(app.commonConst, 'NoProcessData'));/* 请填写工序表数据 */
  230 + return;
  231 + }
  232 + const tempNew = currentData.filter((item) => { /* 获取勾选数据集 */
  233 + return tableselectedRowKeys.indexOf(item.sSlaveId) > -1;
  234 + });
  235 + if (commonUtils.isEmptyArr(tempNew)) {
  236 + message.warn(commonFunc.showMessage(app.commonConst, 'pleaseChooseMoveData'));/* 请选择要移动数据 */
  237 + return;
  238 + }
  239 + const len = currentData.length;
  240 + const newLen = tempNew.length;
  241 + let num = 0.01;/* 循环增加体 */
  242 + let targetiOrder = -1;
  243 + if (type === 1) { /* 上移 */
  244 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
  245 + if (iIndex === 0) {
  246 + if (newLen === 1) {
  247 + message.warn(commonFunc.showMessage(app.commonConst, 'NoUp'));/* 无需上移 */
  248 + return;
  249 + } else {
  250 + targetiOrder = 0;
  251 + }
  252 + } else {
  253 + targetiOrder = currentData[iIndex - 1].iOrder - 1; /* 目标排序号 */
  254 + }
  255 + } else if (type === 2) { /* 下移 */
  256 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
  257 + if (iIndex === len - 1) {
  258 + if (newLen === 1) {
  259 + message.warn(commonFunc.showMessage(app.commonConst, 'NoDown')); /* 无需下移 */
  260 + return;
  261 + } else {
  262 + targetiOrder = currentData[iIndex].iOrder;
  263 + }
  264 + } else {
  265 + targetiOrder = currentData[iIndex + 1].iOrder;
  266 + }
  267 + } else if (type === 0) { /* 置顶 */
  268 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[0].sSlaveId);/* 选中第一个节点的下标 */
  269 + if (iIndex === 0) {
  270 + if (newLen === 1) {
  271 + message.warn(commonFunc.showMessage(app.commonConst, 'NoTop')); /* 无需置顶 */
  272 + return;
  273 + } else {
  274 + targetiOrder = currentData[iIndex].iOrder;
  275 + }
  276 + } else {
  277 + targetiOrder = currentData[0].iOrder - 1;
  278 + }
  279 + } else if (type === 3) { /* 置底 */
  280 + const iIndex = currentData.findIndex(item => item.sSlaveId === tempNew[newLen - 1].sSlaveId);/* 选中最后一个节点的下标 */
  281 + if (iIndex === len - 1) {
  282 + if (newLen === 1) {
  283 + message.warn(commonFunc.showMessage(app.commonConst, 'NoBottom')); /* 无需置底 */
  284 + return;
  285 + } else {
  286 + targetiOrder = currentData[iIndex].iOrder;
  287 + }
  288 + } else {
  289 + targetiOrder = currentData[len - 1].iOrder + 1;
  290 + }
  291 + }
  292 + tempNew.forEach((item) => {
  293 + const index1 = currentData.findIndex(item1 => item1.sSlaveId === item.sSlaveId);
  294 + currentData[index1] = { ...item, iOrder: targetiOrder + num, handleType: 'update' };
  295 + num += 0.01;
  296 + });
  297 + currentData = this.sortData(currentData);
  298 + currentData = this.orderNum(currentData);
  299 + const iIndex = currentData.findIndex(item => item.sSlaveId === tableselectedRowKeys[0]);
  300 + const slavePagination = { ...slavePaginationOld };
  301 + slavePagination.current = Math.ceil((iIndex + 1) / commonConfig.pageSize);
  302 + this.props.onSaveState({ [`${name}Data`]: currentData, slavePagination });
  303 + } else if (name === 'slaveInfo') {
  304 + this.props.onSaveState({ isChangeMachine: true });
  305 + }
  306 + };
  307 +
  308 + /* 自定义排序号 */
  309 + orderNum = (tableData) => {
  310 + tableData.forEach((item, index) => {
  311 + item.iOrder = index + 1;
  312 + item.handleType = 'update';
  313 + });
  314 + return tableData;
  315 + };
  316 +
  317 + /** 处理选择行发生改变 */
  318 + // handleTableFilterData = (name, data, record) => {
  319 + // /* 外置处理业务 */
  320 + // if (name === 'slave') {
  321 + // let slaveInfoDataNew = '';
  322 + // slaveInfoDataNew = data.filter(item => record.sSlaveId.split(',').includes(item.sId));
  323 + // return slaveInfoDataNew;
  324 + // }
  325 + // };
  326 + /** 处理card点击事件 */
  327 + handleTabsCallback = (child) => {
  328 + if (commonUtils.isNotEmptyArr(this.props.teamData)) {
  329 + child.cardSelectedColor = '#fff7e6';
  330 + const iIndex = this.props.teamData.findIndex(item => item.sId === child.sId);
  331 + const teamDataNew = this.props.teamData;
  332 + teamDataNew.forEach((item, index) => {
  333 + if (index !== iIndex) { item.cardSelectedColor = ''; }
  334 + });
  335 + }
  336 + this.props.onSaveState({ Loading: true });
  337 + this.props.onTabsCallback(child);
  338 + };
  339 + // renderCards = (data) => {
  340 + // let showInfo = '';
  341 + // data.map((item) => {
  342 + // showInfo += (
  343 + // <Col span={4}>
  344 + // <Card title={item.sTeamName} bordered={false}>
  345 + // {item.sTeamName} {item.dHour} {'30%'}
  346 + // </Card>
  347 + // </Col>
  348 + // );
  349 + // });
  350 + // return showInfo;
  351 + // }
  352 + render() {
  353 + const { pageLoading } = this.props;
  354 + return (
  355 + <div className="product-plan-info-box">
  356 + <Spin spinning={pageLoading} style={{ height: '100%' }}>
  357 + <div style={{ height: '100%' }}>
  358 + <ProductionPlanOutsideComponent
  359 + style={{ height: '100%' }}
  360 + {...this.props}
  361 + {...this.state}
  362 + onTableFilterData={this.handleTableFilterData}
  363 + onRowClick={this.onRowClick}
  364 + onDoubleClick={this.onDoubleClick}
  365 + // onRowMouseEnter={this.onRowMouseEnter}
  366 + orderData={this.orderData}
  367 + onCloseChangeMachine={this.onCloseChangeMachine}
  368 + onTabsCallback={this.handleTabsCallback}
  369 + onTableSelectRowChange={this.onTableSelectRowChange}
  370 + />
  371 + </div>
  372 + </Spin>
  373 + </div>
  374 + );
  375 + }
  376 +}
  377 +
  378 +const ProductionPlanOutsideComponent = Form.create({
  379 + mapPropsToFields(props) {
  380 + const { masterData } = props;
  381 + const obj = commonFunc.mapPropsToFields(masterData, Form);
  382 + return obj;
  383 + },
  384 +})((props) => {
  385 + const {
  386 + form, onReturnForm, app, masterData, sModelsId, masterConfig, teamSelectedRowKeys, clearArray, slavePagination, planLoadingSate,
  387 + Loading } = props;
  388 + // console.log('props:===', props);
  389 + /* 回带表单 */
  390 + onReturnForm(form);
  391 + // const pageFlag = sStateSelect === '0' || sStateSelect === '1' || sStateSelect === '2';
  392 + const pagination = {
  393 + pageSize: commonConfig.pageSize,
  394 + ...slavePagination,
  395 + size: 'large',
  396 + pageSizeOptions: commonConfig.pageSizeOptions,
  397 + // showQuickJumper: true,
  398 + hideOnSinglePage: false,
  399 + showSizeChanger: true,
  400 + current: commonUtils.isEmptyObject(slavePagination) ? 1 : slavePagination.current,
  401 + };
  402 + const width = '18px';
  403 + const height = '18px';
  404 + const moveUp = {
  405 + title: '上移',
  406 + width: { width },
  407 + height: { height },
  408 + img: <img src={MoveUp} alt="上移" width="16px" height="16px" />,
  409 + disableimg: <img src={DisableMoveUp} alt="上移" width="16px" height="16px" />,
  410 + };
  411 + const moveDown = {
  412 + title: '下移',
  413 + width: { width },
  414 + height: { height },
  415 + img: <img src={MoveDown} alt="下移" width="16px" height="16px" />,
  416 + disableimg: <img src={DisableMoveDown} alt="下移" width="16px" height="16px" />,
  417 + };
  418 + const moveTop = {
  419 + title: '置顶',
  420 + width: { width },
  421 + height: { height },
  422 + img: <img src={MoveTop} alt="置顶" width="16px" height="16px" />,
  423 + disableimg: <img src={DisableMoveTop} alt="置顶" width="16px" height="16px" />,
  424 + };
  425 + const moveBottom = {
  426 + title: '置底',
  427 + width: { width },
  428 + height: { height },
  429 + img: <img src={MoveBottom} alt="置底" width="16px" height="16px" />,
  430 + disableimg: <img src={DisableMoveBottom} alt="置底" width="16px" height="16px" />,
  431 + };
  432 + const changeMachine = {
  433 + title: '更换机台',
  434 + width: { width },
  435 + height: { height },
  436 + img: <img src={ChangeMachine} alt="更换机台" width="20px" height="20px" />,
  437 + disableimg: <img src={DisableChangeMachine} alt="更换机台" width="20px" height="20px" />,
  438 + };
  439 + const resetSearch = {
  440 + title: '重置搜索',
  441 + width: { width },
  442 + height: { height },
  443 + img: <img src={Reset} alt="重置搜索" width="18px" height="18px" />,
  444 + disableimg: <img src={DisableReset} alt="重置搜索" width="18px" height="18px" />,
  445 + };
  446 + const addProps = {};
  447 + const tableProps = {
  448 + ...commonBusiness.getTableTypes('slave', props),
  449 + onTableFilterData: props.onTableFilterData,
  450 + tableProps: {
  451 + rowKey: 'sSlaveId',
  452 + pagination,
  453 + sortSelf: true,
  454 + onRow: (record) => {
  455 + return {
  456 + onClick: () => { props.onRowClick('slave', record, true); },
  457 + onDoubleClick: () => { props.onDoubleClick('slave', record); },
  458 + // onMouseEnter: () => { props.onRowMouseEnter('slave', record); },
  459 + };
  460 + },
  461 + onChange: props.onTitleChange.bind(this, 'slave'),
  462 + },
  463 + clearArray: props.clearArray,
  464 + };
  465 +
  466 + const tableInfoProps = {
  467 + ...commonBusiness.getTableTypes('slaveInfo', props),
  468 + tableProps: {
  469 + rowKey: 'sId',
  470 + pagination,
  471 + planLoadingSate,
  472 + onRow: (record) => {
  473 + return {
  474 + onClick: () => { props.onRowClick('slaveInfo', record, true); },
  475 + onDoubleClick: () => { props.onDoubleClick('slaveInfo', record); },
  476 + // onMouseEnter: () => { props.onRowMouseEnter('slaveInfo', record); },
  477 + };
  478 + },
  479 + onChange: props.onTitleChange.bind(this, 'slaveInfo'),
  480 + },
  481 + // data: commonUtils.isNotEmptyObject(props.slaveInfoDataNew) ? props.slaveInfoDataNew : props.slaveInfoData,
  482 + };
  483 + const gridStyle = {
  484 + width: '100%',
  485 + textAlign: 'left',
  486 + };
  487 + const setUp = commonFunc.showMessage(app.commonConst, 'setUp');/* 上移 */
  488 + const setDown = commonFunc.showMessage(app.commonConst, 'setDown');/* 下移 */
  489 + const setTop = commonFunc.showMessage(app.commonConst, 'setTop');/* 置顶 */
  490 + const setBottom = commonFunc.showMessage(app.commonConst, 'setBottom');/* 置底 */
  491 + const setMachine = commonFunc.showMessage(app.commonConst, 'changeMachine');/* 置底 */
  492 + const setResetSearch = commonFunc.showMessage(app.commonConst, 'setResetSearch');/* 重置搜索 */
  493 + const resetSearchEnabled = clearArray.length > 0;
  494 +
  495 + const iMachineIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sMachineId');
  496 + const machineShowTypeProps = {
  497 + app,
  498 + record: masterData,
  499 + name: 'master',
  500 + form: props.form,
  501 + formId: sModelsId,
  502 + getSqlDropDownData: props.getSqlDropDownData,
  503 + getSqlCondition: props.getSqlCondition,
  504 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  505 + getFloatNum: props.getFloatNum,
  506 + getDateFormat: props.getDateFormat,
  507 + onChange: props.onChange,
  508 + showConfig: iMachineIndex > -1 ? masterConfig.gdsconfigformslave[iMachineIndex] : {},
  509 + formItemLayout: {},
  510 + enabled: true,
  511 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sMachineId,
  512 + bTable: false,
  513 + onFilterDropDownData: props.onFilterDropDownData,
  514 + };
  515 + const iTeamIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'sTeamId');
  516 + const teamShowTypeProps = {
  517 + app,
  518 + record: masterData,
  519 + name: 'master',
  520 + form: props.form,
  521 + formId: sModelsId,
  522 + getSqlDropDownData: props.getSqlDropDownData,
  523 + getSqlCondition: props.getSqlCondition,
  524 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  525 + getFloatNum: props.getFloatNum,
  526 + getDateFormat: props.getDateFormat,
  527 + onChange: props.onChange,
  528 + showConfig: iTeamIndex > -1 ? masterConfig.gdsconfigformslave[iTeamIndex] : {},
  529 + formItemLayout: {},
  530 + enabled: true,
  531 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.sTeamId,
  532 + bTable: false,
  533 + onFilterDropDownData: props.onFilterDropDownData,
  534 + };
  535 + const iStartIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'tStartDate');
  536 + const startShowTypeProps = {
  537 + app,
  538 + record: masterData,
  539 + name: 'master',
  540 + form: props.form,
  541 + formId: sModelsId,
  542 + getSqlDropDownData: props.getSqlDropDownData,
  543 + getSqlCondition: props.getSqlCondition,
  544 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  545 + getFloatNum: props.getFloatNum,
  546 + getDateFormat: props.getDateFormat,
  547 + onChange: props.onChange,
  548 + showConfig: iStartIndex > -1 ? masterConfig.gdsconfigformslave[iStartIndex] : {},
  549 + formItemLayout: {},
  550 + enabled: true,
  551 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.tStartDate,
  552 + bTable: false,
  553 + onFilterDropDownData: props.onFilterDropDownData,
  554 + };
  555 +
  556 + const bSplitIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'bSplit');
  557 + const splitShowTypeProps = {
  558 + app,
  559 + record: masterData,
  560 + name: 'master',
  561 + form: props.form,
  562 + formId: sModelsId,
  563 + getSqlDropDownData: props.getSqlDropDownData,
  564 + getSqlCondition: props.getSqlCondition,
  565 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  566 + getFloatNum: props.getFloatNum,
  567 + getDateFormat: props.getDateFormat,
  568 + onChange: props.onChange,
  569 + showConfig: bSplitIndex > -1 ? masterConfig.gdsconfigformslave[bSplitIndex] : {},
  570 + formItemLayout: {},
  571 + enabled: true,
  572 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.bSplit,
  573 + bTable: false,
  574 + onFilterDropDownData: props.onFilterDropDownData,
  575 + };
  576 +
  577 + const iSplitNumIndex = commonUtils.isEmptyObject(masterConfig) ? -1 : masterConfig.gdsconfigformslave.findIndex(item => item.sName === 'iSplitNum');
  578 + const splitNumShowTypeProps = {
  579 + app,
  580 + record: masterData,
  581 + name: 'master',
  582 + form: props.form,
  583 + formId: sModelsId,
  584 + getSqlDropDownData: props.getSqlDropDownData,
  585 + getSqlCondition: props.getSqlCondition,
  586 + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord,
  587 + getFloatNum: props.getFloatNum,
  588 + getDateFormat: props.getDateFormat,
  589 + onChange: props.onChange,
  590 + showConfig: iSplitNumIndex > -1 ? masterConfig.gdsconfigformslave[iSplitNumIndex] : {},
  591 + formItemLayout: {},
  592 + enabled: true,
  593 + dataValue: commonUtils.isEmptyObject(masterData) ? '' : masterData.iSplitNum,
  594 + bTable: false,
  595 + onFilterDropDownData: props.onFilterDropDownData,
  596 + };
  597 +
  598 + let selectedRowKey = {};
  599 + if (commonUtils.isNotEmptyArr(teamSelectedRowKeys)) {
  600 + selectedRowKey = teamSelectedRowKeys[0];
  601 + }
  602 +
  603 + let teamDataNum = 0;
  604 + if (commonUtils.isNotEmptyArr(props.teamData)) {
  605 + // 取得导航按钮的行数
  606 + if (props.teamData.length % 8 === 0) {
  607 + teamDataNum = (props.teamData.length / 8) - 1;
  608 + } else {
  609 + teamDataNum = Math.floor(props.teamData.length / 8);
  610 + }
  611 + }
  612 + return (
  613 + <Form style={{ height: '100%' }}>
  614 + <Layout style={{ height: '100%' }} className="xly-productionPlan-list">
  615 + <Header className={styles.header} style={{ backgroundColor: 'rgb(100, 100, 100)' }}>
  616 + <Toolbar {...props} className="billBtnGroup" style={{ backgroundColor: '#646464', color: 'rgb(255,255,255)' }} />
  617 + </Header>
  618 + <Layout className={styles.clayout} style={{ height: '100%' }} >
  619 + <div className="productionCard">
  620 + <Spin spinning={Loading === undefined ? false : Loading}>
  621 + <Card bordered={false}>
  622 + <Row gutter={16}>
  623 + {
  624 + commonUtils.isNotEmptyArr(props.teamData) ? props.teamData.map((child) => {
  625 + const sType = commonUtils.isNotEmptyNumber(child.sType) ? child.sType.toString() : '';/* 0 - 全部单据 1-未排程 2- 已排程 */
  626 + const cardColor = sType === '0' ? 'allCard' : sType === '1' ? 'unCard' : 'defaultCard';
  627 + return (
  628 + <Col span={3} style={{ padding: '0px' }} className={selectedRowKey === child.sId ? 'cardSelectedColor' : commonUtils.isNotEmptyObject(child.cardSelectedColor) ? 'cardSelectedColor' : cardColor} >
  629 + <Card.Grid hoverable={false}style={gridStyle} onClick={props.onTabsCallback.bind(this, child)}>
  630 + <div className="card_left">
  631 + <div className="card_top">
  632 + <div className="card_left1" >{child.tStartDate}</div>
  633 + <div className="card_left2" style={{ color: '#ff0000' }} >{`${child.dHour}h`} </div>
  634 + </div>
  635 + <div className="card_mid">{child.sMachineName}</div>
  636 + </div>
  637 + </Card.Grid>
  638 + </Col>);
  639 + }) : ''
  640 + }
  641 + </Row>
  642 + </Card>
  643 + </Spin>
  644 + </div>
  645 + <div className={selfstyles.mainPlan}>
  646 + <Layout className={['processList', 'processListTable']}>
  647 + <Sider className="process">
  648 + <a title={setResetSearch} {...addProps} onClick={resetSearchEnabled ? e => props.onResetTableSearch() : null}>{ resetSearchEnabled ? resetSearch.img : resetSearch.disableimg}</a>&nbsp;
  649 + <a title={setTop} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 0) : null}>{ props.moveEnabled ? moveTop.img : moveTop.disableimg}</a>
  650 + <a title={setUp} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 1) : null}>{ props.moveEnabled ? moveUp.img : moveUp.disableimg }</a>
  651 + <a title={setDown} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 2) : null}>{props.moveEnabled ? moveDown.img : moveDown.disableimg }</a>
  652 + <a title={setBottom} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slave', 3) : null}>{props.moveEnabled ? moveBottom.img : moveBottom.disableimg }</a>&nbsp;&nbsp;
  653 + <a title={setMachine} {...addProps} onClick={props.moveEnabled ? e => props.orderData(e, 'slaveInfo', 0) : null}>{props.moveEnabled ? changeMachine.img : changeMachine.disableimg }</a>
  654 + </Sider>
  655 + <Content
  656 + className="xly-normal-list productPlan"
  657 + style={{ height: `calc( 100vh - 10px - ${teamDataNum * 45}px)` }}
  658 + >
  659 + <StaticEditTable {...tableProps} />
  660 + </Content>
  661 + </Layout>
  662 + </div>
  663 + </Layout>
  664 + {
  665 + props.isChangeMachine ?
  666 + <AntdDraggableModal
  667 + width={500}
  668 + title="换机台"
  669 + visible={props.isChangeMachine}
  670 + onCancel={props.onCloseChangeMachine}
  671 + onOk={props.onChangeMachine}
  672 + okButtonProps={commonUtils.isNotEmptyObject(masterData) && (commonUtils.isNotEmptyStr(masterData.sMachineId) || (masterData.bSplit && commonUtils.isNotEmptyStr(masterData.iSplitNum))) ? { disabled: false } : { disabled: true }}
  673 + >
  674 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...machineShowTypeProps} /> }
  675 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...teamShowTypeProps} /> }
  676 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...startShowTypeProps} /> }
  677 + { commonUtils.isEmptyObject(masterConfig) ? '' : <ShowType {...splitShowTypeProps} /> }
  678 + { commonUtils.isNotEmptyObject(masterConfig) && commonUtils.isNotEmptyObject(masterData) && masterData.bSplit ? <ShowType {...splitNumShowTypeProps} /> : '' }
  679 + </AntdDraggableModal>
  680 + : ''
  681 + }
  682 + </Layout>
  683 + </Form>
  684 + );
  685 +});
  686 +
  687 +export default CommonBase(CommonProductionPlanOutsideEvent(ProductionPlanOutside));
... ...
src/routes/manufacture/workOrderPackTableTreeNew/workOrderPackTableTreeNew.js 0 → 100644
  1 +
  2 +import { connect } from "umi";
  3 +import WorkOrderPackTableTreeNew from "../../../components/Manufacture/WorkOrderPackTableTreeNew";
  4 +
  5 +function WorkOrderPackTableTreeNewComponent({ dispatch, app, content }) {
  6 + function removePane(changePanes, currentPane) {
  7 + dispatch({ type: "app/removePane", payload: { changePanes, currentPane } });
  8 + }
  9 +
  10 + const commonProps = {
  11 + app,
  12 + content,
  13 + dispatch,
  14 + onRemovePane: removePane
  15 + };
  16 + return <WorkOrderPackTableTreeNew {...commonProps} />;
  17 +}
  18 +
  19 +export default connect(({ app, content }) => ({ app, content }))(
  20 + WorkOrderPackTableTreeNewComponent
  21 +);
... ...
src/routes/productionPlan/productionPlan.js 0 → 100644
  1 +import { connect } from 'umi';
  2 +import ProductionPlanComponent from '../../components/ProductionPlan/ProductionPlan';
  3 +
  4 +function ProductionPlan({ dispatch, app, content }) {
  5 + const ProductionPlanBillProps = {
  6 + app,
  7 + content,
  8 + dispatch,
  9 + };
  10 +
  11 + return (
  12 + <ProductionPlanComponent {...ProductionPlanBillProps} style={{ height: '100%' }} />
  13 + );
  14 +}
  15 +
  16 +export default connect(({ app, content }) =>
  17 + ({ app, content }))(ProductionPlan);
... ...
src/routes/productionPlan/productionPlanChangeMachineInfo.js 0 → 100644
  1 +import { connect } from 'umi';
  2 +import ProductionPlanChangeMachineInfo from '../../components/productionPlanInfo/productionPlanInfo';
  3 +
  4 +function ProductionPlanChangeMachine({ dispatch, app, content }) {
  5 + function removePane(changePanes, currentPane) {
  6 + dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
  7 + }
  8 +
  9 + const productionPlanChangeMachineProps = {
  10 + app,
  11 + content,
  12 + dispatch,
  13 + onRemovePane: removePane,
  14 + };
  15 +
  16 + return (
  17 + <ProductionPlanChangeMachineInfo {...productionPlanChangeMachineProps} className="test" />
  18 + );
  19 +}
  20 +
  21 +export default connect(({ app, content }) =>
  22 + ({ app, content }))(ProductionPlanChangeMachine);
... ...
src/routes/productionPlan/productionPlanInfo.js 0 → 100644
  1 +import { connect } from 'umi';
  2 +import ProductionPlanInfoComponentInfo from '../../components/productionPlanInfo/productionPlanInfo';
  3 +
  4 +function ProductionPlanInfo({ dispatch, app, content }) {
  5 + function removePane(changePanes, currentPane) {
  6 + dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
  7 + }
  8 +
  9 + const productionPlanProps = {
  10 + app,
  11 + content,
  12 + dispatch,
  13 + onRemovePane: removePane,
  14 + };
  15 +
  16 + return (
  17 + <ProductionPlanInfoComponentInfo {...productionPlanProps} className="test" />
  18 + );
  19 +}
  20 +
  21 +export default connect(({ app, content }) =>
  22 + ({ app, content }))(ProductionPlanInfo);
... ...
src/routes/productionPlan/productionPlanOutside.js 0 → 100644
  1 +import { connect } from 'umi';
  2 +import ProductionPlanOutsideComponentInfo from '../../components/productionPlanInfo/productionPlanOutside';
  3 +
  4 +function ProductionPlanInfo({ dispatch, app, content }) {
  5 + function removePane(changePanes, currentPane) {
  6 + dispatch({ type: 'app/removePane', payload: { changePanes, currentPane } });
  7 + }
  8 +
  9 + const productionPlanProps = {
  10 + app,
  11 + content,
  12 + dispatch,
  13 + onRemovePane: removePane,
  14 + };
  15 +
  16 + return (
  17 + <ProductionPlanOutsideComponentInfo {...productionPlanProps} className="test" />
  18 + );
  19 +}
  20 +
  21 +export default connect(({ app, content }) =>
  22 + ({ app, content }))(ProductionPlanInfo);
... ...
src/routes/tab/tab.js
... ... @@ -38,6 +38,8 @@ import ProcessCardInfo from &#39;@/routes/manufacture/processCard/processCardInfo&#39;;
38 38 import ProcessCardInfoPack from '@/routes/manufacture/processCardPack/processCardInfoPack';
39 39 import ProcessCardPackTableTree from '@/routes/manufacture/processCardPackTableTree/processCardPackTableTree';
40 40 import ProcessCardPackTableTreeNew from '@/routes/manufacture/processCardPackTableTreeNew/processCardPackTableTreeNew';
  41 +import WorkOrderPackTableTreeNew from '@/routes/manufacture/workOrderPackTableTreeNew/workOrderPackTableTreeNew';
  42 +import ProductionPlan from '@/routes/productionPlan/productionPlan';/* 生产排程 */
41 43 import styles from '@/index.less';
42 44 import { sendWebSocketMessage } from '@/components/Common/commonFunc';
43 45 import { isNotEmptyObject, isNotEmptyArr } from '@/utils/utils'; /* 通用方法 */
... ... @@ -88,7 +90,9 @@ function Tab({ dispatch, app }) {
88 90 '/indexPage/processCard' : <ProcessCardInfo />,
89 91 '/indexPage/processCardPack' : <ProcessCardInfoPack />,
90 92 '/indexPage/processCardPackTableTree' : <ProcessCardPackTableTree />,
91   - '/indexPage/processCardPackTableTreeNew' : <ProcessCardPackTableTreeNew />
  93 + '/indexPage/processCardPackTableTreeNew' : <ProcessCardPackTableTreeNew />,
  94 + '/indexPage/workOrderPackTableTreeNew' : <WorkOrderPackTableTreeNew />,
  95 + '/indexPage/productionPlan' : <ProductionPlan />
92 96 }
93 97 const content = routeList[pane.route] || <IndexCenter />;
94 98  
... ...