From 9a76e537c0c1a414434ad9f685cf6412b994d39a Mon Sep 17 00:00:00 2001 From: fanfan Date: Wed, 27 Mar 2024 10:57:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AD=9B=E9=80=89=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 53 +++++++- package.json | 2 +- src/main.js | 4 +- src/views/dataCenter/goods/Index.vue | 174 ++++++++++++++++++++++++++- yarn.lock | 48 ++++++-- 5 files changed, 263 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb29386..3c14503 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,12 +12,12 @@ "ant-design-vue": "1.7.8", "axios": "^0.19.0", "core-js": "^3.1.2", + "element-ui": "^2.15.14", "enquire.js": "^2.1.6", "lodash.clonedeep": "^4.5.0", "lodash.get": "^4.4.2", "lodash.pick": "^4.4.0", "md5": "^2.2.1", - "moment": "^2.24.0", "nprogress": "^0.2.0", "store": "^2.0.12", "viser-vue": "^2.4.6", @@ -7894,6 +7894,38 @@ "integrity": "sha512-Uk7C+7aPBryUR1Fwvk9VmipBcN9fVsqBO57jV2ZjTm+IZ6BMNqu7EDVEg2HxCNufk6QcWlFsBkhQyQroB2VWKw==", "dev": true }, + "node_modules/element-ui": { + "version": "2.15.14", + "resolved": "https://registry.npmjs.org/element-ui/-/element-ui-2.15.14.tgz", + "integrity": "sha512-2v9fHL0ZGINotOlRIAJD5YuVB8V7WKxrE9Qy7dXhRipa035+kF7WuU/z+tEmLVPBcJ0zt8mOu1DKpWcVzBK8IA==", + "dependencies": { + "async-validator": "~1.8.1", + "babel-helper-vue-jsx-merge-props": "^2.0.0", + "deepmerge": "^1.2.0", + "normalize-wheel": "^1.0.1", + "resize-observer-polyfill": "^1.5.0", + "throttle-debounce": "^1.0.1" + }, + "peerDependencies": { + "vue": "^2.5.17" + } + }, + "node_modules/element-ui/node_modules/async-validator": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz", + "integrity": "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==", + "dependencies": { + "babel-runtime": "6.x" + } + }, + "node_modules/element-ui/node_modules/deepmerge": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz", + "integrity": "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/elliptic": { "version": "6.5.4", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", @@ -13883,9 +13915,9 @@ } }, "node_modules/moment": { - "version": "2.29.4", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", - "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "version": "2.30.1", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", + "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", "engines": { "node": "*" } @@ -14298,6 +14330,11 @@ "node": ">=4" } }, + "node_modules/normalize-wheel": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz", + "integrity": "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==" + }, "node_modules/npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -19088,6 +19125,14 @@ "integrity": "sha512-wCVxLDcFxw7ujDxaeJC6nfl2XfHJNYs8yUYJnvMgtPEFlttP9tHSfRUv2vBe6C4hkVFPWoP1P6ZccbYjmSEkKA==", "dev": true }, + "node_modules/throttle-debounce": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz", + "integrity": "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==", + "engines": { + "node": ">=4" + } + }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", diff --git a/package.json b/package.json index 06dd219..c824e43 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,12 @@ "ant-design-vue": "1.7.8", "axios": "^0.19.0", "core-js": "^3.1.2", + "element-ui": "^2.15.14", "enquire.js": "^2.1.6", "lodash.clonedeep": "^4.5.0", "lodash.get": "^4.4.2", "lodash.pick": "^4.4.0", "md5": "^2.2.1", - "moment": "^2.24.0", "nprogress": "^0.2.0", "store": "^2.0.12", "viser-vue": "^2.4.6", diff --git a/src/main.js b/src/main.js index 67356c3..df71cb7 100644 --- a/src/main.js +++ b/src/main.js @@ -14,7 +14,8 @@ import './permission' // permission control import './utils/filter' // global filter import './global.less' import { Dialog } from '@/components' - +import ElementUI from 'element-ui' +import 'element-ui/lib/theme-chalk/index.css' Vue.config.productionTip = false Vue.prototype.pagination = { total: 0, // 数据总数 @@ -26,6 +27,7 @@ Vue.prototype.pagination = { showTotal: total => `共 ${total} 条记录`, } // mount axios Vue.$http and this.$http +Vue.use(ElementUI) Vue.use(VueAxios) Vue.use(Dialog) diff --git a/src/views/dataCenter/goods/Index.vue b/src/views/dataCenter/goods/Index.vue index 58df41d..7d66273 100644 --- a/src/views/dataCenter/goods/Index.vue +++ b/src/views/dataCenter/goods/Index.vue @@ -70,6 +70,23 @@ {{ item.name }} + +
+ + +
+
搜索 @@ -242,7 +259,7 @@ import * as GoodsApi from '@/api/goods' import { ContentHeader, STable } from '@/components' import CategoryModel from '@/common/model/Category' import * as Api from '@/api/store' - +import moment from 'moment' // 表格表头 const columns = [ { @@ -346,7 +363,9 @@ export default { is_pool: '', data_type: '', categoryId: '', - spec_type:'' + spec_type: '', + start_time: '', + end_time: '', }, // 正在加载 isLoading: false, @@ -410,6 +429,131 @@ export default { categoryIds: [], categoryPriceIds: [], rate: '', + pickerOptions: { + disabledDate(time) { + return time.getTime() > Date.now() + }, + shortcuts: [ + { + text: '今天', + onClick(picker) { + picker.$emit('pick', [new Date(), new Date()]) + }, + }, + { + text: '昨天', + onClick(picker) { + const date = new Date() + date.setTime(date.getTime() - 3600 * 1000 * 24) + picker.$emit('pick', [date, date]) + }, + }, + { + text: '近7天', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '近30天', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '近90天', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '近180天', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + start.setTime(start.getTime() - 3600 * 1000 * 24 * 180) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '近一年', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + start.setTime(start.getTime() - 3600 * 1000 * 24 * 365) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '本周', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + //现在星期几;0代表星期天,6代表星期六 + var thisDay = start.getDay() + //现在是一个月的第几天 + var thisDate = start.getDate() + console.log(thisDay) + console.log(thisDate) + if (thisDay != 0) { + start.setDate(thisDate - thisDay + 1) + } + picker.$emit('pick', [start, end]) + }, + }, + { + text: '本月', + onClick(picker) { + const end = new Date() + const start = new Date() + end.setTime(start.getTime() - 3600 * 1000 * 24) + start.setDate(1) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '本季度', + onClick(picker) { + var oDate = new Date() + var thisYear = oDate.getFullYear() + var thisMonth = oDate.getMonth() + 1 + var n = Math.ceil(thisMonth / 3) // 季度 + var Month = n * 3 - 1 + var start = new Date(thisYear, Month - 2, 1) + var end = new Date() + end.setTime(end.getTime() - 3600 * 1000 * 24) + picker.$emit('pick', [start, end]) + }, + }, + { + text: '本年', + onClick(picker) { + const end = new Date() + const start = new Date() + start.setMonth(0) + start.setDate(1) + end.setTime(end.getTime() - 3600 * 1000 * 24) + picker.$emit('pick', [start, end]) + }, + }, + ], + }, + dateSpan: [], } }, created() { @@ -431,9 +575,6 @@ export default { }, }, methods: { - handleTableChange(e) { - console.log(e) - }, validateAmount() { let row = this.rate console.log(row) @@ -481,6 +622,11 @@ export default { // 确认搜索 handleSearch(e) { + console.log(this.dateSpan) + if (this.dateSpan.length > 0) { + this.queryParam.start_time = this.dateSpan[0] + this.queryParam.end_time = this.dateSpan[1] + } e.preventDefault() this.searchForm.validateFields((error, values) => { if (!error) { @@ -695,6 +841,24 @@ export default { /deep/.ant-card-body { padding: 22px 18px; } +/deep/.el-range-editor--mini .el-range-input { + font-size: 14px; +} +/deep/.el-date-editor .el-range__icon { + line-height: 24px !important; +} +/deep/.el-range-editor--mini .el-range__close-icon { + line-height: 24px !important; +} +/deep/.el-range-editor--mini .el-range-separator { + line-height: 24px !important; +} +/deep/.el-range-editor.el-input__inner { + padding: 3px 0 3px 10px; +} +/deep/.el-picker-panel__sidebar{ + width: 85px; +} // 筛选tab .tab-list { margin-right: 20px; diff --git a/yarn.lock b/yarn.lock index 70a8679..606fe1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2621,6 +2621,13 @@ "resolved" "https://registry.npmjs.org/async-validator/-/async-validator-3.5.2.tgz" "version" "3.5.2" +"async-validator@~1.8.1": + "integrity" "sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==" + "resolved" "https://registry.npmjs.org/async-validator/-/async-validator-1.8.5.tgz" + "version" "1.8.5" + dependencies: + "babel-runtime" "6.x" + "async@^2.6.4": "integrity" "sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA==" "resolved" "https://registry.npmjs.org/async/-/async-2.6.4.tgz" @@ -2718,7 +2725,7 @@ "babel-runtime" "^6.22.0" "babel-types" "^6.24.1" -"babel-helper-vue-jsx-merge-props@^2.0.3": +"babel-helper-vue-jsx-merge-props@^2.0.0", "babel-helper-vue-jsx-merge-props@^2.0.3": "integrity" "sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==" "resolved" "https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz" "version" "2.0.3" @@ -4504,6 +4511,11 @@ "resolved" "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz" "version" "0.1.4" +"deepmerge@^1.2.0": + "integrity" "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" + "resolved" "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz" + "version" "1.5.2" + "deepmerge@^1.5.2": "integrity" "sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==" "resolved" "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.2.tgz" @@ -4877,6 +4889,18 @@ "resolved" "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.302.tgz" "version" "1.4.302" +"element-ui@^2.15.14": + "integrity" "sha512-2v9fHL0ZGINotOlRIAJD5YuVB8V7WKxrE9Qy7dXhRipa035+kF7WuU/z+tEmLVPBcJ0zt8mOu1DKpWcVzBK8IA==" + "resolved" "https://registry.npmjs.org/element-ui/-/element-ui-2.15.14.tgz" + "version" "2.15.14" + dependencies: + "async-validator" "~1.8.1" + "babel-helper-vue-jsx-merge-props" "^2.0.0" + "deepmerge" "^1.2.0" + "normalize-wheel" "^1.0.1" + "resize-observer-polyfill" "^1.5.0" + "throttle-debounce" "^1.0.1" + "elliptic@^6.5.3": "integrity" "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==" "resolved" "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz" @@ -8271,10 +8295,10 @@ dependencies: "minimist" "^1.2.6" -"moment@^2.21.0", "moment@^2.24.0": - "integrity" "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" - "resolved" "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz" - "version" "2.29.4" +"moment@^2.21.0": + "integrity" "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" + "resolved" "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz" + "version" "2.30.1" "move-concurrently@^1.0.1": "integrity" "sha512-hdrFxZOycD/g6A6SoI2bB5NA/5NEqD0569+S47WZhPvm46sD50ZHdYaFmnua5lndde9rCHGjmfK7Z8BuCt/PcQ==" @@ -8548,6 +8572,11 @@ "query-string" "^4.1.0" "sort-keys" "^1.0.0" +"normalize-wheel@^1.0.1": + "integrity" "sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==" + "resolved" "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz" + "version" "1.0.1" + "npm-run-path@^2.0.0": "integrity" "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==" "resolved" "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz" @@ -10067,7 +10096,7 @@ "resolved" "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz" "version" "1.0.0" -"resize-observer-polyfill@^1.5.1": +"resize-observer-polyfill@^1.5.0", "resize-observer-polyfill@^1.5.1": "integrity" "sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==" "resolved" "https://registry.npmjs.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz" "version" "1.5.1" @@ -11186,6 +11215,11 @@ "resolved" "https://registry.npmjs.org/throat/-/throat-4.1.0.tgz" "version" "4.1.0" +"throttle-debounce@^1.0.1": + "integrity" "sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==" + "resolved" "https://registry.npmjs.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz" + "version" "1.1.0" + "through@^2.3.6", "through@~2.3.4", "through@~2.3.8": "integrity" "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" "resolved" "https://registry.npmjs.org/through/-/through-2.3.8.tgz" @@ -11841,7 +11875,7 @@ "resolved" "https://registry.npmmirror.com/vue-ueditor-wrap/-/vue-ueditor-wrap-2.5.6.tgz" "version" "2.5.6" -"vue@*", "vue@^2 || ^3.0.0-0", "vue@^2.0.0", "vue@^2.5.3", "vue@^2.6.0", "vue@^2.6.10", "vue@^2.x", "vue@>= 2.0", "vue@>= 2.5.0", "vue@>=2.5.0", "vue@2.x": +"vue@*", "vue@^2 || ^3.0.0-0", "vue@^2.0.0", "vue@^2.5.17", "vue@^2.5.3", "vue@^2.6.0", "vue@^2.6.10", "vue@^2.x", "vue@>= 2.0", "vue@>= 2.5.0", "vue@>=2.5.0", "vue@2.x": "integrity" "sha512-b2qkFyOM0kwqWFuQmgd4o+uHGU7T+2z3T+WQp8UBjADfEv2n4FEMffzBmCKNP0IGzOEEfYjvtcC62xaSKeQDrQ==" "resolved" "https://registry.npmjs.org/vue/-/vue-2.7.14.tgz" "version" "2.7.14"