2024-09-09 修改了大部分下拉组件为模糊筛选,减轻前端渲染压力

This commit is contained in:
2024-09-09 15:26:17 +08:00
parent fe5d3b70df
commit 563132273c
717 changed files with 107188 additions and 138520 deletions

View File

@@ -0,0 +1,701 @@
<template>
<div class="app-container">
<el-card style="height: 850px">
<el-col style="width: 921px">
<div style="margin-top: 7px; margin-bottom: 7px">
<el-cascader ref="cascader" :options="product" :show-all-levels="false" placeholder="产品名称" clearable size="small" @clear="clearData" @change="getData"/>
<el-input v-model="specificationsValue" style="width:200px" placeholder="名称/规格/型号" size="small" clearable @keyup.enter.native="pageCurrent=1;updateCheck()"/>
<el-button :disabled="disabled1" icon="el-icon-edit" type="primary" style="margin-left: 10px" plain size="small" @click="setUpInventory()">最低库存</el-button>
<el-button :disabled="disabled" type="distribution" icon="el-icon-check" size="small" @click="openOrder()">提交补货</el-button>
<el-checkbox v-model="checked" style="margin-left: 40px" @change="updateCheck">自制补货</el-checkbox>
<el-badge :value="numberReturnedItems" class="item">
<el-button type="text" size="small" style="margin-left: 70px" @click="viewReturnedContracts()">打回通知</el-button>
</el-badge>
</div>
<div>
<el-table
v-loading="loading"
ref="table"
:data="tableData"
:row-class-name="tableRowClassName"
:summary-method="getSummaries"
highlight-current-row
show-summary
border
size="small"
style="width: 921px"
height="740px"
@sort-change="sortChange"
@row-click="updateStock">
<el-table-column :width="setColumnWidth('序号')" style="width: 55px;" label="选入" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="selectIn(scope.row)"><svg-icon icon-class="右箭头" style="width: 20px;height: 20px"/></el-button>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('类型')" label="类型" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.补货类型 }}
</template>
</el-table-column>
<el-table-column width="130px" label="名称" align="center" prop="物料名称" sortable="物料名称" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.物料名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="图号或型号" align="center" prop="图号或型号" sortable="图号或型号" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('单位')" label="单位" align="center">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="库存" align="center" prop="库存" sortable="库存">
<template slot-scope="scope">
{{ scope.row.库存 }}
</template>
</el-table-column>
<el-table-column width="85px" label="补货中" align="center" prop="补货中" sortable="补货中">
<template slot-scope="scope">
{{ scope.row.补货中 }}
</template>
</el-table-column>
<el-table-column width="85px" label="需求量" align="center" prop="需求量" sortable="需求量">
<template slot-scope="scope">
{{ scope.row.需求量 }}
</template>
</el-table-column>
<el-table-column width="73px" label="最低库存" align="center" prop="最低库存">
<template slot-scope="scope">
{{ scope.row.最低库存 }}
</template>
</el-table-column>
<el-table-column label="补货数" align="center" prop="补货数">
<template slot-scope="scope">
<el-input-number v-model="scope.row.补货数" :min="1" size="mini" style="margin: 0;width: 100%"/>
</template>
</el-table-column>
</el-table>
<div class="block" style="margin-top: 10px;">
<el-pagination
:current-page="pageCurrent"
:page-sizes="[10, 20, 30, 40, 100]"
:page-size="pageSize"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="handleSizeChanges"
@current-change="handleCurrentChanges"/>
</div>
</div>
</el-col>
<el-col style="width: 720px;margin-left: 30px">
<div style="margin-top: 7px">
<p v-if="!checked" style="margin-bottom: 0px;margin-left: 270px; font-size: 20px;font-weight:bold">外购件补货单</p>
<p v-if="checked" style="margin-bottom: 0px;margin-left: 270px;color: #919ae9;font-size: 20px;font-weight:bold">自制件补货单</p>
<el-table
v-loading="loading1"
ref="table1"
:data="tableData1"
:header-cell-style="{background: '#2283D4',color: 'white'}"
highlight-current-row
show-summary
border
stripe
size="small"
style="width: 661px"
height="740px">
<el-table-column :width="setColumnWidth('序号')" label="选出" align="center">
<template slot-scope="scope">
<el-button type="text" size="mini" @click="deleteProduct(scope.row)"><svg-icon icon-class="箭头2" class="is-rotate" style="width: 20px;height: 20px"/></el-button>
</template>
</el-table-column>
<el-table-column width="180px" label="名称" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column width="120px" label="图号或型号" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.代号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('单位')" label="单位" align="center">
<template slot-scope="scope">
{{ scope.row.单位 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('补货数量')" label="补货数量" align="center" prop="补货数量">
<template slot-scope="scope">
{{ scope.row.补货数量 }}
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="50">
<template slot-scope="scope">
<el-tooltip :open-delay="700" effect="dark" content="上传照片" placement="top">
<el-button type="text" icon="el-icon-picture-outline" size="mini" @click="handlePicture(scope.row)"/>
</el-tooltip>
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('类型')" label="类型" align="center">
<template slot-scope="scope">
{{ scope.row.类型 }}
</template>
</el-table-column>
</el-table>
</div>
</el-col>
</el-card>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" title="最低库存" center width="300px">
<el-form ref="form" :model="form">
<el-form-item prop="最低库存">
<el-input-number v-model="form.最低库存" :min="0" :step="1" size="small" clearable style="width:200px;margin-left: 25px"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff()"> </el-button>
<el-button type="primary" @click="submitStock()"> </el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" title="补货期限" center width="300px">
<el-date-picker
v-model="finishTime"
size="small"
align="center"
style="width: 100%"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
placeholder="选择日期"/>
<el-input
:rows="3"
v-model="orderRemarks"
style="margin-top: 30px"
type="textarea"
placeholder="请输入订单备注!"/>
<div slot="footer" class="dialog-footer">
<el-button @click="callOff()"> </el-button>
<el-button type="primary" @click="submitOrder()"> </el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible2" title="上传图片" center style="height: 800px" width="30%">
<el-upload
id="invoiceScan"
ref="upload"
:multiple="true"
:auto-upload="false"
:on-success="uploadSuccess"
:before-upload="beforeUpload"
:on-exceed="warningExceed"
:limit="limit"
:data="Data"
:action="upload"
style="margin-left: 60px"
list-type="picture-card">
<i class="el-icon-plus"/>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible2=false">取消</el-button>
<el-button type="primary" style="width: 70px" @click="submitPicture()">确定</el-button>
</div>
</el-dialog>
<el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleReturnContract" center width="1120px">
<div style="width: 100%;overflow: hidden">
<el-table
:data="tableData100"
:header-cell-style="{background: '#383E4B',color: 'white'}"
highlight-current-row
border
stripe
size="mini"
style="width: 1090px;margin-top: 10px;"
height="440px">
<el-table-column width="80px" label="序号" type="index" align="center"/>
<el-table-column width="150px" label="订单编号" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.订单编号 }}
</template>
</el-table-column>
<el-table-column width="150px" label="名称" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.名称 }}
</template>
</el-table-column>
<el-table-column width="180px" label="图号或型号" show-overflow-tooltip align="center">
<template slot-scope="scope">
{{ scope.row.图号或型号 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('数量')" label="补货数量" align="center">
<template slot-scope="scope">
{{ scope.row.补货数量 }}
</template>
</el-table-column>
<el-table-column width="200px" label="打回原因" align="center" show-overflow-tooltip>
<template slot-scope="scope">
{{ scope.row.打回原因 }}
</template>
</el-table-column>
<el-table-column :width="setColumnWidth('姓名')" label="打回人" align="center">
<template slot-scope="scope">
{{ scope.row.姓名 }}
</template>
</el-table-column>
<el-table-column label="打回日期" align="center">
<template slot-scope="scope">
{{ scope.row.打回日期 }}
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { url } from '@/utils/request'
export default {
data() {
return {
tableData100: [],
numberReturnedItems: '',
orderRemarks: '',
checked: false,
showInput: false,
disabled: true,
disabled1: true,
stockValue: '', // 累计库存流水号
number: '',
specificationsValue: '', // 规格型号
loading: false, // 数据加载
loading1: false, // 数据加载
dialogFormVisible: false,
dialogFormVisible2: false,
dialogFormVisibleReturnContract: false,
form: {
最低库存: ''
},
product: [], // 产品名称数组
productValue: '',
finishTime: '',
limit: 5,
Data: {},
upload: url,
dialogFormVisible1: false,
total: 0, // 分页总数
tableData: [],
tableData1: [],
pageCurrent: 1, // 分页当前页
pageSize: 20, // 分页每页显示条数
orderName: '', // 排序列名
order: '' // 排序方式
}
},
computed: {
...mapGetters([
'id',
'token'
])
},
updated() {
this.$nextTick(() => {
this.$refs['table'].doLayout()
this.$refs['table1'].doLayout()
})
},
created() {
this.searchTable()
this.searchNumber()
this.getTreeData()
},
methods: {
getData(val) {
this.pageCurrent = 1
this.productValue = val[val.length - 1]
this.updateCheck()
},
clearData() {
this.pageCurrent = 1
this.productValue = ''
this.updateCheck()
},
getTreeData() {
var param = []
param[0] = ['子节点', 0]
var Data = this.CreateData('11', '产品关系_查询节点', param)
this.ExecDatabase(Data).then(response => {
const data = response.data
this.product = this.tree(data, 0)
})
},
tree(data, pid) {
const result = []
let temp
for (let i = 0; i < data.length; i++) {
if (data[i].父节点 === pid) {
const obj = { label: data[i].节点名称, value: data[i].子节点 }
temp = this.tree(data, data[i].子节点)
if (temp.length > 0) {
obj.children = temp
}
result.push(obj)
}
}
return result
},
viewReturnedContracts() {
this.dialogFormVisibleReturnContract = true
this.searchTable100()
this.updateNumber()
},
searchTable100() {
var param = []
var Data = this.CreateData('11', '仓储管理_补货订单打回_查询', param)
this.ExecDatabase(Data).then(response => {
this.tableData100 = response.data
})
},
updateNumber() {
var param = []
var Data = this.CreateData('12', '仓储管理_补货订单打回_查看', param)
this.ExecDatabase(Data).then(response => {
this.searchNumber()
})
},
searchNumber() {
var param = []
var Data = this.CreateData('11', '仓储管理_补货订单打回_未查看数量', param)
this.ExecDatabase(Data).then(response => {
this.numberReturnedItems = response.data[0].数量
})
},
sortChange(column) {
if (column.prop === '物料名称') {
this.orderName = 1
} else if (column.prop === '图号或型号') {
this.orderName = 2
} else if (column.prop === '库存') {
this.orderName = 3
} else if (column.prop === '补货中') {
this.orderName = 4
} else if (column.prop === '需求量') {
this.orderName = 5
} else {
this.orderName = 0
}
if (column.order === 'ascending') {
this.order = 1
} else if (column.order === 'descending') { this.order = 2 } else {
this.order = ''
}
this.searchTable()
},
warningExceed() {
this.$message.error('仅可上传五张照片')
},
beforeUpload(file) { // 上传前检测
const isJPG = /^image\/.*/.test(file.type)
if (!isJPG) {
this.$message.error('只能上传图片。。')
}
return isJPG
},
uploadSuccess(res) { // 上传成功回调
this.dialogFormVisible2 = false
this.$refs.upload.clearFiles()
},
setUpInventory() {
this.dialogFormVisible = true
},
openOrder() {
this.finishTime = ''
this.dialogFormVisible1 = true
},
handlePicture(row) {
this.dialogFormVisible2 = true
this.replenishmentOrderId = row.补货单明细中间表流水号
// this.PersonId = row.人员编号
},
submitPicture() {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['补货单明细中间表流水号', this.replenishmentOrderId]
param[1] = ['是否外购', check]
param[2] = ['文件名称', '']
param[3] = ['文件后缀', '']
param[4] = ['文件内容', null]
var Data1 = this.CreateData('15', '补货单_上传图片', param)
this.Data.param = Data1
this.$refs.upload.submit()
this.dialogFormVisible2 = false
},
submitOrder() {
if (this.finishTime) {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['是否外购', check]
param[1] = ['操作者', this.id]
param[2] = ['补货期限', this.finishTime]
param[3] = ['订单备注', this.orderRemarks]
var Data = this.CreateData('12', '报缺补货_提交', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.$message.success('提交成功')
this.dialogFormVisible1 = false
this.updateCheck()
} else {
this.$message.error('提交失败')
}
})
} else {
this.$message.warning('请选择补货期限')
}
},
selectIn(row) {
if (row.补货数 !== 0 && row.补货数 !== undefined) {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['累计库存流水号', row.累计库存流水号]
param[1] = ['补货数', row.补货数]
param[2] = ['物料流水号', row.物料流水号]
param[3] = ['是否外购', check]
var Data = this.CreateData('12', '报缺补货_选入', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.updateCheck()
this.$message.success('选入成功')
} else {
this.$message.error('选入失败')
}
})
} else {
this.$message.warning('补货数不能为0或空')
}
},
deleteProduct(row) {
let check
this.checked ? check = 0 : check = 1
var param = []
param[0] = ['补货单明细中间表流水号', row.补货单明细中间表流水号]
param[1] = ['是否外购', check]
param[2] = ['补货数量', row.补货数量]
var Data = this.CreateData('12', '报缺补货_选出', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.updateCheck()
this.$message.success('移出成功')
} else {
this.$message.error('移出失败')
}
})
},
updateStock(row) {
this.stockValue = row.累计库存流水号
this.form.最低库存 = Number(row.最低库存)
this.disabled1 = false
},
callOff() {
this.dialogFormVisible = false
this.dialogFormVisible1 = false
},
submitStock() {
if (this.form.最低库存 !== '' && this.form.最低库存 !== undefined) {
var param = []
param[0] = ['累计库存流水号', this.stockValue]
param[1] = ['类型流水号', 1]
param[2] = ['最低库存', this.form.最低库存]
var Data = this.CreateData('12', '最低库存_编辑数据', param)
this.ExecDatabase(Data).then(response => {
if (response.data[0].result === '1') {
this.updateCheck()
this.dialogFormVisible = false
this.$message.success('编辑成功')
} else {
this.$message.error('编辑失败')
}
})
} else {
this.$message.warning('不能为空')
}
},
tableRowClassName({ row, rowIndex }) {
if (Number(row.库存预警) === 0) {
if (row.补货类型 === '外购') {
return 'Outsourcing'
}
} else if (Number(row.库存预警) === 1) {
return 'red'
} else if (Number(row.库存预警) === 2) {
return 'yellow'
}
},
updateCheck() {
if (this.checked) {
this.searchTable1()
} else {
this.searchTable()
}
this.disabled1 = true
},
searchTable() {
let specificationsValue_check, product_check
this.specificationsValue ? specificationsValue_check = 1 : specificationsValue_check = 0
this.productValue ? product_check = 1 : product_check = 0
var param = []
param[0] = ['品名', this.specificationsValue]
param[1] = ['品名_check', specificationsValue_check]
param[2] = ['产品', this.productValue]
param[3] = ['产品_check', product_check]
param[4] = ['排序名称', this.orderName]
param[5] = ['排序方式', this.order]
var Data = this.CreateData('11', '仓储管理_报缺补货_外购件_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
console.log(response.data.rows, 2222)
this.tableData = response.data.rows
this.total = response.data.total
})
var param1 = []
var Data1 = this.CreateData('11', '仓储管理_外购补货中间表_查询', param1)
this.ExecDatabase(Data1).then(response => {
this.tableData1 = response.data
if (response.data.length === 0) {
this.disabled = true
} else {
this.disabled = false
}
})
},
searchTable1() {
let specificationsValue_check, product_check
this.specificationsValue ? specificationsValue_check = 1 : specificationsValue_check = 0
this.productValue ? product_check = 1 : product_check = 0
var param = []
param[0] = ['品名', this.specificationsValue]
param[1] = ['品名_check', specificationsValue_check]
param[2] = ['产品', this.productValue]
param[3] = ['产品_check', product_check]
param[4] = ['排序名称', this.orderName]
param[5] = ['排序方式', this.order]
var Data = this.CreateData('11', '仓储管理_报缺补货_外购件_查询', param, this.pageSize, this.pageCurrent)
this.ExecDatabase(Data).then(response => {
this.tableData = response.data.rows
this.total = response.data.total
})
var param1 = []
var Data1 = this.CreateData('11', '仓储管理_自制补货中间表_查询', param1)
this.ExecDatabase(Data1).then(response => {
this.tableData1 = response.data
if (response.data.length === 0) {
this.disabled = true
} else {
this.disabled = false
}
})
},
// 表格统计1
getSummaries(param) {
const { columns, data } = param
const sums = []
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '合计'
return
} else if (index === 5) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
} else if (index === 6) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
} else if (index === 7) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
} else if (index === 8) {
const values = data.map(item => Number(item[column.property]))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
if (!isNaN(value)) {
return prev + curr
} else {
return prev
}
}, 0)
sums[index] = sums[index]
} else {
sums[index] = 'N/A'
}
}
})
return sums
},
handleSizeChanges(val) {
this.pageCurrent = 1
this.pageSize = val
this.updateCheck()
},
handleCurrentChanges(val) {
this.pageCurrent = val
this.updateCheck()
}
}
}
</script>
<style>
.is-rotate {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-o-transform: rotate(180deg);
-ms-transform: rotate(180deg);
transform: rotate(180deg);
}
.Outsourcing {
background: #D9FFFF!important;
}
.red {
background: #e88383!important;
}
.yellow {
background: yellow!important;
}
</style>