10 changed files with 2197 additions and 2445 deletions
@ -1,7 +1,7 @@ |
|||||||
<template> |
<template> |
||||||
<router-view #="{ Component }"> |
<router-view #="{ Component }"> |
||||||
<keep-alive :include="$store.getters.tagsKeep"> |
<!-- <keep-alive :include="$store.getters.tagsKeep"> --> |
||||||
<component :is="Component" /> |
<component :is="Component" /> |
||||||
</keep-alive> |
<!-- </keep-alive> --> |
||||||
</router-view> |
</router-view> |
||||||
</template> |
</template> |
||||||
|
@ -1,266 +1,249 @@ |
|||||||
<template> |
<template> |
||||||
<basic-container> |
<basic-container> |
||||||
<avue-crud :option="option" |
<avue-crud :option="option" v-model:search="search" v-model:page="page" v-model="form" :table-loading="loading" |
||||||
v-model:search="search" |
:data="data" :permission="permissionList" :before-open="beforeOpen" ref="crud" @row-update="rowUpdate" |
||||||
v-model:page="page" |
@row-save="rowSave" @row-del="rowDel" @search-change="searchChange" @search-reset="searchReset" |
||||||
v-model="form" |
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange" |
||||||
:table-loading="loading" |
@refresh-change="refreshChange" @on-load="onLoad"> |
||||||
:data="data" |
<template #id-header="{ column }"> |
||||||
:permission="permissionList" |
<span>{{ column.label }}</span> |
||||||
:before-open="beforeOpen" |
<el-input size="autosize" v-model="query.id" placeholder="请输入内容" suffix-icon="el-icon-search" /> |
||||||
ref="crud" |
<!-- <el-tag>{{(column || {}).label}}-{{(column || {}).prop}}</el-tag> --> |
||||||
@row-update="rowUpdate" |
</template> |
||||||
@row-save="rowSave" |
|
||||||
@row-del="rowDel" |
|
||||||
@search-change="searchChange" |
|
||||||
@search-reset="searchReset" |
|
||||||
@selection-change="selectionChange" |
|
||||||
@current-change="currentChange" |
|
||||||
@size-change="sizeChange" |
|
||||||
@refresh-change="refreshChange" |
|
||||||
@on-load="onLoad"> |
|
||||||
<template #id-header="{column}"> |
|
||||||
<span>{{ column.label }}</span> |
|
||||||
<el-input size="autosize" v-model="query.id" placeholder="请输入内容" suffix-icon="el-icon-search" /> |
|
||||||
<!-- <el-tag>{{(column || {}).label}}-{{(column || {}).prop}}</el-tag> --> |
|
||||||
</template> |
|
||||||
|
|
||||||
<template #logisticsLineNumber-header="{column}"> |
<template #logisticsLineNumber-header="{ column }"> |
||||||
<span>{{ column.label }}</span> |
<span>{{ column.label }}</span> |
||||||
<el-input size="autosize" v-model="query.logisticsLineNumber" placeholder="请输入内容" suffix-icon="el-icon-search" /> |
<el-input size="autosize" v-model="query.logisticsLineNumber" placeholder="请输入内容" suffix-icon="el-icon-search" /> |
||||||
<!-- <el-tag>{{(column || {}).label}}-{{(column || {}).prop}}</el-tag> --> |
<!-- <el-tag>{{(column || {}).label}}-{{(column || {}).prop}}</el-tag> --> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<template #logisticsLineName-header="{column}"> |
<template #logisticsLineName-header="{ column }"> |
||||||
<span>{{ column.label }}</span> |
<span>{{ column.label }}</span> |
||||||
<el-input size="autosize" v-model="query.logisticsLineName" placeholder="请输入内容" suffix-icon="el-icon-search" /> |
<el-input size="autosize" v-model="query.logisticsLineName" placeholder="请输入内容" suffix-icon="el-icon-search" /> |
||||||
<!-- <el-tag>{{(column || {}).label}}-{{(column || {}).prop}}</el-tag> --> |
<!-- <el-tag>{{(column || {}).label}}-{{(column || {}).prop}}</el-tag> --> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<template #menu-left> |
<template #menu-left> |
||||||
<el-button type="danger" |
<el-button type="danger" icon="el-icon-delete" plain v-if="permission.stationlinenum_delete" |
||||||
icon="el-icon-delete" |
@click="handleDelete">删 除 |
||||||
plain |
|
||||||
v-if="permission.stationlinenum_delete" |
|
||||||
@click="handleDelete">删 除 |
|
||||||
</el-button> |
</el-button> |
||||||
<el-button type="warning" |
<el-button type="warning" plain icon="el-icon-download" @click="handleExport">导 出 |
||||||
plain |
|
||||||
icon="el-icon-download" |
|
||||||
@click="handleExport">导 出 |
|
||||||
</el-button> |
</el-button> |
||||||
</template> |
</template> |
||||||
|
|
||||||
|
|
||||||
</avue-crud> |
</avue-crud> |
||||||
</basic-container> |
</basic-container> |
||||||
</template> |
</template> |
||||||
|
|
||||||
<script> |
<script> |
||||||
import {getList, getDetail, add, update, remove} from "@/api/factory/snm/stationlinenum"; |
import { getList, getDetail, add, update, remove } from "@/api/factory/snm/stationlinenum"; |
||||||
import option from "@/option/factory/snm/stationlinenum"; |
import option from "@/option/factory/snm/stationlinenum"; |
||||||
import {mapGetters} from "vuex"; |
import { mapGetters } from "vuex"; |
||||||
import {exportBlob} from "@/api/common"; |
import { exportBlob } from "@/api/common"; |
||||||
import {getToken} from '@/utils/auth'; |
import { getToken } from '@/utils/auth'; |
||||||
import {downloadXls} from "@/utils/util"; |
import { downloadXls } from "@/utils/util"; |
||||||
import {dateNow} from "@/utils/date"; |
import { dateNow } from "@/utils/date"; |
||||||
import NProgress from 'nprogress'; |
import NProgress from 'nprogress'; |
||||||
import 'nprogress/nprogress.css'; |
import 'nprogress/nprogress.css'; |
||||||
|
|
||||||
|
export default { |
||||||
|
data() { |
||||||
|
return { |
||||||
|
form: {}, |
||||||
|
query: {}, |
||||||
|
search: {}, |
||||||
|
loading: true, |
||||||
|
page: { |
||||||
|
pageSize: 30, |
||||||
|
currentPage: 1, |
||||||
|
total: 0 |
||||||
|
}, |
||||||
|
selectionList: [], |
||||||
|
option: option, |
||||||
|
data: [] |
||||||
|
}; |
||||||
|
}, |
||||||
|
computed: { |
||||||
|
...mapGetters(["permission"]), |
||||||
|
permissionList() { |
||||||
|
|
||||||
export default { |
|
||||||
data() { |
|
||||||
return { |
return { |
||||||
form: {}, |
addBtn: this.validData(this.permission.stationlinenum_add, false), |
||||||
query: {}, |
viewBtn: this.validData(this.permission.stationlinenum_view, false), |
||||||
search: {}, |
delBtn: this.validData(this.permission.stationlinenum_delete, false), |
||||||
loading: true, |
editBtn: this.validData(this.permission.stationlinenum_edit, false) |
||||||
page: { |
|
||||||
pageSize: 30, |
|
||||||
currentPage: 1, |
|
||||||
total: 0 |
|
||||||
}, |
|
||||||
selectionList: [], |
|
||||||
option: option, |
|
||||||
data: [] |
|
||||||
}; |
}; |
||||||
}, |
}, |
||||||
computed: { |
ids() { |
||||||
...mapGetters(["permission"]), |
let ids = []; |
||||||
permissionList() { |
this.selectionList.forEach(ele => { |
||||||
|
ids.push(ele.id); |
||||||
return { |
}); |
||||||
addBtn: this.validData(this.permission.stationlinenum_add, false), |
return ids.join(","); |
||||||
viewBtn: this.validData(this.permission.stationlinenum_view, false), |
} |
||||||
delBtn: this.validData(this.permission.stationlinenum_delete, false), |
}, |
||||||
editBtn: this.validData(this.permission.stationlinenum_edit, false) |
methods: { |
||||||
}; |
rowSave(row, done, loading) { |
||||||
}, |
add(row).then(() => { |
||||||
ids() { |
this.onLoad(this.page); |
||||||
let ids = []; |
this.$message({ |
||||||
this.selectionList.forEach(ele => { |
type: "success", |
||||||
ids.push(ele.id); |
message: "操作成功!" |
||||||
}); |
}); |
||||||
return ids.join(","); |
done(); |
||||||
} |
}, error => { |
||||||
|
loading(); |
||||||
|
window.console.log(error); |
||||||
|
}); |
||||||
|
}, |
||||||
|
rowUpdate(row, index, done, loading) { |
||||||
|
update(row).then(() => { |
||||||
|
this.onLoad(this.page); |
||||||
|
this.$message({ |
||||||
|
type: "success", |
||||||
|
message: "操作成功!" |
||||||
|
}); |
||||||
|
done(); |
||||||
|
}, error => { |
||||||
|
loading(); |
||||||
|
console.log(error); |
||||||
|
}); |
||||||
}, |
}, |
||||||
methods: { |
rowDel(row) { |
||||||
rowSave(row, done, loading) { |
this.$confirm("确定将选择数据删除?", { |
||||||
add(row).then(() => { |
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(row.id); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
this.onLoad(this.page); |
this.onLoad(this.page); |
||||||
this.$message({ |
this.$message({ |
||||||
type: "success", |
type: "success", |
||||||
message: "操作成功!" |
message: "操作成功!" |
||||||
}); |
}); |
||||||
done(); |
|
||||||
}, error => { |
|
||||||
loading(); |
|
||||||
window.console.log(error); |
|
||||||
}); |
}); |
||||||
}, |
}, |
||||||
rowUpdate(row, index, done, loading) { |
handleDelete() { |
||||||
update(row).then(() => { |
if (this.selectionList.length === 0) { |
||||||
|
this.$message.warning("请选择至少一条数据"); |
||||||
|
return; |
||||||
|
} |
||||||
|
this.$confirm("确定将选择数据删除?", { |
||||||
|
confirmButtonText: "确定", |
||||||
|
cancelButtonText: "取消", |
||||||
|
type: "warning" |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
|
return remove(this.ids); |
||||||
|
}) |
||||||
|
.then(() => { |
||||||
this.onLoad(this.page); |
this.onLoad(this.page); |
||||||
this.$message({ |
this.$message({ |
||||||
type: "success", |
type: "success", |
||||||
message: "操作成功!" |
message: "操作成功!" |
||||||
}); |
}); |
||||||
done(); |
this.$refs.crud.toggleSelection(); |
||||||
}, error => { |
|
||||||
loading(); |
|
||||||
console.log(error); |
|
||||||
}); |
}); |
||||||
}, |
}, |
||||||
rowDel(row) { |
handleExport() { |
||||||
this.$confirm("确定将选择数据删除?", { |
let downloadUrl = `/logpm-factory/snm/stationlinenum/export-stationlinenum?${this.website.tokenHeader}=${getToken()}`; |
||||||
confirmButtonText: "确定", |
const { |
||||||
cancelButtonText: "取消", |
logisticsLineNumber, |
||||||
type: "warning" |
logisticsLineName, |
||||||
}) |
} = this.query; |
||||||
.then(() => { |
let values = { |
||||||
return remove(row.id); |
logisticsLineNumber_equal: logisticsLineNumber, |
||||||
}) |
logisticsLineName_like: logisticsLineName, |
||||||
.then(() => { |
}; |
||||||
this.onLoad(this.page); |
this.$confirm("是否导出数据?", "提示", { |
||||||
this.$message({ |
confirmButtonText: "确定", |
||||||
type: "success", |
cancelButtonText: "取消", |
||||||
message: "操作成功!" |
type: "warning" |
||||||
}); |
}).then(() => { |
||||||
}); |
NProgress.start(); |
||||||
}, |
exportBlob(downloadUrl, values).then(res => { |
||||||
handleDelete() { |
downloadXls(res.data, `诗尼曼线路${dateNow()}.xlsx`); |
||||||
if (this.selectionList.length === 0) { |
NProgress.done(); |
||||||
this.$message.warning("请选择至少一条数据"); |
|
||||||
return; |
|
||||||
} |
|
||||||
this.$confirm("确定将选择数据删除?", { |
|
||||||
confirmButtonText: "确定", |
|
||||||
cancelButtonText: "取消", |
|
||||||
type: "warning" |
|
||||||
}) |
}) |
||||||
.then(() => { |
}); |
||||||
return remove(this.ids); |
}, |
||||||
}) |
beforeOpen(done, type) { |
||||||
.then(() => { |
if (["edit", "view"].includes(type)) { |
||||||
this.onLoad(this.page); |
getDetail(this.form.id).then(res => { |
||||||
this.$message({ |
this.form = res.data.data; |
||||||
type: "success", |
|
||||||
message: "操作成功!" |
|
||||||
}); |
|
||||||
this.$refs.crud.toggleSelection(); |
|
||||||
}); |
|
||||||
}, |
|
||||||
handleExport() { |
|
||||||
let downloadUrl = `/logpm-factory/snm/stationlinenum/export-stationlinenum?${this.website.tokenHeader}=${getToken()}`; |
|
||||||
const { |
|
||||||
logisticsLineNumber, |
|
||||||
logisticsLineName, |
|
||||||
} = this.query; |
|
||||||
let values = { |
|
||||||
logisticsLineNumber_equal: logisticsLineNumber, |
|
||||||
logisticsLineName_like: logisticsLineName, |
|
||||||
}; |
|
||||||
this.$confirm("是否导出数据?", "提示", { |
|
||||||
confirmButtonText: "确定", |
|
||||||
cancelButtonText: "取消", |
|
||||||
type: "warning" |
|
||||||
}).then(() => { |
|
||||||
NProgress.start(); |
|
||||||
exportBlob(downloadUrl, values).then(res => { |
|
||||||
downloadXls(res.data, `诗尼曼线路${dateNow()}.xlsx`); |
|
||||||
NProgress.done(); |
|
||||||
}) |
|
||||||
}); |
}); |
||||||
}, |
} |
||||||
beforeOpen(done, type) { |
done(); |
||||||
if (["edit", "view"].includes(type)) { |
}, |
||||||
getDetail(this.form.id).then(res => { |
searchReset() { |
||||||
this.form = res.data.data; |
this.query = {}; |
||||||
}); |
this.onLoad(this.page); |
||||||
} |
}, |
||||||
done(); |
searchChange(params, done) { |
||||||
}, |
this.query = params; |
||||||
searchReset() { |
this.page.currentPage = 1; |
||||||
this.query = {}; |
this.onLoad(this.page, params); |
||||||
this.onLoad(this.page); |
done(); |
||||||
}, |
}, |
||||||
searchChange(params, done) { |
selectionChange(list) { |
||||||
this.query = params; |
this.selectionList = list; |
||||||
this.page.currentPage = 1; |
}, |
||||||
this.onLoad(this.page, params); |
selectionClear() { |
||||||
done(); |
this.selectionList = []; |
||||||
}, |
this.$refs.crud.toggleSelection(); |
||||||
selectionChange(list) { |
}, |
||||||
this.selectionList = list; |
currentChange(currentPage) { |
||||||
}, |
this.page.currentPage = currentPage; |
||||||
selectionClear() { |
}, |
||||||
this.selectionList = []; |
sizeChange(pageSize) { |
||||||
this.$refs.crud.toggleSelection(); |
this.page.pageSize = pageSize; |
||||||
}, |
}, |
||||||
currentChange(currentPage){ |
refreshChange() { |
||||||
this.page.currentPage = currentPage; |
this.onLoad(this.page, this.query); |
||||||
}, |
}, |
||||||
sizeChange(pageSize){ |
onLoad(page, params = {}) { |
||||||
this.page.pageSize = pageSize; |
this.loading = true; |
||||||
}, |
|
||||||
refreshChange() { |
|
||||||
this.onLoad(this.page, this.query); |
|
||||||
}, |
|
||||||
onLoad(page, params = {}) { |
|
||||||
this.loading = true; |
|
||||||
|
|
||||||
const { |
const { |
||||||
logisticsLineNumber, |
logisticsLineNumber, |
||||||
logisticsLineName, |
logisticsLineName, |
||||||
} = this.query; |
} = this.query; |
||||||
|
|
||||||
let values = { |
let values = { |
||||||
logisticsLineNumber_equal: logisticsLineNumber, |
logisticsLineNumber_equal: logisticsLineNumber, |
||||||
logisticsLineName_like: logisticsLineName, |
logisticsLineName_like: logisticsLineName, |
||||||
}; |
}; |
||||||
|
|
||||||
getList(page.currentPage, page.pageSize, values).then(res => { |
getList(page.currentPage, page.pageSize, values).then(res => { |
||||||
const data = res.data.data; |
const data = res.data.data; |
||||||
this.page.total = data.total; |
this.page.total = data.total; |
||||||
this.data = data.records; |
this.data = data.records; |
||||||
this.loading = false; |
this.loading = false; |
||||||
this.selectionClear(); |
this.selectionClear(); |
||||||
}); |
}); |
||||||
} |
|
||||||
} |
} |
||||||
}; |
} |
||||||
|
}; |
||||||
</script> |
</script> |
||||||
|
|
||||||
<style scoped lang='scss'> |
<style scoped lang='scss'> |
||||||
:deep(.no-print){ |
:deep(.no-print) { |
||||||
margin-left:auto; |
margin-left: auto; |
||||||
.el-button{ |
|
||||||
margin-right:0 |
.el-button { |
||||||
|
margin-right: 0 |
||||||
} |
} |
||||||
} |
} |
||||||
:deep(.avue-form__row){ |
|
||||||
max-width:300px!important; |
:deep(.avue-form__row) { |
||||||
|
max-width: 300px !important; |
||||||
} |
} |
||||||
:deep(.el-form-item__label){ |
|
||||||
width:auto !important; |
:deep(.el-form-item__label) { |
||||||
|
width: auto !important; |
||||||
} |
} |
||||||
</style> |
</style> |
||||||
|
Loading…
Reference in new issue