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