Commit 79ee33de653db7cf93d2cd14cfbd0322631dc102
1 parent
499f04f9
1.产前提醒按照设定完成功能
Showing
2 changed files
with
76 additions
and
184 deletions
src/mes/scheduledTasks/prenatalReminderInfo1/index.js
| 1 | 1 | import React, { useEffect } from "react"; |
| 2 | 2 | import * as commonUtils from "@/utils/utils"; |
| 3 | 3 | import useCommonBase from "@/components/Common/CommonHooks/useCommonBase"; |
| 4 | - | |
| 5 | 4 | import ShowType from "@/components/Common/CommonComponent"; |
| 6 | - | |
| 7 | 5 | import styles from "./index.less"; |
| 8 | 6 | |
| 9 | -const usePrenatalReminderInfoEvent = props => { | |
| 10 | - const { formData } = props; | |
| 7 | +const usePrenatalReminderInfoEvent = function(props) { | |
| 8 | + const formData = props.formData; | |
| 11 | 9 | |
| 12 | 10 | useEffect( |
| 13 | - async () => { | |
| 11 | + async function() { | |
| 14 | 12 | if (commonUtils.isNotEmptyArr(formData)) { |
| 15 | 13 | const result = await handleGetData(formData[0]); |
| 16 | 14 | const result1 = await handleGetData(formData[1], 1); |
| ... | ... | @@ -29,20 +27,18 @@ const usePrenatalReminderInfoEvent = props => { |
| 29 | 27 | [formData] |
| 30 | 28 | ); |
| 31 | 29 | |
| 32 | - // 获取数据集 | |
| 33 | - const handleGetData = async (config, index = "") => { | |
| 34 | - const { app } = props; | |
| 35 | - const { userinfo = {} } = app; | |
| 36 | - const globalData = commonUtils.convertStrToObj( | |
| 37 | - localStorage.xlybusinessglobalData | |
| 38 | - ); | |
| 39 | - const { sWorkshopId } = userinfo; | |
| 40 | - const { currentSelectedMachineTaskDataRow = {} } = globalData; | |
| 41 | - const { sOrderId } = currentSelectedMachineTaskDataRow; | |
| 30 | + const handleGetData = async function(config, index) { | |
| 31 | + if (index === undefined) index = ""; | |
| 32 | + const app = props.app; | |
| 33 | + const userinfo = app.userinfo || {}; | |
| 34 | + const globalData = commonUtils.convertStrToObj(localStorage.xlybusinessglobalData); | |
| 35 | + const sWorkshopId = userinfo.sWorkshopId; | |
| 36 | + const currentSelectedMachineTaskDataRow = globalData.currentSelectedMachineTaskDataRow || {}; | |
| 37 | + const sOrderId = currentSelectedMachineTaskDataRow.sOrderId; | |
| 42 | 38 | const conditonValues = props.onGetSqlConditionValues(config); |
| 43 | 39 | const addState = |
| 44 | 40 | (await props.onGetDataSet({ |
| 45 | - name: `slave${index}`, | |
| 41 | + name: "slave" + index, | |
| 46 | 42 | configData: config, |
| 47 | 43 | condition: { |
| 48 | 44 | sSqlCondition: { |
| ... | ... | @@ -56,17 +52,19 @@ const usePrenatalReminderInfoEvent = props => { |
| 56 | 52 | return addState; |
| 57 | 53 | }; |
| 58 | 54 | |
| 59 | - return { | |
| 60 | - ...props | |
| 61 | - }; | |
| 55 | + return { ...props }; | |
| 62 | 56 | }; |
| 63 | 57 | |
| 64 | -const PrenatalReminderInfo = baseProps => { | |
| 58 | +const PrenatalReminderInfo = function(baseProps) { | |
| 65 | 59 | const props = usePrenatalReminderInfoEvent(useCommonBase(baseProps)); |
| 66 | - const { bFinish } = props; | |
| 60 | + const bFinish = props.bFinish; | |
| 67 | 61 | if (!bFinish) return ""; |
| 68 | 62 | |
| 69 | - const { app, slaveData, slave1Data, slave2Data, slaveConfig, slave1Config, slave2Config } = props; | |
| 63 | + const app = props.app; | |
| 64 | + const slaveData = props.slaveData; | |
| 65 | + const slave1Data = props.slave1Data; | |
| 66 | + const slave2Data = props.slave2Data; | |
| 67 | + const slaveConfig = props.slaveConfig; | |
| 70 | 68 | |
| 71 | 69 | const viewRow1 = commonUtils.isNotEmptyArr(slaveData) ? slaveData[0] : {}; |
| 72 | 70 | const viewRow2 = commonUtils.isNotEmptyArr(slave1Data) ? slave1Data[0] : {}; |
| ... | ... | @@ -74,159 +72,60 @@ const PrenatalReminderInfo = baseProps => { |
| 74 | 72 | const viewRow = { ...viewRow1, ...viewRow2, ...viewRow3 }; |
| 75 | 73 | const tableName = "slave"; |
| 76 | 74 | |
| 77 | - const memoListFilter = | |
| 78 | - slaveConfig?.gdsconfigformslave | |
| 79 | - .filter(item => item.sControlName?.includes("_")); | |
| 80 | - console.log('memoListFilter', memoListFilter, slave2Config?.gdsconfigformslave, slaveConfig, slave1Config, slave2Config); | |
| 81 | - | |
| 82 | - const leftSize = Math.ceil(memoListFilter.length / 2); | |
| 83 | - const rightSize = memoListFilter.length - leftSize; | |
| 84 | - const leftMemoList = memoListFilter.slice(0, leftSize); | |
| 85 | - const rightMemoList = memoListFilter.slice(leftSize, memoListFilter.length); | |
| 86 | - | |
| 87 | - return ( | |
| 88 | - <div className={styles.prenatalReminderInfo}> | |
| 89 | - {[ | |
| 90 | - "技术评审汇签", | |
| 91 | - "客户投诉", | |
| 92 | - "本批生产注意事项", | |
| 93 | - "不合格报告", | |
| 94 | - "车间产前提醒" | |
| 95 | - ].map((title, index) => { | |
| 96 | - let dataValueNew = ""; | |
| 97 | - const child = { | |
| 98 | - sId: commonUtils.createSid(), | |
| 99 | - sName: `sTempMemo${index}`, | |
| 100 | - sControlName: "", | |
| 101 | - bVisible: true, | |
| 102 | - showName: title | |
| 103 | - }; | |
| 104 | - | |
| 105 | - const memoList = new Array(20) | |
| 106 | - .fill("") | |
| 107 | - .map((_, i) => viewRow[`sNoteMemo${i + 1}`]); | |
| 108 | - | |
| 109 | - const getMemoValue = (from, to) => { | |
| 110 | - const tempList = memoList | |
| 111 | - .slice(from, to) | |
| 112 | - .filter(item => item !== undefined) | |
| 113 | - .map((item, i) => `${i + 1}) ${item}`); | |
| 114 | - return tempList.join("\n"); | |
| 115 | - }; | |
| 116 | - | |
| 117 | - if (title === "客户投诉") { | |
| 118 | - dataValueNew = getMemoValue(0, 4); | |
| 119 | - } else if (title === "不合格报告") { | |
| 120 | - dataValueNew = getMemoValue(4, 8); | |
| 121 | - } else if (title === "车间产前提醒") { | |
| 122 | - dataValueNew = viewRow.sMemo; | |
| 123 | - } else if (title === "本批生产注意事项") { | |
| 124 | - dataValueNew = getMemoValue(16, 20); | |
| 125 | - } else if (title === "技术评审汇签") { | |
| 126 | - const dataValue1 = leftMemoList | |
| 127 | - .map( | |
| 128 | - ({ sName, showName }) => `${showName}:${viewRow[sName] || ""}` | |
| 129 | - ) | |
| 130 | - .join("\n"); | |
| 131 | - | |
| 132 | - const dataValue2 = rightMemoList | |
| 133 | - .map( | |
| 134 | - ({ sName, showName }) => `${showName}:${viewRow[sName] || ""}` | |
| 135 | - ) | |
| 136 | - .join("\n"); | |
| 137 | - const showTypeProps1 = { | |
| 138 | - app, | |
| 139 | - className: styles.showType, | |
| 140 | - iColValue: 24, | |
| 141 | - name: tableName, | |
| 142 | - record: viewRow, | |
| 143 | - sId: commonUtils.createSid(), | |
| 144 | - getSqlDropDownData: props.getSqlDropDownData, | |
| 145 | - getSqlCondition: props.getSqlCondition, | |
| 146 | - handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord, | |
| 147 | - getFloatNum: props.getFloatNum, | |
| 148 | - onChange: props.onDataChange, | |
| 149 | - showConfig: { ...child, costomStyle: styles.hideRightBorder }, | |
| 150 | - slaveConfig: props[`${tableName}Config`], | |
| 151 | - formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } }, | |
| 152 | - textArea: true, | |
| 153 | - enabled: false, | |
| 154 | - dataValue: dataValue1, | |
| 155 | - bTable: true, | |
| 156 | - bViewTable: true, | |
| 157 | - formRoute: props.formRoute, | |
| 158 | - getDateFormat: props.getDateFormat | |
| 159 | - }; | |
| 160 | - | |
| 161 | - const showTypeProps2 = { | |
| 162 | - app, | |
| 163 | - className: styles.showType, | |
| 164 | - iColValue: 24, | |
| 165 | - name: tableName, | |
| 166 | - record: viewRow, | |
| 167 | - sId: commonUtils.createSid(), | |
| 168 | - getSqlDropDownData: props.getSqlDropDownData, | |
| 169 | - getSqlCondition: props.getSqlCondition, | |
| 170 | - handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord, | |
| 171 | - getFloatNum: props.getFloatNum, | |
| 172 | - onChange: props.onDataChange, | |
| 173 | - showConfig: { ...child, costomStyle: styles.hideLeftBorder }, | |
| 174 | - slaveConfig: props[`${tableName}Config`], | |
| 175 | - formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } }, | |
| 176 | - textArea: true, | |
| 177 | - enabled: false, | |
| 178 | - dataValue: dataValue2, | |
| 179 | - bTable: true, | |
| 180 | - bViewTable: true, | |
| 181 | - formRoute: props.formRoute, | |
| 182 | - getDateFormat: props.getDateFormat | |
| 183 | - }; | |
| 184 | - | |
| 185 | - return ( | |
| 186 | - <div> | |
| 187 | - <div className={styles.title}>{title}</div> | |
| 188 | - <div className={styles.content1}> | |
| 189 | - <ShowType {...showTypeProps1} /> | |
| 190 | - <ShowType {...showTypeProps2} /> | |
| 191 | - </div> | |
| 192 | - </div> | |
| 193 | - ); | |
| 194 | - } | |
| 195 | - const showTypeProps = { | |
| 196 | - app, | |
| 197 | - className: styles.showType, | |
| 198 | - iColValue: 24, | |
| 199 | - name: tableName, | |
| 200 | - record: viewRow, | |
| 201 | - sId: commonUtils.createSid(), | |
| 202 | - getSqlDropDownData: props.getSqlDropDownData, | |
| 203 | - getSqlCondition: props.getSqlCondition, | |
| 204 | - handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord, | |
| 205 | - getFloatNum: props.getFloatNum, | |
| 206 | - onChange: props.onDataChange, | |
| 207 | - showConfig: child, | |
| 208 | - slaveConfig: props[`${tableName}Config`], | |
| 209 | - formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } }, | |
| 210 | - textArea: true, | |
| 211 | - enabled: false, | |
| 212 | - dataValue: dataValueNew, | |
| 213 | - bTable: true, | |
| 214 | - bViewTable: true, | |
| 215 | - formRoute: props.formRoute, | |
| 216 | - getDateFormat: props.getDateFormat | |
| 217 | - }; | |
| 75 | + const gdsconfigformslave = slaveConfig ? (slaveConfig.gdsconfigformslave || []) : []; | |
| 76 | + const memoListFilter = gdsconfigformslave.filter(function(item) { | |
| 77 | + return item && item.sControlName && item.sControlName.includes("_") && item.bVisible; | |
| 78 | + }); | |
| 79 | + | |
| 80 | + const renderItems = []; | |
| 81 | + | |
| 82 | + memoListFilter.forEach(function(item, index) { | |
| 83 | + const title = item.showName; | |
| 84 | + console.log('nihaoaoaoao ', title, item); | |
| 85 | + const dataValueNew = viewRow[item.sName] || ""; | |
| 86 | + const child = { | |
| 87 | + sId: commonUtils.createSid(), | |
| 88 | + sName: item.sName, | |
| 89 | + sControlName: item.sControlName, | |
| 90 | + bVisible: true, | |
| 91 | + showName: title | |
| 92 | + }; | |
| 93 | + const showTypeProps = { | |
| 94 | + app: app, | |
| 95 | + className: styles.showType, | |
| 96 | + iColValue: item.iColValue || 24, | |
| 97 | + name: tableName, | |
| 98 | + record: viewRow, | |
| 99 | + sId: commonUtils.createSid(), | |
| 100 | + getSqlDropDownData: props.getSqlDropDownData, | |
| 101 | + getSqlCondition: props.getSqlCondition, | |
| 102 | + handleSqlDropDownNewRecord: props.handleSqlDropDownNewRecord, | |
| 103 | + getFloatNum: props.getFloatNum, | |
| 104 | + onChange: props.onDataChange, | |
| 105 | + showConfig: child, | |
| 106 | + slaveConfig: props[tableName + "Config"], | |
| 107 | + formItemLayout: { labelCol: { span: 0 }, wrapperCol: { span: 24 } }, | |
| 108 | + textArea: true, | |
| 109 | + enabled: false, | |
| 110 | + dataValue: dataValueNew, | |
| 111 | + bTable: true, | |
| 112 | + bViewTable: true, | |
| 113 | + formRoute: props.formRoute, | |
| 114 | + getDateFormat: props.getDateFormat | |
| 115 | + }; | |
| 116 | + | |
| 117 | + const key = item.iIncrement !== undefined ? item.iIncrement : index; | |
| 118 | + renderItems.push( | |
| 119 | + React.createElement("div", { key: key }, | |
| 120 | + React.createElement("div", { className: styles.title }, title), | |
| 121 | + React.createElement("div", { className: styles.content }, | |
| 122 | + React.createElement(ShowType, showTypeProps) | |
| 123 | + ) | |
| 124 | + ) | |
| 125 | + ); | |
| 126 | + }); | |
| 218 | 127 | |
| 219 | - return ( | |
| 220 | - <div> | |
| 221 | - <div className={styles.title}>{title}</div> | |
| 222 | - <div className={styles.content}> | |
| 223 | - <ShowType {...showTypeProps} /> | |
| 224 | - </div> | |
| 225 | - </div> | |
| 226 | - ); | |
| 227 | - })} | |
| 228 | - </div> | |
| 229 | - ); | |
| 128 | + return React.createElement("div", { className: styles.prenatalReminderInfo }, renderItems); | |
| 230 | 129 | }; |
| 231 | 130 | |
| 232 | 131 | export default PrenatalReminderInfo; | ... | ... |
src/mes/scheduledTasks/prenatalReminderInfo1/index.less
| ... | ... | @@ -2,13 +2,10 @@ |
| 2 | 2 | |
| 3 | 3 | .prenatalReminderInfo { |
| 4 | 4 | .size(); |
| 5 | - // border: 1px solid red; | |
| 6 | 5 | display: grid; |
| 7 | - /* 创建两列,每列宽度自动分配 */ | |
| 8 | - grid-template-columns: repeat(2, 1fr); | |
| 9 | - /* 创建三行,每行最小高度为100px,自动扩展 */ | |
| 10 | - grid-template-rows: repeat(3, minmax(100px, auto)); | |
| 11 | - /* 设置行列间距均为10px */ | |
| 6 | + /* 创建单列布局,每行占满整行 */ | |
| 7 | + grid-template-columns: 1fr; | |
| 8 | + /* 设置行间距为10px */ | |
| 12 | 9 | gap: 10px; |
| 13 | 10 | |
| 14 | 11 | |
| ... | ... | @@ -62,10 +59,6 @@ |
| 62 | 59 | } |
| 63 | 60 | } |
| 64 | 61 | |
| 65 | - >div:first-child { | |
| 66 | - grid-column: span 2; | |
| 67 | - } | |
| 68 | - | |
| 69 | 62 | >div:nth-child(1) .title { |
| 70 | 63 | background: url(./assets/1.png) no-repeat; |
| 71 | 64 | background-position-x: -10px; | ... | ... |