批次属性修改

This commit is contained in:
王帅 2025-05-22 19:36:19 +08:00
parent 4a963d3622
commit c60d105e96

View File

@ -0,0 +1,83 @@
<template>
<el-drawer :title="dialog.title" v-model="dialog.visible" @close="cancel">
<el-form ref="drawerRef" :model="formData" :rules="rules" label-position="top">
<el-form-item label="批次号" prop="charge">
<el-input v-model="formData.charge"></el-input>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark"></el-input>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="cancel"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</template>
</el-drawer>
</template>
<script lang="ts" setup>
import { getCurrentInstance, reactive, ref, toRefs } from 'vue'
import { ElForm } from 'element-plus'
import { editWareHouse } from '@/api/material/notPosted'
import { localStorage } from '@/utils/storage'
const { proxy }: any = getCurrentInstance()
const emits = defineEmits(['refresh'])
//
const drawerRef = ref(ElForm);
const state = reactive({
dialog: {
title: "编辑批次",
type: 'edit',
visible: false,
},
formData: {
//
charge: '',
//
remark: '',
//
materialPackingName: '',
siteName: '',
user: localStorage.get('userName')
},
rules: {
charge: [{ required: true, message: "请输入批次号", trigger: "blur" }],
}
})
const { dialog, formData, rules } = toRefs(state)
//
function cancel() {
state.dialog.visible = false;
}
//
function submitForm() {
drawerRef.value.validate((isValid: boolean) => {
if (isValid) {
//
editWareHouse(state.formData).then((res: any) => {
console.log(res)
if (res.errorCode === 200) {
proxy.$ElMessage.success(res.message)
cancel()
emits('refresh')
} else {
proxy.$ElMessage.error(res.message)
}
})
}
});
}
//
const showModal = (row: any) => {
state.dialog.visible = true
//
state.formData.charge = row.CHARGE
state.formData.remark = row.REMARK
state.formData.materialPackingName = row.MATERIALPACKINGNAME
state.formData.siteName = row.SITENAME
}
defineExpose({ showModal })
</script>