From bc22b4397e31538b29856e6d2ea944174ac417c1 Mon Sep 17 00:00:00 2001 From: binbin_pan Date: Wed, 24 Apr 2024 10:14:36 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=86=E6=96=99=E6=95=B0=E6=8D=AE-=E5=BC=B9?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sgzb-screen/src/api/dialog.js | 18 ++ .../src/components/Pagination/index.vue | 118 +++++++++ .../src/components/home/countFlopOne.vue | 17 ++ .../components/home/getMaterialsDialog.vue | 230 ++++++++++++++++++ sgzb-screen/src/components/home/leftOne.vue | 11 +- sgzb-screen/src/untils/scroll-to.js | 58 +++++ 6 files changed, 449 insertions(+), 3 deletions(-) create mode 100644 sgzb-screen/src/api/dialog.js create mode 100644 sgzb-screen/src/components/Pagination/index.vue create mode 100644 sgzb-screen/src/components/home/getMaterialsDialog.vue create mode 100644 sgzb-screen/src/untils/scroll-to.js diff --git a/sgzb-screen/src/api/dialog.js b/sgzb-screen/src/api/dialog.js new file mode 100644 index 00000000..d2f91002 --- /dev/null +++ b/sgzb-screen/src/api/dialog.js @@ -0,0 +1,18 @@ +import { POST, GET } from './index.js' + +const URL_TYPE_LIST = '/screen/material/returnOfMaterialsInfo/getTypeList' +const URL_DETAILS = '/screen/base/largeScreen/home/getMaterialReqData/details' +const URL_UNIT_LIST = '/screen/material/agreementInfo/getUnitList' +const URL_PROJECT_LIST = '/screen/material/agreementInfo/getProjectList' + +// 设备类型 +export const getTypeList = params => GET(URL_TYPE_LIST, params) + +// 详情 +export const getDetails = data => POST(URL_DETAILS, data) + +// 往来单位-下拉 +export const getUnitList = params => GET(URL_UNIT_LIST, params) + +// 工程名称-下拉 +export const getProjectList = params => GET(URL_PROJECT_LIST, params) \ No newline at end of file diff --git a/sgzb-screen/src/components/Pagination/index.vue b/sgzb-screen/src/components/Pagination/index.vue new file mode 100644 index 00000000..57326f8e --- /dev/null +++ b/sgzb-screen/src/components/Pagination/index.vue @@ -0,0 +1,118 @@ + + + + + diff --git a/sgzb-screen/src/components/home/countFlopOne.vue b/sgzb-screen/src/components/home/countFlopOne.vue index f5dda941..66854ecc 100644 --- a/sgzb-screen/src/components/home/countFlopOne.vue +++ b/sgzb-screen/src/components/home/countFlopOne.vue @@ -25,11 +25,17 @@
{{ suffix }}
+ + \ No newline at end of file diff --git a/sgzb-screen/src/components/home/leftOne.vue b/sgzb-screen/src/components/home/leftOne.vue index c019dff1..0c6a8a20 100644 --- a/sgzb-screen/src/components/home/leftOne.vue +++ b/sgzb-screen/src/components/home/leftOne.vue @@ -4,9 +4,11 @@
领料数据
- -
- +
+ +
+
+
@@ -52,6 +54,9 @@ export default { } else { return str.replace(/(\d{3})(?=\d)/g, '$1,'); // 直接在中间用逗号分割 } + }, + handleClick(maType) { + this.$refs.countFlopOne.handleClick(maType) } } } diff --git a/sgzb-screen/src/untils/scroll-to.js b/sgzb-screen/src/untils/scroll-to.js new file mode 100644 index 00000000..c5d8e04e --- /dev/null +++ b/sgzb-screen/src/untils/scroll-to.js @@ -0,0 +1,58 @@ +Math.easeInOutQuad = function(t, b, c, d) { + t /= d / 2 + if (t < 1) { + return c / 2 * t * t + b + } + t-- + return -c / 2 * (t * (t - 2) - 1) + b +} + +// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts +var requestAnimFrame = (function() { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) } +})() + +/** + * Because it's so fucking difficult to detect the scrolling element, just move them all + * @param {number} amount + */ +function move(amount) { + document.documentElement.scrollTop = amount + document.body.parentNode.scrollTop = amount + document.body.scrollTop = amount +} + +function position() { + return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop +} + +/** + * @param {number} to + * @param {number} duration + * @param {Function} callback + */ +export function scrollTo(to, duration, callback) { + const start = position() + const change = to - start + const increment = 20 + let currentTime = 0 + duration = (typeof (duration) === 'undefined') ? 500 : duration + var animateScroll = function() { + // increment the time + currentTime += increment + // find the value with the quadratic in-out easing function + var val = Math.easeInOutQuad(currentTime, start, change, duration) + // move the document.body + move(val) + // do the animation unless its over + if (currentTime < duration) { + requestAnimFrame(animateScroll) + } else { + if (callback && typeof (callback) === 'function') { + // the animation is done so lets callback + callback() + } + } + } + animateScroll() +}