Elements-SY

modify

......@@ -47,24 +47,42 @@ const permission = {
return new Promise((resolve) => {
// 向后端请求路由数据
getRouters().then((res) => {
const newUrl = {
id: 24,
name: "et86",
path: "/et86",
hidden: false,
component: "allocationConfig/et86",
meta: {
title: "ET86",
icon: "edit",
permissions: "allocation:rand:list",
noCache: false,
const newUrl = [
{
id: 24,
name: "et86",
path: "/et86",
hidden: false,
component: "allocationConfig/et86",
meta: {
title: "ET86",
icon: "edit",
permissions: "allocation:rand:list",
noCache: false,
},
alwaysShow: false,
children: null,
},
alwaysShow: false,
children: null,
};
{
id: 25,
name: "et86BlackStation",
path: "/et86BlackStation",
hidden: false,
component: "allocationConfig/et86BlackStation",
meta: {
title: "黑名单维护",
icon: "processing",
permissions: "allocation:rand:list",
noCache: false,
},
alwaysShow: false,
children: null,
},
];
res.data.map((item) => {
if (item.name == "AllocationConfig") {
item.children.push(newUrl);
item.children.push(newUrl[0]);
item.children.push(newUrl[1]);
}
});
res.data = hasPermi.routerPer(res.data);
......
<template>
<div class=''></div>
</template>
<script>
export default {
name: '',
components: {},
data() {
return {
}
},
computed: {},
created () {},
mounted () {},
methods: {}
}
</script>
<style lang='scss' scoped>
</style>
<template>
<div class=''></div>
</template>
<script>
export default {
name: '',
components: {},
data() {
return {
}
},
computed: {},
created () {},
mounted () {},
methods: {}
}
</script>
<style lang='scss' scoped>
</style>
......@@ -119,7 +119,6 @@ export default {
},
// 添加
addBtn(item) {
console.log("add:", item);
this.$router.push({
path: "/edit",
query: {
......@@ -137,7 +136,6 @@ export default {
status: row.status
},
});
console.log("查看:", row);
},
// 编辑
editRow({ row }) {
......@@ -161,6 +159,7 @@ export default {
deleteEtesRuleById({ id: row.id }).then(res=>{
const { code, msg } = res;
if (code == 200) {
this.searchBtn();
this.msgSuccess("删除成功!");
}else{
this.msgError(msg || "删除失败");
......
<template>
<div class="error-container">
<el-dialog
title="错误信息"
:visible.sync="dialogVisible"
@open="dialogOpenEvent"
@close="dialogCloseEvent"
>
<el-table :data="errorMessageData">
<el-table-column
type="index"
width="50"
align="center"
></el-table-column>
<el-table-column label="错误信息" prop="errorMessage" width="200">
<template slot-scope="scope">
<div v-for="(m, key) in scope.row.errorMessage" :key="key">
{{ m }}
</div>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
dialogVisible: false,
errorMessageData: [],
};
},
computed: {},
created() {},
mounted() {},
methods: {
dialogOpenEvent(data) {
if (data && data.length) {
this.errorMessageData = data;
console.log(data);
}
this.dialogVisible = true;
this.$emit("open");
},
dialogCloseEvent() {
this.dialogVisible = false;
this.$emit("close");
},
},
};
</script>
<style lang='scss' scoped>
</style>
export const formConfig = [
{
label: "商品名",
type: "Input",
name: "skuCode",
prop: "skuCode",
placeholder: "根据Hscode查询",
trigger: "blur", // 事件名
},
];
<template>
<div style="margin: 20px">
<el-form :inline="true" :model="form" class="demo-form-inline" size="small">
<el-form-item label="商品名">
<el-input
v-model="form.skuCode"
placeholder="根据Hscode查询"
></el-input>
</el-form-item>
<el-form-item>
<el-upload
action="/flightInfoImport/importFlight"
name="file"
:http-request="uploadExcel"
:on-remove="handleRemove"
:limit="1"
:on-exceed="handleExceed"
:file-list="fileList"
accept=".xlsx"
class="upload-demo"
v-hasPermi="['base:flightImport:importFlight']"
>
<el-button icon="el-icon-upload2" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-download"
@click="downloadTempleate"
v-hasPermi="['base:flightImport:exportExcel']"
>下载模板
</el-button>
</el-form-item>
</el-form>
<div style="font-size: 12px; font-weight: 700; margin-bottom: 15px">
提示:<span style="color: #1890ff">以下为所提交的数据或出错信息</span>
</div>
<div class="btn-wrap">
<el-button
type="danger"
size="mini"
icon="el-icon-delete"
@click="deleteRow"
>删除</el-button
>
</div>
<el-table
ref="filterTable"
class="mt10"
:data="tableData"
size="small"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column label="行号" prop="line" width="50" align="center">
</el-table-column>
<el-table-column label="错误信息" prop="errorMessage" width="200">
<template slot-scope="scope">
<div v-for="(m, key) in scope.row.errorMessage" :key="key">
{{ m }}
</div>
</template>
</el-table-column>
<el-table-column v-if="tableData.length == 0"></el-table-column>
<template v-for="(value, key) in this.tableData[0]">
<el-table-column
:key="key"
v-if="key != 'errorMessage' && key != 'line'"
:label="key"
:prop="key"
></el-table-column>
</template>
</el-table>
<ModleView ref="modleView" />
</div>
</template>
<script>
import {
filghtKindData,
downLoadTemplate,
importFlight,
} from "@/api/flightInfoImport";
import ModleView from "./components/ModleView";
export default {
name: "FlightInformationImport",
components: {
ModleView,
},
data() {
return {
flightType: [],
form: {
skuCode: "",
},
fileList: [],
tableData: [],
multipleSelection: [],
};
},
methods: {
typeData() {
filghtKindData().then((response) => {
if (response.code != 200) {
this.msgError(response.msg);
}
this.flightType = response.data;
this.form.type = response.data[0].code;
});
},
downloadTempleate() {
let downloadType = "";
let fileName = "";
switch (this.form.type) {
case "flightKind20":
downloadType = "whiteTail";
fileName = "航班信息导入模板WhiteTail.xlsx";
break;
case "flightKind30":
downloadType = "purpleTail";
fileName = "航班信息导入模板PurpleTail.xlsx";
break;
default:
this.$confirm("此类航班暂无模板,请选择其他类型航班", "提示", {
confirmButtonText: "确定",
showCancelButton: false,
type: "warning",
});
}
if (downloadType != "") {
downLoadTemplate(downloadType).then((res) => {
if (res) {
const blob = new Blob([res]);
const link = document.createElement("a"); //创建a标签
link.download = fileName; //a标签添加属性
link.style.display = "none";
link.href = URL.createObjectURL(blob);
document.body.appendChild(link);
link.click(); //执行下载
URL.revokeObjectURL(link.href); //释放url
document.body.removeChild(link); //释放标签
} else {
this.$message.error("下载失败");
}
});
}
},
uploadExcel(option) {
//上传excel
const file = option.file;
importFlight(file, this.form.type).then((res) => {
if (res.code != 200) {
if (res.code == 603) {
this.$alert(res.msg, "提示", {
confirmButtonText: "确定",
type: "warning",
});
} else {
this.$confirm("是否查看错误信息列表?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
}).then(() => {
console.log(this.$refs.modleView);
this.$refs.modleView.dialogOpenEvent(res.data)
})
.catch(() => {});
this.$message.warning(res.msg);
this.tableData = res.data;
}
} else {
this.$message.success("导入成功");
this.tableData = res.data;
}
});
},
handleRemove(file, fileList) {
//清掉上传的文件
this.tableData = [];
this.fileList = [];
},
handleExceed(files) {
//重复上传文件
let file = {};
file.file = files[0];
file.name = files[0].name;
this.fileList = [];
this.fileList.push(file);
this.uploadExcel(file);
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
deleteRow() {
this.$confirm("是否确认删除?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
center: true,
})
.then(() => {
this.msgSuccess("删除成功!");
})
.catch(() => {});
},
},
created() {
this.typeData();
},
activated() {
this.typeData();
},
};
</script>
<style rel="stylesheet/scss" lang="scss">
.upload-demo {
float: right;
}
.el-upload-list {
display: inline-block;
margin-left: 10px;
vertical-align: top;
}
</style>
const state = {
1: "有效",
0: "无效",
};
export const tableAttr = {
border: true,
loadingTable: false,
isDragSort: false, // 拖拽tableData数据一定要加id字段
maxHeight: 300,
btnCofig: {
isBtn: true,
btnGroup: [
{
type: "primary", // text、primary、danger
icon: "el-icon-search", // el-icon-edit 、el-icon-delete、el-icon-plus、el-icon-download、el-icon-upload el-icon--right
btnName: "搜索",
size: "mini", // medium / small / mini
round: false,
loading: false,
event: "search",
},
{
type: "primary",
icon: "el-icon-upload",
btnName: "导入",
size: "mini",
round: false,
loading: false,
event: "upLoad",
},
{
type: "primary",
icon: "el-icon-download",
btnName: "导出",
size: "mini",
round: false,
loading: false,
event: "download",
},
{
type: "danger",
icon: "el-icon-delete",
btnName: "删除",
size: "mini",
round: false,
loading: false,
event: "delete",
},
],
},
};
export const columnHeader = (viewRow, editRow, deleteRow) => [
{
type: "selection",
align: "center",
prop: "selection",
width: "50",
},
{
type: "index",
label: "序号",
prop: "id",
align: "center",
width: "50",
},
{
label: "原航班号",
prop: "originOfFlightNo",
align: "center",
minWidth: 100,
},
{
label: "顺位航班",
prop: "rankFltNoStr",
align: "center",
minWidth: 100,
},
{
label: "URSA包含",
prop: "includeUrsa",
align: "center",
minWidth: 100,
},
{
label: "URSA不包含",
prop: "notIncludeUrsa",
align: "center",
minWidth: 100,
},
{
label: "状态",
prop: "status",
align: "center",
minWidth: 100,
render: (h, params) => {
const { row } = params;
return h("div", `${state[row.status]}`);
},
},
{
label: "创建时间",
prop: "createTime",
align: "center",
minWidth: 100,
sortable: true,
"sort-method": (a, b) => b.createTime - a.createTime,
},
{
label: "创建人",
prop: "createUserName",
align: "center",
minWidth: 100,
},
{
label: "修改时间",
prop: "updateTime",
align: "center",
minWidth: 100,
},
{
label: "修改人",
prop: "updateUserName",
align: "center",
minWidth: 100,
},
{
label: "操作",
prop: "operate",
align: "center",
minWidth: 120,
fixed: "right",
render: (h, params) => {
return h("div", [
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-view",
},
on: {
click() {
viewRow(params);
},
},
},
"查看"
),
h(
"el-button",
{
props: {
type: "text",
size: "mini",
icon: "el-icon-edit",
},
on: {
click() {
editRow(params);
},
},
},
"修改"
),
h(
"el-button",
{
style: {
color: "#ff4949",
},
props: {
type: "text",
size: "mini",
icon: "el-icon-delete",
},
on: {
click() {
deleteRow(params);
},
},
},
"删除"
),
]);
},
},
];