|
|
|
|
@ -45,7 +45,7 @@
|
|
|
|
|
<Button v-if="row.status === 2" type="success" size="small" style="border-radius: 6px;" ghost @click="showSummaryModal(row)">盘点小结</Button>
|
|
|
|
|
<template v-if="row.status === 2">
|
|
|
|
|
<el-dropdown trigger="hover" @command="command => handleMoreCommand(command, row)">
|
|
|
|
|
<Button type="info" size="small" style="border-radius: 6px;" ghost>更多<i class="el-icon-arrow-down el-icon--right"></i></Button>
|
|
|
|
|
<Button type="info" size="small" style="border-radius: 6px;" ghost>更多<i class="el-icon-arrow-down el-icon--right" /></Button>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
<el-dropdown-item command="edit">编辑</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="delete">删除</el-dropdown-item>
|
|
|
|
|
@ -165,6 +165,12 @@
|
|
|
|
|
@on-clear="handleDateClear"
|
|
|
|
|
/>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="盘点类型" prop="type">
|
|
|
|
|
<Select v-model="planModal.form.type" style="width: 200px">
|
|
|
|
|
<Option :value="1">日常检查</Option>
|
|
|
|
|
<Option :value="2">年度盘点</Option>
|
|
|
|
|
</Select>
|
|
|
|
|
</FormItem>
|
|
|
|
|
<FormItem label="备注" prop="remark">
|
|
|
|
|
<Input v-model="planModal.form.remark" type="textarea" :rows="3" placeholder="请输入备注信息" />
|
|
|
|
|
</FormItem>
|
|
|
|
|
@ -341,7 +347,7 @@
|
|
|
|
|
<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)" />
|
|
|
|
|
<img :src="file.url" @click="previewImage(file.url)">
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="row.files.length > 3" class="photo-more">
|
|
|
|
|
+{{ row.files.length - 3 }}
|
|
|
|
|
@ -370,7 +376,7 @@
|
|
|
|
|
|
|
|
|
|
<!-- 预览弹窗 -->
|
|
|
|
|
<div v-if="previewUrl" class="image-preview-modal" @click="closePreview">
|
|
|
|
|
<img :src="previewUrl" class="image-preview-large" />
|
|
|
|
|
<img :src="previewUrl" class="image-preview-large">
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- Plan Detail Modal -->
|
|
|
|
|
@ -426,7 +432,7 @@
|
|
|
|
|
<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)" />
|
|
|
|
|
<img :src="file.url" @click="previewImage(file.url)">
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="row.files.length > 3" class="photo-more">
|
|
|
|
|
+{{ row.files.length - 3 }}
|
|
|
|
|
@ -454,7 +460,11 @@
|
|
|
|
|
</Modal>
|
|
|
|
|
|
|
|
|
|
<!-- 盘点小结 Modal -->
|
|
|
|
|
<Modal v-model="summaryModal.visible" title="盘点小结" width="800">
|
|
|
|
|
<Modal
|
|
|
|
|
v-model="summaryModal.visible"
|
|
|
|
|
title="盘点小结"
|
|
|
|
|
width="800"
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<div id="print-table">
|
|
|
|
|
<div style="text-align: center; font-size: 20px; font-weight: bold; margin-bottom: 12px;">盘点小结</div>
|
|
|
|
|
@ -488,22 +498,38 @@
|
|
|
|
|
<td>{{ summaryModal.data ? summaryModal.data.actualCount : '' }}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td>签字区</td>
|
|
|
|
|
<td class="sign-cell"></td>
|
|
|
|
|
<td class="sign-cell">签字区</td>
|
|
|
|
|
<td style="text-align: center">
|
|
|
|
|
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<div style="margin: 24px 0 8px 0;">
|
|
|
|
|
<span style="font-weight: bold;">签字图片上传:</span>
|
|
|
|
|
<div v-if="summaryModal.signImage" style="margin-top: 8px;">
|
|
|
|
|
<img :src="summaryModal.signImage" style="max-width: 200px; max-height: 100px; border: 1px solid #eee;" />
|
|
|
|
|
<div style="position: relative; display: inline-block;">
|
|
|
|
|
<img
|
|
|
|
|
:src="summaryModal.signImage"
|
|
|
|
|
style="max-width: 200px; max-height: 100px; border: 1px solid #eee; cursor: pointer;"
|
|
|
|
|
@click="previewImage(summaryModal.signImage)"
|
|
|
|
|
>
|
|
|
|
|
<Button
|
|
|
|
|
type="error"
|
|
|
|
|
size="small"
|
|
|
|
|
style="position: absolute; top: 5px; right: 5px;"
|
|
|
|
|
@click.stop="summaryModal.signImage = null; summaryModal.signImageId = null"
|
|
|
|
|
>
|
|
|
|
|
重新上传
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else style="margin-top: 8px;">
|
|
|
|
|
<Upload
|
|
|
|
|
:before-upload="beforeSignUpload"
|
|
|
|
|
:on-success="handleSignUpload"
|
|
|
|
|
:show-upload-list="false"
|
|
|
|
|
:action="'/api/admin/upload-file'"
|
|
|
|
|
:action="baseUrl + 'api/admin/upload-file'"
|
|
|
|
|
>
|
|
|
|
|
<Button type="primary" size="small">上传签字图片</Button>
|
|
|
|
|
</Upload>
|
|
|
|
|
@ -512,7 +538,7 @@
|
|
|
|
|
</div>
|
|
|
|
|
<template slot="footer">
|
|
|
|
|
<Button v-print="'#print-table'">打印</Button>
|
|
|
|
|
<Button type="primary" @click="handleSummarySubmit" style="margin-left: 8px;">提交</Button>
|
|
|
|
|
<Button type="primary" style="margin-left: 8px;" @click="handleSummarySubmit">提交</Button>
|
|
|
|
|
</template>
|
|
|
|
|
</Modal>
|
|
|
|
|
</div>
|
|
|
|
|
@ -529,6 +555,7 @@ import request from '@/utils/request'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
baseUrl: process.env.VUE_APP_BASE_API || window.location.origin + '/',
|
|
|
|
|
planSearch: {
|
|
|
|
|
keyword: '',
|
|
|
|
|
dateRange: [],
|
|
|
|
|
@ -542,6 +569,17 @@ export default {
|
|
|
|
|
planColumns: [
|
|
|
|
|
{ title: '计划编号', key: 'no' },
|
|
|
|
|
{ title: '计划名称', key: 'name' },
|
|
|
|
|
{
|
|
|
|
|
title: '盘点类型',
|
|
|
|
|
key: 'type',
|
|
|
|
|
render: (h, params) => {
|
|
|
|
|
const typeMap = {
|
|
|
|
|
1: '日常检查',
|
|
|
|
|
2: '年度盘点'
|
|
|
|
|
}
|
|
|
|
|
return h('span', typeMap[params.row.type] || '-')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
{ title: '开始日期', key: 'start_date' },
|
|
|
|
|
{ title: '结束日期', key: 'end_date' },
|
|
|
|
|
{
|
|
|
|
|
@ -617,6 +655,7 @@ export default {
|
|
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
dateRange: [],
|
|
|
|
|
type: 1, // 默认为日常检查
|
|
|
|
|
remark: ''
|
|
|
|
|
},
|
|
|
|
|
rules: {
|
|
|
|
|
@ -796,7 +835,9 @@ export default {
|
|
|
|
|
summaryModal: {
|
|
|
|
|
visible: false,
|
|
|
|
|
data: null,
|
|
|
|
|
signImage: null
|
|
|
|
|
signImageId: null,
|
|
|
|
|
signImage: null,
|
|
|
|
|
type: 1 // 默认为日常检查
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -939,6 +980,7 @@ export default {
|
|
|
|
|
id: plan.id,
|
|
|
|
|
name: plan.name,
|
|
|
|
|
dateRange: [plan.start_date, plan.end_date],
|
|
|
|
|
type: plan.type,
|
|
|
|
|
remark: plan.remark
|
|
|
|
|
}
|
|
|
|
|
this.planModal.visible = true
|
|
|
|
|
@ -947,6 +989,7 @@ export default {
|
|
|
|
|
id: '',
|
|
|
|
|
name: '',
|
|
|
|
|
dateRange: [],
|
|
|
|
|
type: 1, // 默认为日常检查
|
|
|
|
|
remark: ''
|
|
|
|
|
}
|
|
|
|
|
this.planModal.visible = true
|
|
|
|
|
@ -978,7 +1021,7 @@ export default {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const { id, name, dateRange, remark } = this.planModal.form
|
|
|
|
|
const { id, name, dateRange,type, remark } = this.planModal.form
|
|
|
|
|
const formatDate = (date) => {
|
|
|
|
|
const d = new Date(date)
|
|
|
|
|
const year = d.getFullYear()
|
|
|
|
|
@ -995,6 +1038,7 @@ export default {
|
|
|
|
|
formData.append('name', name)
|
|
|
|
|
formData.append('start_date', formatDate(dateRange[0]))
|
|
|
|
|
formData.append('end_date', formatDate(dateRange[1]))
|
|
|
|
|
formData.append('type', type)
|
|
|
|
|
if (remark) formData.append('remark', remark)
|
|
|
|
|
if (id) formData.append('id', id)
|
|
|
|
|
|
|
|
|
|
@ -1486,17 +1530,25 @@ export default {
|
|
|
|
|
this.loadPlanDetailData()
|
|
|
|
|
},
|
|
|
|
|
showSummaryModal(row) {
|
|
|
|
|
// 假设 row 里有计划相关字段,实际/计划数量等
|
|
|
|
|
// 从原始列表数据中查找完整的计划信息
|
|
|
|
|
const planData = this.planList.find(plan => plan.id === row.id)
|
|
|
|
|
if (!planData) {
|
|
|
|
|
this.$Message.error('未找到计划数据')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.summaryModal.data = {
|
|
|
|
|
name: row.name,
|
|
|
|
|
planStart: row.start_date,
|
|
|
|
|
planEnd: row.end_date,
|
|
|
|
|
actualStart: row.actual_start_date || '-', // 你可根据实际数据调整
|
|
|
|
|
actualEnd: row.actual_end_date || '-',
|
|
|
|
|
planCount: row.plan_count || '-', // 你可根据实际数据调整
|
|
|
|
|
actualCount: row.actual_count || '-'
|
|
|
|
|
id: planData.id,
|
|
|
|
|
name: planData.name,
|
|
|
|
|
planStart: planData.start_date,
|
|
|
|
|
planEnd: planData.end_date,
|
|
|
|
|
actualStart: planData.act_start_date || '-',
|
|
|
|
|
actualEnd: planData.act_end_date || '-',
|
|
|
|
|
planCount: planData.chart_total || '-',
|
|
|
|
|
actualCount: planData.chart_done || '-'
|
|
|
|
|
}
|
|
|
|
|
this.summaryModal.signImage = null
|
|
|
|
|
this.summaryModal.signImageId = planData.sign_id || null
|
|
|
|
|
this.summaryModal.signImage = planData.sign.url || null
|
|
|
|
|
this.summaryModal.visible = true
|
|
|
|
|
},
|
|
|
|
|
beforeSignUpload(file) {
|
|
|
|
|
@ -1505,6 +1557,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
handleSignUpload(response) {
|
|
|
|
|
// 假设 response.url 是图片地址
|
|
|
|
|
this.summaryModal.signImageId = response.id
|
|
|
|
|
this.summaryModal.signImage = response.url
|
|
|
|
|
},
|
|
|
|
|
handleMoreCommand(command, row) {
|
|
|
|
|
@ -1516,14 +1569,25 @@ export default {
|
|
|
|
|
this.viewPlanDetail(row)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleSummarySubmit() {
|
|
|
|
|
if (!this.summaryModal.signImage) {
|
|
|
|
|
async handleSummarySubmit() {
|
|
|
|
|
if (!this.summaryModal.signImageId) {
|
|
|
|
|
this.$Message.warning('请上传签字图片')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
// TODO: 提交盘点小结逻辑
|
|
|
|
|
this.$Message.success('提交成功')
|
|
|
|
|
this.summaryModal.visible = false
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const params = {
|
|
|
|
|
id: this.summaryModal.data.id,
|
|
|
|
|
sign_id: this.summaryModal.signImageId,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await saveStocktakingPlan(params)
|
|
|
|
|
this.$Message.success('提交成功')
|
|
|
|
|
this.summaryModal.visible = false
|
|
|
|
|
this.searchPlans() // 刷新列表
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.$Message.error('提交失败:' + (error.message || '未知错误'))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|