Commit 1343e97aae92b83dfee67fd2bf38c608d52f682f

Authored by chenxt
1 parent 9b2947cf

补版颜色选择

src/components/Common/CommonComponent/index.js
... ... @@ -744,7 +744,7 @@ export default class CommonComponent extends Component {
744 744 };
745 745 getSelectTableOption = () => {
746 746 const { selectTableData } = this.state;
747   - const { showConfig , app} = this.props;
  747 + const { showConfig, app } = this.props;
748 748 const { userinfo } = app;
749 749 let { sTableTitleSql } = showConfig;
750 750 /* 根据用户配置语言 设置表格标题 */
... ... @@ -1235,7 +1235,7 @@ export default class CommonComponent extends Component {
1235 1235 }
1236 1236 }
1237 1237 /* 返回值 */
1238   -
  1238 +
1239 1239 return options;
1240 1240 };
1241 1241  
... ... @@ -1953,7 +1953,7 @@ export default class CommonComponent extends Component {
1953 1953 const sFontColor = this.props.showConfig.sFontColor;
1954 1954 obj.labelCol.style = { color: sFontColor, fontWeight: 'bold', backgroundColor: '#BFEFFF' };
1955 1955 }
1956   -
  1956 +
1957 1957 /* 返回值 */
1958 1958 return obj;
1959 1959 };
... ... @@ -2669,6 +2669,10 @@ export default class CommonComponent extends Component {
2669 2669 this.props.onPreviewImage(e, dataUrl);
2670 2670 }
2671 2671 handleViewChoose = () => {
  2672 + if (this.props?.formId === '172117190122117645759356840' && this.props?.showConfig?.sName.includes('Color')) {
  2673 + this.props.onViewChoose(this.props.name, this.props.showConfig.sName, this.props.record, null, true);
  2674 + return
  2675 + }
2672 2676 this.props.onViewChoose(this.props.name, this.props.showConfig.sName, this.props.record);
2673 2677 }
2674 2678 handleMemoShow = () => {
... ... @@ -3053,10 +3057,10 @@ export default class CommonComponent extends Component {
3053 3057 /* 页面输出 */
3054 3058 const className = iColValue === 24 ? 'input24' : iColValue === 18 ? 'input18' : iColValue === 12 ? 'input12' : 'changeClassName';
3055 3059 const mesInputBlue = enabled && !this.props.bNoMesBlue && this.firstDataIndex !== 'b';
3056   - const {bManual = false} = this.props?.app?.userinfo || {}
  3060 + const { bManual = false } = this.props?.app?.userinfo || {}
3057 3061 return (
3058 3062 <div ref={this.myRef} className={`${className} ${mesInputBlue ? "mesInputBlue" : ""}`} style={componentStyle}>
3059   - {mesInputBlue ? <div className={`mesInputBlueBg ${bManual ? 'manualOverride' : ''}`} /> : ''}
  3063 + {mesInputBlue ? <div className={`mesInputBlueBg ${bManual ? 'manualOverride' : ''}`} /> : ''}
3060 3064 <div className={`${this.props.className} ${readonlyStyle} ${costomStyle}`}>
3061 3065 {oPreDot}
3062 3066 {commonAssembly}
... ...
src/components/Common/CommonTable/index.js
... ... @@ -211,7 +211,9 @@ class CommonTableRc extends React.Component {
211 211 commonFileDownloadList: [], // 多文件列表
212 212 pdfFileVisible: false, // pdf文件弹窗
213 213 pdfFileUrl: "",
214   - currentHoverSid: ""
  214 + currentHoverSid: "",
  215 + positiveColorModel: false, // 颜色预览弹窗
  216 + tableRecord: null, // 当前行数据
215 217 };
216 218 this.rowKey = commonUtils.isNotEmptyObject(props.tableProps) && !commonUtils.isEmpty(props.tableProps.rowKey) ? props.tableProps.rowKey : 'sId'; /* 表格主键 */
217 219 this.config = {}; /* 配置信息(基础)(数据格式:对象) */
... ... @@ -7363,8 +7365,8 @@ class CommonTableRc extends React.Component {
7363 7365 this.setState({ sCurrMemoProps });
7364 7366 }
7365 7367 };
7366   - handleViewChoose = (name, sName, record, index) => {
7367   - this.props.onViewChoose(name, sName, record, index);
  7368 + handleViewChoose = (name, sName, record, index, isColor) => {
  7369 + this.props.onViewChoose(name, sName, record, index, isColor);
7368 7370 };
7369 7371 /* 弹出通用窗体 */
7370 7372 handlePopupModal = (showConfig, name) => {
... ... @@ -10720,6 +10722,7 @@ class CommonTableRc extends React.Component {
10720 10722 this.props.onMoveRow(dragIndex, hoverIndex, dragKey, hoverKey);
10721 10723 }
10722 10724 };
  10725 +
10723 10726 /** 渲染 */
10724 10727 render() {
10725 10728 /* 获取upload的props */
... ...
src/default.less
... ... @@ -348,11 +348,12 @@
348 348  
349 349 .viewChooseSpan {
350 350 display: block;
351   - top: 14px;
  351 + // top: 14px;
352 352 white-space: nowrap;
353 353 word-break: break-all;
354 354 text-overflow: ellipsis;
355 355 overflow: hidden;
  356 + font-size: 16px !important;
356 357 }
357 358 }
358 359  
... ... @@ -409,6 +410,7 @@
409 410  
410 411 .sActiveIdStyle {
411 412 background: #ffcc4e !important;
  413 + font-size: 16px;
412 414 }
413 415  
414 416 .ant-select-selector {
... ...
src/mes/common/commonModelComponent/index.js
... ... @@ -2,7 +2,7 @@
2 2 import React, { useEffect, useRef, useState } from "react";
3 3 import moment from "moment";
4 4 import { cloneDeep } from "lodash";
5   -import { Tabs, Modal, Space, Button, DatePicker, Radio, message, Avatar } from "antd";
  5 +import { Tabs, Modal, Space, Button, DatePicker, Radio, message, Avatar, Row, Col, Table } from "antd";
6 6 import * as commonUtils from "@/utils/utils";
7 7 import * as commonConfig from "@/utils/config";
8 8 import * as commonServices from "@/services/services";
... ... @@ -1650,7 +1650,7 @@ const CommonModelComponent = props =&gt; {
1650 1650 tableBtnsConfig,
1651 1651 children = []
1652 1652 } = config;
1653   -
  1653 +
1654 1654 if (showType === "none") {
1655 1655 if (!children.length) return "";
1656 1656 const footerComponent = useFooterComponent({ ...props, sTabName });
... ... @@ -1864,7 +1864,7 @@ const CommonModelComponent = props =&gt; {
1864 1864 <>
1865 1865 {/* 第一个单独一行 */}
1866 1866 {first && (
1867   - <div style={{ width: '100%', marginBottom: '8px', minHeight:' 20%', }}>
  1867 + <div style={{ width: '100%', marginBottom: '8px', minHeight: ' 20%', }}>
1868 1868 {renderConfig(first, 0)}
1869 1869 </div>
1870 1870 )}
... ... @@ -1877,7 +1877,7 @@ const CommonModelComponent = props =&gt; {
1877 1877 gap: '8px',
1878 1878 marginBottom: '8px',
1879 1879 width: '100%',
1880   - minHeight:' 79%',
  1880 + minHeight: ' 79%',
1881 1881 }}
1882 1882 >
1883 1883 {secondAndThird.map((config, idx) => {
... ... @@ -2105,7 +2105,7 @@ const CommonViewTableComponent = props =&gt; {
2105 2105 viewProps.enabledNew = false;
2106 2106 }
2107 2107 console.log(viewProps, 'viewProps');
2108   -
  2108 +
2109 2109 return (
2110 2110 <>
2111 2111 <TabTitleComponent {...props} sTabName={groupList[index]} />
... ... @@ -2325,9 +2325,39 @@ const CommonTableComponent = props =&gt; {
2325 2325 config
2326 2326 });
2327 2327 }
  2328 + },
  2329 + onViewChoose: (tableName, sFieldName, record, index, isColor) => {
  2330 + handleViewChoose(tableName, sFieldName, record, index, isColor);
  2331 +
2328 2332 }
2329 2333 };
  2334 + const handleViewChoose = (tableName, sFieldName, record, index, isColor) => {
  2335 + if (isColor) {
  2336 + const { sId } = record; /* 控制表主键 */
  2337 + const { enabled, processSelectedRowKeys } = props;
  2338 + const NoProcessParameters = commonFunc.showLocalMessage(props, 'NoProcessParameters', '无工艺参数!');
  2339 + const sisColorSelectedRowKeys = [];
  2340 + let jsonData = [];
  2341 + const { [`${tableName}Data`]: tableData } = props;
  2342 + const iIndex = tableData?.findIndex(item => item.sId === sId);
  2343 + if (iIndex > -1) {
  2344 + const sPositiveColor = tableData[iIndex][sFieldName];
  2345 + const sPositiveColorList = (sPositiveColor && sPositiveColor !== 'undefined' && sPositiveColor !== 'null')
  2346 + ? JSON.parse(sPositiveColor)
  2347 + : [];
  2348 + props.onSaveState({
  2349 + sisColorChooseVisible: true,
  2350 + controlSelectedRowId: sId, /* 控制表选中行sId */
  2351 + processSelectedRowId: '', /* 工序表选中行sId */
  2352 + sisColorSelectedRowKeys,
  2353 + sisColorSelectedData: sPositiveColorList,
  2354 + sisColorField: sFieldName,
  2355 + sisTableName: tableName,
  2356 + });
2330 2357  
  2358 + }
  2359 + }
  2360 + }
2331 2361 const stepName = sTabName?.split("_")[1] || "";
2332 2362 if (stepName.startsWith("第") && stepName.endsWith("转")) {
2333 2363 tableProps.data = tableProps.data.filter(item => item.sRev === stepName);
... ... @@ -2357,6 +2387,8 @@ const CommonTableComponent = props =&gt; {
2357 2387 }
2358 2388 }
2359 2389 }, [props.masterData])
  2390 + console.log('tableProps', tableProps);
  2391 +
2360 2392 return (
2361 2393 <>
2362 2394 <TabTitleComponent {...props} sTabName={sTabName} />
... ... @@ -2374,6 +2406,7 @@ const CommonTableComponent = props =&gt; {
2374 2406 itemClickRef={itemClickRef}
2375 2407 onTableBtnClick={handleTableBtnClick}
2376 2408 />
  2409 + <SisColorChooseComponent {...props} />
2377 2410 </>
2378 2411 );
2379 2412 };
... ... @@ -3106,4 +3139,206 @@ const TaskConfirmModal = props =&gt; {
3106 3139 );
3107 3140 };
3108 3141  
  3142 +const SisColorChooseComponent = props => {
  3143 + const { sisColorChooseVisible, sisColorField, sisTableName, controlSelectedRowId } = props;
  3144 +
  3145 + const [rightData, setRightData] = useState([]);
  3146 +
  3147 + if (!sisColorChooseVisible) return "";
  3148 +
  3149 + const handleClose = () => {
  3150 +
  3151 + props.onSaveState({
  3152 + sisColorChooseVisible: false,
  3153 + sisColorSelectedData: []
  3154 + });
  3155 +
  3156 + setRightData([]);
  3157 + };
  3158 +
  3159 + const handelSubmit = () => {
  3160 + const { [`${sisTableName}Data`]: tableData } = props;
  3161 + const iIndex = tableData?.findIndex(item => item.sId === controlSelectedRowId);
  3162 + // iPositiveColor sPositiveColor sOppositeColor
  3163 + const colorList = JSON.parse(tableData[iIndex][sisColorField]).map(item => {
  3164 + const i = rightData.findIndex(rightItem => rightItem.sId === item.sId);
  3165 + let newItem = {
  3166 + ...item
  3167 + }
  3168 + if (i > -1) {
  3169 + newItem = {
  3170 + ...newItem,
  3171 + bSelected: true
  3172 + }
  3173 + }
  3174 + return newItem
  3175 + });
  3176 + const totalDColor = rightData.reduce((total, item) => total + item.dColor, 0);
  3177 + tableData[iIndex] = {
  3178 + ...tableData[iIndex],
  3179 + [sisColorField]: JSON.stringify(colorList),
  3180 + iOutsideQty: totalDColor
  3181 + }
  3182 + console.log("🚀 ~ handelSubmit ~ tableData[iIndex]:", totalDColor);
  3183 +
  3184 + props.onSaveState({
  3185 + [`${sisTableName}Data`]: [...tableData],
  3186 + sisColorChooseVisible: false,
  3187 + sisColorSelectedData: []
  3188 + });
  3189 +
  3190 + }
  3191 +
  3192 + const handleLeftSelectChange = (selectedRowKeys, selectedRows) => {
  3193 + setRightData(selectedRows);
  3194 + };
  3195 +
  3196 + const handleDeleteRight = (record) => {
  3197 + const newData = rightData.filter(item => item.sId !== record.sId);
  3198 + setRightData(newData);
  3199 + };
  3200 +
  3201 + const leftRowSelection = {
  3202 + type: 'checkbox',
  3203 + selectedRowKeys: rightData.map(item => item.sId),
  3204 + onChange: handleLeftSelectChange,
  3205 + };
  3206 +
  3207 +
  3208 + const rowCellStyleLeft = {
  3209 + fontSize: '16px',
  3210 + };
  3211 +
  3212 + const rowCellStyleRight = {
  3213 + fontSize: '16px',
  3214 + };
  3215 +
  3216 + const headerCellStyle = {
  3217 + fontSize: '20px',
  3218 + fontWeight: 'bold',
  3219 + };
  3220 +
  3221 + const CustomCellLeft = (cellProps) => (
  3222 + <td {...cellProps} style={{ ...cellProps.style, ...rowCellStyleLeft }} />
  3223 + );
  3224 +
  3225 + const CustomCellRight = (cellProps) => (
  3226 + <td {...cellProps} style={{ ...cellProps.style, ...rowCellStyleRight }} />
  3227 + );
  3228 +
  3229 + const baseColumns = [
  3230 + {
  3231 + title: '序号',
  3232 + dataIndex: 'index',
  3233 + key: 'index',
  3234 + width: 60,
  3235 + align: 'center',
  3236 + render: (_, record, index) => index + 1,
  3237 + customHeaderCell: () => ({ style: headerCellStyle }),
  3238 + },
  3239 + {
  3240 + title: '名称',
  3241 + dataIndex: 'sName',
  3242 + customHeaderCell: () => ({ style: headerCellStyle }),
  3243 + },
  3244 + {
  3245 + title: '板数',
  3246 + dataIndex: 'dColor',
  3247 + customHeaderCell: () => ({ style: headerCellStyle }),
  3248 + },
  3249 + ];
  3250 +
  3251 + const rightColumns = [
  3252 + ...baseColumns.map(col => ({ ...col })),
  3253 + {
  3254 + title: '操作',
  3255 + key: 'action',
  3256 + width: 80,
  3257 + align: 'center',
  3258 + customHeaderCell: () => ({ style: headerCellStyle }),
  3259 + render: (_, record) => (
  3260 + <a
  3261 + onClick={(e) => { e.stopPropagation(); handleDeleteRight(record); }}
  3262 + style={{ color: '#ff4d4f', cursor: 'pointer' }}
  3263 + >
  3264 + 删除
  3265 + </a>
  3266 + ),
  3267 + },
  3268 + ];
  3269 +
  3270 + // --- 组件映射 ---
  3271 +
  3272 + const tableComponentsLeft = {
  3273 + body: {
  3274 + cell: CustomCellLeft,
  3275 + },
  3276 + };
  3277 +
  3278 + const tableComponentsRight = {
  3279 + body: {
  3280 + cell: CustomCellRight,
  3281 + },
  3282 + };
  3283 +
  3284 + return (
  3285 + <Modal
  3286 + title='颜色选择'
  3287 + open={sisColorChooseVisible}
  3288 + width={1000}
  3289 + height={400}
  3290 +
  3291 + footer={
  3292 + <Space>
  3293 + <Button
  3294 + size="large"
  3295 + type="primary"
  3296 + onClick={handelSubmit}
  3297 + >
  3298 + 确认
  3299 + </Button>
  3300 + <Button
  3301 + size="large"
  3302 + type="primary"
  3303 + onClick={handleClose}
  3304 + >
  3305 + 取消
  3306 + </Button>
  3307 + </Space>
  3308 + }
  3309 + onCancel={handleClose}
  3310 + >
  3311 + <Row gutter={[8, 0]}>
  3312 + {/* 左侧表格 */}
  3313 + <Col span={8} className="commonColorModal">
  3314 + <Table
  3315 + rowSelection={leftRowSelection}
  3316 + rowKey="sId"
  3317 + columns={baseColumns}
  3318 + dataSource={props.sisColorSelectedData || []}
  3319 + pagination={false}
  3320 + scroll={{ y: 350 }}
  3321 + components={tableComponentsLeft}
  3322 + />
  3323 + </Col>
  3324 +
  3325 + {/* 右侧表格 */}
  3326 + <Col span={16} className="commonColorModal">
  3327 + <Table
  3328 + rowSelection={null}
  3329 + rowKey="sId"
  3330 + columns={rightColumns}
  3331 + dataSource={rightData}
  3332 + pagination={false}
  3333 + scroll={{ y: 350 }}
  3334 + components={tableComponentsRight}
  3335 + />
  3336 + </Col>
  3337 + </Row>
  3338 + </Modal>
  3339 + );
  3340 +};
  3341 +
  3342 +
  3343 +
3109 3344 export default CommonModel;
... ...
src/mes/common/commonModelComponent/index.less
... ... @@ -43,6 +43,22 @@
43 43 }
44 44 }
45 45 }
  46 +/* 全局 CSS */
  47 +.custom-table-header-large {
  48 + font-size: 20px !important;
  49 + font-weight: bold !important;
  50 +}
  51 +
  52 +
  53 + :global {
  54 + .commonColorModal {
  55 + :global {
  56 + .ant-table-thead > tr > th {
  57 + font-size: 14px !important;
  58 + }
  59 + }
  60 + }
  61 + }
46 62  
47 63 .commonRepairModal {
48 64 .size();
... ...