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

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

@ -38,7 +38,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="rules" :rules="rules"
:formAllSchemas="Itembasic.allSchemas" :formAllSchemas="Itembasic.allSchemas"
:apiUpdate="ItembasicApi.updateItembasic" :apiUpdate="ItembasicApi.updateItembasic"
@ -155,6 +155,30 @@ const basicFormRef = ref()
const openForm = (type: string, id?: number) => { const openForm = (type: string, id?: number) => {
basicFormRef.value.open(type, id) 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 detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {
detailRef.value.openDetail(row, titleName, titleValue, 'basicItembasic') detailRef.value.openDetail(row, titleName, titleValue, 'basicItembasic')
@ -198,6 +222,7 @@ const searchFormClick = (searchData) => {
getList() // getList() //
} }
/** 初始化 **/ /** 初始化 **/
onMounted(() => { onMounted(() => {
getList() getList()

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

@ -1,7 +1,11 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="Itempackaging.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> <Search
:schema="Itempackaging.allSchemas.searchSchema"
@search="setSearchParams"
@reset="setSearchParams"
/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -41,7 +45,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="ItempackagingRules" :rules="ItempackagingRules"
:formAllSchemas="Itempackaging.allSchemas" :formAllSchemas="Itempackaging.allSchemas"
:apiUpdate="ItempackagingApi.updateItempackaging" :apiUpdate="ItempackagingApi.updateItempackaging"
@ -54,7 +58,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="Itempackaging.allSchemas" /> <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> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -96,7 +105,7 @@ const HeadButttondata = [
defaultButtons.defaultExportBtn({ hasPermi: 'wms:itempackaging:export' }), // defaultButtons.defaultExportBtn({ hasPermi: 'wms:itempackaging:export' }), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -110,16 +119,22 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = (val, item) => {
console.log(104, val) console.log(104, val)
if (val == 'add') { // if (val == 'add') {
//
openForm('create') openForm('create')
} else if (val == 'import') { // } else if (val == 'import') {
//
handleImport() handleImport()
} else if (val == 'export') { // } else if (val == 'export') {
//
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') {
//
getList() getList()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
@ -127,15 +142,17 @@ const buttonBaseClick = (val, item) => {
// - // -
const butttondata = [ const butttondata = [
defaultButtons.mainListEditBtn({ hasPermi: 'wms:itempackaging:update' }), // defaultButtons.mainListEditBtn({ hasPermi: 'wms:itempackaging:update' }), //
defaultButtons.mainListDeleteBtn({hasPermi:'wms:itempackaging:delete'}), // defaultButtons.mainListDeleteBtn({ hasPermi: 'wms:itempackaging:delete' }) //
] ]
// - // -
const buttonTableClick = async (val, row) => { const buttonTableClick = async (val, row) => {
if (val == 'edit') { // if (val == 'edit') {
//
// const res = await ItempackagingApi.getItempackaging(row.id) // const res = await ItempackagingApi.getItempackaging(row.id)
openForm('update', row) openForm('update', row)
} else if (val == 'delete') { // } else if (val == 'delete') {
//
handleDelete(row.id) handleDelete(row.id)
} }
} }
@ -145,7 +162,28 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) 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) => { const searchTableSuccess = (formField, searchField, val, formRef) => {
nextTick(() => { nextTick(() => {

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

@ -41,7 +41,7 @@
<!-- 表单弹窗添加/修改 --> <!-- 表单弹窗添加/修改 -->
<BasicForm <BasicForm
ref="basicFormRef" ref="basicFormRef"
@success="getList" @success="formsSuccess"
:rules="SupplierRules" :rules="SupplierRules"
:formAllSchemas="Supplier.allSchemas" :formAllSchemas="Supplier.allSchemas"
:apiUpdate="SupplierApi.updateSupplier" :apiUpdate="SupplierApi.updateSupplier"
@ -143,7 +143,28 @@ const basicFormRef = ref()
const openForm = (type: string, row?: any) => { const openForm = (type: string, row?: any) => {
basicFormRef.value.open(type, row) 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 detailRef = ref()
const openDetail = (row: any, titleName: any, titleValue: any) => { const openDetail = (row: any, titleName: any, titleValue: any) => {

Loading…
Cancel
Save