9 changed files with 1855 additions and 604 deletions
@ -0,0 +1,115 @@
|
||||
export const columnList = [ |
||||
{ |
||||
prop: '', |
||||
label: '复选框', |
||||
type: 0, |
||||
width: 55, |
||||
fixed: true, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '序号', |
||||
type: 12, |
||||
values: '', |
||||
width: 55, |
||||
fixed: true, |
||||
}, |
||||
{ |
||||
prop: 'palletName', |
||||
label: '托盘名称', |
||||
type: 2, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'trayTypeName', |
||||
label: '打托方式', |
||||
type: 1, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'warehouseName', |
||||
label: '仓库', |
||||
type: 1, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'typeName', |
||||
label: '托盘类型', |
||||
type: 3, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'trayStatusName', |
||||
label: '托盘状态', |
||||
type: 3, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'palletCode', |
||||
label: '托盘码', |
||||
type: 2, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'oldQrCode', |
||||
label: '旧托盘码', |
||||
type: 1, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: 'disableTypeName', |
||||
label: '禁用状态', |
||||
type: 1, |
||||
values: '', |
||||
width: '150', |
||||
checkarr: [], |
||||
fixed: false, |
||||
sortable: true, |
||||
head: false, |
||||
}, |
||||
{ |
||||
prop: '', |
||||
label: '操作', |
||||
type: 6, |
||||
values: '', |
||||
width: '200', |
||||
checkarr: [], |
||||
fixed: 'right', |
||||
head: false, |
||||
}, |
||||
]; |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,560 @@
|
||||
<template> |
||||
<basic-container v-loading="loadingObj.pageLoading"> |
||||
<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.BasicdataTray_delete"--> |
||||
<!-- @click="handleDelete">删 除--> |
||||
<!-- </el-button>--> |
||||
<!-- <el-button type="warning"--> |
||||
<!-- plain--> |
||||
<!-- icon="el-icon-download"--> |
||||
<!-- @click="handleExport">导 出--> |
||||
<!-- </el-button>--> |
||||
<el-button type="warning" plain icon="el-icon-camera" @click="handleqr" |
||||
>查看二维码 |
||||
</el-button> |
||||
<el-button type="warning" plain icon="el-icon-edit" @click="lossess">报 损 </el-button> |
||||
<el-button type="warning" plain icon="el-icon-circle-close" @click="disable" |
||||
>禁 用 |
||||
</el-button> |
||||
<el-button type="warning" plain icon="el-icon-check" @click="addable">启 用 </el-button> |
||||
<el-button type="warning" plain icon="el-icon-refresh" @click="vacants" |
||||
>一 键 空 置 |
||||
</el-button> |
||||
</template> |
||||
<template #menu="{ size, row, index }"> |
||||
<!-- <el-button type="primary" text icon="el-icon-view" v-if="row.trayStatus !=='3'" @click="losses(row)">报 损</el-button>--> |
||||
<!-- <el-button type="primary" text icon="el-icon-view" v-if="row.trayStatus !=='3' && row.disableType==1 && row.trayStatus !=='1' " @click="vacant(row)">一 键 空 置</el-button>--> |
||||
<!-- <el-button type="primary" text icon="el-icon-view" v-if="row.trayStatus !=='3' && row.disableType==1" @click="disable(row)">禁 用</el-button>--> |
||||
<!-- <el-button type="primary" text icon="el-icon-view" v-if="row.trayStatus !=='3' && row.disableType==2" @click="addable(row)">启 用</el-button>--> |
||||
<el-button |
||||
type="primary" |
||||
text |
||||
icon="el-icon-view" |
||||
v-if="row.trayStatus !== '3'" |
||||
@click="Details(row)" |
||||
>在 托 详 情</el-button |
||||
> |
||||
<el-button type="primary" text icon="el-icon-view" @click="historys(row)" |
||||
>历 史 记 录</el-button |
||||
> |
||||
</template> |
||||
</avue-crud> |
||||
<el-dialog title="二维码" :visible.sync="dialogVisible" width="600px" v-model="dialogVisible"> |
||||
<div class="print_QRCode"> |
||||
<div v-html="html"></div> |
||||
</div> |
||||
<div class="dialog-footer mt10"> |
||||
<!-- <el-button type="primary" @click="ddd">导 出</el-button>--> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
<el-button type="primary" icon="Printer" @click="printTemplate">打 印</el-button> |
||||
</div> |
||||
</el-dialog> |
||||
<el-dialog :title="'确认破损'" v-model="damagedBox" width="45%" append-to-body> |
||||
<avue-form :option="damagedoption" v-model="damagedform" :data="damageddata" ref="signform"> |
||||
</avue-form> |
||||
<div style="bottom: 7%; margin-left: 500px; width: 50%"> |
||||
<div style="width: 100%"> |
||||
<el-button type="primary" @click="submitForm" style="margin-right: 20%">确定</el-button> |
||||
<el-button type="primary" @click="cancellation">取消</el-button> |
||||
</div> |
||||
</div> |
||||
</el-dialog> |
||||
</basic-container> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
getList, |
||||
getDetail, |
||||
add, |
||||
update, |
||||
remove, |
||||
vacant, |
||||
getPrintTemplate, |
||||
disable, |
||||
addable, |
||||
vacants, |
||||
} from '@/api/basicdata/basicdataTray'; |
||||
import option from '@/option/basicdata/basicdataTray'; |
||||
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 { getLodop } from '@/utils/LodopFuncs'; |
||||
import print from '@/utils/print'; |
||||
|
||||
export default { |
||||
data() { |
||||
return { |
||||
form: {}, |
||||
query: {}, |
||||
//破损是否显示 |
||||
damagedBox: false, |
||||
search: {}, |
||||
loading: true, |
||||
page: { |
||||
pageSize: 30, |
||||
currentPage: 1, |
||||
total: 0, |
||||
}, |
||||
// 破损表单数据 |
||||
damagedform: {}, |
||||
// 破损列表 |
||||
damageddata: [], |
||||
// 表单配置 |
||||
damagedoption: { |
||||
height: 'auto', |
||||
width: '40px', |
||||
calcHeight: 30, |
||||
tip: false, |
||||
searchShow: false, |
||||
searchMenuSpan: 6, |
||||
border: true, |
||||
index: true, |
||||
viewBtn: true, |
||||
dialogClickModal: false, |
||||
|
||||
emptyBtn: false, //隐藏清空按钮 |
||||
submitBtn: false, //隐藏提交按钮 |
||||
column: [ |
||||
{ |
||||
label: '破损图片', |
||||
prop: 'damagedPhotos', |
||||
labelWidth: '150', |
||||
type: 'upload', |
||||
listType: 'picture-card', |
||||
width: '150px', |
||||
span: 15, |
||||
multiple: true, |
||||
align: 'left', |
||||
action: '/blade-resource/oss/endpoint/put-file', |
||||
limit: 5, |
||||
propsHttp: { |
||||
res: 'data', |
||||
url: 'link', |
||||
}, |
||||
disabled: false, |
||||
}, |
||||
|
||||
{ |
||||
label: '备注', |
||||
prop: 'damagedNote', |
||||
labelWidth: '150', |
||||
span: 15, |
||||
type: 'input', |
||||
width: '150px', |
||||
align: 'center', |
||||
}, |
||||
], |
||||
}, |
||||
damagedId: null, |
||||
selectionList: [], |
||||
option: option, |
||||
data: [], |
||||
html: null, // 页面包条码内容 |
||||
dialogVisible: false, |
||||
loadingObj: { |
||||
pageLoading: false, |
||||
}, |
||||
}; |
||||
}, |
||||
computed: { |
||||
...mapGetters(['permission']), |
||||
permissionList() { |
||||
return { |
||||
addBtn: this.validData(this.permission.BasicdataTray_add, false), |
||||
viewBtn: this.validData(this.permission.BasicdataTray_view, false), |
||||
delBtn: this.validData(this.permission.BasicdataTray_delete, false), |
||||
editBtn: this.validData(this.permission.BasicdataTray_edit, false), |
||||
}; |
||||
}, |
||||
ids() { |
||||
let ids = []; |
||||
this.selectionList.forEach(ele => { |
||||
ids.push(ele.id); |
||||
}); |
||||
return ids.join(','); |
||||
}, |
||||
}, |
||||
methods: { |
||||
//取消 |
||||
cancellation() { |
||||
this.damagedBox = false; |
||||
}, |
||||
historys(row) { |
||||
this.$router.push({ |
||||
path: '/basicdata/warehouse/tray/basicdataTrayhistory', |
||||
query: { |
||||
data: encodeURIComponent(JSON.stringify(row)), |
||||
name: row.palletCode + '-查看历史记录', |
||||
}, |
||||
}); |
||||
}, |
||||
submitForm() { |
||||
let row = {}; |
||||
row.id = this.damagedform.id; |
||||
row.trayStatus = 3; |
||||
row.damagedPhotos = this.damagedform.damagedPhotos.join(','); |
||||
row.damagedNote = this.damagedform.damagedNote; |
||||
console.log('更新参数>>>>>>>>', row); |
||||
update(row).then( |
||||
() => { |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
this.damagedBox = false; |
||||
this.onLoad(this.page, this.query); |
||||
}, |
||||
error => { |
||||
loading(); |
||||
console.log(error); |
||||
} |
||||
); |
||||
}, |
||||
losses(row) { |
||||
this.damagedform = row; |
||||
this.damagedBox = true; |
||||
}, |
||||
lossess() { |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning('请选择一条数据'); |
||||
return; |
||||
} |
||||
if (this.selectionList.length > 1) { |
||||
this.$message.warning('只能选一条数据'); |
||||
return; |
||||
} |
||||
console.log('this.selectionList>>>>>>', this.selectionList); |
||||
this.damagedform.id = this.selectionList[0].id; |
||||
this.damagedBox = true; |
||||
}, |
||||
vacant(row) { |
||||
this.$confirm('确认空置?') |
||||
.then(_ => { |
||||
console.log('row>>>>>>>>>>>>>>>>空置', row); |
||||
vacant(row).then( |
||||
() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
}, |
||||
error => { |
||||
loading(); |
||||
console.log(error); |
||||
} |
||||
); |
||||
}) |
||||
.catch(_ => {}); |
||||
}, |
||||
vacants() { |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning('请选择至少一条数据'); |
||||
return; |
||||
} |
||||
this.$confirm('确定将选择数据空置?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}) |
||||
.then(() => { |
||||
console.log('this.selectionList>>>>>>>>>>>>>>>>>>', this.selectionList); |
||||
const newList = this.selectionList.map(item => item.palletCode); |
||||
return vacants(newList); |
||||
}) |
||||
.then(() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
}); |
||||
}, |
||||
disable() { |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning('请选择至少一条数据'); |
||||
return; |
||||
} |
||||
this.$confirm('确定将选择数据禁用?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}) |
||||
.then(() => { |
||||
return disable(this.ids); |
||||
}) |
||||
.then(() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
}); |
||||
}, |
||||
addable() { |
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning('请选择至少一条数据'); |
||||
return; |
||||
} |
||||
this.$confirm('确定将选择数据启用?', { |
||||
confirmButtonText: '确定', |
||||
cancelButtonText: '取消', |
||||
type: 'warning', |
||||
}) |
||||
.then(() => { |
||||
return addable(this.ids); |
||||
}) |
||||
.then(() => { |
||||
this.onLoad(this.page); |
||||
this.$message({ |
||||
type: 'success', |
||||
message: '操作成功!', |
||||
}); |
||||
}); |
||||
}, |
||||
//批量打印数据处理代码 |
||||
printTemplate() { |
||||
const printNode = document.querySelectorAll('.print_QRCode>div>div'); |
||||
|
||||
console.log('printNode :>> ', printNode); |
||||
print(printNode, 'titlePrint'); |
||||
}, |
||||
async handleqr() { |
||||
try { |
||||
this.loadingObj.pageLoading = true; |
||||
|
||||
if (this.selectionList.length === 0) { |
||||
this.$message.warning('请选择至少一条数据'); |
||||
return; |
||||
} |
||||
|
||||
let checkcode = []; |
||||
this.selectionList.map(item => { |
||||
checkcode.push(item.id); |
||||
}); |
||||
|
||||
let qr = checkcode.join(','); |
||||
console.log(qr); |
||||
this.html = ''; |
||||
const res = await getPrintTemplate(qr); |
||||
console.log(res.data); |
||||
const { code, data } = res.data; |
||||
if (code !== 200) return; |
||||
this.html = this.getHtmls(data.dataList, data.templateHtml); |
||||
this.dialogVisible = true; |
||||
} catch (error) { |
||||
console.log('error :>> ', error); |
||||
} finally { |
||||
this.loadingObj.pageLoading = false; |
||||
} |
||||
}, |
||||
Details(row) { |
||||
this.$router.push({ |
||||
path: '/basicdata/warehouse/tray/basicdataTrayedt', |
||||
query: { |
||||
data: encodeURIComponent(JSON.stringify(row)), |
||||
name: row.palletCode + '-查看在托情况', |
||||
}, |
||||
}); |
||||
}, |
||||
rowSave(row, done, loading) { |
||||
console.log('this.form>>>>>>>>>>>>', this.form); |
||||
// this.form.trayStatus("1"); |
||||
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 = `/api/logpm-basicdata/material/export-BasicdataTray?${ |
||||
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(); |
||||
}); |
||||
}); |
||||
}, |
||||
beforeOpen(done, type) { |
||||
if (['edit', 'view'].includes(type)) { |
||||
getDetail(this.form.id).then(res => { |
||||
this.form = res.data.data; |
||||
}); |
||||
} |
||||
done(); |
||||
}, |
||||
searchReset() { |
||||
this.query = {}; |
||||
console.log('123123123'); |
||||
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 = []; |
||||
console.log(this.query, 'query'); |
||||
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 { warehouseId, trayStatus, type, palletCode, palletName } = this.query; |
||||
|
||||
let values = { |
||||
warehouseId: warehouseId, |
||||
trayStatus: trayStatus, |
||||
type: type, |
||||
palletCode: palletCode, |
||||
palletName: palletName, |
||||
}; |
||||
|
||||
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(.avue-form__row) { |
||||
margin-left: 10px; |
||||
max-width: 300px !important; |
||||
} |
||||
:deep(.no-print) { |
||||
margin-left: auto; |
||||
} |
||||
:deep(.el-form-item__label) { |
||||
width: auto !important; |
||||
} |
||||
:deep(.avue-form__row) { |
||||
margin-left: 0; |
||||
} |
||||
:deep(.no-print) { |
||||
.el-button { |
||||
margin-right: 0; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue