From a40fe057a0e2fdc9f7dcafdfc019f59b26d75c23 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 09:38:43 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=BC=98=E5=8C=96gird=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=20loading=E6=97=B6=E9=97=B4=E5=BB=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 48a46365..662bd117 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -303,7 +303,7 @@ export default class menu extends React.Component { this.setState({ pageLoading: true }) setTimeout(() => { this.setState({ pageLoading: false }) - }, 500) + }, 800) } pageShow(e) {} gridEditChange(e) {} @@ -558,17 +558,14 @@ export default class menu extends React.Component { count: this.props.dataCount }} onPrevClick={(e) => { - this.gridPageLoad() this.props.pageChange(e) }} page={this.props.page} pageFn={(e) => this.setState({ page: e })} onNextClick={(e) => { - this.gridPageLoad() this.props.pageChange(e) }} onJumpPage={(e) => { - this.gridPageLoad() this.props.pageChange(e) }} onCountChange={(e) => { From 811223c738c23e319a8a0452f8004a8f9374038f Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 09:50:51 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/order/list/list.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pages/order/list/list.js b/src/pages/order/list/list.js index 5500e362..c0bc9792 100644 --- a/src/pages/order/list/list.js +++ b/src/pages/order/list/list.js @@ -190,10 +190,10 @@ export default class orderlist extends React.Component { prop: 'status', menuList: [ { id: 999, name: '全部' }, - { id: 1, name: '商品-充值中' }, - { id: 2, name: '商品-已完成' }, - { id: 3, name: '商品-充值失败' }, - { id: 4, name: '商品-已取消' }, + { id: 1, name: '直充-充值中' }, + { id: 2, name: '直充-已完成' }, + { id: 3, name: '直充-充值失败' }, + { id: 4, name: '直充-已取消' }, { id: 111, name: '立减金-待领取' }, { id: 222, name: '立减金-已领取' }, { id: 5, name: '立减金-已过期' } @@ -778,7 +778,7 @@ export default class orderlist extends React.Component { ) } if (com === 'type_text') { - return {rowData.type === 1 ? '商品' : '立减金'} + return {rowData.type === 1 ? '直充' : '立减金'} } if (com == 'channel_activity_id') { return ( @@ -797,7 +797,8 @@ export default class orderlist extends React.Component { onClick={(e) => this.moreFn(e, rowData)}> 详情 - {rowData.status == 1||rowData.status == 0&&rowData.type==1 ? ( + {rowData.status == 1 || + (rowData.status == 0 && rowData.type == 1) ? ( this.deleteFn(e, rowData)}> From 4d4812e29b3596e0c5c983857214b13d7468a9c8 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 10:57:37 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E9=87=8D=E7=BD=AE=20grid=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 662bd117..9df5eb99 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -268,10 +268,17 @@ export default class menu extends React.Component { this.setState({ page: nextProps.page }) this.setState({ page: nextProps.page, emptyText: nextProps.emptyText }) this.setState({ dataCount: nextProps.dataCount }) + this.scrollPosition() this.gridPageLoad() } } + /* 重置grid滚动条 */ + scrollPosition() { + document.getElementById('grid').scrollLeft = 0 + document.getElementById('grid').scrollTop = 0 + } + onConfirm = () => {} onCancel = () => {} From abca49beae2cbdbeb718e89d63ffa88a96910bd3 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 11:27:03 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E4=BC=98=E5=8C=96loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 11 +- src/pages/plan/keyList/index.jsx | 614 +++++++++++++++---------------- 2 files changed, 310 insertions(+), 315 deletions(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 9df5eb99..95b8d8dd 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -160,6 +160,7 @@ export default class menu extends React.Component { } //Safari与Chrome属于同一类型 dom.onmousewheel = this.scrollFunc + this.gridPageLoad() } //多选 @@ -307,10 +308,12 @@ export default class menu extends React.Component { this.setState({ pageCount: e }) } gridPageLoad() { - this.setState({ pageLoading: true }) - setTimeout(() => { - this.setState({ pageLoading: false }) - }, 800) + if (!this.state.pageLoading) { + this.setState({ pageLoading: true }) + setTimeout(() => { + this.setState({ pageLoading: false }) + }, 800) + } } pageShow(e) {} gridEditChange(e) {} diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index d9a41e2c..b74bc5b5 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -1,9 +1,9 @@ -import React, { useRef } from "react"; -import { useUpdateEffect, useSetState } from "ahooks"; +import React, { useRef } from 'react' +import { useUpdateEffect, useSetState } from 'ahooks' -import { getNowTime } from "@/utils.js"; -import menu from "@/assets/enum.js"; -import _ from "lodash"; +import { getNowTime } from '@/utils.js' +import menu from '@/assets/enum.js' +import _ from 'lodash' import { Button, Icon, @@ -14,8 +14,8 @@ import { DropdownClickTrigger, MenuItem, DropdownContent, - Menu, -} from "zent"; + Menu +} from 'zent' import { keyCancel, @@ -26,124 +26,124 @@ import { getKeysList, batchUploadVoid, batchUploadUsed, - exportKey, -} from "@/assets/api.js"; + exportKey +} from '@/assets/api.js' -import Grid from "@/components/gird/main.js"; -import TabPage from "@/components/tabPage/main.js"; -import KeysFind from "@/components/keysFind"; -import UseUploadExcel from "@/components/UseUploadExcel"; +import Grid from '@/components/gird/main.js' +import TabPage from '@/components/tabPage/main.js' +import KeysFind from '@/components/keysFind' +import UseUploadExcel from '@/components/UseUploadExcel' -import "./style.less"; +import './style.less' const tableColumn = [ { - title: "key码", - name: "key_code", - prop: "key_code", - type: "normal", - width: "auto", + title: 'key码', + name: 'key_code', + prop: 'key_code', + type: 'normal', + width: 'auto' }, { - title: "归属营销计划", - width: "auto", - type: "normal", - prop: "title", - name: "title", + title: '归属营销计划', + width: 'auto', + type: 'normal', + prop: 'title', + name: 'title' }, { - title: "归属KEY批次", - prop: "batch_name", - name: "batch_name", - width: "auto", - type: "normal", + title: '归属KEY批次', + prop: 'batch_name', + name: 'batch_name', + width: 'auto', + type: 'normal' }, { - title: "状态", - prop: "status", - name: "status", - width: "auto", - type: "slot", + title: '状态', + prop: 'status', + name: 'status', + width: 'auto', + type: 'slot' }, { - title: "操作", - name: "opearo", - prop: "opearo", - type: "slot", - width: "auto", + title: '操作', + name: 'opearo', + prop: 'opearo', + type: 'slot', + width: 'auto' }, { - title: "总发放条数", - prop: "total", - name: "total", - width: "auto", - type: "normal", + title: '总发放条数', + prop: 'total', + name: 'total', + width: 'auto', + type: 'normal' }, { - title: "剩余条数", - prop: "residue", - name: "residue", - width: "auto", - type: "normal", + title: '剩余条数', + prop: 'residue', + name: 'residue', + width: 'auto', + type: 'normal' }, { - title: "已使用条数", - name: "usage", - prop: "usage", - type: "normal", - width: "auto", + title: '已使用条数', + name: 'usage', + prop: 'usage', + type: 'normal', + width: 'auto' }, { - title: "已过期条数", - name: "overdue", - prop: "overdue", - type: "normal", - width: "auto", + title: '已过期条数', + name: 'overdue', + prop: 'overdue', + type: 'normal', + width: 'auto' }, { - title: "已作废条数", - name: "invalid", - prop: "invalid", - type: "normal", - width: "auto", + title: '已作废条数', + name: 'invalid', + prop: 'invalid', + type: 'normal', + width: 'auto' }, { - title: "已完结条数", - name: "end", - prop: "end", - type: "normal", - width: "auto", + title: '已完结条数', + name: 'end', + prop: 'end', + type: 'normal', + width: 'auto' }, { - title: "更新时间", - name: "update_time", - prop: "update_time", - type: "normal", - width: "220px", - }, -]; + title: '更新时间', + name: 'update_time', + prop: 'update_time', + type: 'normal', + width: '220px' + } +] const UseKeyList = () => { - const key_query_el = useRef(null); - const plan_list_el = useRef(null); + const key_query_el = useRef(null) + const plan_list_el = useRef(null) const [state, setState] = useSetState({ - tabList: [{ title: "KEY列表" }], + tabList: [{ title: 'KEY列表' }], query: { - begin_time: "", - end_time: "", - reseller_id: "", - plan_id: "", - status: "", - key: "", + begin_time: '', + end_time: '', + reseller_id: '', + plan_id: '', + status: '', + key: '' }, - hash: "", + hash: '', page: 1, limit: 10, isQuery: false, selectTable: [], multipleDisabledBtn: true, exportKeyBtn: false, - lodgingTable: true, + lodgingTable: false, tableHeight: 500, tableData: [], grantTotal: 0, @@ -151,11 +151,11 @@ const UseKeyList = () => { usageTotal: 0, outdateTotal: 0, invalidTotal: 0, - dialogTitle: "", + dialogTitle: '', bachVisible: false, - bachUrl: "", - bachApiType: 0, - }); + bachUrl: '', + bachApiType: 0 + }) /** * @@ -169,48 +169,48 @@ const UseKeyList = () => { plan_id: state.query.plan_id || null, status: state.query.status || null, key: state.query.key || null, - hash: state.hash !== "" ? state.hash : null, + hash: state.hash !== '' ? state.hash : null, page: state.page, - limit: state.limit, - }; + limit: state.limit + } param = _.omitBy( { - ...param, + ...param }, (value) => { - return _.isNaN(value) || _.isNil(value); + return _.isNaN(value) || _.isNil(value) } - ); - return param; - }; + ) + return param + } /** * 获取表格 */ const getTable = () => { - const param = getParam(); + const param = getParam() getKeysList(param).then((res) => { handelResponse( res, (req, msg) => { - console.log("req =>", req); + console.log('req =>', req) if (req.total > 0) { - setState({ lodgingTable: false }); + setState({ lodgingTable: false }) } else { - setState({ lodgingTable: true }); + setState({ lodgingTable: true }) } - setState({ dataCount: req.total, tableData: req.data }); + setState({ dataCount: req.total, tableData: req.data }) }, (err) => { - Notify.warn(err); + Notify.warn(err) } - ); - }); - }; + ) + }) + } useUpdateEffect(() => { - getTable(); - }, [state.isQuery]); + getTable() + }, [state.isQuery]) /** * 获取查询值 @@ -218,285 +218,291 @@ const UseKeyList = () => { const getQuery = (data) => { let queryParams = _.omitBy( { - ...data, + ...data }, (value) => { - return _.isNaN(value) || _.isNil(value); + return _.isNaN(value) || _.isNil(value) } - ); - setState({ query: queryParams }); - }; + ) + setState({ query: queryParams }) + } /** * 查询按钮 */ const onQueryBtn = () => { - setState({ page: 1, limit: 10, hash: "", isQuery: !state.isQuery }); - }; + setState({ page: 1, limit: 10, hash: '', isQuery: !state.isQuery }) + } /** * 重置 */ const resetBtn = () => { - setState({ page: 1, limit: 10, hash: "", tableData: [] }); - }; + setState({ + page: 1, + limit: 10, + hash: '', + tableData: [], + lodgingTable: false + }) + } /** * 清空 select table */ const clearSelectTableBtn = () => { - plan_list_el.current.allChecked(false); - setState({ selectTable: [] }); - }; + plan_list_el.current.allChecked(false) + setState({ selectTable: [] }) + } /** * 作废 */ const multipleCancel = () => { let keys = _.map(state.selectTable, (item) => { - return item.key; - }); + return item.key + }) let formdata = { - keys: keys, - }; + keys: keys + } keyBatchCancel(formdata).then((res) => { handelResponse( res, (req, msg) => { - Notify.success("批量作废成功"); - clearSelectTableBtn(); + Notify.success('批量作废成功') + clearSelectTableBtn() setState({ multipleDisabledBtn: true, - isQuery: !state.isQuery, - }); + isQuery: !state.isQuery + }) }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); - }; + ) + }) + } /** * 使用 */ const multipleUse = () => { let keys = _.map(state.selectTable, (item) => { - return item.key; - }); + return item.key + }) let formdata = { - keys: keys, - }; + keys: keys + } keyBatchUsage(formdata).then((res) => { handelResponse( res, (req, msg) => { - Notify.success("批量标记为使用成功"); - clearSelectTableBtn(); + Notify.success('批量标记为使用成功') + clearSelectTableBtn() setState({ multipleDisabledBtn: true, - isQuery: !state.isQuery, - }); + isQuery: !state.isQuery + }) }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); - }; + ) + }) + } /** * 导出 */ const bachExportKey = () => { - let tag = false; - let param = getParam(); - delete param.page; - delete param.limit; + let tag = false + let param = getParam() + delete param.page + delete param.limit // hash - if (state.hash !== "") { - param.hash = state.hash; + if (state.hash !== '') { + param.hash = state.hash } // 4个条件必须有一个 for (let key in param) { if ( - param.hasOwnProperty("key") === true || - param.hasOwnProperty("plan_id") === true || - param.hasOwnProperty("reseller_id") === true || - param.hasOwnProperty("hash") === true + param.hasOwnProperty('key') === true || + param.hasOwnProperty('plan_id') === true || + param.hasOwnProperty('reseller_id') === true || + param.hasOwnProperty('hash') === true ) { - tag = true; + tag = true } } // 如果用户勾选的数据 只导出 if (state.selectTable.length > 0) { - let key_arr = []; + let key_arr = [] key_arr = state.selectTable.map((item) => { - return item.key; - }); + return item.key + }) param = { - keys: key_arr.join(","), - }; - tag = true; + keys: key_arr.join(',') + } + tag = true } if (tag) { exportKey(param).then((res) => { - if (res.type == "application/json") { - const reader = new FileReader(); //创建一个FileReader实例 - reader.readAsText(res, "utf-8"); //读取文件,结果用字符串形式表示 + if (res.type == 'application/json') { + const reader = new FileReader() //创建一个FileReader实例 + reader.readAsText(res, 'utf-8') //读取文件,结果用字符串形式表示 reader.onload = function () { - const obj = JSON.parse(reader.result); - Notify.clear(); - Notify.error(obj.message); - }; + const obj = JSON.parse(reader.result) + Notify.clear() + Notify.error(obj.message) + } } else { - let bl = new Blob([res]); - let fileName = "营销计划" + getNowTime() + ".xlsx"; //设置文件名 - var link = document.createElement("a"); //创建标签 - link.href = window.URL.createObjectURL(bl); - link.download = fileName; //下载的文件名 - link.click(); - window.URL.revokeObjectURL(link.href); //清除URL + let bl = new Blob([res]) + let fileName = '营销计划' + getNowTime() + '.xlsx' //设置文件名 + var link = document.createElement('a') //创建标签 + link.href = window.URL.createObjectURL(bl) + link.download = fileName //下载的文件名 + link.click() + window.URL.revokeObjectURL(link.href) //清除URL } - }); + }) } - }; + } const onPageChange = (e) => { - setState({ page: e, isQuery: !state.isQuery }); - }; + setState({ page: e, isQuery: !state.isQuery }) + } const onCountChange = (e) => { - setState({ limit: e, isQuery: !state.isQuery }); - }; + setState({ limit: e, isQuery: !state.isQuery }) + } const selectionFun = (data) => { if (data.length > 0) { - setState({ multipleDisabledBtn: false }); + setState({ multipleDisabledBtn: false }) } else { - setState({ multipleDisabledBtn: true }); + setState({ multipleDisabledBtn: true }) } - setState({ selectTable: data }); - let grantTotal = 0; - let surplusTotal = 0; - let usageTotal = 0; - let invalidTotal = 0; - let outdateTotal = 0; + setState({ selectTable: data }) + let grantTotal = 0 + let surplusTotal = 0 + let usageTotal = 0 + let invalidTotal = 0 + let outdateTotal = 0 // let usage_total = 0; // let silent_total = 0; data.forEach((item) => { - grantTotal += Number(item.total); - surplusTotal += Number(item.residue); - usageTotal += Number(item.usage); - outdateTotal += Number(item.overdue); - invalidTotal += Number(item.invalid); + grantTotal += Number(item.total) + surplusTotal += Number(item.residue) + usageTotal += Number(item.usage) + outdateTotal += Number(item.overdue) + invalidTotal += Number(item.invalid) // usage_total += Number(item.usage_total); // silent_total += Number(item.silent_total); - }); + }) setState({ grantTotal, usageTotal, invalidTotal, outdateTotal, - surplusTotal, - }); - }; + surplusTotal + }) + } const menuItemClick = (e, key, rowData) => { if (Number(key) === 1) { let formdata = { - key: rowData.key, - }; + key: rowData.key + } keyUsage(formdata).then((res) => { handelResponse( res, (req, msg) => { - setState({ page: 1, limit: 10, isQuery: !state.isQuery }); - Notify.success("标记为使用成功"); + setState({ page: 1, limit: 10, isQuery: !state.isQuery }) + Notify.success('标记为使用成功') }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); + ) + }) } if (Number(key) === 2) { let formdata = { - key: rowData.key, - }; + key: rowData.key + } keyCancel(formdata).then((res) => { handelResponse( res, (req, msg) => { - setState({ page: 1, limit: 10, isQuery: !state.isQuery }); - Notify.success("作废成功"); + setState({ page: 1, limit: 10, isQuery: !state.isQuery }) + Notify.success('作废成功') }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); + ) + }) } if (Number(key) === 3) { - sessionStorage.setItem("keyCode", rowData.key); - window.open("#/home/key-log"); + sessionStorage.setItem('keyCode', rowData.key) + window.open('#/home/key-log') } - }; + } /** * 批量上传操作 */ const bachUploadQuery = () => { let obj = { - bachUrl: "/key/import?type=1", - dialogTitle: "批量上传查询", + bachUrl: '/key/import?type=1', + dialogTitle: '批量上传查询', bachVisible: true, - bachApiType: 1, - }; - setState(obj); - }; + bachApiType: 1 + } + setState(obj) + } /** * 批量上传作废 */ const bachUploadVoid = () => { let obj = { - bachUrl: "/key/import?type=2", - dialogTitle: "批量上传作废", + bachUrl: '/key/import?type=2', + dialogTitle: '批量上传作废', bachVisible: true, - bachApiType: 2, - }; - setState(obj); - }; + bachApiType: 2 + } + setState(obj) + } /** * 批量上传使用 */ const bachUploadTagUse = () => { let obj = { - bachUrl: "/key/import?type=3", - dialogTitle: "批量上传使用", + bachUrl: '/key/import?type=3', + dialogTitle: '批量上传使用', bachVisible: true, - bachApiType: 3, - }; - setState(obj); - }; + bachApiType: 3 + } + setState(obj) + } const bachOnClose = () => { - setState({ bachVisible: false }); - }; + setState({ bachVisible: false }) + } const bachImportBtn = (data) => { // 批量上传查询 if (state.bachApiType === 1) { - setState({ page: 1, hash: data, isQuery: !state.isQuery }); - return; + setState({ page: 1, hash: data, isQuery: !state.isQuery }) + return } // 批量上传作废 @@ -505,21 +511,21 @@ const UseKeyList = () => { handelResponse( res, (req, msg) => { - Notify.success("批量上传标记为作废"); - key_query_el.current.clearData(); // 重置 + Notify.success('批量上传标记为作废') + key_query_el.current.clearData() // 重置 setState({ page: 1, limit: 10, hash: data, - isQuery: !state.isQuery, - }); + isQuery: !state.isQuery + }) }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); - return; + ) + }) + return } // 批量上传使用 @@ -528,28 +534,28 @@ const UseKeyList = () => { handelResponse( res, (req, msg) => { - Notify.success("批量上传标记为使用"); - key_query_el.current.clearData(); // 重置 + Notify.success('批量上传标记为使用') + key_query_el.current.clearData() // 重置 setState({ page: 1, limit: 10, hash: data, - isQuery: !state.isQuery, - }); + isQuery: !state.isQuery + }) }, (err) => { - Notify.error(err); + Notify.error(err) } - ); - }); - return; + ) + }) + return } - }; + } return ( -
+
-
+
getQuery(data)} @@ -557,39 +563,34 @@ const UseKeyList = () => { resetChange={() => resetBtn()} />
-
+
{/* 批量上传操作 */}
@@ -597,15 +598,14 @@ const UseKeyList = () => {
{state.selectTable.length > 0 ? ( clearSelectTableBtn()}> + - } - > + }> 已选择 - + {state.selectTable.length} 发放key总数:{state.grantTotal},剩余key总数: @@ -615,7 +615,7 @@ const UseKeyList = () => { ) : null} { pageChange={(e) => onPageChange(e)} emptyText={ state.lodgingTable - ? "抱歉,暂无相关数据记录" - : "查询 请输入【分销商】或【计划名称】或【key】进行查询" + ? '抱歉,暂无相关数据记录' + : '查询 请输入【分销商】或【计划名称】或【key】进行查询' } countChange={(e) => onCountChange(e)} checkChange={(data) => selectionFun(data)} ComponentHandler={(com, rowData) => { - if (com == "dates") { + if (com == 'dates') { return ( {rowData.begin_time} 至 {rowData.end_time} - ); + ) } - if (com == "status") { + if (com == 'status') { return ( -

+

+ background: menu.keyStatusBg(parseInt(rowData.status)) + }}> {rowData.status_text}

- ); + ) } - if (com == "opearo") { + if (com == 'opearo') { return (
+ className='grid-link' + style={{ paddingLeft: '2px', color: '#d8dbdd' }}> 详情 -
- 更多 +
+ 更多
menuItemClick(e, key, rowData)} - > + onClick={(e, key) => menuItemClick(e, key, rowData)}> + key='1' + disabled={rowData.status === 1 ? false : true}> 标记成已使用 + }> 作废 - 日志 + 日志 - ); + ) } }} /> @@ -710,10 +703,9 @@ const UseKeyList = () => { visible={state.bachVisible} url={state.bachUrl} onClose={() => bachOnClose()} - onImport={(data) => bachImportBtn(data)} - > + onImport={(data) => bachImportBtn(data)}>
- ); -}; + ) +} -export default UseKeyList; +export default UseKeyList From f72ee906889dc0bc1c93885ec62b77ce38cd3234 Mon Sep 17 00:00:00 2001 From: Apple <> Date: Wed, 24 Aug 2022 14:07:51 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=B0=81=E8=A3=85table=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=8A=A0=E8=BD=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 15 ++++----------- src/pages/plan/keyList/index.jsx | 10 +++++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 95b8d8dd..92c6468a 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -135,7 +135,7 @@ export default class menu extends React.Component { indeterminate: false, pageNum: 0, pageCount: props.dataCount, - pageLoading: false, + pageLoading: true, editShow: false, postion: null, historyrow_id: null, @@ -160,7 +160,6 @@ export default class menu extends React.Component { } //Safari与Chrome属于同一类型 dom.onmousewheel = this.scrollFunc - this.gridPageLoad() } //多选 @@ -265,12 +264,11 @@ export default class menu extends React.Component { componentWillReceiveProps(nextProps) { if (this.state.tableData != nextProps.tableData) { - this.setState({ tableData: nextProps.tableData }) + this.setState({ tableData: nextProps.tableData ,pageLoading:false}) this.setState({ page: nextProps.page }) this.setState({ page: nextProps.page, emptyText: nextProps.emptyText }) this.setState({ dataCount: nextProps.dataCount }) this.scrollPosition() - this.gridPageLoad() } } @@ -307,13 +305,8 @@ export default class menu extends React.Component { this.props.countChange(e) this.setState({ pageCount: e }) } - gridPageLoad() { - if (!this.state.pageLoading) { - this.setState({ pageLoading: true }) - setTimeout(() => { - this.setState({ pageLoading: false }) - }, 800) - } + gridPageLoad(flag) { + this.setState({ pageLoading: flag }) } pageShow(e) {} gridEditChange(e) {} diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index b74bc5b5..3d0d7d62 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -1,4 +1,4 @@ -import React, { useRef } from 'react' +import React, { useRef,useEffect } from 'react' import { useUpdateEffect, useSetState } from 'ahooks' import { getNowTime } from '@/utils.js' @@ -188,6 +188,7 @@ const UseKeyList = () => { * 获取表格 */ const getTable = () => { + plan_list_el.current.gridPageLoad(true); const param = getParam() getKeysList(param).then((res) => { handelResponse( @@ -212,6 +213,12 @@ const UseKeyList = () => { getTable() }, [state.isQuery]) + useEffect(()=>{ + plan_list_el.current.gridPageLoad(false); + return ()=>{//在函数组件卸载前执行 + + } + }, []); /** * 获取查询值 */ @@ -252,6 +259,7 @@ const UseKeyList = () => { */ const clearSelectTableBtn = () => { plan_list_el.current.allChecked(false) + plan_list_el.current.gridPageLoad(false); setState({ selectTable: [] }) } From 1510ce866470f55974d7cd7866dd494790e11f37 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 16:44:20 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dkeys=E6=9F=A5=E8=AF=A2b?= =?UTF-8?q?ug=E4=BB=A5=E5=8F=8Agrid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 15 ++++++++++++--- src/pages/plan/keyList/index.jsx | 18 ++++++++---------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 92c6468a..7e5875a9 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -199,6 +199,15 @@ export default class menu extends React.Component { this.setState({ tableData: tabledata }) } + gridPageLoads() { + let clr = null + if (clr) clearTimeout(clr) + this.setState({ pageLoading: true }) + clr = setTimeout(() => { + this.setState({ pageLoading: false }) + }, 800) + } + checkChange(index, e) { this.state.tableData[index].checked = e.target.checked this.setState({ @@ -264,11 +273,12 @@ export default class menu extends React.Component { componentWillReceiveProps(nextProps) { if (this.state.tableData != nextProps.tableData) { - this.setState({ tableData: nextProps.tableData ,pageLoading:false}) + this.setState({ tableData: nextProps.tableData }) this.setState({ page: nextProps.page }) this.setState({ page: nextProps.page, emptyText: nextProps.emptyText }) this.setState({ dataCount: nextProps.dataCount }) this.scrollPosition() + this.gridPageLoads() } } @@ -306,7 +316,7 @@ export default class menu extends React.Component { this.setState({ pageCount: e }) } gridPageLoad(flag) { - this.setState({ pageLoading: flag }) + this.setState({ pageLoading: flag }) } pageShow(e) {} gridEditChange(e) {} @@ -319,7 +329,6 @@ export default class menu extends React.Component { } rowItemClick(index) { console.log(index) - this.setState({ curIndex: index }) } diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index 3d0d7d62..0ad21d1e 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -1,4 +1,4 @@ -import React, { useRef,useEffect } from 'react' +import React, { useRef, useEffect } from 'react' import { useUpdateEffect, useSetState } from 'ahooks' import { getNowTime } from '@/utils.js' @@ -188,7 +188,7 @@ const UseKeyList = () => { * 获取表格 */ const getTable = () => { - plan_list_el.current.gridPageLoad(true); + plan_list_el.current.gridPageLoad(true) const param = getParam() getKeysList(param).then((res) => { handelResponse( @@ -213,12 +213,9 @@ const UseKeyList = () => { getTable() }, [state.isQuery]) - useEffect(()=>{ - plan_list_el.current.gridPageLoad(false); - return ()=>{//在函数组件卸载前执行 - - } - }, []); + useEffect(() => { + plan_list_el.current.gridPageLoad(false) + }, []) /** * 获取查询值 */ @@ -250,7 +247,8 @@ const UseKeyList = () => { limit: 10, hash: '', tableData: [], - lodgingTable: false + lodgingTable: false, + dataCount: 0 }) } @@ -259,7 +257,7 @@ const UseKeyList = () => { */ const clearSelectTableBtn = () => { plan_list_el.current.allChecked(false) - plan_list_el.current.gridPageLoad(false); + plan_list_el.current.gridPageLoad(false) setState({ selectTable: [] }) } From 5ea9708d117848491f0bf4e3f0300f7abb6458d4 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 17:48:04 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.css | 2 -- src/components/gird/main.js | 31 ++++++++++++++----------------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/components/gird/main.css b/src/components/gird/main.css index e7f24c84..a752857c 100644 --- a/src/components/gird/main.css +++ b/src/components/gird/main.css @@ -159,8 +159,6 @@ opacity: 1; width: 100%; height: 100px; - display: flex !important ; - justify-content: center; } .grid-loading.show .loading-bar { diff --git a/src/components/gird/main.js b/src/components/gird/main.js index 7e5875a9..d128ed0f 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -135,7 +135,7 @@ export default class menu extends React.Component { indeterminate: false, pageNum: 0, pageCount: props.dataCount, - pageLoading: true, + pageLoading: false, editShow: false, postion: null, historyrow_id: null, @@ -199,11 +199,9 @@ export default class menu extends React.Component { this.setState({ tableData: tabledata }) } - gridPageLoads() { - let clr = null - if (clr) clearTimeout(clr) + gridPageLoad() { this.setState({ pageLoading: true }) - clr = setTimeout(() => { + setTimeout(() => { this.setState({ pageLoading: false }) }, 800) } @@ -278,7 +276,6 @@ export default class menu extends React.Component { this.setState({ page: nextProps.page, emptyText: nextProps.emptyText }) this.setState({ dataCount: nextProps.dataCount }) this.scrollPosition() - this.gridPageLoads() } } @@ -315,9 +312,7 @@ export default class menu extends React.Component { this.props.countChange(e) this.setState({ pageCount: e }) } - gridPageLoad(flag) { - this.setState({ pageLoading: flag }) - } + pageShow(e) {} gridEditChange(e) {} getSelectData() { @@ -404,14 +399,13 @@ export default class menu extends React.Component { })}{' '}
- +
+
+
数据加载中,请耐心等待
+
@@ -570,14 +564,17 @@ export default class menu extends React.Component { count: this.props.dataCount }} onPrevClick={(e) => { + this.gridPageLoad() this.props.pageChange(e) }} page={this.props.page} pageFn={(e) => this.setState({ page: e })} onNextClick={(e) => { + this.gridPageLoad() this.props.pageChange(e) }} onJumpPage={(e) => { + this.gridPageLoad() this.props.pageChange(e) }} onCountChange={(e) => { From 6f9a142e84003ffffc8639eaf3b1fbbc3b1d4875 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Wed, 24 Aug 2022 17:51:09 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/gird/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/gird/main.js b/src/components/gird/main.js index d128ed0f..f10e15b7 100644 --- a/src/components/gird/main.js +++ b/src/components/gird/main.js @@ -1,7 +1,7 @@ import React from 'react' import ReactDom from 'react-dom' import './main.css' -import { Icon, Checkbox, Switch, InlineLoading } from 'zent' +import { Icon, Checkbox, Switch } from 'zent' import _ from 'lodash' import Pagination from '../pagination/main.js' import GridEdit from '../gridEdit/main.js' From 08120a9c2b10be90eb1bf3a8f567a1a2d7947317 Mon Sep 17 00:00:00 2001 From: Apple <> Date: Wed, 24 Aug 2022 17:51:53 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E5=9B=9E=E9=80=80keyList?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/keyList/index.jsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index 0ad21d1e..566668f9 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -1,4 +1,4 @@ -import React, { useRef, useEffect } from 'react' +import React, { useRef } from 'react' import { useUpdateEffect, useSetState } from 'ahooks' import { getNowTime } from '@/utils.js' @@ -188,7 +188,6 @@ const UseKeyList = () => { * 获取表格 */ const getTable = () => { - plan_list_el.current.gridPageLoad(true) const param = getParam() getKeysList(param).then((res) => { handelResponse( @@ -213,9 +212,7 @@ const UseKeyList = () => { getTable() }, [state.isQuery]) - useEffect(() => { - plan_list_el.current.gridPageLoad(false) - }, []) + /** * 获取查询值 */ @@ -257,7 +254,6 @@ const UseKeyList = () => { */ const clearSelectTableBtn = () => { plan_list_el.current.allChecked(false) - plan_list_el.current.gridPageLoad(false) setState({ selectTable: [] }) } From 97c98bb22c280b65f5f24beceffd6d4255fbfbfe Mon Sep 17 00:00:00 2001 From: Apple <> Date: Wed, 24 Aug 2022 18:01:10 +0800 Subject: [PATCH 10/10] =?UTF-8?q?keys=E6=9F=A5=E8=AF=A2=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/plan/keyList/index.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/plan/keyList/index.jsx b/src/pages/plan/keyList/index.jsx index 566668f9..0d1f42d1 100644 --- a/src/pages/plan/keyList/index.jsx +++ b/src/pages/plan/keyList/index.jsx @@ -6,6 +6,7 @@ import menu from '@/assets/enum.js' import _ from 'lodash' import { Button, + BlockLoading, Icon, Notify, Alert, @@ -137,6 +138,7 @@ const UseKeyList = () => { key: '' }, hash: '', + loading:false, page: 1, limit: 10, isQuery: false, @@ -189,10 +191,12 @@ const UseKeyList = () => { */ const getTable = () => { const param = getParam() + setState({loading:true}); getKeysList(param).then((res) => { handelResponse( res, (req, msg) => { + setState({loading:false}); console.log('req =>', req) if (req.total > 0) { setState({ lodgingTable: false }) @@ -616,6 +620,7 @@ const UseKeyList = () => { {state.invalidTotal} ) : null} + { } }} /> +
+ {/* 批量上传 */}