This commit is contained in:
mkm 2024-08-25 17:57:27 +08:00
parent c144eeccda
commit 0a44272658
4 changed files with 191 additions and 1 deletions

View File

@ -67,3 +67,8 @@ export function total_warehouse_product_list(params: any) {
export function negative_inventory(params: any) { export function negative_inventory(params: any) {
return request.get({ url: '/workbench/negative_inventory', params }) return request.get({ url: '/workbench/negative_inventory', params })
} }
// 负库存列表统计
export function update_negative_zero(params: any) {
return request.get({ url: '/workbench/update_negative_zero', params })
}

View File

@ -79,6 +79,18 @@
min-width="200" min-width="200"
show-overflow-tooltip show-overflow-tooltip
/> />
<el-table-column label="操作" width="180" fixed="right">
<template #default="{ row }">
<el-button
v-perms="['statistics.negative/update_negative_zero']"
type="primary"
link
@click="handleDetail(row)"
>
归零
</el-button>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
<div class="flex mt-4 justify-end"> <div class="flex mt-4 justify-end">
@ -91,7 +103,7 @@
<script lang="ts" setup name="storeProductLists"> <script lang="ts" setup name="storeProductLists">
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useDictData } from '@/hooks/useDictOptions' import { useDictData } from '@/hooks/useDictOptions'
import { negative_inventory } from '@/api/workbench' import { negative_inventory, update_negative_zero } from '@/api/workbench'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { apiSystemStoreLists } from '@/api/system_store' import { apiSystemStoreLists } from '@/api/system_store'
@ -123,6 +135,17 @@ const remoteMethod = (e = '') => {
}) })
} }
//
const handleDetail = async (data: any) => {
update_negative_zero({ type: queryParams.type, id: data.id })
.then((res) => {
ElMessage.success('操作成功')
getLists()
})
.catch((err) => {
ElMessage.error('操作失败')
})
}
// //
const { dictData } = useDictData('') const { dictData } = useDictData('')
// //

View File

@ -68,6 +68,14 @@
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button
v-perms="['warehouse_product.warehouse_product/delete']" v-perms="['warehouse_product.warehouse_product/delete']"
type="primary"
link
@click="handleEdit(row)"
>
编辑
</el-button>
<el-button
v-perms="['warehouse_product.warehouse_product/edit']"
type="danger" type="danger"
link link
@click="handleDeletes(row.id)" @click="handleDeletes(row.id)"
@ -213,6 +221,7 @@
:is_warehouse="is_warehouse" :is_warehouse="is_warehouse"
></product-pop> ></product-pop>
</el-dialog> </el-dialog>
<edit-popup v-if="showEdit" ref="editRef" @success="getLists" @close="showEdit = false" />
</template> </template>
<script lang="ts" setup name="storeOrderDETAILS"> <script lang="ts" setup name="storeOrderDETAILS">
@ -228,6 +237,11 @@ import type { PropType } from 'vue'
import { usePaging } from '@/hooks/usePaging' import { usePaging } from '@/hooks/usePaging'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import feedback from '@/utils/feedback' import feedback from '@/utils/feedback'
import EditPopup from './editProduct.vue'
const editRef = shallowRef<InstanceType<typeof EditPopup>>()
//
const showEdit = ref(false)
const route = useRoute() const route = useRoute()
@ -375,6 +389,13 @@ const handleStock = () => {
} }
isSubmit.value = true isSubmit.value = true
} }
//
const handleEdit = async (data: any) => {
showEdit.value = true
await nextTick()
editRef.value?.open('edit')
editRef.value?.setFormData(data)
}
// //
const handleDeletes = async (id: number | any[]) => { const handleDeletes = async (id: number | any[]) => {
await feedback.confirm('确定要删除?') await feedback.confirm('确定要删除?')

View File

@ -0,0 +1,141 @@
<template>
<div class="edit-popup">
<popup
ref="popupRef"
:title="popupTitle"
:async="true"
width="550px"
@confirm="handleSubmit"
@close="handleClose"
>
<el-form ref="formRef" :model="formData" label-width="90px" :rules="formRules">
<el-form-item label="商品名称" prop="store_name">
<el-input v-model="formData.store_name" disabled />
</el-form-item>
<el-form-item label="数量" prop="nums">
<el-input
v-model="formData.nums"
clearable
placeholder="请输入数量"
:readonly="false"
/>
</el-form-item>
<el-form-item label="采购价" prop="purchase">
<el-input
v-model="formData.purchase"
clearable
placeholder="请输入采购价"
:readonly="false"
/>
</el-form-item>
<el-form-item label="总价格" prop="total_price">
<el-input
v-model="formData.total_price"
clearable
placeholder="请输入总价格"
:readonly="false"
/>
</el-form-item>
</el-form>
</popup>
</div>
</template>
<script lang="ts" setup name="warehouseOrderEdit">
import type { FormInstance } from 'element-plus'
import Popup from '@/components/popup/index.vue'
import {
apiWarehouseOrderAdd,
apiWarehouseOrderUpdateEdit,
apiWarehouseOrderDetail
} from '@/api/warehouse_order'
import { timeFormat } from '@/utils/util'
import type { PropType } from 'vue'
defineProps({
dictData: {
type: Object as PropType<Record<string, any[]>>,
default: () => ({})
}
})
const emit = defineEmits(['success', 'close'])
const formRef = shallowRef<FormInstance>()
const popupRef = shallowRef<InstanceType<typeof Popup>>()
const mode = ref('add')
//
const popupTitle = computed(() => {
return mode.value == 'edit' ? '编辑商品' : '新增商品仓储订单'
})
//
const formData = reactive({
id: '',
store_name: '',
total_price: '',
nums: '',
purchase: ''
})
//
const formRules = reactive<any>({
warehouse_id: [
{
required: true,
message: '请输入仓库',
trigger: ['blur']
}
],
total_price: [
{
required: true,
message: '请输入总价格',
trigger: ['blur']
}
]
})
//
const setFormData = async (data: Record<any, any>) => {
for (const key in formData) {
if (data[key] != null && data[key] != undefined) {
//@ts-ignore
formData[key] = data[key]
}
}
}
const getDetail = async (row: Record<string, any>) => {
const data = await apiWarehouseOrderDetail({
id: row.id
})
setFormData(data)
}
//
const handleSubmit = async () => {
await formRef.value?.validate()
const data = { ...formData }
mode.value == 'edit'
? await apiWarehouseOrderUpdateEdit(data)
: await apiWarehouseOrderAdd(data)
popupRef.value?.close()
emit('success')
}
//
const open = (type = 'add') => {
mode.value = type
popupRef.value?.open()
}
//
const handleClose = () => {
emit('close')
}
defineExpose({
open,
setFormData,
getDetail
})
</script>