3 changed files with 554 additions and 351 deletions
@ -1,267 +1,386 @@
|
||||
<template> |
||||
<basic-container> |
||||
|
||||
<!-- <el-row> --> |
||||
<!-- <div class="avue-crud__header"> --> |
||||
<!-- 头部左侧按钮模块 --> |
||||
<!-- <div class="avue-crud__left"> |
||||
<el-button type="danger" icon="el-icon-bottom" @click="handleExportInfo" plain |
||||
>导出 --> |
||||
<!-- </el-button> |
||||
</div> |
||||
</div> --> |
||||
<!-- </el-row> --> |
||||
<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 #menu-left> |
||||
<el-button type="danger" |
||||
icon="el-icon-delete" |
||||
plain |
||||
v-if="permission.warehouseRetentionRecord_delete" |
||||
@click="handleDelete">删 除 |
||||
</el-button> |
||||
<!-- <el-button type="warning"--> |
||||
<!-- plain--> |
||||
<!-- icon="el-icon-download"--> |
||||
<!-- @click="handleExport">导 出--> |
||||
<!-- </el-button>--> |
||||
</template> |
||||
</avue-crud> |
||||
</basic-container> |
||||
</template> |
||||
<div class="maxContent"> |
||||
<!-- 搜索功能 --> |
||||
<div> |
||||
<div class="SoInput" v-show="searchSo"> |
||||
<el-form :model="SoInfoData"> |
||||
<el-form-item label="搜索框1:"> |
||||
<el-input v-model="SoInfoData.a" placeholder="请输入1" /> |
||||
</el-form-item> |
||||
<el-form-item label="搜索框2:"> |
||||
<el-input v-model="SoInfoData.b" placeholder="请输入2" /> |
||||
</el-form-item> |
||||
<el-form-item label="搜索框3:"> |
||||
<el-input v-model="SoInfoData.c" placeholder="请输入3" /> |
||||
</el-form-item> |
||||
<el-form-item label="搜索框4:"> |
||||
<el-input v-model="SoInfoData.d" placeholder="请输入4" /> |
||||
</el-form-item> |
||||
</el-form> |
||||
<div class="SoBtn"> |
||||
<el-button icon="el-icon-delete" @click="searchReset()">清 空</el-button> |
||||
<el-button type="primary" icon="el-icon-search" @click="searchChange">搜 索</el-button> |
||||
</div> |
||||
</div> |
||||
<!-- 查询按钮 --> |
||||
<!-- 头部右侧按钮模块 --> |
||||
<div class="avue-crud__right"> |
||||
<el-button icon="el-icon-refresh" @click="Refresh" circle></el-button> |
||||
<el-button icon="el-icon-search" @click="searchSo = !searchSo" circle></el-button> |
||||
</div> |
||||
<!-- 表格开始 --> |
||||
<el-table |
||||
v-loading="loading" |
||||
element-loading-text="数据正在更新中..." |
||||
:data="ElData" |
||||
row-key="name" |
||||
border |
||||
height="600" |
||||
style="width: 100%" |
||||
ref="tableRef" |
||||
@select-all="selectAll" |
||||
@select="selectChange" |
||||
> |
||||
<el-table-column type="selection" width="55" fixed /> |
||||
<el-table-column type="index" fixed width="50" height="100" label="#" align="center" /> |
||||
|
||||
<script> |
||||
import {getList, getDetail, add, update, remove,$_RetentionWarehouseRetentionRecord} from "@/api/warehouse/warehouseRetentionRecord"; |
||||
import option from "@/option/warehouse/warehouseRetentionRecord"; |
||||
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'; |
||||
<!-- |
||||
Type ===1 普通文本 |
||||
Type ===2 图片显示 |
||||
Type ===3 操作功能 |
||||
label: 标题 |
||||
width: 宽度 |
||||
prop: 数据字段 |
||||
--> |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
form: {}, |
||||
query: {}, |
||||
search: {}, |
||||
loading: true, |
||||
page: { |
||||
pageSize: 30, |
||||
currentPage: 1, |
||||
total: 0 |
||||
}, |
||||
selectionList: [], |
||||
option: option, |
||||
data: [] |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(["permission"]), |
||||
permissionList() { |
||||
return { |
||||
addBtn: this.validData(this.permission.warehouseRetentionRecord_add, false), |
||||
viewBtn: this.validData(this.permission.warehouseRetentionRecord_view, false), |
||||
delBtn: this.validData(this.permission.warehouseRetentionRecord_delete, false), |
||||
editBtn: this.validData(this.permission.warehouseRetentionRecord_edit, false) |
||||
}; |
||||
}, |
||||
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: "操作成功!" |
||||
}); |
||||
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); |
||||
}); |
||||
}, |
||||
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" |
||||
}) |
||||
.then(() => { |
||||
return remove(this.ids); |
||||
}) |
||||
.then(() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: "success", |
||||
message: "操作成功!" |
||||
}); |
||||
this.$refs.crud.toggleSelection(); |
||||
}); |
||||
}, |
||||
// handleExport() { |
||||
// let downloadUrl = `/retentionRecord/warehouseRetentionRecord/export-warehouseRetentionRecord?${this.website.tokenHeader}=${getToken()}`; |
||||
// const { |
||||
// } = this.query; |
||||
// let values = { |
||||
// }; |
||||
// this.$confirm("是否导出数据?", "提示", { |
||||
// confirmButtonText: "确定", |
||||
// cancelButtonText: "取消", |
||||
// type: "warning" |
||||
// }).then(() => { |
||||
// NProgress.start(); |
||||
// exportBlob(downloadUrl, values).then(res => { |
||||
// downloadXls(res.data, `滞留记录${dateNow()}.xlsx`); |
||||
// NProgress.done(); |
||||
// }) |
||||
// }); |
||||
// }, |
||||
// 导出功能 |
||||
handleExportInfo() { |
||||
let row = {}; |
||||
if (!!this.ids) { |
||||
row.ids = this.ids; |
||||
} else { |
||||
row.ids = ''; |
||||
} |
||||
$_RetentionWarehouseRetentionRecord(row).then(res => { |
||||
downloadXls(res.data, '滞留包条数据.xlsx'); |
||||
}); |
||||
}, |
||||
<el-table-column |
||||
:prop="item.prop" |
||||
:label="item.label" |
||||
:width="item.width" |
||||
:fixed="item.fixed" |
||||
align="center" |
||||
v-for="(item, index) in menuData" |
||||
:key="item.label" |
||||
> |
||||
<el-table-column |
||||
:prop="item.prop" |
||||
:label="item.label" |
||||
:width="item.width" |
||||
:fixed="item.fixed" |
||||
align="center" |
||||
> |
||||
<template #header> |
||||
<!-- <el-input |
||||
@change="InputSo(item)" |
||||
clearable |
||||
v-if="item.type == 4" |
||||
v-model="item.values" |
||||
:placeholder="`请输入${item.label}`" |
||||
/> --> |
||||
</template> |
||||
|
||||
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; |
||||
<template #default="props"> |
||||
<img :src="props.row[item.prop]" class="el-Img" v-if="item.type === 2" /> |
||||
|
||||
const { |
||||
} = this.query; |
||||
|
||||
let values = { |
||||
}; |
||||
<div :class="ElBtnClass" v-if="item.type == 3"> |
||||
<el-button |
||||
:link="ElButtonS[0].link" |
||||
:class="ElButtonS[0].class" |
||||
:auto-insert-space="ElButtonS[0].space" |
||||
:size="ElButtonS[0].size" |
||||
:icon="ElButtonS[0].icon" |
||||
@click="ViewEvent(props.row)" |
||||
>详情</el-button |
||||
> |
||||
</div> |
||||
<span v-if="item.type == 6">{{ |
||||
props.row[item.prop] == 1 |
||||
? '装车滞留' |
||||
: props.row[item.prop] == 2 |
||||
? '配送滞留' |
||||
: props.row[item.prop] == 3 |
||||
? '出库滞留滞留' |
||||
: '/' |
||||
}}</span> |
||||
<span v-if="item.type == 1">{{ |
||||
props.row[item.prop] ? props.row[item.prop] : '/' |
||||
}}</span> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table-column> |
||||
</el-table> |
||||
</div> |
||||
<!-- 表格翻页功能 --> |
||||
<div class="demo-pagination-block TCdemo-pagination-block"> |
||||
<el-pagination |
||||
v-model:current-page="currentPage" |
||||
v-model:page-size="pageSize" |
||||
:page-sizes="pageList" |
||||
:disabled="disabled" |
||||
:background="background" |
||||
layout="total, sizes, prev, pager, next, jumper" |
||||
:total="total" |
||||
@size-change="PageSizeChange" |
||||
@current-change="SizeChange" |
||||
/> |
||||
</div> |
||||
<!-- 弹窗详情 --> |
||||
<el-dialog v-model="PopupDetails" title="详情数据展示" width="70%" :before-close="handleClose"> |
||||
<el-tabs type="border-card" class="demo-tabs"> |
||||
<el-tab-pane v-for="item in Tabs" :key="item.name"> |
||||
<template #label> |
||||
<span class="custom-tabs-label"> |
||||
<el-icon><component :is="item.icon" /></el-icon> |
||||
<span>{{ item.label }}</span> |
||||
</span> |
||||
</template> |
||||
</el-tab-pane> |
||||
</el-tabs> |
||||
<template #footer> |
||||
<span class="dialog-footer"> |
||||
<el-button>Cancel</el-button> |
||||
<el-button type="primary"> Confirm </el-button> |
||||
</span> |
||||
</template> |
||||
</el-dialog> |
||||
</div> |
||||
</template> |
||||
|
||||
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 setup> |
||||
import { ref, reactive, onMounted, computed } from 'vue'; |
||||
import { $_warehouseRetentionRecordPage } from '@/api/warehouse/warehouseRetentionRecord.js'; |
||||
import { ElMessage } from 'element-plus'; |
||||
const SoInfoData = ref({}); //搜索框参数 |
||||
const searchSo = ref(false); //搜索框 |
||||
const ElData = ref([]); //表格的值 |
||||
const currentPage = ref(1); // 默认页码 |
||||
const pageSize = ref(20); // 默认每一页几条 |
||||
const pageList = ref([5, 10, 50, 100, 200]); // 选择每页显示多少条 |
||||
const background = ref(true); // 是否开启背景颜色 |
||||
const disabled = ref(false); // 是否禁止使用页码功能 |
||||
const total = ref(10); //页码总数 |
||||
const loading = ref(false); //表格加载Load |
||||
const PopupDetails = ref(false); //弹窗详情是否展示 |
||||
const Tabs = ref([ |
||||
// 标题栏 |
||||
{ label: '处理中', name: 0, icon: 'Monitor' }, |
||||
{ label: '理赔金额未出', name: 1, icon: 'Coin' }, |
||||
{ label: '处理完毕', name: 2, icon: 'Check' }, |
||||
{ label: '完结', name: 3, icon: 'Reading' }, |
||||
{ label: '仲裁中', name: 4, icon: 'List' }, |
||||
{ label: '全部', name: 5, icon: 'Notification' }, |
||||
]); |
||||
// 菜单表头 |
||||
const menuData = ref([ |
||||
{ |
||||
prop: 'retentionCarNo', |
||||
label: '滞留车次号', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: true, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: 'retentionType', |
||||
label: '滞留类型', |
||||
type: 6, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: true, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: 'assembleCarPersonName', |
||||
label: '装车人名称', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: 'retentionRemarks', |
||||
label: '备注', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '预留1', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '预留2', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '预留3', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '预留4', |
||||
type: 4, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '操作', |
||||
type: 3, |
||||
values: '', |
||||
width: '130', |
||||
checkarr: [], |
||||
fixed: 'right', |
||||
search: false, |
||||
head: true, |
||||
}, |
||||
]); //表头结构 |
||||
// 按钮配置 |
||||
const ElButtonS = ref([ |
||||
// 1.link 切换按钮样式(文本模式-false ,按钮模式-tre) |
||||
// 2.class 按钮样式名(用于切换按钮样式) |
||||
// 3.space 是否开启按钮文子直接间距(true开启 ,false关闭) |
||||
// 4.size 按钮尺寸默认小尺寸('large'| 'default'| 'small') |
||||
// 5.icon 按钮图标 |
||||
// 6.table 按钮名称 |
||||
{ |
||||
link: false, |
||||
class: 'el-btn-view', |
||||
space: true, |
||||
size: 'small', |
||||
icon: 'el-icon-view', |
||||
table: '详情', |
||||
}, |
||||
]); |
||||
// 页面初始化请求 |
||||
function onLoad() { |
||||
loading.value = true; //开启表格加载 |
||||
let Data = { |
||||
current: currentPage.value, //页码 |
||||
size: pageSize.value, //条数 |
||||
}; |
||||
$_warehouseRetentionRecordPage(Data).then(res => { |
||||
console.log(res, '滞留初始化页面获取到的值'); |
||||
ElData.value = res.data.data.records; |
||||
total.value = res.data.data.total; //数据总条数 |
||||
loading.value = false; //关闭表格加载 |
||||
}); |
||||
} |
||||
// 调用页面初始化获取数据 |
||||
onLoad(); |
||||
const InputSo = val => { |
||||
console.log(val); |
||||
}; |
||||
// 表格筛选 |
||||
const selectChange = () => { |
||||
console.log('触发了选择'); |
||||
}; |
||||
// 表格筛选 |
||||
const selectAll = () => { |
||||
console.log('触发了选择'); |
||||
}; |
||||
// 重置搜索表单 |
||||
const searchReset = () => { |
||||
SoInfoData.value = {}; |
||||
}; |
||||
// 点击详情按钮 |
||||
const ViewEvent = val => { |
||||
console.log(val); |
||||
PopupDetails.value = true; |
||||
}; |
||||
// 关闭弹窗关闭回调 |
||||
const handleClose = () => { |
||||
PopupDetails.value = false; |
||||
}; |
||||
// 刷新页面按钮(初始化页面参数) |
||||
const Refresh = () => { |
||||
onLoad(); //初始化表格数据 |
||||
}; |
||||
</script> |
||||
|
||||
<style lang='scss' scoped> |
||||
:deep(.avue-crud) { |
||||
display: flex; |
||||
<style lang="scss" scoped> |
||||
.maxContent { |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
height: 100%; |
||||
display: flex; |
||||
flex-direction: column; |
||||
} |
||||
:deep(.el-card__body) { |
||||
height: 100%; |
||||
.SoInput { |
||||
display: flex; |
||||
justify-content: space-between; |
||||
padding: 0 10px; |
||||
margin-top: 10px; |
||||
form { |
||||
display: flex; |
||||
flex-wrap: wrap; |
||||
margin-top: 5px; |
||||
:deep(.el-form-item) { |
||||
margin-bottom: 0; |
||||
} |
||||
} |
||||
.SoBtn { |
||||
display: flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
} |
||||
} |
||||
:deep(.el-card) { |
||||
height: 100%; |
||||
.avue-crud__right { |
||||
margin-top: 5px; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: flex-end; |
||||
margin-bottom: 5px; |
||||
padding: 0 10px; |
||||
} |
||||
.el-fy { |
||||
:deep(.cell) { |
||||
padding: 0; |
||||
} |
||||
.demo-pagination-block { |
||||
flex: 1; |
||||
display: flex; |
||||
align-items: flex-end; |
||||
align-items: flex-end; |
||||
margin-bottom: 8px; |
||||
justify-content: flex-end; |
||||
margin-right: 6px; |
||||
} |
||||
:deep(.el-table-column--selection) { |
||||
text-align: center; |
||||
} |
||||
</style> |
||||
|
Loading…
Reference in new issue