|
|
|
|
@ -646,7 +646,9 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="inventory-list-section">
|
|
|
|
|
<h3>盘点物资列表</h3>
|
|
|
|
|
<h3>盘点物资列表
|
|
|
|
|
<!-- <Button type="primary" style="margin-left: 8px" @click="exportExcel(new Date().getTime().toString(), planDetailModal.data ? planDetailModal.data.id : null)">导出盘点物资</Button> -->
|
|
|
|
|
</h3>
|
|
|
|
|
<Table
|
|
|
|
|
:columns="planDetailColumns"
|
|
|
|
|
:data="planDetailModal.inventoryList"
|
|
|
|
|
@ -768,6 +770,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<Button v-print="'#print-table'">打印</Button>
|
|
|
|
|
<Button type="primary" style="margin-left: 8px" @click="exportExcel(new Date().getTime().toString())">导出盘点物资</Button>
|
|
|
|
|
<Button type="primary" style="margin-left: 8px" @click="handleSummarySubmit">提交</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</Modal>
|
|
|
|
|
@ -789,7 +792,9 @@ import { index as baseFormIndex } from '@/api/system/baseForm.js'
|
|
|
|
|
import { getparameteritemMore } from '@/api/system/dictionary.js'
|
|
|
|
|
import qs from 'qs'
|
|
|
|
|
import request from '@/utils/request'
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
download
|
|
|
|
|
} from "@/utils/downloadRequest";
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
@ -1301,12 +1306,12 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '原库存数量',
|
|
|
|
|
key: 'chushishuliang',
|
|
|
|
|
title: '在库数量',
|
|
|
|
|
key: 'zaikushuliang',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.chushishuliang : '-')
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.zaikushuliang : '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
@ -1438,13 +1443,13 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '原库存数量',
|
|
|
|
|
key: 'chushishuliang',
|
|
|
|
|
title: '在库数量',
|
|
|
|
|
key: 'zaikushuliang',
|
|
|
|
|
width: 110,
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
const quantity = params.row.inventory?.chushishuliang
|
|
|
|
|
const quantity = params.row.inventory?.zaikushuliang
|
|
|
|
|
const unit = params.row.inventory?.jiliangdanwei || ''
|
|
|
|
|
// 如果原库存数量为 null、undefined 或空值,显示 "-"
|
|
|
|
|
// 如果在库数量为 null、undefined 或空值,显示 "-"
|
|
|
|
|
if (quantity == null || quantity === '') {
|
|
|
|
|
return h('span', '-')
|
|
|
|
|
}
|
|
|
|
|
@ -1469,11 +1474,11 @@ export default {
|
|
|
|
|
if (quantity === '-') {
|
|
|
|
|
return h('span', '-')
|
|
|
|
|
}
|
|
|
|
|
// 获取原库存数量(可能为 null)
|
|
|
|
|
const originalQuantity = params.row.inventory?.chushishuliang
|
|
|
|
|
// 比较盘点数量和原库存数量
|
|
|
|
|
// 如果原库存数量为 null、undefined 或空值,且盘点数量有值,则显示红色
|
|
|
|
|
// 如果原库存数量存在,则比较字符串值
|
|
|
|
|
// 获取在库数量(可能为 null)
|
|
|
|
|
const originalQuantity = params.row.inventory?.zaikushuliang
|
|
|
|
|
// 比较盘点数量和在库数量
|
|
|
|
|
// 如果在库数量为 null、undefined 或空值,且盘点数量有值,则显示红色
|
|
|
|
|
// 如果在库数量存在,则比较字符串值
|
|
|
|
|
const isDifferent = (originalQuantity == null || originalQuantity === '') || (originalQuantity != null && String(quantity) !== String(originalQuantity))
|
|
|
|
|
// 如果不同,使用红色字体
|
|
|
|
|
const style = isDifferent ? { color: 'red' } : {}
|
|
|
|
|
@ -2406,6 +2411,8 @@ export default {
|
|
|
|
|
const params = {
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 9999, // 获取所有数据
|
|
|
|
|
sort_name: 'status',
|
|
|
|
|
sort_type: 'DESC',
|
|
|
|
|
'filter[0][key]': 'material_infos_plan_id',
|
|
|
|
|
'filter[0][op]': 'eq',
|
|
|
|
|
'filter[0][value]': this.summaryModal.data.id
|
|
|
|
|
@ -2414,16 +2421,16 @@ export default {
|
|
|
|
|
const res = await getStocktakingPlanLinkList(qs.stringify(params))
|
|
|
|
|
if (res && res.list) {
|
|
|
|
|
const list = res.list.data || []
|
|
|
|
|
// 对数据进行排序:盘点数量和原库存数量不同的排在前面
|
|
|
|
|
// 对数据进行排序:盘点数量和在库数量不同的排在前面
|
|
|
|
|
list.sort((a, b) => {
|
|
|
|
|
// 判断 a 是否不同
|
|
|
|
|
const aQuantity = a.check_num || '-'
|
|
|
|
|
const aOriginalQuantity = a.inventory?.chushishuliang
|
|
|
|
|
const aOriginalQuantity = a.inventory?.zaikushuliang
|
|
|
|
|
const aIsDifferent = (aOriginalQuantity == null || aOriginalQuantity === '') || (aOriginalQuantity != null && String(aQuantity) !== String(aOriginalQuantity))
|
|
|
|
|
|
|
|
|
|
// 判断 b 是否不同
|
|
|
|
|
const bQuantity = b.check_num || '-'
|
|
|
|
|
const bOriginalQuantity = b.inventory?.chushishuliang
|
|
|
|
|
const bOriginalQuantity = b.inventory?.zaikushuliang
|
|
|
|
|
const bIsDifferent = (bOriginalQuantity == null || bOriginalQuantity === '') || (bOriginalQuantity != null && String(bQuantity) !== String(bOriginalQuantity))
|
|
|
|
|
|
|
|
|
|
// 不同的排在前面(返回负数表示 a 排在前面,正数表示 b 排在前面)
|
|
|
|
|
@ -2440,6 +2447,44 @@ export default {
|
|
|
|
|
this.summaryModal.loading = false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async exportExcel(sheetName, planId) {
|
|
|
|
|
// 如果没有传入 planId,则使用 summaryModal.data.id(向后兼容)
|
|
|
|
|
const targetPlanId = planId || (this.summaryModal.data && this.summaryModal.data.id)
|
|
|
|
|
|
|
|
|
|
if (!targetPlanId) {
|
|
|
|
|
this.$Message.warning('请先选择盘点计划')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const params = {
|
|
|
|
|
page: 1,
|
|
|
|
|
page_size: 9999,
|
|
|
|
|
is_export: 1,
|
|
|
|
|
'filter[0][key]': 'material_infos_plan_id',
|
|
|
|
|
'filter[0][op]': 'eq',
|
|
|
|
|
'filter[0][value]': targetPlanId,
|
|
|
|
|
// 'export_fields[inventory.wuzibianma_material_infos_wuzibianma_relation.material_info_type]': '分类',
|
|
|
|
|
'export_fields[inventory.wuzibianma_material_infos_wuzibianma_relation.fenlei_detail.name]': '所属种类',
|
|
|
|
|
'export_fields[inventory.zichanmingcheng]': '物资名称',
|
|
|
|
|
'export_fields[inventory.rukupici]': '入库批次',
|
|
|
|
|
'export_fields[inventory.shunxuhao]': '顺序号',
|
|
|
|
|
'export_fields[inventory.guigexinghao]': '物资型号',
|
|
|
|
|
'export_fields[inventory.wuziguige]': '物资规格',
|
|
|
|
|
'export_fields[inventory.zaikushuliang]': '在库数量',
|
|
|
|
|
'export_fields[inventory.jiliangdanwei]': '单位',
|
|
|
|
|
'export_fields[responsible_admin.name]': '盘点人',
|
|
|
|
|
'export_fields[check_num]': '盘点数量',
|
|
|
|
|
'export_fields[check_date]': '盘点日期',
|
|
|
|
|
'export_fields[remark]': '备注'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
download(
|
|
|
|
|
'/api/admin/material-infos-plan-link/index',
|
|
|
|
|
'post',
|
|
|
|
|
qs.stringify(params),
|
|
|
|
|
`盘点物资${sheetName}.xlsx`
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
handleMoreCommand(command, row) {
|
|
|
|
|
if (command === 'edit') {
|
|
|
|
|
this.showPlanModal('edit', row)
|
|
|
|
|
|