|
|
|
|
@ -35,7 +35,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Plan Table -->
|
|
|
|
|
<Table :columns="planColumns" :data="planList" :loading="planLoading">
|
|
|
|
|
<Table :columns="planColumns" :data="planList" :loading="planLoading" height="400">
|
|
|
|
|
<template slot="status" slot-scope="{ row }">
|
|
|
|
|
<Tag :color="getStatusColor(row.status)">{{ getStatusText(row.status) }}</Tag>
|
|
|
|
|
</template>
|
|
|
|
|
@ -203,67 +203,41 @@
|
|
|
|
|
<!-- List Search Filters -->
|
|
|
|
|
<div class="search-filters">
|
|
|
|
|
<div class="filter-item">
|
|
|
|
|
<span class="selector-item__label">关键词:</span>
|
|
|
|
|
<Input
|
|
|
|
|
v-model="listSearch.keyword"
|
|
|
|
|
<span class="selector-item__label">盘点日期:</span>
|
|
|
|
|
<DatePicker
|
|
|
|
|
v-model="listSearch.dateRange"
|
|
|
|
|
type="daterange"
|
|
|
|
|
split-panels
|
|
|
|
|
style="width: 200px"
|
|
|
|
|
:clearable="true"
|
|
|
|
|
style="width: 180px"
|
|
|
|
|
placeholder="单号/计划/区域/执行人"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="filter-item">
|
|
|
|
|
<span class="selector-item__label">所属计划:</span>
|
|
|
|
|
<Select v-model="listSearch.planId" style="width: 180px" :clearable="true">
|
|
|
|
|
<Option v-for="plan in planList" :key="plan.id" :value="plan.id">{{
|
|
|
|
|
plan.name
|
|
|
|
|
}}</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="filter-item">
|
|
|
|
|
<span class="selector-item__label">状态:</span>
|
|
|
|
|
<Select v-model="listSearch.status" style="width: 120px" :clearable="true">
|
|
|
|
|
<Option value="0">未盘点</Option>
|
|
|
|
|
<Option value="1">已盘点</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="filter-item">
|
|
|
|
|
<Button type="primary" @click="searchList">查询</Button>
|
|
|
|
|
<Button style="margin-left: 10px" @click="resetListSearch">重置</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Inventory List Table -->
|
|
|
|
|
<Table :columns="listColumns" :data="inventoryList" :loading="listLoading">
|
|
|
|
|
<template slot="planName" slot-scope="{ row }">
|
|
|
|
|
{{ row.material_infos_plan ? row.material_infos_plan.name : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="area" slot-scope="{ row }">
|
|
|
|
|
{{ row.material_info ? row.material_info.suozaicangku : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="executor" slot-scope="{ row }">
|
|
|
|
|
{{ row.responsible_admin ? row.responsible_admin.name : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="startTime" slot-scope="{ row }">
|
|
|
|
|
{{ row.material_infos_plan ? row.material_infos_plan.start_date : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="endTime" slot-scope="{ row }">
|
|
|
|
|
{{ row.material_infos_plan ? row.material_infos_plan.end_date : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
<!-- History List Table -->
|
|
|
|
|
<Table :columns="outsideListColumns" :data="inventoryList" :loading="listLoading" border height="400">
|
|
|
|
|
<template slot="status" slot-scope="{ row }">
|
|
|
|
|
<Tag :color="getInventoryStatusColor(row.status)">{{
|
|
|
|
|
getInventoryStatusText(row.status)
|
|
|
|
|
}}</Tag>
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="action" slot-scope="{ row }">
|
|
|
|
|
<div style="display: flex; gap: 8px; justify-content: center">
|
|
|
|
|
<Button
|
|
|
|
|
type="primary"
|
|
|
|
|
size="small"
|
|
|
|
|
style="border-radius: 6px"
|
|
|
|
|
@click="viewInventoryDetail(row)"
|
|
|
|
|
>查看</Button
|
|
|
|
|
>
|
|
|
|
|
<template slot="responsible_admin" slot-scope="{ row }">
|
|
|
|
|
{{ row.responsible_admin ? row.responsible_admin.name : '-' }}
|
|
|
|
|
</template>
|
|
|
|
|
<template slot="photos" slot-scope="{ row }">
|
|
|
|
|
<div v-if="row.files && row.files.length" class="photo-list">
|
|
|
|
|
<div v-for="(file, index) in row.files.slice(0, 3)" :key="index" class="photo-item">
|
|
|
|
|
<img :src="file.url" @click="previewImage(file.url)" />
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="row.files.length > 3" class="photo-more">
|
|
|
|
|
+{{ row.files.length - 3 }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<span v-else>-</span>
|
|
|
|
|
</template>
|
|
|
|
|
</Table>
|
|
|
|
|
|
|
|
|
|
@ -863,8 +837,8 @@ export default {
|
|
|
|
|
|
|
|
|
|
listSearch: {
|
|
|
|
|
keyword: '',
|
|
|
|
|
planId: '',
|
|
|
|
|
status: '',
|
|
|
|
|
dateRange: [],
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
pageSize: 10
|
|
|
|
|
},
|
|
|
|
|
@ -1233,6 +1207,138 @@ export default {
|
|
|
|
|
align: 'center'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
outsideListColumns: [
|
|
|
|
|
{
|
|
|
|
|
title: '一级分类',
|
|
|
|
|
key: 'yijifenlei',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
if (!params.row.inventory || !params.row.inventory.wuzibianma_material_infos_wuzibianma_relation) {
|
|
|
|
|
return h('span', '-')
|
|
|
|
|
}
|
|
|
|
|
const materialInfoType = params.row.inventory.wuzibianma_material_infos_wuzibianma_relation.material_info_type
|
|
|
|
|
const value = materialInfoType ? materialInfoType.split('-')[0] : ''
|
|
|
|
|
return h('span', value || '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '二级分类',
|
|
|
|
|
key: 'erjifenlei',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
if (!params.row.inventory || !params.row.inventory.wuzibianma_material_infos_wuzibianma_relation) {
|
|
|
|
|
return h('span', '-')
|
|
|
|
|
}
|
|
|
|
|
const materialInfoType = params.row.inventory.wuzibianma_material_infos_wuzibianma_relation.material_info_type
|
|
|
|
|
let value = ''
|
|
|
|
|
if (materialInfoType) {
|
|
|
|
|
const parts = materialInfoType.split('-')
|
|
|
|
|
value = parts.length > 1 ? parts[1] : parts[0]
|
|
|
|
|
}
|
|
|
|
|
return h('span', value || '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '所属种类',
|
|
|
|
|
key: 'suoshuzhonglei',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
if (!params.row.inventory || !params.row.inventory.wuzibianma_material_infos_wuzibianma_relation) {
|
|
|
|
|
return h('span', '-')
|
|
|
|
|
}
|
|
|
|
|
const fenleiDetail = params.row.inventory.wuzibianma_material_infos_wuzibianma_relation.fenlei_detail
|
|
|
|
|
const value = fenleiDetail ? fenleiDetail.name : ''
|
|
|
|
|
return h('span', value || '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物资名称',
|
|
|
|
|
key: 'zichanmingcheng',
|
|
|
|
|
minWidth: 150,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.zichanmingcheng : '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物资型号',
|
|
|
|
|
key: 'guigexinghao',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.guigexinghao : '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '物资规格',
|
|
|
|
|
key: 'wuziguige',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.wuziguige : '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '单位',
|
|
|
|
|
key: 'jiliangdanwei',
|
|
|
|
|
width: 80,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.jiliangdanwei : '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '原库存数量',
|
|
|
|
|
key: 'chushishuliang',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
return h('span', params.row.inventory ? params.row.inventory.chushishuliang : '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '盘点日期',
|
|
|
|
|
key: 'check_date',
|
|
|
|
|
width: 180,
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '盘点数量',
|
|
|
|
|
key: 'check_num',
|
|
|
|
|
width: 100,
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '状态',
|
|
|
|
|
slot: 'status',
|
|
|
|
|
key: 'status',
|
|
|
|
|
width: 100,
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '盘点人',
|
|
|
|
|
slot: 'responsible_admin',
|
|
|
|
|
key: 'responsible_admin',
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '照片',
|
|
|
|
|
slot: 'photos',
|
|
|
|
|
width: 200,
|
|
|
|
|
align: 'center'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '备注',
|
|
|
|
|
key: 'remark',
|
|
|
|
|
minWidth: 200,
|
|
|
|
|
tooltip: true,
|
|
|
|
|
align: 'center'
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
previewUrl: '',
|
|
|
|
|
planDetailModal: {
|
|
|
|
|
visible: false,
|
|
|
|
|
@ -1605,38 +1711,52 @@ export default {
|
|
|
|
|
async searchList() {
|
|
|
|
|
this.listLoading = true
|
|
|
|
|
try {
|
|
|
|
|
const formData = new FormData()
|
|
|
|
|
formData.append('page', this.listSearch.pageIndex)
|
|
|
|
|
formData.append('page_size', this.listSearch.pageSize)
|
|
|
|
|
|
|
|
|
|
// 添加计划外筛选参数
|
|
|
|
|
formData.append('has_material_infos_plan_id', '0')
|
|
|
|
|
|
|
|
|
|
// 只添加非空的搜索条件
|
|
|
|
|
if (this.listSearch.keyword) {
|
|
|
|
|
formData.append('keyword', this.listSearch.keyword)
|
|
|
|
|
const params = {
|
|
|
|
|
page: this.listSearch.pageIndex,
|
|
|
|
|
page_size: this.listSearch.pageSize,
|
|
|
|
|
has_material_infos_plan_id: '0'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 计划筛选
|
|
|
|
|
if (this.listSearch.planId) {
|
|
|
|
|
const filterIndex = this.listSearch.keyword ? 1 : 0
|
|
|
|
|
formData.append(`filter[${filterIndex}][key]`, 'material_infos_plan_id')
|
|
|
|
|
formData.append(`filter[${filterIndex}][op]`, 'eq')
|
|
|
|
|
formData.append(`filter[${filterIndex}][value]`, this.listSearch.planId)
|
|
|
|
|
// 确保日期范围有效且不为空
|
|
|
|
|
if (
|
|
|
|
|
this.listSearch.dateRange &&
|
|
|
|
|
this.listSearch.dateRange.length === 2 &&
|
|
|
|
|
this.listSearch.dateRange[0] &&
|
|
|
|
|
this.listSearch.dateRange[1]
|
|
|
|
|
) {
|
|
|
|
|
const formatDate = date => {
|
|
|
|
|
const d = new Date(date)
|
|
|
|
|
if (isNaN(d.getTime())) return null // 检查日期是否有效
|
|
|
|
|
const year = d.getFullYear()
|
|
|
|
|
const month = String(d.getMonth() + 1).padStart(2, '0')
|
|
|
|
|
const day = String(d.getDate()).padStart(2, '0')
|
|
|
|
|
return `${year}-${month}-${day}`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 状态筛选
|
|
|
|
|
if (this.listSearch.status) {
|
|
|
|
|
const filterIndex = (this.listSearch.keyword ? 1 : 0) + (this.listSearch.planId ? 1 : 0)
|
|
|
|
|
formData.append(`filter[${filterIndex}][key]`, 'status')
|
|
|
|
|
formData.append(`filter[${filterIndex}][op]`, 'eq')
|
|
|
|
|
formData.append(`filter[${filterIndex}][value]`, this.listSearch.status)
|
|
|
|
|
const startDate = formatDate(this.listSearch.dateRange[0])
|
|
|
|
|
const endDate = formatDate(this.listSearch.dateRange[1])
|
|
|
|
|
|
|
|
|
|
// 只有当两个日期都有效时才添加过滤条件
|
|
|
|
|
if (startDate && endDate) {
|
|
|
|
|
params['filter[0][key]'] = 'check_date'
|
|
|
|
|
params['filter[0][op]'] = 'range'
|
|
|
|
|
params['filter[0][value]'] = startDate + ',' + endDate
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const res = await getStocktakingPlanLinkList(formData)
|
|
|
|
|
if (res && res.list) {
|
|
|
|
|
const res = await getStocktakingHistoryList(qs.stringify(params))
|
|
|
|
|
if (res) {
|
|
|
|
|
// 处理返回数据,可能是 res.data 或 res.list.data
|
|
|
|
|
if (res.list && res.list.data) {
|
|
|
|
|
this.inventoryList = res.list.data
|
|
|
|
|
this.listTotal = res.list.total
|
|
|
|
|
this.listTotal = res.list.total || res.list.data.length
|
|
|
|
|
} else if (res.data) {
|
|
|
|
|
this.inventoryList = res.data
|
|
|
|
|
this.listTotal = res.total || res.data.length
|
|
|
|
|
} else {
|
|
|
|
|
this.inventoryList = []
|
|
|
|
|
this.listTotal = 0
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$Message.error('获取盘点列表失败')
|
|
|
|
|
@ -1648,8 +1768,8 @@ export default {
|
|
|
|
|
resetListSearch() {
|
|
|
|
|
this.listSearch = {
|
|
|
|
|
keyword: '',
|
|
|
|
|
planId: '',
|
|
|
|
|
status: '',
|
|
|
|
|
dateRange: [],
|
|
|
|
|
pageIndex: 1,
|
|
|
|
|
pageSize: 10
|
|
|
|
|
}
|
|
|
|
|
@ -2196,7 +2316,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
showSummaryModal(row) {
|
|
|
|
|
// 从原始列表数据中查找完整的计划信息
|
|
|
|
|
console.log("this.planList",this.historyPlanList)
|
|
|
|
|
console.log('this.planList', this.historyPlanList)
|
|
|
|
|
const planData = this.historyPlanList.find(plan => plan.id === row.id)
|
|
|
|
|
if (!planData) {
|
|
|
|
|
this.$Message.error('未找到计划数据')
|
|
|
|
|
@ -2214,7 +2334,7 @@ export default {
|
|
|
|
|
actualCount: planData.chart_done || '-'
|
|
|
|
|
}
|
|
|
|
|
this.summaryModal.signImageId = planData.sign_id || null
|
|
|
|
|
this.summaryModal.signImage = planData.sign?planData.sign.url:null
|
|
|
|
|
this.summaryModal.signImage = planData.sign ? planData.sign.url : null
|
|
|
|
|
this.summaryModal.visible = true
|
|
|
|
|
},
|
|
|
|
|
beforeSignUpload(file) {
|
|
|
|
|
|