Compare commits
No commits in common. "70557ee3df914be662beb2f6c2d174e3381c6a1c" and "21ca5bc98f044fe1562be9efd956464b03a9cd3f" have entirely different histories.
70557ee3df
...
21ca5bc98f
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Dialog :title="dialogTitle" v-model="dialogVisible" @close="emits">
|
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||||
<el-form
|
<el-form
|
||||||
width="400px"
|
width="400px"
|
||||||
ref="formRef"
|
ref="formRef"
|
||||||
@ -20,7 +20,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="物料分类编码" prop="matTypeCode" >
|
<el-form-item label="物料分类编码" prop="matTypeCode" >
|
||||||
<el-input v-model="formData.matTypeCode" placeholder="请输入物料分类编码" disabled show-word-limit />
|
<el-input v-model="formData.matTypeCode" placeholder="请输入物料分类编码" show-word-limit :disabled="formType === 'update'"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="最大流水号" prop="curMaxSeq" >
|
<el-form-item label="最大流水号" prop="curMaxSeq" >
|
||||||
<el-input v-model="formData.curMaxSeq" placeholder="请输入当前最大流水号" :disabled="formType === 'update'" show-word-limit/>
|
<el-input v-model="formData.curMaxSeq" placeholder="请输入当前最大流水号" :disabled="formType === 'update'" show-word-limit/>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
<el-button @click="emits">取 消</el-button>
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
</template>
|
</template>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
@ -112,11 +112,6 @@ const open = async (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
const emits = async () => {
|
|
||||||
dialogVisible.value = false
|
|
||||||
emit('success')
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 提交表单 */
|
/** 提交表单 */
|
||||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
const submitForm = async () => {
|
const submitForm = async () => {
|
||||||
|
|||||||
@ -120,7 +120,6 @@
|
|||||||
</Dialog>
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { nextTick } from 'vue'
|
|
||||||
import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
import { getIntDictOptions, getStrDictOptions, getBoolDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||||
import * as MaterialApi from '@/api/heli/material'
|
import * as MaterialApi from '@/api/heli/material'
|
||||||
import {getSupplierPage} from "@/api/heli/supplier";
|
import {getSupplierPage} from "@/api/heli/supplier";
|
||||||
@ -175,8 +174,6 @@ const formRef = ref() // 表单 Ref
|
|||||||
const supplierList = ref<any[]>([]) //
|
const supplierList = ref<any[]>([]) //
|
||||||
const supplierSelectList = ref<any[]>([])
|
const supplierSelectList = ref<any[]>([])
|
||||||
const supplierSelectLoading = ref(false);
|
const supplierSelectLoading = ref(false);
|
||||||
const isInitialized = ref(false) // 是否已初始化完成,防止加载时触发watch
|
|
||||||
const originalMatCate = ref() // 记录打开时的物料大类,用于判断是否用户主动修改
|
|
||||||
|
|
||||||
const remoteSupplierSearch = (query: string) => {
|
const remoteSupplierSearch = (query: string) => {
|
||||||
if (query) {
|
if (query) {
|
||||||
@ -199,15 +196,9 @@ const open = async (type: string, id?: number) => {
|
|||||||
resetForm()
|
resetForm()
|
||||||
// 修改时,设置数据
|
// 修改时,设置数据
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
isInitialized.value = false
|
|
||||||
try {
|
try {
|
||||||
if (id) {
|
if (id) {
|
||||||
const data = await MaterialApi.getMaterial(id)
|
formData.value = await MaterialApi.getMaterial(id)
|
||||||
formData.value = data
|
|
||||||
// 记录原始物料大类
|
|
||||||
originalMatCate.value = data.matCate
|
|
||||||
} else {
|
|
||||||
originalMatCate.value = undefined
|
|
||||||
}
|
}
|
||||||
let params = {
|
let params = {
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
@ -219,9 +210,6 @@ const open = async (type: string, id?: number) => {
|
|||||||
supplierSelectList.value = supplierData.list;
|
supplierSelectList.value = supplierData.list;
|
||||||
} finally {
|
} finally {
|
||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
nextTick(() => {
|
|
||||||
isInitialized.value = true
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -292,18 +280,8 @@ const handleSelectedSupplier = (newValue: any) => {
|
|||||||
|
|
||||||
/** 监听物料类型变化,查询matcode并更新code */
|
/** 监听物料类型变化,查询matcode并更新code */
|
||||||
watch(() => formData.value.matCate, async (newVal) => {
|
watch(() => formData.value.matCate, async (newVal) => {
|
||||||
// 如果未初始化完成,不处理
|
|
||||||
if (!isInitialized.value) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 如果新值为空,清空编码
|
|
||||||
if (!newVal) {
|
if (!newVal) {
|
||||||
formData.value.code = undefined
|
formData.value.code = undefined
|
||||||
originalMatCate.value = undefined
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 如果值没有变化(用户选择的是同一个值),不更新编码
|
|
||||||
if (newVal === originalMatCate.value) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -313,8 +291,6 @@ watch(() => formData.value.matCate, async (newVal) => {
|
|||||||
} else {
|
} else {
|
||||||
formData.value.code = null
|
formData.value.code = null
|
||||||
}
|
}
|
||||||
// 更新原始值
|
|
||||||
originalMatCate.value = newVal
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('查询matcode失败:', error)
|
console.error('查询matcode失败:', error)
|
||||||
formData.value.code = null
|
formData.value.code = null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user