Browse Source

基础信息修改

master
zhang_li 1 year ago
parent
commit
ae1a9e2fd6
  1. 38
      src/components/BasicForm/src/BasicForm.vue
  2. 27
      src/views/wms/basicDataManage/itemManage/itembasic/index.vue
  3. 78
      src/views/wms/basicDataManage/itemManage/itempackaging/index.vue
  4. 25
      src/views/wms/basicDataManage/supplierManage/supplier/index.vue

38
src/components/BasicForm/src/BasicForm.vue

@ -244,26 +244,26 @@ const submitForm = async () => {
// data.masterId = props.masterParmas.masterId
// data.number = props.masterParmas.number
// }
console.log(props.formAllSchemas.formSchema)
var isHave = props.formAllSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if (formType.value === 'create') {
await props.apiCreate(data)
message.success(t('common.createSuccess'))
} else {
await props.apiUpdate(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
// console.log(props.formAllSchemas.formSchema)
// var isHave = props.formAllSchemas.formSchema.some(function (item) {
// return item.field === 'activeTime' || item.field === 'expireTime';
// });
// if(isHave){
// if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
// message.error('')
// return;
// }
// }
// if (formType.value === 'create') {
// await props.apiCreate(data)
// message.success(t('common.createSuccess'))
// } else {
// await props.apiUpdate(data)
// message.success(t('common.updateSuccess'))
// }
// dialogVisible.value = false
//
emit('success')
emit('success',formType.value,data)
} finally {
formLoading.value = false
}

27
src/views/wms/basicDataManage/itemManage/itembasic/index.vue

@ -38,7 +38,7 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
@success="formsSuccess"
:rules="rules"
:formAllSchemas="Itembasic.allSchemas"
:apiUpdate="ItembasicApi.updateItembasic"
@ -155,6 +155,30 @@ const basicFormRef = ref()
const openForm = (type: string, id?: number) => {
basicFormRef.value.open(type, id)
}
// form
const formsSuccess = async (formType,data) => {
var isHave =Itembasic.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
message.error('失效时间要大于生效时间')
return;
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (formType === 'create') {
await ItembasicApi.createItembasic(data)
message.success(t('common.createSuccess'))
} else {
await ItembasicApi.updateItembasic(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItembasic')
@ -198,6 +222,7 @@ const searchFormClick = (searchData) => {
getList() //
}
/** 初始化 **/
onMounted(() => {
getList()

78
src/views/wms/basicDataManage/itemManage/itempackaging/index.vue

@ -1,7 +1,11 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<Search :schema="Itempackaging.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" />
<Search
:schema="Itempackaging.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap>
<!-- 列表头部 -->
@ -27,13 +31,13 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #itemCode="{row}">
<template #itemCode="{ row }">
<el-button type="primary" link @click="openDetail(row, '物料代码', row.itemCode)">
<span>{{ row.itemCode }}</span>
</el-button>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event, row)" />
</template>
</Table>
</ContentWrap>
@ -41,7 +45,7 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
@success="formsSuccess"
:rules="ItempackagingRules"
:formAllSchemas="Itempackaging.allSchemas"
:apiUpdate="ItempackagingApi.updateItempackaging"
@ -54,7 +58,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="Itempackaging.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/itempackaging/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/wms/itempackaging/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -91,12 +100,12 @@ const { getList, setSearchParams } = tableMethods
//
const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:itempackaging:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:itempackaging:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:itempackaging:export'}), //
defaultButtons.defaultAddBtn({ hasPermi: 'wms:itempackaging:create' }), //
defaultButtons.defaultImportBtn({ hasPermi: 'wms:itempackaging:import' }), //
defaultButtons.defaultExportBtn({ hasPermi: 'wms:itempackaging:export' }), //
defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -110,32 +119,40 @@ const HeadButttondata = [
//
const buttonBaseClick = (val, item) => {
console.log(104, val)
if (val == 'add') { //
if (val == 'add') {
//
openForm('create')
} else if (val == 'import') { //
} else if (val == 'import') {
//
handleImport()
} else if (val == 'export') { //
} else if (val == 'export') {
//
handleExport()
} else if (val == 'refresh') { //
} else if (val == 'refresh') {
//
getList()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
// -
const butttondata = [
defaultButtons.mainListEditBtn({hasPermi:'wms:itempackaging:update'}), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:itempackaging:delete'}), //
defaultButtons.mainListEditBtn({ hasPermi: 'wms:itempackaging:update' }), //
defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:itempackaging:delete' }) //
]
// -
const buttonTableClick = async (val, row) => {
if (val == 'edit') { //
if (val == 'edit') {
//
// const res = await ItempackagingApi.getItempackaging(row.id)
openForm('update', row)
} else if (val == 'delete') { //
} else if (val == 'delete') {
//
handleDelete(row.id)
}
}
@ -145,7 +162,28 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
const formsSuccess = async (formType, data) => {
var isHave = Itempackaging.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return
}
}
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') {
await ItempackagingApi.createItempackaging(data)
message.success(t('common.createSuccess'))
} else {
await ItempackagingApi.updateItempackaging(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
//
const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => {

25
src/views/wms/basicDataManage/supplierManage/supplier/index.vue

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="basicFormRef"
@success="getList"
@success="formsSuccess"
:rules="SupplierRules"
:formAllSchemas="Supplier.allSchemas"
:apiUpdate="SupplierApi.updateSupplier"
@ -143,7 +143,28 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row)
}
const formsSuccess = async (formType, data) => {
var isHave = Supplier.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return
}
}
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') {
await SupplierApi.createSupplier(data)
message.success(t('common.createSuccess'))
} else {
await SupplierApi.updateSupplier(data)
message.success(t('common.updateSuccess'))
}
basicFormRef.value.dialogVisible = false
getList()
}
/** 详情操作 */
const detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => {

Loading…
Cancel
Save