diff --git a/src/assets/css/base.scss b/src/assets/css/base.scss index a1cd5b1..6d85083 100644 --- a/src/assets/css/base.scss +++ b/src/assets/css/base.scss @@ -743,7 +743,7 @@ color:var(--color-text) !important; background: #3e4557 !important; } -.searchWrap , .ant-modal-body ,.paid-search{ +.searchWrap , .ant-modal-body ,.paid-search, .edit-container{ .ant-input-affix-wrapper{ background-color: #50586c; } diff --git a/src/components/TableModule/index.jsx b/src/components/TableModule/index.jsx index 7bf076f..9e34642 100644 --- a/src/components/TableModule/index.jsx +++ b/src/components/TableModule/index.jsx @@ -125,12 +125,25 @@ const TableModule = forwardRef((props, ref) => { const [postdata, setPostdata] = useState({ formData: { ...pageData }, }); + // 进入页面的初次请求 是否完成 + const firstFetchRef = useRef() function onShowSizeChange(pn, page_size) { setPageData({ - pn, - page_size, + pn:1, + page_size: page_size }); + fetch({pn:1,page_size:page_size}) + } + + function onChange(pn, page_size){ + if(pageData.page_size == page_size){ + setPageData({ + pn, + page_size, + }); + fetch({pn,page_size}) + } } // 是否添加序号 @@ -179,7 +192,7 @@ const TableModule = forwardRef((props, ref) => { // temp_obj.carId = sessionTabList.plate2 fetchPlateSearch(sessionTabList.plateValue.match(/:(\S*)/)[1], setPlateData, []); } else { - fetch() + fetch('first') } // if (sessionTabList.start_time) { @@ -212,19 +225,29 @@ const TableModule = forwardRef((props, ref) => { }, [formData]) const [getForm, setGetForm] = useState({}) //查询函数 - function fetch(pn, update) { + function fetch(args1, update) { // setLoading(true); - let pnno = pn ? { pn: 1 } : {} + let pnno = args1 ? { pn: 1 } : {} let updateData = update ? update : {} + if (update) { searchForm.setFieldsValue(update); setSessionTabList({ ...sessionTabList, ...update }); if (pageData?.pn != 1) { setPageData({ ...pageData, pn: 1 }); + fetch({ ...pageData, pn: 1 }) return } } - let form = { ...searchForm.getFieldsValue(), ...pageData, ...otherData, ...pnno, ...updateData }; + let form = {}; + if(typeof args1 == 'object'){ + form = {...searchForm.getFieldsValue(), ...args1, ...otherData, ...updateData} + }else{ + form = {...searchForm.getFieldsValue(), ...pageData, ...otherData, ...pnno, ...updateData} + } + if(args1 == 'first' && sessionTabList.plate2){ // 去掉plateData的监听, 避免进入页面多发送一次请求 + form.carId = sessionTabList.plate2 + } if (timeFlag) { form = { ...form, @@ -263,7 +286,6 @@ const TableModule = forwardRef((props, ref) => { form.end_time = moment(form.end_time).format("YYYY-MM-DD HH:mm:ss"); } if (moment(form.end_time) - moment(form.start_time) > 180 * 3600 * 24000) { - //console.log(2222,form.end_time,form.start_time,moment(form.end_time) - moment(form.start_time)) if (mandatory) { if (Array.isArray(mandatory)) { // 两个只要有一个填就可以 @@ -284,8 +306,6 @@ const TableModule = forwardRef((props, ref) => { } } if (limitCon && limitCon(form)) return - //setLoading(true); - console.log(form); search(form); } //重置 @@ -394,24 +414,26 @@ const TableModule = forwardRef((props, ref) => { }; timeout = setTimeout(fake, 1000); }; - useEffect(() => { - if (plateData.length > 0 && sessionTabList?.plateValue) { - //searchForm.setFieldsValue({ ...sessionTabList, carId: sessionTabList.plate2 }) - let temp_obj = { ...sessionTabList } - if (sessionTabList.start_time) { - temp_obj.start_time = moment(sessionTabList.start_time) - temp_obj.end_time = moment(sessionTabList.end_time) - } - if (sessionTabList.in_time) { - temp_obj.in_time = moment(sessionTabList.in_time) - } - temp_obj.carId = sessionTabList.plate2 - searchForm.setFieldsValue(temp_obj) - fetch() - } - }, [plateData]) + + // useEffect(() => { + // if (plateData.length > 0 && sessionTabList?.plateValue) { + // //searchForm.setFieldsValue({ ...sessionTabList, carId: sessionTabList.plate2 }) + // let temp_obj = { ...sessionTabList } + // if (sessionTabList.start_time) { + // temp_obj.start_time = moment(sessionTabList.start_time) + // temp_obj.end_time = moment(sessionTabList.end_time) + // } + // if (sessionTabList.in_time) { + // temp_obj.in_time = moment(sessionTabList.in_time) + // } + // temp_obj.carId = sessionTabList.plate2 + // searchForm.setFieldsValue(temp_obj) + // fetch() + // } + // }, [plateData]) + const handlePlateSearch = (newValue, item) => { - console.log(newValue, item); + // console.log(newValue, item); if (newValue) { fetchPlateSearch(newValue, setPlateData, item); } else { @@ -954,7 +976,7 @@ const TableModule = forwardRef((props, ref) => { useEffect(() => { - fetch(); + // fetch(); setLoading(false); }, [pageData]); @@ -990,7 +1012,15 @@ const TableModule = forwardRef((props, ref) => { - {renderAdd()} @@ -1072,7 +1102,7 @@ const TableModule = forwardRef((props, ref) => { current={pageData.pn} pageSize={pageData.page_size} pageSizeOptions={dictionary?.pageSizeOptions} - onChange={onShowSizeChange} + onChange={onChange} onShowSizeChange={onShowSizeChange} /> diff --git a/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx b/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx index d3feaaa..b2dd76d 100644 --- a/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx +++ b/src/pages/InRoadMgm/PersonMgm/PersonInfo/loadable.jsx @@ -238,13 +238,9 @@ function PersonInfo() { const getAssets = (id, editFlag) => { if (id) { - let temp_params = {id: id} if(showEdit || editFlag){ - temp_params.user_id = currentPersonId - } - ajax.getUserGoods(temp_params).then(res => { - if (res.status == 20000) { - if (showEdit || editFlag) { + ajax.getAssets({id: id , user_id: currentPersonId}).then(res => { // + if (res.status == 20000) { let temparr = []; res.data.map(item => { temparr.push({ @@ -254,16 +250,27 @@ function PersonInfo() { }) setAssetsEditOptions(temparr) } else { + message.error(res.message) + } + }).catch(err => { + console.log(err) + }).finally(() => { + + }) + }else{ + ajax.getUserGoods({id: id}).then(res => { // 已经被分配过的物品 + if (res.status == 20000) { setAssetsOptions(res.data) + } else { + message.error(res.message) } - } else { - message.error(res.message) - } - }).catch(err => { - console.log(err) - }).finally(() => { - - }) + }).catch(err => { + console.log(err) + }).finally(() => { + + }) + } + } } @@ -709,6 +716,7 @@ function PersonInfo() { placeholder="收费员姓名" value={currentPersonInfo.name} showClose={true} + showCount={true} onChange={e => { setCurrentPersonInfo({ ...currentPersonInfo, name: e.target.value }) }} />
@@ -727,6 +735,7 @@ function PersonInfo() { placeholder="输入员工编号" value={currentPersonInfo.number} showClose={true} + showCount={true} onChange={e => { setCurrentPersonInfo({ ...currentPersonInfo, number: e.target.value }) }} /> { setCurrentPersonInfo({ ...currentPersonInfo, tel: e.target.value }) }} /> { setCurrentPersonInfo({ ...currentPersonInfo, pda_number: e.target.value }) }} />