Elements-SY

modify

...@@ -47,7 +47,8 @@ const permission = { ...@@ -47,7 +47,8 @@ const permission = {
47 return new Promise((resolve) => { 47 return new Promise((resolve) => {
48 // 向后端请求路由数据 48 // 向后端请求路由数据
49 getRouters().then((res) => { 49 getRouters().then((res) => {
50 - const newUrl = { 50 + const newUrl = [
51 + {
51 id: 24, 52 id: 24,
52 name: "et86", 53 name: "et86",
53 path: "/et86", 54 path: "/et86",
...@@ -61,10 +62,27 @@ const permission = { ...@@ -61,10 +62,27 @@ const permission = {
61 }, 62 },
62 alwaysShow: false, 63 alwaysShow: false,
63 children: null, 64 children: null,
64 - }; 65 + },
66 + {
67 + id: 25,
68 + name: "et86BlackStation",
69 + path: "/et86BlackStation",
70 + hidden: false,
71 + component: "allocationConfig/et86BlackStation",
72 + meta: {
73 + title: "黑名单维护",
74 + icon: "processing",
75 + permissions: "allocation:rand:list",
76 + noCache: false,
77 + },
78 + alwaysShow: false,
79 + children: null,
80 + },
81 + ];
65 res.data.map((item) => { 82 res.data.map((item) => {
66 if (item.name == "AllocationConfig") { 83 if (item.name == "AllocationConfig") {
67 - item.children.push(newUrl); 84 + item.children.push(newUrl[0]);
85 + item.children.push(newUrl[1]);
68 } 86 }
69 }); 87 });
70 res.data = hasPermi.routerPer(res.data); 88 res.data = hasPermi.routerPer(res.data);
......
1 -<template>
2 - <div class=''></div>
3 - </template>
4 -
5 - <script>
6 -
7 - export default {
8 - name: '',
9 - components: {},
10 - data() {
11 -
12 - return {
13 -
14 - }
15 - },
16 -
17 - computed: {},
18 - created () {},
19 - mounted () {},
20 - methods: {}
21 - }
22 - </script>
23 - <style lang='scss' scoped>
24 -
25 - </style>
1 -<template>
2 - <div class=''></div>
3 - </template>
4 -
5 - <script>
6 -
7 - export default {
8 - name: '',
9 - components: {},
10 - data() {
11 -
12 - return {
13 -
14 - }
15 - },
16 -
17 - computed: {},
18 - created () {},
19 - mounted () {},
20 - methods: {}
21 - }
22 - </script>
23 - <style lang='scss' scoped>
24 -
25 - </style>
...@@ -119,7 +119,6 @@ export default { ...@@ -119,7 +119,6 @@ export default {
119 }, 119 },
120 // 添加 120 // 添加
121 addBtn(item) { 121 addBtn(item) {
122 - console.log("add:", item);
123 this.$router.push({ 122 this.$router.push({
124 path: "/edit", 123 path: "/edit",
125 query: { 124 query: {
...@@ -137,7 +136,6 @@ export default { ...@@ -137,7 +136,6 @@ export default {
137 status: row.status 136 status: row.status
138 }, 137 },
139 }); 138 });
140 - console.log("查看:", row);
141 }, 139 },
142 // 编辑 140 // 编辑
143 editRow({ row }) { 141 editRow({ row }) {
...@@ -161,6 +159,7 @@ export default { ...@@ -161,6 +159,7 @@ export default {
161 deleteEtesRuleById({ id: row.id }).then(res=>{ 159 deleteEtesRuleById({ id: row.id }).then(res=>{
162 const { code, msg } = res; 160 const { code, msg } = res;
163 if (code == 200) { 161 if (code == 200) {
162 + this.searchBtn();
164 this.msgSuccess("删除成功!"); 163 this.msgSuccess("删除成功!");
165 }else{ 164 }else{
166 this.msgError(msg || "删除失败"); 165 this.msgError(msg || "删除失败");
......
1 +<template>
2 + <div class="error-container">
3 + <el-dialog
4 + title="错误信息"
5 + :visible.sync="dialogVisible"
6 + @open="dialogOpenEvent"
7 + @close="dialogCloseEvent"
8 + >
9 + <el-table :data="errorMessageData">
10 + <el-table-column
11 + type="index"
12 + width="50"
13 + align="center"
14 + ></el-table-column>
15 + <el-table-column label="错误信息" prop="errorMessage" width="200">
16 + <template slot-scope="scope">
17 + <div v-for="(m, key) in scope.row.errorMessage" :key="key">
18 + {{ m }}
19 + </div>
20 + </template>
21 + </el-table-column>
22 + </el-table>
23 + </el-dialog>
24 + </div>
25 +</template>
26 +
27 + <script>
28 +export default {
29 + data() {
30 + return {
31 + dialogVisible: false,
32 + errorMessageData: [],
33 + };
34 + },
35 + computed: {},
36 + created() {},
37 + mounted() {},
38 + methods: {
39 + dialogOpenEvent(data) {
40 + if (data && data.length) {
41 + this.errorMessageData = data;
42 + console.log(data);
43 + }
44 + this.dialogVisible = true;
45 + this.$emit("open");
46 + },
47 + dialogCloseEvent() {
48 + this.dialogVisible = false;
49 + this.$emit("close");
50 + },
51 + },
52 +};
53 +</script>
54 + <style lang='scss' scoped>
55 +
56 + </style>
1 +export const formConfig = [
2 + {
3 + label: "商品名",
4 + type: "Input",
5 + name: "skuCode",
6 + prop: "skuCode",
7 + placeholder: "根据Hscode查询",
8 + trigger: "blur", // 事件名
9 + },
10 +];
1 +<template>
2 + <div style="margin: 20px">
3 + <el-form :inline="true" :model="form" class="demo-form-inline" size="small">
4 + <el-form-item label="商品名">
5 + <el-input
6 + v-model="form.skuCode"
7 + placeholder="根据Hscode查询"
8 + ></el-input>
9 + </el-form-item>
10 + <el-form-item>
11 + <el-upload
12 + action="/flightInfoImport/importFlight"
13 + name="file"
14 + :http-request="uploadExcel"
15 + :on-remove="handleRemove"
16 + :limit="1"
17 + :on-exceed="handleExceed"
18 + :file-list="fileList"
19 + accept=".xlsx"
20 + class="upload-demo"
21 + v-hasPermi="['base:flightImport:importFlight']"
22 + >
23 + <el-button icon="el-icon-upload2" type="primary">点击上传</el-button>
24 + </el-upload>
25 + </el-form-item>
26 + <el-form-item>
27 + <el-button
28 + type="primary"
29 + icon="el-icon-download"
30 + @click="downloadTempleate"
31 + v-hasPermi="['base:flightImport:exportExcel']"
32 + >下载模板
33 + </el-button>
34 + </el-form-item>
35 + </el-form>
36 + <div style="font-size: 12px; font-weight: 700; margin-bottom: 15px">
37 + 提示:<span style="color: #1890ff">以下为所提交的数据或出错信息</span>
38 + </div>
39 + <div class="btn-wrap">
40 + <el-button
41 + type="danger"
42 + size="mini"
43 + icon="el-icon-delete"
44 + @click="deleteRow"
45 + >删除</el-button
46 + >
47 + </div>
48 + <el-table
49 + ref="filterTable"
50 + class="mt10"
51 + :data="tableData"
52 + size="small"
53 + border
54 + @selection-change="handleSelectionChange"
55 + >
56 + <el-table-column type="selection" width="55"></el-table-column>
57 + <el-table-column label="行号" prop="line" width="50" align="center">
58 + </el-table-column>
59 + <el-table-column label="错误信息" prop="errorMessage" width="200">
60 + <template slot-scope="scope">
61 + <div v-for="(m, key) in scope.row.errorMessage" :key="key">
62 + {{ m }}
63 + </div>
64 + </template>
65 + </el-table-column>
66 + <el-table-column v-if="tableData.length == 0"></el-table-column>
67 + <template v-for="(value, key) in this.tableData[0]">
68 + <el-table-column
69 + :key="key"
70 + v-if="key != 'errorMessage' && key != 'line'"
71 + :label="key"
72 + :prop="key"
73 + ></el-table-column>
74 + </template>
75 + </el-table>
76 + <ModleView ref="modleView" />
77 + </div>
78 +</template>
79 +
80 +<script>
81 +import {
82 + filghtKindData,
83 + downLoadTemplate,
84 + importFlight,
85 +} from "@/api/flightInfoImport";
86 +import ModleView from "./components/ModleView";
87 +export default {
88 + name: "FlightInformationImport",
89 + components: {
90 + ModleView,
91 + },
92 + data() {
93 + return {
94 + flightType: [],
95 + form: {
96 + skuCode: "",
97 + },
98 + fileList: [],
99 + tableData: [],
100 + multipleSelection: [],
101 + };
102 + },
103 + methods: {
104 + typeData() {
105 + filghtKindData().then((response) => {
106 + if (response.code != 200) {
107 + this.msgError(response.msg);
108 + }
109 + this.flightType = response.data;
110 + this.form.type = response.data[0].code;
111 + });
112 + },
113 + downloadTempleate() {
114 + let downloadType = "";
115 + let fileName = "";
116 + switch (this.form.type) {
117 + case "flightKind20":
118 + downloadType = "whiteTail";
119 + fileName = "航班信息导入模板WhiteTail.xlsx";
120 + break;
121 + case "flightKind30":
122 + downloadType = "purpleTail";
123 + fileName = "航班信息导入模板PurpleTail.xlsx";
124 + break;
125 + default:
126 + this.$confirm("此类航班暂无模板,请选择其他类型航班", "提示", {
127 + confirmButtonText: "确定",
128 + showCancelButton: false,
129 + type: "warning",
130 + });
131 + }
132 + if (downloadType != "") {
133 + downLoadTemplate(downloadType).then((res) => {
134 + if (res) {
135 + const blob = new Blob([res]);
136 + const link = document.createElement("a"); //创建a标签
137 + link.download = fileName; //a标签添加属性
138 + link.style.display = "none";
139 + link.href = URL.createObjectURL(blob);
140 + document.body.appendChild(link);
141 + link.click(); //执行下载
142 + URL.revokeObjectURL(link.href); //释放url
143 + document.body.removeChild(link); //释放标签
144 + } else {
145 + this.$message.error("下载失败");
146 + }
147 + });
148 + }
149 + },
150 + uploadExcel(option) {
151 + //上传excel
152 + const file = option.file;
153 + importFlight(file, this.form.type).then((res) => {
154 + if (res.code != 200) {
155 + if (res.code == 603) {
156 + this.$alert(res.msg, "提示", {
157 + confirmButtonText: "确定",
158 + type: "warning",
159 + });
160 + } else {
161 + this.$confirm("是否查看错误信息列表?", "提示", {
162 + confirmButtonText: "确定",
163 + cancelButtonText: "取消",
164 + type: "warning",
165 + center: true,
166 + }).then(() => {
167 + console.log(this.$refs.modleView);
168 + this.$refs.modleView.dialogOpenEvent(res.data)
169 + })
170 + .catch(() => {});
171 + this.$message.warning(res.msg);
172 + this.tableData = res.data;
173 + }
174 + } else {
175 + this.$message.success("导入成功");
176 + this.tableData = res.data;
177 + }
178 + });
179 + },
180 + handleRemove(file, fileList) {
181 + //清掉上传的文件
182 + this.tableData = [];
183 + this.fileList = [];
184 + },
185 + handleExceed(files) {
186 + //重复上传文件
187 + let file = {};
188 + file.file = files[0];
189 + file.name = files[0].name;
190 + this.fileList = [];
191 + this.fileList.push(file);
192 + this.uploadExcel(file);
193 + },
194 + handleSelectionChange(val) {
195 + this.multipleSelection = val;
196 + },
197 + deleteRow() {
198 + this.$confirm("是否确认删除?", "提示", {
199 + confirmButtonText: "确定",
200 + cancelButtonText: "取消",
201 + type: "warning",
202 + center: true,
203 + })
204 + .then(() => {
205 + this.msgSuccess("删除成功!");
206 + })
207 + .catch(() => {});
208 + },
209 + },
210 + created() {
211 + this.typeData();
212 + },
213 + activated() {
214 + this.typeData();
215 + },
216 +};
217 +</script>
218 +<style rel="stylesheet/scss" lang="scss">
219 +.upload-demo {
220 + float: right;
221 +}
222 +
223 +.el-upload-list {
224 + display: inline-block;
225 + margin-left: 10px;
226 + vertical-align: top;
227 +}
228 +</style>
1 +const state = {
2 + 1: "有效",
3 + 0: "无效",
4 +};
5 +export const tableAttr = {
6 + border: true,
7 + loadingTable: false,
8 + isDragSort: false, // 拖拽tableData数据一定要加id字段
9 + maxHeight: 300,
10 + btnCofig: {
11 + isBtn: true,
12 + btnGroup: [
13 + {
14 + type: "primary", // text、primary、danger
15 + icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right
16 + btnName: "搜索",
17 + size: "mini", // medium / small / mini
18 + round: false,
19 + loading: false,
20 + event: "search",
21 + },
22 + {
23 + type: "primary",
24 + icon: "el-icon-upload",
25 + btnName: "导入",
26 + size: "mini",
27 + round: false,
28 + loading: false,
29 + event: "upLoad",
30 + },
31 + {
32 + type: "primary",
33 + icon: "el-icon-download",
34 + btnName: "导出",
35 + size: "mini",
36 + round: false,
37 + loading: false,
38 + event: "download",
39 + },
40 + {
41 + type: "danger",
42 + icon: "el-icon-delete",
43 + btnName: "删除",
44 + size: "mini",
45 + round: false,
46 + loading: false,
47 + event: "delete",
48 + },
49 + ],
50 + },
51 +};
52 +export const columnHeader = (viewRow, editRow, deleteRow) => [
53 + {
54 + type: "selection",
55 + align: "center",
56 + prop: "selection",
57 + width: "50",
58 + },
59 + {
60 + type: "index",
61 + label: "序号",
62 + prop: "id",
63 + align: "center",
64 + width: "50",
65 + },
66 + {
67 + label: "原航班号",
68 + prop: "originOfFlightNo",
69 + align: "center",
70 + minWidth: 100,
71 + },
72 + {
73 + label: "顺位航班",
74 + prop: "rankFltNoStr",
75 + align: "center",
76 + minWidth: 100,
77 + },
78 + {
79 + label: "URSA包含",
80 + prop: "includeUrsa",
81 + align: "center",
82 + minWidth: 100,
83 + },
84 + {
85 + label: "URSA不包含",
86 + prop: "notIncludeUrsa",
87 + align: "center",
88 + minWidth: 100,
89 + },
90 + {
91 + label: "状态",
92 + prop: "status",
93 + align: "center",
94 + minWidth: 100,
95 + render: (h, params) => {
96 + const { row } = params;
97 + return h("div", `${state[row.status]}`);
98 + },
99 + },
100 + {
101 + label: "创建时间",
102 + prop: "createTime",
103 + align: "center",
104 + minWidth: 100,
105 + sortable: true,
106 + "sort-method": (a, b) => b.createTime - a.createTime,
107 + },
108 + {
109 + label: "创建人",
110 + prop: "createUserName",
111 + align: "center",
112 + minWidth: 100,
113 + },
114 + {
115 + label: "修改时间",
116 + prop: "updateTime",
117 + align: "center",
118 + minWidth: 100,
119 + },
120 + {
121 + label: "修改人",
122 + prop: "updateUserName",
123 + align: "center",
124 + minWidth: 100,
125 + },
126 + {
127 + label: "操作",
128 + prop: "operate",
129 + align: "center",
130 + minWidth: 120,
131 + fixed: "right",
132 + render: (h, params) => {
133 + return h("div", [
134 + h(
135 + "el-button",
136 + {
137 + props: {
138 + type: "text",
139 + size: "mini",
140 + icon: "el-icon-view",
141 + },
142 + on: {
143 + click() {
144 + viewRow(params);
145 + },
146 + },
147 + },
148 + "查看"
149 + ),
150 + h(
151 + "el-button",
152 + {
153 + props: {
154 + type: "text",
155 + size: "mini",
156 + icon: "el-icon-edit",
157 + },
158 + on: {
159 + click() {
160 + editRow(params);
161 + },
162 + },
163 + },
164 + "修改"
165 + ),
166 + h(
167 + "el-button",
168 + {
169 + style: {
170 + color: "#ff4949",
171 + },
172 + props: {
173 + type: "text",
174 + size: "mini",
175 + icon: "el-icon-delete",
176 + },
177 + on: {
178 + click() {
179 + deleteRow(params);
180 + },
181 + },
182 + },
183 + "删除"
184 + ),
185 + ]);
186 + },
187 + },
188 +];