Elements-SY

et86黑名单维护

1 +import request from "@/utils/request";
2 +
3 +// HScode黑名单查询
4 +export function findHsCodeList(data) {
5 + return request({
6 + url: "/etes/findHsCodeList",
7 + method: "post",
8 + data: data,
9 + });
10 +}
11 +
12 +// HScode黑名单删除
13 +export function delBlackList(data) {
14 + return request({
15 + url: "/etes/delBlackList",
16 + method: "post",
17 + data: data,
18 + });
19 +}
20 +
21 +// HScode黑名单下载模板
22 +export function downLoadTemplate(template) {
23 + return request({
24 + url: "/etes/downLoadTemplate?template=" + template,
25 + method: "get",
26 + responseType: "blob",
27 + });
28 +}
29 +
30 +// HScode黑名单导入
31 +export function uploadHsCode(data) {
32 + return request({
33 + url: "/etes/uploadHsCode",
34 + method: "post",
35 + data: data,
36 + });
37 +}
38 +
1 <template> 1 <template>
2 <div class="table-container"> 2 <div class="table-container">
3 - <el-row v-if="attrs.btnCofig.isBtn" style="margin-bottom: 15px"> 3 + <el-row
4 + v-if="attrs.btnCofig.isBtn"
5 + style="margin-bottom: 15px"
6 + id="group-btn"
7 + >
4 <el-col> 8 <el-col>
5 <span 9 <span
6 v-for="(item, i) in attrs.btnCofig.btnGroup" 10 v-for="(item, i) in attrs.btnCofig.btnGroup"
...@@ -13,8 +17,8 @@ ...@@ -13,8 +17,8 @@
13 :round="item.round" 17 :round="item.round"
14 :size="item.size" 18 :size="item.size"
15 :loading="item.loading" 19 :loading="item.loading"
16 - @click="handleClick(item)" 20 + @click="handleClick(item, i)"
17 - v-if="item.btnName !== '导入' && item.btnName !== '导出'" 21 + v-if="item.btnName !== '导入' && item.btnName !== '增加'"
18 >{{ item.btnName }}</el-button 22 >{{ item.btnName }}</el-button
19 > 23 >
20 <el-upload 24 <el-upload
...@@ -62,8 +66,10 @@ ...@@ -62,8 +66,10 @@
62 <!-- 分页 --> 66 <!-- 分页 -->
63 <div 67 <div
64 v-if="pageConfig.isPagination" 68 v-if="pageConfig.isPagination"
69 + id="pagination"
65 class="pagination-container" 70 class="pagination-container"
66 :style="{ textAlign: pageConfig.position || 'right' }" 71 :style="{ textAlign: pageConfig.position || 'right' }"
72 + ref="paginationRef"
67 > 73 >
68 <el-pagination 74 <el-pagination
69 background 75 background
...@@ -219,8 +225,8 @@ export default { ...@@ -219,8 +225,8 @@ export default {
219 this.$emit("currentChange", e); 225 this.$emit("currentChange", e);
220 }, 226 },
221 // btn点击事件注册 227 // btn点击事件注册
222 - handleClick(item) { 228 + handleClick(item, i) {
223 - this.$emit(item.event, item); 229 + this.$emit(item.event, item, i);
224 }, 230 },
225 // 拖拽行更新排序 231 // 拖拽行更新排序
226 rowDrop() { 232 rowDrop() {
...@@ -259,6 +265,9 @@ export default { ...@@ -259,6 +265,9 @@ export default {
259 }, 265 },
260 // 选择上传 266 // 选择上传
261 toUpload(options) { 267 toUpload(options) {
268 + this.$refs.upload.map((item) => {
269 + item.clearFiles(); //上传成功之后清除历史记录
270 + });
262 this.$emit("upload", options); 271 this.$emit("upload", options);
263 }, 272 },
264 //移除上传 273 //移除上传
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
4 <sidebar class="sidebar-container" 4 <sidebar class="sidebar-container"
5 :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }" /> 5 :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBg : variables.menuLightBg }" />
6 <div :class="{ hasTagsView: needTagsView }" class="main-container"> 6 <div :class="{ hasTagsView: needTagsView }" class="main-container">
7 - <div :class="{ 'fixed-header': fixedHeader }" ref="headerBlock"> 7 + <div :class="{ 'fixed-header': fixedHeader }">
8 <navbar /> 8 <navbar />
9 <tags-view v-if="needTagsView" /> 9 <tags-view v-if="needTagsView" />
10 </div> 10 </div>
......
1 -import store from '@/store' 1 +import store from "@/store";
2 2
3 -const { body } = document 3 +const { body } = document;
4 -const WIDTH = 992 // refer to Bootstrap's responsive design 4 +const WIDTH = 992; // refer to Bootstrap's responsive design
5 5
6 export default { 6 export default {
7 watch: { 7 watch: {
8 $route(route) { 8 $route(route) {
9 + this.getBlockCurrentHeight();
9 if (this.device === "mobile" && this.sidebar.opened) { 10 if (this.device === "mobile" && this.sidebar.opened) {
10 store.dispatch("app/closeSideBar", { withoutAnimation: false }); 11 store.dispatch("app/closeSideBar", { withoutAnimation: false });
11 } 12 }
...@@ -23,7 +24,9 @@ export default { ...@@ -23,7 +24,9 @@ export default {
23 store.dispatch("app/toggleDevice", "mobile"); 24 store.dispatch("app/toggleDevice", "mobile");
24 store.dispatch("app/closeSideBar", { withoutAnimation: true }); 25 store.dispatch("app/closeSideBar", { withoutAnimation: true });
25 } 26 }
26 - this.getBlockCurrentHeight(); 27 + this.$nextTick(()=>{
28 + this.getBlockCurrentHeight();
29 + })
27 }, 30 },
28 methods: { 31 methods: {
29 // use $_ for mixins properties 32 // use $_ for mixins properties
...@@ -42,9 +45,9 @@ export default { ...@@ -42,9 +45,9 @@ export default {
42 } 45 }
43 } 46 }
44 }, 47 },
45 - getBlockCurrentHeight(){; 48 + getBlockCurrentHeight() {
46 - // console.log(this.$refs.headerBlock, this.$refs.headerBlock.clientHeight); 49 + let height = this.$refs.appMainBlock.$el.clientHeight;
47 - // console.log(this.$refs.appMainBlock); 50 + this.$store.dispatch("app/setAppMainBlockCH", height);
48 - } 51 + },
49 }, 52 },
50 }; 53 };
......
...@@ -82,7 +82,7 @@ export const constantRoutes = [ ...@@ -82,7 +82,7 @@ export const constantRoutes = [
82 { 82 {
83 path: "/errorInfo", 83 path: "/errorInfo",
84 component: (resolve) => 84 component: (resolve) =>
85 - require(["@/views/et86Config/et86HsCodeBlack/errorInfo"], resolve), 85 + require(["@/views/et86Config/errorInfo"], resolve),
86 name: "errorInfo", 86 name: "errorInfo",
87 meta: { title: "错误信息提示", icon: "user" }, 87 meta: { title: "错误信息提示", icon: "user" },
88 }, 88 },
......
1 const getters = { 1 const getters = {
2 - sidebar: state => state.app.sidebar, 2 + sidebar: (state) => state.app.sidebar,
3 - size: state => state.app.size, 3 + size: (state) => state.app.size,
4 - device: state => state.app.device, 4 + device: (state) => state.app.device,
5 - visitedViews: state => state.tagsView.visitedViews, 5 + appMainBlockClientHeight: (state) => state.app.appMainBlockClientHeight,
6 - cachedViews: state => state.tagsView.cachedViews, 6 + visitedViews: (state) => state.tagsView.visitedViews,
7 - token: state => state.user.token, 7 + cachedViews: (state) => state.tagsView.cachedViews,
8 - avatar: state => state.user.avatar, 8 + token: (state) => state.user.token,
9 - name: state => state.user.name, 9 + avatar: (state) => state.user.avatar,
10 - id: state => state.user.id, 10 + name: (state) => state.user.name,
11 - activePortName: state => state.user.activePortName, 11 + id: (state) => state.user.id,
12 - portName: state => state.user.portName, 12 + activePortName: (state) => state.user.activePortName,
13 - introduction: state => state.user.introduction, 13 + portName: (state) => state.user.portName,
14 - roles: state => state.user.roles, 14 + introduction: (state) => state.user.introduction,
15 - permissions: state => state.user.permissions, 15 + roles: (state) => state.user.roles,
16 - permission_routes: state => state.permission.routes, 16 + permissions: (state) => state.user.permissions,
17 - topbarRouters: state => state.permission.topbarRouters, 17 + permission_routes: (state) => state.permission.routes,
18 - defaultRoutes: state => state.permission.defaultRoutes, 18 + topbarRouters: (state) => state.permission.topbarRouters,
19 - sidebarRouters: state => state.permission.sidebarRouters, 19 + defaultRoutes: (state) => state.permission.defaultRoutes,
20 - filghtAllData: state => state.permission.filghtAllData, 20 + sidebarRouters: (state) => state.permission.sidebarRouters,
21 - tableHeader: state => state.user.tableHeader 21 + filghtAllData: (state) => state.permission.filghtAllData,
22 -} 22 + tableHeader: (state) => state.user.tableHeader,
23 +};
23 export default getters 24 export default getters
......
...@@ -2,13 +2,16 @@ ...@@ -2,13 +2,16 @@
2 2
3 const state = { 3 const state = {
4 sidebar: { 4 sidebar: {
5 - opened: localStorage.getItem('sidebarStatus') ? !!+localStorage.getItem('sidebarStatus') : true, 5 + opened: localStorage.getItem("sidebarStatus")
6 - withoutAnimation: false 6 + ? !!+localStorage.getItem("sidebarStatus")
7 + : true,
8 + withoutAnimation: false,
7 }, 9 },
8 - device: 'desktop', 10 + device: "desktop",
9 //size: Cookies.get('size') || 'medium' 11 //size: Cookies.get('size') || 'medium'
10 - size: localStorage.getItem('size') || 'medium' 12 + size: localStorage.getItem("size") || "medium",
11 -} 13 + appMainBlockClientHeight: null
14 +};
12 15
13 const mutations = { 16 const mutations = {
14 TOGGLE_SIDEBAR: state => { 17 TOGGLE_SIDEBAR: state => {
...@@ -35,23 +38,30 @@ const mutations = { ...@@ -35,23 +38,30 @@ const mutations = {
35 state.size = size 38 state.size = size
36 //Cookies.set('size', size) 39 //Cookies.set('size', size)
37 localStorage.setItem('size', size) 40 localStorage.setItem('size', size)
38 - } 41 + },
42 + SET_APPMAINBLOCKCH: (state, height) => {
43 + state.appMainBlockClientHeight = height;
44 + },
45 +
39 } 46 }
40 47
41 const actions = { 48 const actions = {
42 toggleSideBar({ commit }) { 49 toggleSideBar({ commit }) {
43 - commit('TOGGLE_SIDEBAR') 50 + commit("TOGGLE_SIDEBAR");
44 }, 51 },
45 closeSideBar({ commit }, { withoutAnimation }) { 52 closeSideBar({ commit }, { withoutAnimation }) {
46 - commit('CLOSE_SIDEBAR', withoutAnimation) 53 + commit("CLOSE_SIDEBAR", withoutAnimation);
47 }, 54 },
48 toggleDevice({ commit }, device) { 55 toggleDevice({ commit }, device) {
49 - commit('TOGGLE_DEVICE', device) 56 + commit("TOGGLE_DEVICE", device);
50 }, 57 },
51 setSize({ commit }, size) { 58 setSize({ commit }, size) {
52 - commit('SET_SIZE', size) 59 + commit("SET_SIZE", size);
53 - } 60 + },
54 -} 61 + setAppMainBlockCH({ commit }, height) {
62 + commit("SET_APPMAINBLOCKCH", height);
63 + },
64 +};
55 65
56 export default { 66 export default {
57 namespaced: true, 67 namespaced: true,
......
1 -import { parseTime } from './FedEx' 1 +import { parseTime } from "./FedEx";
2 2
3 /** 3 /**
4 * 表格时间格式化 4 * 表格时间格式化
5 */ 5 */
6 export function formatDate(cellValue) { 6 export function formatDate(cellValue) {
7 if (cellValue == null || cellValue == "") return ""; 7 if (cellValue == null || cellValue == "") return "";
8 - var date = new Date(cellValue) 8 + var date = new Date(cellValue);
9 - var year = date.getFullYear() 9 + var year = date.getFullYear();
10 - var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 10 + var month =
11 - var day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate() 11 + date.getMonth() + 1 < 10
12 - var hours = date.getHours() < 10 ? '0' + date.getHours() : date.getHours() 12 + ? "0" + (date.getMonth() + 1)
13 - var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() 13 + : date.getMonth() + 1;
14 - var seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() 14 + var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
15 - return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds 15 + var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
16 + var minutes =
17 + date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
18 + var seconds =
19 + date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
20 + return (
21 + year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds
22 + );
16 } 23 }
17 24
18 /** 25 /**
...@@ -21,40 +28,40 @@ export function formatDate(cellValue) { ...@@ -21,40 +28,40 @@ export function formatDate(cellValue) {
21 * @returns {string} 28 * @returns {string}
22 */ 29 */
23 export function formatTime(time, option) { 30 export function formatTime(time, option) {
24 - if (('' + time).length === 10) { 31 + if (("" + time).length === 10) {
25 - time = parseInt(time) * 1000 32 + time = parseInt(time) * 1000;
26 } else { 33 } else {
27 - time = +time 34 + time = +time;
28 } 35 }
29 - const d = new Date(time) 36 + const d = new Date(time);
30 - const now = Date.now() 37 + const now = Date.now();
31 38
32 - const diff = (now - d) / 1000 39 + const diff = (now - d) / 1000;
33 40
34 if (diff < 30) { 41 if (diff < 30) {
35 - return '刚刚' 42 + return "刚刚";
36 } else if (diff < 3600) { 43 } else if (diff < 3600) {
37 // less 1 hour 44 // less 1 hour
38 - return Math.ceil(diff / 60) + '分钟前' 45 + return Math.ceil(diff / 60) + "分钟前";
39 } else if (diff < 3600 * 24) { 46 } else if (diff < 3600 * 24) {
40 - return Math.ceil(diff / 3600) + '小时前' 47 + return Math.ceil(diff / 3600) + "小时前";
41 } else if (diff < 3600 * 24 * 2) { 48 } else if (diff < 3600 * 24 * 2) {
42 - return '1天前' 49 + return "1天前";
43 } 50 }
44 if (option) { 51 if (option) {
45 - return parseTime(time, option) 52 + return parseTime(time, option);
46 } else { 53 } else {
47 return ( 54 return (
48 d.getMonth() + 55 d.getMonth() +
49 1 + 56 1 +
50 - '月' + 57 + "月" +
51 d.getDate() + 58 d.getDate() +
52 - '日' + 59 + "日" +
53 d.getHours() + 60 d.getHours() +
54 - '时' + 61 + "时" +
55 d.getMinutes() + 62 d.getMinutes() +
56 - '分' 63 + "分"
57 - ) 64 + );
58 } 65 }
59 } 66 }
60 67
...@@ -63,18 +70,18 @@ export function formatTime(time, option) { ...@@ -63,18 +70,18 @@ export function formatTime(time, option) {
63 * @returns {Object} 70 * @returns {Object}
64 */ 71 */
65 export function getQueryObject(url) { 72 export function getQueryObject(url) {
66 - url = url == null ? window.location.href : url 73 + url = url == null ? window.location.href : url;
67 - const search = url.substring(url.lastIndexOf('?') + 1) 74 + const search = url.substring(url.lastIndexOf("?") + 1);
68 - const obj = {} 75 + const obj = {};
69 - const reg = /([^?&=]+)=([^?&=]*)/g 76 + const reg = /([^?&=]+)=([^?&=]*)/g;
70 search.replace(reg, (rs, $1, $2) => { 77 search.replace(reg, (rs, $1, $2) => {
71 - const name = decodeURIComponent($1) 78 + const name = decodeURIComponent($1);
72 - let val = decodeURIComponent($2) 79 + let val = decodeURIComponent($2);
73 - val = String(val) 80 + val = String(val);
74 - obj[name] = val 81 + obj[name] = val;
75 - return rs 82 + return rs;
76 - }) 83 + });
77 - return obj 84 + return obj;
78 } 85 }
79 86
80 /** 87 /**
...@@ -83,14 +90,14 @@ export function getQueryObject(url) { ...@@ -83,14 +90,14 @@ export function getQueryObject(url) {
83 */ 90 */
84 export function byteLength(str) { 91 export function byteLength(str) {
85 // returns the byte length of an utf8 string 92 // returns the byte length of an utf8 string
86 - let s = str.length 93 + let s = str.length;
87 for (var i = str.length - 1; i >= 0; i--) { 94 for (var i = str.length - 1; i >= 0; i--) {
88 - const code = str.charCodeAt(i) 95 + const code = str.charCodeAt(i);
89 - if (code > 0x7f && code <= 0x7ff) s++ 96 + if (code > 0x7f && code <= 0x7ff) s++;
90 - else if (code > 0x7ff && code <= 0xffff) s += 2 97 + else if (code > 0x7ff && code <= 0xffff) s += 2;
91 - if (code >= 0xDC00 && code <= 0xDFFF) i-- 98 + if (code >= 0xdc00 && code <= 0xdfff) i--;
92 } 99 }
93 - return s 100 + return s;
94 } 101 }
95 102
96 /** 103 /**
...@@ -98,13 +105,13 @@ export function byteLength(str) { ...@@ -98,13 +105,13 @@ export function byteLength(str) {
98 * @returns {Array} 105 * @returns {Array}
99 */ 106 */
100 export function cleanArray(actual) { 107 export function cleanArray(actual) {
101 - const newArray = [] 108 + const newArray = [];
102 for (let i = 0; i < actual.length; i++) { 109 for (let i = 0; i < actual.length; i++) {
103 if (actual[i]) { 110 if (actual[i]) {
104 - newArray.push(actual[i]) 111 + newArray.push(actual[i]);
105 } 112 }
106 } 113 }
107 - return newArray 114 + return newArray;
108 } 115 }
109 116
110 /** 117 /**
...@@ -112,13 +119,13 @@ export function cleanArray(actual) { ...@@ -112,13 +119,13 @@ export function cleanArray(actual) {
112 * @returns {Array} 119 * @returns {Array}
113 */ 120 */
114 export function param(json) { 121 export function param(json) {
115 - if (!json) return '' 122 + if (!json) return "";
116 return cleanArray( 123 return cleanArray(
117 - Object.keys(json).map(key => { 124 + Object.keys(json).map((key) => {
118 - if (json[key] === undefined) return '' 125 + if (json[key] === undefined) return "";
119 - return encodeURIComponent(key) + '=' + encodeURIComponent(json[key]) 126 + return encodeURIComponent(key) + "=" + encodeURIComponent(json[key]);
120 }) 127 })
121 - ).join('&') 128 + ).join("&");
122 } 129 }
123 130
124 /** 131 /**
...@@ -126,21 +133,21 @@ export function param(json) { ...@@ -126,21 +133,21 @@ export function param(json) {
126 * @returns {Object} 133 * @returns {Object}
127 */ 134 */
128 export function param2Obj(url) { 135 export function param2Obj(url) {
129 - const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ') 136 + const search = decodeURIComponent(url.split("?")[1]).replace(/\+/g, " ");
130 if (!search) { 137 if (!search) {
131 - return {} 138 + return {};
132 } 139 }
133 - const obj = {} 140 + const obj = {};
134 - const searchArr = search.split('&') 141 + const searchArr = search.split("&");
135 - searchArr.forEach(v => { 142 + searchArr.forEach((v) => {
136 - const index = v.indexOf('=') 143 + const index = v.indexOf("=");
137 if (index !== -1) { 144 if (index !== -1) {
138 - const name = v.substring(0, index) 145 + const name = v.substring(0, index);
139 - const val = v.substring(index + 1, v.length) 146 + const val = v.substring(index + 1, v.length);
140 - obj[name] = val 147 + obj[name] = val;
141 } 148 }
142 - }) 149 + });
143 - return obj 150 + return obj;
144 } 151 }
145 152
146 /** 153 /**
...@@ -148,9 +155,9 @@ export function param2Obj(url) { ...@@ -148,9 +155,9 @@ export function param2Obj(url) {
148 * @returns {string} 155 * @returns {string}
149 */ 156 */
150 export function html2Text(val) { 157 export function html2Text(val) {
151 - const div = document.createElement('div') 158 + const div = document.createElement("div");
152 - div.innerHTML = val 159 + div.innerHTML = val;
153 - return div.textContent || div.innerText 160 + return div.textContent || div.innerText;
154 } 161 }
155 162
156 /** 163 /**
...@@ -160,21 +167,21 @@ export function html2Text(val) { ...@@ -160,21 +167,21 @@ export function html2Text(val) {
160 * @returns {Object} 167 * @returns {Object}
161 */ 168 */
162 export function objectMerge(target, source) { 169 export function objectMerge(target, source) {
163 - if (typeof target !== 'object') { 170 + if (typeof target !== "object") {
164 - target = {} 171 + target = {};
165 } 172 }
166 if (Array.isArray(source)) { 173 if (Array.isArray(source)) {
167 - return source.slice() 174 + return source.slice();
168 } 175 }
169 - Object.keys(source).forEach(property => { 176 + Object.keys(source).forEach((property) => {
170 - const sourceProperty = source[property] 177 + const sourceProperty = source[property];
171 - if (typeof sourceProperty === 'object') { 178 + if (typeof sourceProperty === "object") {
172 - target[property] = objectMerge(target[property], sourceProperty) 179 + target[property] = objectMerge(target[property], sourceProperty);
173 } else { 180 } else {
174 - target[property] = sourceProperty 181 + target[property] = sourceProperty;
175 } 182 }
176 - }) 183 + });
177 - return target 184 + return target;
178 } 185 }
179 186
180 /** 187 /**
...@@ -183,18 +190,18 @@ export function objectMerge(target, source) { ...@@ -183,18 +190,18 @@ export function objectMerge(target, source) {
183 */ 190 */
184 export function toggleClass(element, className) { 191 export function toggleClass(element, className) {
185 if (!element || !className) { 192 if (!element || !className) {
186 - return 193 + return;
187 } 194 }
188 - let classString = element.className 195 + let classString = element.className;
189 - const nameIndex = classString.indexOf(className) 196 + const nameIndex = classString.indexOf(className);
190 if (nameIndex === -1) { 197 if (nameIndex === -1) {
191 - classString += '' + className 198 + classString += "" + className;
192 } else { 199 } else {
193 classString = 200 classString =
194 classString.substr(0, nameIndex) + 201 classString.substr(0, nameIndex) +
195 - classString.substr(nameIndex + className.length) 202 + classString.substr(nameIndex + className.length);
196 } 203 }
197 - element.className = classString 204 + element.className = classString;
198 } 205 }
199 206
200 /** 207 /**
...@@ -202,10 +209,10 @@ export function toggleClass(element, className) { ...@@ -202,10 +209,10 @@ export function toggleClass(element, className) {
202 * @returns {Date} 209 * @returns {Date}
203 */ 210 */
204 export function getTime(type) { 211 export function getTime(type) {
205 - if (type === 'start') { 212 + if (type === "start") {
206 - return new Date().getTime() - 3600 * 1000 * 24 * 90 213 + return new Date().getTime() - 3600 * 1000 * 24 * 90;
207 } else { 214 } else {
208 - return new Date(new Date().toDateString()) 215 + return new Date(new Date().toDateString());
209 } 216 }
210 } 217 }
211 218
...@@ -216,38 +223,38 @@ export function getTime(type) { ...@@ -216,38 +223,38 @@ export function getTime(type) {
216 * @return {*} 223 * @return {*}
217 */ 224 */
218 export function debounce(func, wait, immediate) { 225 export function debounce(func, wait, immediate) {
219 - let timeout, args, context, timestamp, result 226 + let timeout, args, context, timestamp, result;
220 227
221 const later = function () { 228 const later = function () {
222 // 据上一次触发时间间隔 229 // 据上一次触发时间间隔
223 - const last = +new Date() - timestamp 230 + const last = +new Date() - timestamp;
224 231
225 // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait 232 // 上次被包装函数被调用时间间隔 last 小于设定时间间隔 wait
226 if (last < wait && last > 0) { 233 if (last < wait && last > 0) {
227 - timeout = setTimeout(later, wait - last) 234 + timeout = setTimeout(later, wait - last);
228 } else { 235 } else {
229 - timeout = null 236 + timeout = null;
230 // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用 237 // 如果设定为immediate===true,因为开始边界已经调用过了此处无需调用
231 if (!immediate) { 238 if (!immediate) {
232 - result = func.apply(context, args) 239 + result = func.apply(context, args);
233 - if (!timeout) context = args = null 240 + if (!timeout) context = args = null;
234 } 241 }
235 } 242 }
236 - } 243 + };
237 244
238 return function (...args) { 245 return function (...args) {
239 - context = this 246 + context = this;
240 - timestamp = +new Date() 247 + timestamp = +new Date();
241 - const callNow = immediate && !timeout 248 + const callNow = immediate && !timeout;
242 // 如果延时不存在,重新设定延时 249 // 如果延时不存在,重新设定延时
243 - if (!timeout) timeout = setTimeout(later, wait) 250 + if (!timeout) timeout = setTimeout(later, wait);
244 if (callNow) { 251 if (callNow) {
245 - result = func.apply(context, args) 252 + result = func.apply(context, args);
246 - context = args = null 253 + context = args = null;
247 } 254 }
248 255
249 - return result 256 + return result;
250 - } 257 + };
251 } 258 }
252 259
253 /** 260 /**
...@@ -258,18 +265,18 @@ export function debounce(func, wait, immediate) { ...@@ -258,18 +265,18 @@ export function debounce(func, wait, immediate) {
258 * @returns {Object} 265 * @returns {Object}
259 */ 266 */
260 export function deepClone(source) { 267 export function deepClone(source) {
261 - if (!source && typeof source !== 'object') { 268 + if (!source && typeof source !== "object") {
262 - throw new Error('error arguments', 'deepClone') 269 + throw new Error("error arguments", "deepClone");
263 } 270 }
264 - const targetObj = source.constructor === Array ? [] : {} 271 + const targetObj = source.constructor === Array ? [] : {};
265 - Object.keys(source).forEach(keys => { 272 + Object.keys(source).forEach((keys) => {
266 - if (source[keys] && typeof source[keys] === 'object') { 273 + if (source[keys] && typeof source[keys] === "object") {
267 - targetObj[keys] = deepClone(source[keys]) 274 + targetObj[keys] = deepClone(source[keys]);
268 } else { 275 } else {
269 - targetObj[keys] = source[keys] 276 + targetObj[keys] = source[keys];
270 } 277 }
271 - }) 278 + });
272 - return targetObj 279 + return targetObj;
273 } 280 }
274 281
275 /** 282 /**
...@@ -277,16 +284,16 @@ export function deepClone(source) { ...@@ -277,16 +284,16 @@ export function deepClone(source) {
277 * @returns {Array} 284 * @returns {Array}
278 */ 285 */
279 export function uniqueArr(arr) { 286 export function uniqueArr(arr) {
280 - return Array.from(new Set(arr)) 287 + return Array.from(new Set(arr));
281 } 288 }
282 289
283 /** 290 /**
284 * @returns {string} 291 * @returns {string}
285 */ 292 */
286 export function createUniqueString() { 293 export function createUniqueString() {
287 - const timestamp = +new Date() + '' 294 + const timestamp = +new Date() + "";
288 - const randomNum = parseInt((1 + Math.random()) * 65536) + '' 295 + const randomNum = parseInt((1 + Math.random()) * 65536) + "";
289 - return (+(randomNum + timestamp)).toString(32) 296 + return (+(randomNum + timestamp)).toString(32);
290 } 297 }
291 298
292 /** 299 /**
...@@ -296,7 +303,7 @@ export function createUniqueString() { ...@@ -296,7 +303,7 @@ export function createUniqueString() {
296 * @returns {boolean} 303 * @returns {boolean}
297 */ 304 */
298 export function hasClass(ele, cls) { 305 export function hasClass(ele, cls) {
299 - return !!ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)')) 306 + return !!ele.className.match(new RegExp("(\\s|^)" + cls + "(\\s|$)"));
300 } 307 }
301 308
302 /** 309 /**
...@@ -305,7 +312,7 @@ export function hasClass(ele, cls) { ...@@ -305,7 +312,7 @@ export function hasClass(ele, cls) {
305 * @param {string} cls 312 * @param {string} cls
306 */ 313 */
307 export function addClass(ele, cls) { 314 export function addClass(ele, cls) {
308 - if (!hasClass(ele, cls)) ele.className += ' ' + cls 315 + if (!hasClass(ele, cls)) ele.className += " " + cls;
309 } 316 }
310 317
311 /** 318 /**
...@@ -315,76 +322,122 @@ export function addClass(ele, cls) { ...@@ -315,76 +322,122 @@ export function addClass(ele, cls) {
315 */ 322 */
316 export function removeClass(ele, cls) { 323 export function removeClass(ele, cls) {
317 if (hasClass(ele, cls)) { 324 if (hasClass(ele, cls)) {
318 - const reg = new RegExp('(\\s|^)' + cls + '(\\s|$)') 325 + const reg = new RegExp("(\\s|^)" + cls + "(\\s|$)");
319 - ele.className = ele.className.replace(reg, ' ') 326 + ele.className = ele.className.replace(reg, " ");
320 } 327 }
321 } 328 }
322 329
323 export function makeMap(str, expectsLowerCase) { 330 export function makeMap(str, expectsLowerCase) {
324 - const map = Object.create(null) 331 + const map = Object.create(null);
325 - const list = str.split(',') 332 + const list = str.split(",");
326 for (let i = 0; i < list.length; i++) { 333 for (let i = 0; i < list.length; i++) {
327 - map[list[i]] = true 334 + map[list[i]] = true;
328 } 335 }
329 - return expectsLowerCase 336 + return expectsLowerCase ? (val) => map[val.toLowerCase()] : (val) => map[val];
330 - ? val => map[val.toLowerCase()]
331 - : val => map[val]
332 } 337 }
333 338
334 -export const exportDefault = 'export default ' 339 +export const exportDefault = "export default ";
335 340
336 export const beautifierConf = { 341 export const beautifierConf = {
337 html: { 342 html: {
338 - indent_size: '2', 343 + indent_size: "2",
339 - indent_char: ' ', 344 + indent_char: " ",
340 - max_preserve_newlines: '-1', 345 + max_preserve_newlines: "-1",
341 preserve_newlines: false, 346 preserve_newlines: false,
342 keep_array_indentation: false, 347 keep_array_indentation: false,
343 break_chained_methods: false, 348 break_chained_methods: false,
344 - indent_scripts: 'separate', 349 + indent_scripts: "separate",
345 - brace_style: 'end-expand', 350 + brace_style: "end-expand",
346 space_before_conditional: true, 351 space_before_conditional: true,
347 unescape_strings: false, 352 unescape_strings: false,
348 jslint_happy: false, 353 jslint_happy: false,
349 end_with_newline: true, 354 end_with_newline: true,
350 - wrap_line_length: '110', 355 + wrap_line_length: "110",
351 indent_inner_html: true, 356 indent_inner_html: true,
352 comma_first: false, 357 comma_first: false,
353 e4x: true, 358 e4x: true,
354 - indent_empty_lines: true 359 + indent_empty_lines: true,
355 }, 360 },
356 js: { 361 js: {
357 - indent_size: '2', 362 + indent_size: "2",
358 - indent_char: ' ', 363 + indent_char: " ",
359 - max_preserve_newlines: '-1', 364 + max_preserve_newlines: "-1",
360 preserve_newlines: false, 365 preserve_newlines: false,
361 keep_array_indentation: false, 366 keep_array_indentation: false,
362 break_chained_methods: false, 367 break_chained_methods: false,
363 - indent_scripts: 'normal', 368 + indent_scripts: "normal",
364 - brace_style: 'end-expand', 369 + brace_style: "end-expand",
365 space_before_conditional: true, 370 space_before_conditional: true,
366 unescape_strings: false, 371 unescape_strings: false,
367 jslint_happy: true, 372 jslint_happy: true,
368 end_with_newline: true, 373 end_with_newline: true,
369 - wrap_line_length: '110', 374 + wrap_line_length: "110",
370 indent_inner_html: true, 375 indent_inner_html: true,
371 comma_first: false, 376 comma_first: false,
372 e4x: true, 377 e4x: true,
373 - indent_empty_lines: true 378 + indent_empty_lines: true,
374 - } 379 + },
375 -} 380 +};
376 381
377 // 首字母大小 382 // 首字母大小
378 export function titleCase(str) { 383 export function titleCase(str) {
379 - return str.replace(/( |^)[a-z]/g, L => L.toUpperCase()) 384 + return str.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
380 } 385 }
381 386
382 // 下划转驼峰 387 // 下划转驼峰
383 export function camelCase(str) { 388 export function camelCase(str) {
384 - return str.replace(/-[a-z]/g, str1 => str1.substr(-1).toUpperCase()) 389 + return str.replace(/-[a-z]/g, (str1) => str1.substr(-1).toUpperCase());
385 } 390 }
386 391
387 export function isNumberStr(str) { 392 export function isNumberStr(str) {
388 - return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str) 393 + return /^[+-]?(0|([1-9]\d*))(\.\d+)?$/g.test(str);
389 } 394 }
390 395
396 +// 获取计算元素的属性的margin + padding + clientHeight
397 +function getPropertyValue(el) {
398 + let style, marginTop, marginBottom, paddingTop, paddingBottom;
399 + style = window.getComputedStyle(el, null);
400 + marginTop = style.getPropertyValue("margin-top");
401 + marginBottom = style.getPropertyValue("margin-bottom");
402 + paddingTop = style.getPropertyValue("padding-top");
403 + paddingBottom = style.getPropertyValue("padding-bottom");
404 + return (
405 + parseFloat(marginTop) +
406 + parseFloat(marginBottom) +
407 + parseFloat(paddingTop) +
408 + parseFloat(paddingBottom)
409 + );
410 +}
411 +
412 +// 获取页面内除了table其他模块所占的高
413 +export function restTableHeight($refs) {
414 + let heigth = 0;
415 + Object.keys($refs).map((key) => {
416 + if (key != "formHeaderRef") {
417 + if (key == "ylTable") {
418 + $refs[key].$children.map((item) => {
419 + if (item.$el.id == "group-btn") {
420 + // table表格组合按钮
421 + heigth += getPropertyValue(item.$el);
422 + heigth += item.$el.clientHeight;
423 + } else if (item.$el.className == "el-pagination is-background") {
424 + // table表格组合分页
425 + if (item.$el.offsetParent.className == "pagination-container") {
426 + heigth += getPropertyValue(item.$el.offsetParent);
427 + heigth += item.$el.offsetParent.clientHeight;
428 + }
429 + }
430 + });
431 + } else {
432 + if ($refs[key].hasOwnProperty("$el")) {
433 + heigth += $refs[key].$el.clientHeight;
434 + } else {
435 + heigth += getPropertyValue($refs[key]);
436 + }
437 + }
438 + } else if (key == "formHeaderRef") {
439 + heigth += getPropertyValue($refs[key]);
440 + }
441 + });
442 + return heigth;
443 +}
......
...@@ -79,7 +79,7 @@ service.interceptors.response.use(res => { ...@@ -79,7 +79,7 @@ service.interceptors.response.use(res => {
79 type: 'error' 79 type: 'error'
80 }) 80 })
81 return Promise.reject(new Error(msg)) 81 return Promise.reject(new Error(msg))
82 - } else if (code !== 200 && code !== 201 && code !== 202 && code != 203 && code != 603) { 82 + } else if (code !== 200 && code !== 201 && code !== 202 && code != 203 && code != 603 && code != 402) {
83 Message({ 83 Message({
84 message: msg, 84 message: msg,
85 type: 'error' 85 type: 'error'
......
...@@ -37,7 +37,10 @@ export default { ...@@ -37,7 +37,10 @@ export default {
37 tableData: [], // 表格数据 37 tableData: [], // 表格数据
38 }; 38 };
39 }, 39 },
40 - created() {}, 40 + created() {
41 + const { data } = this.$route.query;
42 + this.tableData = JSON.parse(data);
43 + },
41 methods: { 44 methods: {
42 //条数变化 45 //条数变化
43 handleSizeChange(e) { 46 handleSizeChange(e) {
...@@ -50,10 +53,8 @@ export default { ...@@ -50,10 +53,8 @@ export default {
50 this.pageConfig.pageData.page = e; 53 this.pageConfig.pageData.page = e;
51 this.searchBtn(); 54 this.searchBtn();
52 }, 55 },
53 - // table勾选 56 + // 搜索
54 - handleSelectionChange(val) { 57 + searchBtn() {},
55 - this.multipleSelection = val;
56 - },
57 }, 58 },
58 }; 59 };
59 </script> 60 </script>
......
...@@ -12,19 +12,13 @@ export const columnHeader = () => [ ...@@ -12,19 +12,13 @@ export const columnHeader = () => [
12 { 12 {
13 type: "index", 13 type: "index",
14 label: "序号", 14 label: "序号",
15 - prop: "id", 15 + prop: "rowNum",
16 align: "center", 16 align: "center",
17 width: "70", 17 width: "70",
18 }, 18 },
19 { 19 {
20 - label: "运单号",
21 - prop: "waybillNo",
22 - align: "center",
23 - width: 150,
24 - },
25 - {
26 label: "错误信息", 20 label: "错误信息",
27 - prop: "errorMessage", 21 + prop: "msg",
28 align: "center", 22 align: "center",
29 minWidth: 150, 23 minWidth: 150,
30 }, 24 },
......
...@@ -2,8 +2,8 @@ export const formConfig = [ ...@@ -2,8 +2,8 @@ export const formConfig = [
2 { 2 {
3 label: "商品名", 3 label: "商品名",
4 type: "Input", 4 type: "Input",
5 - name: "skuCode", 5 + name: "searchValue",
6 - prop: "skuCode", 6 + prop: "searchValue",
7 placeholder: "根据Hscode查询", 7 placeholder: "根据Hscode查询",
8 span: 6, 8 span: 6,
9 trigger: "blur", // 事件名 9 trigger: "blur", // 事件名
......
1 <template> 1 <template>
2 - <div class="form-header container"> 2 + <div ref="formHeaderRef" class="form-header container">
3 <el-row> 3 <el-row>
4 <el-col> 4 <el-col>
5 <yl-form 5 <yl-form
...@@ -22,9 +22,11 @@ ...@@ -22,9 +22,11 @@
22 @download="downloadTemplate" 22 @download="downloadTemplate"
23 @upload="toUpload" 23 @upload="toUpload"
24 @rmfile="onRemoveUpload" 24 @rmfile="onRemoveUpload"
25 + @export="exportTemplate"
25 @delete="deleteData" 26 @delete="deleteData"
26 @sizeChange="handleSizeChange" 27 @sizeChange="handleSizeChange"
27 @currentChange="handleCurrentChange" 28 @currentChange="handleCurrentChange"
29 + @selectionEvent="tableSelectionChange"
28 > 30 >
29 </yl-table> 31 </yl-table>
30 <!-- <modle-view 32 <!-- <modle-view
...@@ -85,6 +87,14 @@ import YlTable from "@/components/YlTable"; ...@@ -85,6 +87,14 @@ import YlTable from "@/components/YlTable";
85 import ModleView from "./components/ModleView"; 87 import ModleView from "./components/ModleView";
86 import { formConfig } from "./formConfig"; 88 import { formConfig } from "./formConfig";
87 import { tableAttr, columnHeader } from "./tableConfig"; 89 import { tableAttr, columnHeader } from "./tableConfig";
90 +import { restTableHeight } from "@/utils";
91 +import {
92 + findHsCodeList, // HScode黑名单查询
93 + delBlackList, // HScode黑名单删除
94 + downLoadTemplate, // HScode黑名单下载模板
95 + uploadHsCode, // HScode黑名单导入
96 +} from "@/api/et86HsCodeBlack";
97 +import { downLoadXlsx } from "@/utils/zipdownload";
88 export default { 98 export default {
89 name: "Et86HsCodeBlack", 99 name: "Et86HsCodeBlack",
90 components: { 100 components: {
...@@ -95,7 +105,9 @@ export default { ...@@ -95,7 +105,9 @@ export default {
95 data() { 105 data() {
96 return { 106 return {
97 formConfig: formConfig, // 表单配置项 107 formConfig: formConfig, // 表单配置项
98 - queryForm: {}, // 表单参数 108 + queryForm: {
109 + searchValue: "",
110 + }, // 表单参数
99 paramsForm: { 111 paramsForm: {
100 skuName: "", 112 skuName: "",
101 file: null, 113 file: null,
...@@ -120,13 +132,79 @@ export default { ...@@ -120,13 +132,79 @@ export default {
120 multipleSelection: [], 132 multipleSelection: [],
121 }; 133 };
122 }, 134 },
123 - created() {}, 135 + created() {
136 + // 黑名单查询
137 + this.$nextTick(() => {
138 + this.searchBtn();
139 + });
140 + },
141 + mounted() {
142 + this.$nextTick(() => {
143 + let app = document.querySelector(".app-main");
144 + if (this.$store.getters.appMainBlockClientHeight) {
145 + this.tableAttr.maxHeight =
146 + this.$store.getters.appMainBlockClientHeight -
147 + restTableHeight(this.$refs);
148 + } else {
149 + this.tableAttr.maxHeight =
150 + app.clientHeight - restTableHeight(this.$refs);
151 + }
152 + });
153 + },
124 methods: { 154 methods: {
155 + // HScode黑名单查询
156 + queryFindHsCodeList(params) {
157 + this.tableAttr.loadingTable = true;
158 + findHsCodeList(params)
159 + .then((res) => {
160 + this.tableAttr.loadingTable = false;
161 + const { code, data } = res;
162 + if (code == 200) {
163 + this.tableData = data.list;
164 + this.pageConfig.total = data.total;
165 + }
166 + })
167 + .catch(() => {});
168 + },
169 + // 删除黑名单
170 + toDelBlackList(params) {
171 + delBlackList(params)
172 + .then((res) => {
173 + const { code, msg } = res;
174 + if (code == 200) {
175 + this.searchBtn();
176 + this.msgSuccess(msg || "删除成功!");
177 + } else {
178 + this.$message.error(msg || "删除失败");
179 + }
180 + })
181 + .catch(() => {});
182 + },
125 // 失焦事件 183 // 失焦事件
126 blurEvent() {}, 184 blurEvent() {},
127 - // 选择上传 185 + // 选择上传【HScode黑名单导入】
128 - toUpload(options) { 186 + toUpload({ file }) {
129 - console.log(options); 187 + const formData = new FormData();
188 + formData.append("file", file);
189 + uploadHsCode(formData)
190 + .then((res) => {
191 + const { code, data, msg } = res;
192 + if (code == 200) {
193 + this.searchBtn();
194 + this.msgSuccess(msg || "增加成功!");
195 + } else {
196 + this.$message.error(msg || "增加失败");
197 + this.$router.push({
198 + path: "/errorInfo",
199 + query: {
200 + name: "errorInfo",
201 + error: code,
202 + data: JSON.stringify(data),
203 + },
204 + });
205 + }
206 + })
207 + .catch(() => {});
130 }, 208 },
131 //移除上传 209 //移除上传
132 onRemoveUpload(options) { 210 onRemoveUpload(options) {
...@@ -134,22 +212,74 @@ export default { ...@@ -134,22 +212,74 @@ export default {
134 }, 212 },
135 // 搜索 213 // 搜索
136 searchBtn() { 214 searchBtn() {
137 - this.$refs.ruleForm.handleSearch("ruleForm", (val) => {}); 215 + const { page, size } = this.pageConfig.pageData;
216 + this.$refs.ruleForm.handleSearch("ruleForm", (val) => {
217 + let params = {
218 + limitStart: (page - 1) * size,
219 + limitSize: size,
220 + ...this.queryForm,
221 + };
222 + this.queryFindHsCodeList(params);
223 + });
138 }, 224 },
139 // 确认对话框 225 // 确认对话框
140 dialogConfirm() {}, 226 dialogConfirm() {},
141 - // 下载 227 + // 下载【HScode黑名单下载模板】
142 downloadTemplate() { 228 downloadTemplate() {
143 - // this.$refs.modleViewRef.dialogOpenEvent(); 229 + downLoadTemplate("hsCode")
230 + .then((res) => {
231 + if (res) {
232 + const blob = new Blob([res]);
233 + const link = document.createElement("a"); //创建a标签
234 + link.download = "HSCODE黑名单表.xlsx"; //a标签添加属性
235 + link.style.display = "none";
236 + link.href = URL.createObjectURL(blob);
237 + document.body.appendChild(link);
238 + link.click(); //执行下载
239 + URL.revokeObjectURL(link.href); //释放url
240 + document.body.removeChild(link); //释放标签
241 + } else {
242 + this.$message.error("下载失败");
243 + }
244 + })
245 + .catch(() => {});
144 }, 246 },
145 // 上传 247 // 上传
146 upLoadTemplate() { 248 upLoadTemplate() {
147 // console.log(this.$refs.modleViewRef); 249 // console.log(this.$refs.modleViewRef);
148 }, 250 },
149 // 导出 251 // 导出
150 - exportTemplate() {}, 252 + exportTemplate(row, i) {
253 + this.tableAttr.btnCofig.btnGroup[i].loading = true;
254 + downLoadXlsx("/etes/exportHsCodeList", this.queryForm, "HSCODE黑名单表")
255 + .then(() => {
256 + this.tableAttr.btnCofig.btnGroup[i].loading = false;
257 + })
258 + .catch(() => {
259 + this.$message.error("导出失败");
260 + });
261 + },
151 // 删除 262 // 删除
152 - deleteData() {}, 263 + deleteData(row) {
264 + if (this.multipleSelection.length) {
265 + let params = [];
266 + this.multipleSelection.map((item) => {
267 + params.push(item.id);
268 + });
269 + this.$confirm("是否确认删除?", "提示", {
270 + confirmButtonText: "确定",
271 + cancelButtonText: "取消",
272 + type: "warning",
273 + center: true,
274 + })
275 + .then(() => {
276 + this.toDelBlackList(params);
277 + })
278 + .catch(() => {});
279 + } else {
280 + this.$message.error("请勾选一条或者多条数据再操作!");
281 + }
282 + },
153 //条数变化 283 //条数变化
154 handleSizeChange(e) { 284 handleSizeChange(e) {
155 this.pageConfig.pageData.size = e; 285 this.pageConfig.pageData.size = e;
...@@ -162,11 +292,11 @@ export default { ...@@ -162,11 +292,11 @@ export default {
162 this.searchBtn(); 292 this.searchBtn();
163 }, 293 },
164 // table勾选 294 // table勾选
165 - handleSelectionChange(val) { 295 + tableSelectionChange(val) {
166 this.multipleSelection = val; 296 this.multipleSelection = val;
167 }, 297 },
168 // 删除 298 // 删除
169 - deleteRow() { 299 + deleteRow({ row }) {
170 this.$confirm("是否确认删除?", "提示", { 300 this.$confirm("是否确认删除?", "提示", {
171 confirmButtonText: "确定", 301 confirmButtonText: "确定",
172 cancelButtonText: "取消", 302 cancelButtonText: "取消",
...@@ -174,7 +304,7 @@ export default { ...@@ -174,7 +304,7 @@ export default {
174 center: true, 304 center: true,
175 }) 305 })
176 .then(() => { 306 .then(() => {
177 - this.msgSuccess("删除成功!"); 307 + this.toDelBlackList([row.id]);
178 }) 308 })
179 .catch(() => {}); 309 .catch(() => {});
180 }, 310 },
......
...@@ -2,7 +2,7 @@ export const tableAttr = { ...@@ -2,7 +2,7 @@ export const tableAttr = {
2 border: true, 2 border: true,
3 loadingTable: false, 3 loadingTable: false,
4 isDragSort: false, // 拖拽tableData数据一定要加id字段 4 isDragSort: false, // 拖拽tableData数据一定要加id字段
5 - maxHeight: 300, 5 + maxHeight: 0,
6 btnCofig: { 6 btnCofig: {
7 isBtn: true, 7 isBtn: true,
8 btnGroup: [ 8 btnGroup: [
...@@ -27,7 +27,7 @@ export const tableAttr = { ...@@ -27,7 +27,7 @@ export const tableAttr = {
27 { 27 {
28 type: "primary", 28 type: "primary",
29 icon: "el-icon-upload", 29 icon: "el-icon-upload",
30 - btnName: "导入", 30 + btnName: "增加",
31 size: "mini", 31 size: "mini",
32 round: false, 32 round: false,
33 loading: false, 33 loading: false,
...@@ -45,10 +45,6 @@ export const tableAttr = { ...@@ -45,10 +45,6 @@ export const tableAttr = {
45 round: false, 45 round: false,
46 loading: false, 46 loading: false,
47 event: "export", 47 event: "export",
48 - action: "/goods/uploadGoodsExcel",
49 - fileName: "name",
50 - limit: 1,
51 - accept: ".xlsx",
52 }, 48 },
53 { 49 {
54 type: "danger", 50 type: "danger",
...@@ -77,14 +73,8 @@ export const columnHeader = (deleteRow) => [ ...@@ -77,14 +73,8 @@ export const columnHeader = (deleteRow) => [
77 width: "50", 73 width: "50",
78 }, 74 },
79 { 75 {
80 - label: "口岸",
81 - prop: "portName",
82 - align: "center",
83 - minWidth: 100,
84 - },
85 - {
86 label: "HSCODE", 76 label: "HSCODE",
87 - prop: "goodsCode", 77 + prop: "blackValue",
88 align: "center", 78 align: "center",
89 minWidth: 100, 79 minWidth: 100,
90 }, 80 },
...@@ -102,7 +92,7 @@ export const columnHeader = (deleteRow) => [ ...@@ -102,7 +92,7 @@ export const columnHeader = (deleteRow) => [
102 }, 92 },
103 { 93 {
104 label: "文件名", 94 label: "文件名",
105 - prop: "fileName", 95 + prop: "uploadFileName",
106 align: "center", 96 align: "center",
107 minWidth: 100, 97 minWidth: 100,
108 }, 98 },
......
1 <template> 1 <template>
2 - <div class="form-header container"> 2 + <div ref="formHeaderRef" class="form-header container">
3 <el-row> 3 <el-row>
4 <el-col> 4 <el-col>
5 <yl-form 5 <yl-form
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
13 </el-col> 13 </el-col>
14 </el-row> 14 </el-row>
15 <yl-table 15 <yl-table
16 + ref="ylTable"
16 :attrs="tableAttr" 17 :attrs="tableAttr"
17 :loadingTable="tableAttr.loadingTable" 18 :loadingTable="tableAttr.loadingTable"
18 :columns="columns" 19 :columns="columns"
...@@ -31,6 +32,7 @@ import YlForm from "@/components/YlForm"; ...@@ -31,6 +32,7 @@ import YlForm from "@/components/YlForm";
31 import YlTable from "@/components/YlTable"; 32 import YlTable from "@/components/YlTable";
32 import { formConfig } from "./formConfig"; 33 import { formConfig } from "./formConfig";
33 import { tableAttr, columnHeader } from "./tableConfig"; 34 import { tableAttr, columnHeader } from "./tableConfig";
35 +import { restTableHeight } from "@/utils";
34 import { 36 import {
35 findAllEtesRules, // ET86查询 37 findAllEtesRules, // ET86查询
36 deleteEtesRuleById, // 删除 38 deleteEtesRuleById, // 删除
...@@ -67,7 +69,20 @@ export default { ...@@ -67,7 +69,20 @@ export default {
67 this.searchBtn(); 69 this.searchBtn();
68 }); 70 });
69 }, 71 },
70 - mounted() {}, 72 + mounted() {
73 + this.$nextTick(() => {
74 + let app = document.querySelector(".app-main");
75 + if (this.$store.getters.appMainBlockClientHeight) {
76 + this.tableAttr.maxHeight =
77 + this.$store.getters.appMainBlockClientHeight -
78 + restTableHeight(this.$refs);
79 + } else {
80 + this.tableAttr.maxHeight =
81 + app.clientHeight - restTableHeight(this.$refs);
82 + }
83 + console.log(this.tableAttr.maxHeight);
84 + });
85 + },
71 methods: { 86 methods: {
72 // ET86查询 87 // ET86查询
73 queryFindAllEtesRules(params) { 88 queryFindAllEtesRules(params) {
......
...@@ -6,7 +6,7 @@ export const tableAttr = { ...@@ -6,7 +6,7 @@ export const tableAttr = {
6 border: true, 6 border: true,
7 loadingTable: false, 7 loadingTable: false,
8 isDragSort: false, // 拖拽tableData数据一定要加id字段 8 isDragSort: false, // 拖拽tableData数据一定要加id字段
9 - maxHeight: 300, 9 + maxHeight: 0,
10 btnCofig: { 10 btnCofig: {
11 isBtn: true, 11 isBtn: true,
12 btnGroup: [ 12 btnGroup: [
......
1 +<template>
2 + <div class="error-container">
3 + <el-dialog
4 + :width="width"
5 + :title="title"
6 + :center="center"
7 + :visible.sync="dialogVisible"
8 + :close-on-click-modal="onModalClickClose"
9 + @open="dialogOpenEvent"
10 + @close="dialogCloseEvent"
11 + >
12 + <slot></slot>
13 + <span slot="footer" class="dialog-footer">
14 + <el-button @click="cancel">取 消</el-button>
15 + <el-button type="primary" @click="confirm">{{
16 + confirmBtnName
17 + }}</el-button>
18 + </span>
19 + </el-dialog>
20 + </div>
21 +</template>
22 +
23 +<script>
24 +export default {
25 + props: {
26 + width: {
27 + type: String,
28 + default: "50%",
29 + },
30 + title: {
31 + type: String,
32 + default: "标题",
33 + },
34 + center: {
35 + type: String,
36 + default: "center",
37 + },
38 + confirmBtnName: {
39 + type: String,
40 + default: "确 定",
41 + },
42 + onModalClickClose: {
43 + type: Boolean,
44 + default: false,
45 + },
46 + },
47 + data() {
48 + return {
49 + dialogVisible: false,
50 + };
51 + },
52 + computed: {},
53 + created() {},
54 + mounted() {},
55 + methods: {
56 + dialogOpenEvent(data) {
57 + if (data && data.length) {
58 + console.log(data);
59 + }
60 + this.dialogVisible = true;
61 + this.$emit("open");
62 + },
63 + dialogCloseEvent() {
64 + this.dialogVisible = false;
65 + this.$emit("close");
66 + },
67 + // 确认事件
68 + confirm() {
69 + this.dialogVisible = false;
70 + this.$emit("confirm");
71 + },
72 + // 取消事件
73 + cancel() {
74 + this.dialogVisible = false;
75 + this.$emit("cancel");
76 + },
77 + },
78 +};
79 +</script>
80 +<style lang='scss' scoped>
81 +
82 +</style>
1 +export const formConfig = [
2 + {
3 + label: "ShipmentDesc",
4 + type: "Input",
5 + name: "ShipmentDesc",
6 + prop: "ShipmentDesc",
7 + placeholder: "根据ShipmentDesc查询",
8 + span: 7,
9 + trigger: "blur", // 事件名
10 + },
11 +];
1 +<template>
2 + <div ref="formHeaderRef" class="form-header container">
3 + <el-row>
4 + <el-col>
5 + <yl-form
6 + ref="ruleForm"
7 + :formConfig="formConfig"
8 + :queryForm="queryForm"
9 + :inline="false"
10 + formWidth="auto"
11 + @blur="blurEvent"
12 + />
13 + </el-col>
14 + </el-row>
15 + <yl-table
16 + :attrs="tableAttr"
17 + :loadingTable="tableAttr.loadingTable"
18 + :columns="columns"
19 + :tableData="tableData"
20 + :pageConfig="pageConfig"
21 + @search="searchBtn"
22 + @download="downloadTemplate"
23 + @upload="toUpload"
24 + @rmfile="onRemoveUpload"
25 + @export="exportTemplate"
26 + @delete="deleteData"
27 + @sizeChange="handleSizeChange"
28 + @currentChange="handleCurrentChange"
29 + @selectionEvent="tableSelectionChange"
30 + >
31 + </yl-table>
32 + <!-- <modle-view
33 + ref="modleViewRef"
34 + width="30%"
35 + title="导入Excel"
36 + confirmBtnName="导入Excel"
37 + @confirm="dialogConfirm"
38 + >
39 + <el-form
40 + :model="paramsForm"
41 + :rules="rules"
42 + ref="ruleForm"
43 + label-width="80px"
44 + >
45 + <el-row>
46 + <el-col :span="20">
47 + <el-form-item
48 + label="商品名称"
49 + prop="skuName"
50 + size="small"
51 + label-position="left"
52 + >
53 + <el-input
54 + v-model="paramsForm.skuName"
55 + placeholder="请输入商品名称"
56 + ></el-input>
57 + </el-form-item>
58 + </el-col>
59 + </el-row>
60 + <el-row>
61 + <el-col>
62 + <el-form-item prop="file">
63 + <el-upload
64 + ref="upload"
65 + action="/goods/uploadGoodsExcel"
66 + name="file"
67 + :http-request="toUpload"
68 + :on-remove="onRemoveUpload"
69 + :limit="1"
70 + accept=".xlsx"
71 + class="upload"
72 + >
73 + <el-button type="primary" icon="el-icon-upload2" size="small"
74 + >选择文件</el-button
75 + >
76 + </el-upload>
77 + </el-form-item>
78 + </el-col>
79 + </el-row>
80 + </el-form>
81 + </modle-view> -->
82 + </div>
83 +</template>
84 +<script>
85 +import YlForm from "@/components/YlForm";
86 +import YlTable from "@/components/YlTable";
87 +import ModleView from "./components/ModleView";
88 +import { formConfig } from "./formConfig";
89 +import { tableAttr, columnHeader } from "./tableConfig";
90 +import { restTableHeight } from "@/utils";
91 +import {
92 + findHsCodeList, // HScode黑名单查询
93 + delBlackList, // HScode黑名单删除
94 + downLoadTemplate, // HScode黑名单下载模板
95 + uploadHsCode, // HScode黑名单导入
96 +} from "@/api/et86HsCodeBlack";
97 +import { downLoadXlsx } from "@/utils/zipdownload";
98 +export default {
99 + name: "Et86HsCodeBlack",
100 + components: {
101 + YlForm,
102 + YlTable,
103 + ModleView,
104 + },
105 + data() {
106 + return {
107 + formConfig: formConfig, // 表单配置项
108 + queryForm: {
109 + searchValue: "",
110 + }, // 表单参数
111 + paramsForm: {
112 + skuName: "",
113 + file: null,
114 + },
115 + rules: {
116 + skuName: [
117 + { required: true, message: "请输入商品名称", trigger: "blur" },
118 + ],
119 + },
120 + pageConfig: {
121 + // 分页配置项
122 + isPagination: true,
123 + total: 0,
124 + pageData: {
125 + page: 1,
126 + size: 10,
127 + },
128 + },
129 + tableAttr: tableAttr, // table配置项
130 + columns: columnHeader(this.deleteRow), // 表头
131 + tableData: [], // 表格数据
132 + multipleSelection: [],
133 + };
134 + },
135 + created() {
136 + // 黑名单查询
137 + this.$nextTick(() => {
138 + this.searchBtn();
139 + });
140 + },
141 + mounted() {
142 + this.$nextTick(() => {
143 + let app = document.querySelector(".app-main");
144 + if (this.$store.getters.appMainBlockClientHeight) {
145 + this.tableAttr.maxHeight =
146 + this.$store.getters.appMainBlockClientHeight -
147 + restTableHeight(this.$refs);
148 + } else {
149 + this.tableAttr.maxHeight =
150 + app.clientHeight - restTableHeight(this.$refs);
151 + }
152 + console.log(this.tableAttr.maxHeight);
153 + });
154 + },
155 + methods: {
156 + // HScode黑名单查询
157 + queryFindHsCodeList(params) {
158 + this.tableAttr.loadingTable = true;
159 + findHsCodeList(params)
160 + .then((res) => {
161 + this.tableAttr.loadingTable = false;
162 + const { code, data } = res;
163 + if (code == 200) {
164 + this.tableData = data.list;
165 + this.pageConfig.total = data.total;
166 + }
167 + })
168 + .catch(() => {});
169 + },
170 + // 删除黑名单
171 + toDelBlackList(params) {
172 + delBlackList(params)
173 + .then((res) => {
174 + const { code, msg } = res;
175 + if (code == 200) {
176 + this.searchBtn();
177 + this.msgSuccess(msg || "删除成功!");
178 + } else {
179 + this.$message.error(msg || "删除失败");
180 + }
181 + })
182 + .catch(() => {});
183 + },
184 + // 失焦事件
185 + blurEvent() {},
186 + // 选择上传【HScode黑名单导入】
187 + toUpload({ file }) {
188 + const formData = new FormData();
189 + formData.append("file", file);
190 + uploadHsCode(formData)
191 + .then((res) => {
192 + const { code, data, msg } = res;
193 + if (code == 200) {
194 + this.searchBtn();
195 + this.msgSuccess(msg || "增加成功!");
196 + } else {
197 + this.$message.error(msg || "增加失败");
198 + this.$router.push({
199 + path: "/errorInfo",
200 + query: {
201 + name: "errorInfo",
202 + error: code,
203 + data: JSON.stringify(data),
204 + },
205 + });
206 + }
207 + })
208 + .catch(() => {});
209 + },
210 + //移除上传
211 + onRemoveUpload(options) {
212 + console.log(options);
213 + },
214 + // 搜索
215 + searchBtn() {
216 + const { page, size } = this.pageConfig.pageData;
217 + this.$refs.ruleForm.handleSearch("ruleForm", (val) => {
218 + let params = {
219 + limitStart: (page - 1) * size,
220 + limitSize: size,
221 + ...this.queryForm,
222 + };
223 + this.queryFindHsCodeList(params);
224 + });
225 + },
226 + // 确认对话框
227 + dialogConfirm() {},
228 + // 下载【HScode黑名单下载模板】
229 + downloadTemplate() {
230 + downLoadTemplate("hsCode")
231 + .then((res) => {
232 + if (res) {
233 + const blob = new Blob([res]);
234 + const link = document.createElement("a"); //创建a标签
235 + link.download = "HSCODE黑名单表.xlsx"; //a标签添加属性
236 + link.style.display = "none";
237 + link.href = URL.createObjectURL(blob);
238 + document.body.appendChild(link);
239 + link.click(); //执行下载
240 + URL.revokeObjectURL(link.href); //释放url
241 + document.body.removeChild(link); //释放标签
242 + } else {
243 + this.$message.error("下载失败");
244 + }
245 + })
246 + .catch(() => {});
247 + },
248 + // 上传
249 + upLoadTemplate() {
250 + // console.log(this.$refs.modleViewRef);
251 + },
252 + // 导出
253 + exportTemplate(row, i) {
254 + this.tableAttr.btnCofig.btnGroup[i].loading = true;
255 + downLoadXlsx("/etes/exportHsCodeList", this.queryForm, "HSCODE黑名单表")
256 + .then(() => {
257 + this.tableAttr.btnCofig.btnGroup[i].loading = false;
258 + })
259 + .catch(() => {
260 + this.$message.error("导出失败");
261 + });
262 + },
263 + // 删除
264 + deleteData(row) {
265 + if (this.multipleSelection.length) {
266 + let params = [];
267 + this.multipleSelection.map((item) => {
268 + params.push(item.id);
269 + });
270 + this.$confirm("是否确认删除?", "提示", {
271 + confirmButtonText: "确定",
272 + cancelButtonText: "取消",
273 + type: "warning",
274 + center: true,
275 + })
276 + .then(() => {
277 + this.toDelBlackList(params);
278 + })
279 + .catch(() => {});
280 + } else {
281 + this.$message.error("请勾选一条或者多条数据再操作!");
282 + }
283 + },
284 + //条数变化
285 + handleSizeChange(e) {
286 + this.pageConfig.pageData.size = e;
287 + this.pageConfig.pageData.page = 1;
288 + this.searchBtn();
289 + },
290 + //页码变化
291 + handleCurrentChange(e) {
292 + this.pageConfig.pageData.page = e;
293 + this.searchBtn();
294 + },
295 + // table勾选
296 + tableSelectionChange(val) {
297 + this.multipleSelection = val;
298 + },
299 + // 删除
300 + deleteRow({ row }) {
301 + this.$confirm("是否确认删除?", "提示", {
302 + confirmButtonText: "确定",
303 + cancelButtonText: "取消",
304 + type: "warning",
305 + center: true,
306 + })
307 + .then(() => {
308 + this.toDelBlackList([row.id]);
309 + })
310 + .catch(() => {});
311 + },
312 + },
313 +};
314 +</script>
315 +<style lang="scss" scoped></style>
1 +export const tableAttr = {
2 + border: true,
3 + loadingTable: false,
4 + isDragSort: false, // 拖拽tableData数据一定要加id字段
5 + maxHeight: 300,
6 + btnCofig: {
7 + isBtn: true,
8 + btnGroup: [
9 + {
10 + type: "primary", // text、primary、danger
11 + icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right
12 + btnName: "搜索",
13 + size: "mini", // medium / small / mini
14 + round: false,
15 + loading: false,
16 + event: "search",
17 + },
18 + {
19 + type: "primary",
20 + icon: "el-icon-download",
21 + btnName: "下载模板",
22 + size: "mini",
23 + round: false,
24 + loading: false,
25 + event: "download",
26 + },
27 + {
28 + type: "primary",
29 + icon: "el-icon-upload",
30 + btnName: "增加",
31 + size: "mini",
32 + round: false,
33 + loading: false,
34 + event: "upLoad",
35 + action: "/goods/uploadGoodsExcel",
36 + fileName: "name",
37 + limit: 1,
38 + accept: ".xlsx",
39 + },
40 + {
41 + type: "primary",
42 + icon: "el-icon-download",
43 + btnName: "导出",
44 + size: "mini",
45 + round: false,
46 + loading: false,
47 + event: "export",
48 + },
49 + {
50 + type: "danger",
51 + icon: "el-icon-delete",
52 + btnName: "删除",
53 + size: "mini",
54 + round: false,
55 + loading: false,
56 + event: "delete",
57 + },
58 + ],
59 + },
60 +};
61 +export const columnHeader = (deleteRow) => [
62 + {
63 + type: "selection",
64 + align: "center",
65 + prop: "selection",
66 + width: "50",
67 + },
68 + {
69 + type: "index",
70 + label: "序号",
71 + prop: "id",
72 + align: "center",
73 + width: "50",
74 + },
75 + {
76 + label: "ShipmentDesc",
77 + prop: "ShipmentDesc",
78 + align: "center",
79 + minWidth: 100,
80 + },
81 + {
82 + label: "创建时间",
83 + prop: "createTime",
84 + align: "center",
85 + minWidth: 100,
86 + },
87 + {
88 + label: "创建人",
89 + prop: "createUserName",
90 + align: "center",
91 + minWidth: 100,
92 + },
93 + {
94 + label: "文件名",
95 + prop: "uploadFileName",
96 + align: "center",
97 + minWidth: 100,
98 + },
99 +
100 + {
101 + label: "操作",
102 + prop: "operate",
103 + align: "center",
104 + minWidth: 120,
105 + fixed: "right",
106 + render: (h, params) => {
107 + return h("div", [
108 + h(
109 + "el-button",
110 + {
111 + style: {
112 + color: "#ff4949",
113 + },
114 + props: {
115 + type: "text",
116 + size: "mini",
117 + icon: "el-icon-delete",
118 + },
119 + on: {
120 + click() {
121 + deleteRow(params);
122 + },
123 + },
124 + },
125 + "删除"
126 + ),
127 + ]);
128 + },
129 + },
130 +];
...@@ -195,7 +195,7 @@ export default { ...@@ -195,7 +195,7 @@ export default {
195 console.log(err) 195 console.log(err)
196 }) 196 })
197 } else { 197 } else {
198 - this.$confirm(`是否要${tip}记录!`, "注意!", { 198 + this.$confirm(`是否要${tip}规则!`, "注意!", {
199 confirmButtonText: "确定", 199 confirmButtonText: "确定",
200 cancelButtonText: '取消', 200 cancelButtonText: '取消',
201 type: "warning", 201 type: "warning",
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
17 </el-col> 17 </el-col>
18 <el-col :span="6"> 18 <el-col :span="6">
19 <el-form-item label="运单号"> 19 <el-form-item label="运单号">
20 - <el-input v-model="selectForm.awbNbr" class="formItem" placeholder="例: xxx;xxx;" clearable></el-input> 20 + <el-input v-model="selectForm.awbNbr" class="formItem" placeholder="请输入运单号" clearable></el-input>
21 </el-form-item> 21 </el-form-item>
22 </el-col> 22 </el-col>
23 <el-col :span="6"> 23 <el-col :span="6">
...@@ -138,6 +138,7 @@ export default { ...@@ -138,6 +138,7 @@ export default {
138 this.data = []; 138 this.data = [];
139 }, 139 },
140 mounted() { 140 mounted() {
141 + this.tableHeight = window.innerHeight - this.$refs.dmLogForm.$el.offsetHeight - 130;
141 }, 142 },
142 methods: { 143 methods: {
143 //数据查询 144 //数据查询
......