|
|
|
@ -1,42 +1,45 @@
|
|
|
|
|
<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"> |
|
|
|
|
<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 |
|
|
|
|
@click="handleImport">导 入 |
|
|
|
|
<el-button type="danger" icon="el-icon-delete" plain @click="handleImport" |
|
|
|
|
>导 入 |
|
|
|
|
</el-button> |
|
|
|
|
<!-- v-if="permission.basicMaterial_delete"--> |
|
|
|
|
<el-button type="warning" |
|
|
|
|
plain |
|
|
|
|
icon="el-icon-download" |
|
|
|
|
@click="handleExport">导 出 |
|
|
|
|
<!-- v-if="permission.basicMaterial_delete"--> |
|
|
|
|
<el-button type="warning" plain icon="el-icon-download" @click="handleExport" |
|
|
|
|
>导 出 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button type="warning" plain icon="Printer" @click="handleBatchPrinter"> |
|
|
|
|
批量打印 |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
<template #menu="{row,index,size}"> |
|
|
|
|
<el-button type="text" |
|
|
|
|
plain |
|
|
|
|
icon="el-icon-edit" |
|
|
|
|
@click="rowDelTripartite(row,index)">三方物料</el-button> |
|
|
|
|
<template #menu="{ row, index, size }"> |
|
|
|
|
<el-button type="text" plain icon="el-icon-edit" @click="rowDelTripartite(row, index)"> |
|
|
|
|
三方物料 |
|
|
|
|
</el-button> |
|
|
|
|
<el-button type="text" plain icon="Printer" @click="handlePrinter(row, index, size)"> |
|
|
|
|
打印 |
|
|
|
|
</el-button> |
|
|
|
|
</template> |
|
|
|
|
</avue-crud> |
|
|
|
|
<el-dialog title="物料导入" append-to-body v-model="excelBox" width="555px"> |
|
|
|
@ -48,280 +51,381 @@
|
|
|
|
|
</template> |
|
|
|
|
</avue-form> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="物料二维码" append-to-body v-model="printStock" width="555px"> |
|
|
|
|
<div |
|
|
|
|
class="PrinterValue" |
|
|
|
|
style="width: 100%; border: 1px solid rgb(0, 0, 0); margin-bottom: 10px" |
|
|
|
|
v-for="item in printList" |
|
|
|
|
:key="item.productCode" |
|
|
|
|
> |
|
|
|
|
<div |
|
|
|
|
style=" |
|
|
|
|
border-bottom: 1px solid #000; |
|
|
|
|
font-size: 20px; |
|
|
|
|
width: 100%; |
|
|
|
|
text-align: center; |
|
|
|
|
font-weight: bold; |
|
|
|
|
padding: 10px; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
物料编码 |
|
|
|
|
</div> |
|
|
|
|
<div style="display: flex; justify-content: center; align-items: center"> |
|
|
|
|
<div style="display: flex; width: 40%; justify-content: center; border-right: 1px solid"> |
|
|
|
|
<vue-qr |
|
|
|
|
ref="qrCode" |
|
|
|
|
:text="item.productCode" |
|
|
|
|
style="display: block; height: 120px; width: 120px" |
|
|
|
|
></vue-qr> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div style="text-align: left; height: 120px; box-sizing: border-box; flex: 1; zoom: 0.9"> |
|
|
|
|
<div |
|
|
|
|
style=" |
|
|
|
|
height: 40px; |
|
|
|
|
line-height: 40px; |
|
|
|
|
border-bottom: 1px solid #000; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
padding-left: 10px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
产品名称: {{ item.name }} |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
style=" |
|
|
|
|
height: 40px; |
|
|
|
|
line-height: 40px; |
|
|
|
|
border-bottom: 1px solid #000; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
padding-left: 10px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
产品编码: {{ item.productCode }} |
|
|
|
|
</div> |
|
|
|
|
<div |
|
|
|
|
style=" |
|
|
|
|
height: 40px; |
|
|
|
|
line-height: 40px; |
|
|
|
|
box-sizing: border-box; |
|
|
|
|
padding-left: 10px; |
|
|
|
|
font-size: 14px; |
|
|
|
|
" |
|
|
|
|
> |
|
|
|
|
SKU: {{ item.sku }} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<div class="flex-c-c mt10"> |
|
|
|
|
<el-button @click="() => (printStock = false)">关闭</el-button> |
|
|
|
|
<el-button type="primary" icon="Printer" @click="handlePrinterValue">打印</el-button> |
|
|
|
|
</div> |
|
|
|
|
</el-dialog> |
|
|
|
|
</basic-container> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {getList, getDetail, add, update, remove} from "@/api/basic/basicMaterial"; |
|
|
|
|
import option from "@/option/basic/basicMaterial"; |
|
|
|
|
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/basic/basicMaterial'; |
|
|
|
|
import option from '@/option/basic/basicMaterial'; |
|
|
|
|
import { mapGetters } from 'vuex'; |
|
|
|
|
import { exportBlob } from '@/api/common'; |
|
|
|
|
import { getToken } from '@/utils/auth'; |
|
|
|
|
import { downloadXls } from '@/utils/util'; |
|
|
|
|
import print from '@/utils/print.js'; |
|
|
|
|
import { dateNow } from '@/utils/date'; |
|
|
|
|
import NProgress from 'nprogress'; |
|
|
|
|
import 'nprogress/nprogress.css'; |
|
|
|
|
import VueQr from 'vue-qr/src/packages/vue-qr.vue'; |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
form: {}, |
|
|
|
|
query: {}, |
|
|
|
|
search: {}, |
|
|
|
|
loading: true, |
|
|
|
|
excelBox: false, |
|
|
|
|
excelForm: {}, |
|
|
|
|
page: { |
|
|
|
|
pageSize: 30, |
|
|
|
|
currentPage: 1, |
|
|
|
|
total: 0 |
|
|
|
|
}, |
|
|
|
|
selectionList: [], |
|
|
|
|
option: option, |
|
|
|
|
data: [], |
|
|
|
|
excelOption: { |
|
|
|
|
submitBtn: false, |
|
|
|
|
emptyBtn: false, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: '文件上传', |
|
|
|
|
prop: 'excelFile', |
|
|
|
|
type: 'upload', |
|
|
|
|
drag: true, |
|
|
|
|
loadText: '文件上传,请稍等', |
|
|
|
|
span: 24, |
|
|
|
|
propsHttp: { |
|
|
|
|
res: 'data', |
|
|
|
|
}, |
|
|
|
|
tip: '请上传 .xls,.xlsx 标准格式文件', |
|
|
|
|
action: '/api/logpm-basic/material/import-basicMaterial', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '模板下载', |
|
|
|
|
prop: 'excelTemplate', |
|
|
|
|
formslot: true, |
|
|
|
|
span: 24, |
|
|
|
|
export default { |
|
|
|
|
components: { |
|
|
|
|
VueQr, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
form: {}, |
|
|
|
|
query: {}, |
|
|
|
|
search: {}, |
|
|
|
|
loading: true, |
|
|
|
|
excelBox: false, |
|
|
|
|
excelForm: {}, |
|
|
|
|
page: { |
|
|
|
|
pageSize: 30, |
|
|
|
|
currentPage: 1, |
|
|
|
|
total: 0, |
|
|
|
|
}, |
|
|
|
|
selectionList: [], |
|
|
|
|
option: option, |
|
|
|
|
data: [], |
|
|
|
|
excelOption: { |
|
|
|
|
submitBtn: false, |
|
|
|
|
emptyBtn: false, |
|
|
|
|
column: [ |
|
|
|
|
{ |
|
|
|
|
label: '文件上传', |
|
|
|
|
prop: 'excelFile', |
|
|
|
|
type: 'upload', |
|
|
|
|
drag: true, |
|
|
|
|
loadText: '文件上传,请稍等', |
|
|
|
|
span: 24, |
|
|
|
|
propsHttp: { |
|
|
|
|
res: 'data', |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
tip: '请上传 .xls,.xlsx 标准格式文件', |
|
|
|
|
action: '/api/logpm-basic/material/import-basicMaterial', |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
label: '模板下载', |
|
|
|
|
prop: 'excelTemplate', |
|
|
|
|
formslot: true, |
|
|
|
|
span: 24, |
|
|
|
|
}, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
/** 物料编码二维码打印弹窗 */ |
|
|
|
|
printStock: false, |
|
|
|
|
textValue: '', |
|
|
|
|
printList: [], |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
...mapGetters(['permission']), |
|
|
|
|
permissionList() { |
|
|
|
|
return { |
|
|
|
|
addBtn: this.validData(this.permission.basicMaterial_add, false), |
|
|
|
|
viewBtn: this.validData(this.permission.basicMaterial_view, false), |
|
|
|
|
delBtn: this.validData(this.permission.basicMaterial_delete, false), |
|
|
|
|
editBtn: this.validData(this.permission.basicMaterial_edit, false), |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
...mapGetters(["permission"]), |
|
|
|
|
permissionList() { |
|
|
|
|
return { |
|
|
|
|
addBtn: this.validData(this.permission.basicMaterial_add, false), |
|
|
|
|
viewBtn: this.validData(this.permission.basicMaterial_view, false), |
|
|
|
|
delBtn: this.validData(this.permission.basicMaterial_delete, false), |
|
|
|
|
editBtn: this.validData(this.permission.basicMaterial_edit, false) |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
ids() { |
|
|
|
|
let ids = []; |
|
|
|
|
this.selectionList.forEach(ele => { |
|
|
|
|
ids.push(ele.id); |
|
|
|
|
}); |
|
|
|
|
return ids.join(","); |
|
|
|
|
} |
|
|
|
|
ids() { |
|
|
|
|
let ids = []; |
|
|
|
|
this.selectionList.forEach(ele => { |
|
|
|
|
ids.push(ele.id); |
|
|
|
|
}); |
|
|
|
|
return ids.join(','); |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
watch:{ |
|
|
|
|
'excelForm.isCovered'() { |
|
|
|
|
if (this.excelForm.isCovered !== '') { |
|
|
|
|
const column = this.findObject(this.excelOption.column, 'excelFile'); |
|
|
|
|
column.action = `/api/logpm-warehouse/warehouseWarehousingEntry/import-WarehousingEntry?isCovered=${this.excelForm.isCovered}`; |
|
|
|
|
watch: { |
|
|
|
|
'excelForm.isCovered'() { |
|
|
|
|
if (this.excelForm.isCovered !== '') { |
|
|
|
|
const column = this.findObject(this.excelOption.column, 'excelFile'); |
|
|
|
|
column.action = `/api/logpm-warehouse/warehouseWarehousingEntry/import-WarehousingEntry?isCovered=${this.excelForm.isCovered}`; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
rowDelTripartite(row, num) { |
|
|
|
|
console.log('><><><><', row, num); |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: '/basic/material/basicTripartiteMaterial', |
|
|
|
|
query: { |
|
|
|
|
id: row.id, |
|
|
|
|
name: row.name, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
// this.$router.push({ |
|
|
|
|
// path: '/distribution/inventory/distrilbutionBillLading', |
|
|
|
|
// query:{ |
|
|
|
|
// id: this.ids, |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
}, |
|
|
|
|
rowSave(row, done, loading) { |
|
|
|
|
add(row).then( |
|
|
|
|
() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: 'success', |
|
|
|
|
message: '操作成功!', |
|
|
|
|
}); |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
error => { |
|
|
|
|
loading(); |
|
|
|
|
window.console.log(error); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
|
|
|
|
|
rowDelTripartite(row,num){ |
|
|
|
|
console.log("><><><><",row,num); |
|
|
|
|
this.$router.push({ |
|
|
|
|
path: '/basic/material/basicTripartiteMaterial', |
|
|
|
|
query:{ |
|
|
|
|
id: row.id, |
|
|
|
|
name: row.name |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// this.$router.push({ |
|
|
|
|
// path: '/distribution/inventory/distrilbutionBillLading', |
|
|
|
|
// query:{ |
|
|
|
|
// id: this.ids, |
|
|
|
|
// |
|
|
|
|
// |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
}, |
|
|
|
|
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: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
rowUpdate(row, index, done, loading) { |
|
|
|
|
//表单校验 |
|
|
|
|
update(row).then( |
|
|
|
|
() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: 'success', |
|
|
|
|
message: '操作成功!', |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
handleDelete() { |
|
|
|
|
if (this.selectionList.length === 0) { |
|
|
|
|
this.$message.warning("请选择至少一条数据"); |
|
|
|
|
return; |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
error => { |
|
|
|
|
loading(); |
|
|
|
|
console.log(error); |
|
|
|
|
} |
|
|
|
|
this.$confirm("确定将选择数据删除?", { |
|
|
|
|
confirmButtonText: "确定", |
|
|
|
|
cancelButtonText: "取消", |
|
|
|
|
type: "warning" |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
rowDel(row) { |
|
|
|
|
this.$confirm('确定将选择数据删除?', { |
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
type: 'warning', |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
return remove(row.id); |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
return remove(this.ids); |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: "success", |
|
|
|
|
message: "操作成功!" |
|
|
|
|
}); |
|
|
|
|
this.$refs.crud.toggleSelection(); |
|
|
|
|
.then(() => { |
|
|
|
|
this.onLoad(this.page); |
|
|
|
|
this.$message({ |
|
|
|
|
type: 'success', |
|
|
|
|
message: '操作成功!', |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
uploadAfter(res, done, loading, column) { |
|
|
|
|
window.console.log(column); |
|
|
|
|
this.excelBox = false; |
|
|
|
|
this.refreshChange(); |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
handleExport() { |
|
|
|
|
let downloadUrl = `/api/logpm-basic/material/export-basicMaterial?${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(); |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//导出 |
|
|
|
|
handleImport(){ |
|
|
|
|
this.excelBox = true; |
|
|
|
|
}, |
|
|
|
|
//下载模板 |
|
|
|
|
handleTemplate() { |
|
|
|
|
console.log("下载模板!!!"); |
|
|
|
|
exportBlob( |
|
|
|
|
`/api/logpm-basic/material/export-basicMaterialMb?${this.website.tokenHeader}=${getToken()}` |
|
|
|
|
).then(res => { |
|
|
|
|
downloadXls(res.data, '物料数据模板.xlsx'); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
beforeOpen(done, type) { |
|
|
|
|
if (["edit", "view"].includes(type)) { |
|
|
|
|
getDetail(this.form.id).then(res => { |
|
|
|
|
this.form = res.data.data; |
|
|
|
|
}, |
|
|
|
|
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(); |
|
|
|
|
}, |
|
|
|
|
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 { |
|
|
|
|
productCode, |
|
|
|
|
name, |
|
|
|
|
brandId |
|
|
|
|
} = this.query; |
|
|
|
|
let values = { |
|
|
|
|
productCode:productCode, |
|
|
|
|
name:name, |
|
|
|
|
brandId:brandId, |
|
|
|
|
hide:1 |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
this.$refs.crud.toggleSelection(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
uploadAfter(res, done, loading, column) { |
|
|
|
|
window.console.log(column); |
|
|
|
|
this.excelBox = false; |
|
|
|
|
this.refreshChange(); |
|
|
|
|
done(); |
|
|
|
|
}, |
|
|
|
|
handleExport() { |
|
|
|
|
let downloadUrl = `/api/logpm-basic/material/export-basicMaterial?${ |
|
|
|
|
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(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
//导出 |
|
|
|
|
handleImport() { |
|
|
|
|
this.excelBox = true; |
|
|
|
|
}, |
|
|
|
|
//下载模板 |
|
|
|
|
handleTemplate() { |
|
|
|
|
console.log('下载模板!!!'); |
|
|
|
|
exportBlob( |
|
|
|
|
`/api/logpm-basic/material/export-basicMaterialMb?${this.website.tokenHeader}=${getToken()}` |
|
|
|
|
).then(res => { |
|
|
|
|
downloadXls(res.data, '物料数据模板.xlsx'); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
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; |
|
|
|
|
|
|
|
|
|
const { productCode, name, brandId } = this.query; |
|
|
|
|
let values = { |
|
|
|
|
productCode: productCode, |
|
|
|
|
name: name, |
|
|
|
|
brandId: brandId, |
|
|
|
|
hide: 1, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
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(); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
/** 开启打印弹窗 */ |
|
|
|
|
handlePrinter(row, index, size) { |
|
|
|
|
this.printList = [row]; |
|
|
|
|
this.printStock = true; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** 打印 */ |
|
|
|
|
handlePrinterValue() { |
|
|
|
|
const printerNode = document.querySelectorAll('.PrinterValue'); |
|
|
|
|
console.log('printerNode :>> ', printerNode); |
|
|
|
|
print(printerNode); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
handleBatchPrinter() { |
|
|
|
|
this.printList = this.selectionList; |
|
|
|
|
this.printStock = true; |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped lang='scss'> |
|
|
|
|
:deep(.no-print ){ |
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|
:deep(.no-print) { |
|
|
|
|
margin-left: auto !important; |
|
|
|
|
} |
|
|
|
|
:deep(.el-form-item__label){ |
|
|
|
|
width:auto !important; |
|
|
|
|
:deep(.el-form-item__label) { |
|
|
|
|
width: auto !important; |
|
|
|
|
} |
|
|
|
|
</style> |
|
|
|
|