Browse Source

SCP《供应商便次配置表》增加编辑功能,只可编辑 “延迟便次” 字段

intex_online20250408
叶佳兴 1 week ago
parent
commit
4cfd102e9e
  1. 104
      src/views/wms/supplierManage/supplierDeliMain/index.vue
  2. 4
      src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts

104
src/views/wms/supplierManage/supplierDeliMain/index.vue

@ -40,7 +40,10 @@
</div>
</template>
<template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" />
<ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template>
</Table>
</ContentWrap>
@ -61,7 +64,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="SupplierDeliMain.allSchemas" />
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/basic/supplier-deli-main/import" :importTemplateData="importTemplateData" @success="importSuccess" />
<ImportForm
ref="importFormRef"
url="/basic/supplier-deli-main/import"
:importTemplateData="importTemplateData"
@success="importSuccess"
/>
</template>
<script setup lang="ts">
@ -93,7 +101,16 @@ defineOptions({ name: 'SupplierDeliMain' })
const orginTableColumns = ref(SupplierDeliMain.allSchemas.tableColumns)
const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns)
//
const updataTableColumns = (val: { [x: string]: any; field: string; label?: string | undefined; width?: string | number | undefined; fixed?: "left" | "right" | undefined; children?: any[] | undefined }[]) => {
const updataTableColumns = (
val: {
[x: string]: any
field: string
label?: string | undefined
width?: string | number | undefined
fixed?: 'left' | 'right' | undefined
children?: any[] | undefined
}[]
) => {
orginTableColumns.value = val
}
@ -108,14 +125,18 @@ const search = (mold) => {
setSearchParams(mold)
}
const dateColumns = ref([])
watch(()=>tableObjectHead.tableList,()=>{
watch(
() => tableObjectHead.tableList,
() => {
updateDateTableColumns()
},{deep:true})
},
{ deep: true }
)
const updateDateTableColumns = () => {
console.log('tableObjectHead', tableObjectHead)
dateColumns.value = []
if (tableObjectHead.tableList.length > 10) {
tableObjectHead.tableList.forEach(item=>{
tableObjectHead.tableList.forEach((item) => {
dateColumns.value.push({
width: 120,
field: item,
@ -123,7 +144,7 @@ const updateDateTableColumns = ()=>{
})
})
} else {
tableObjectHead.tableList.forEach(item=>{
tableObjectHead.tableList.forEach((item) => {
dateColumns.value.push({
field: item,
label: item
@ -143,7 +164,12 @@ routeName.value = route.name
// const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns)
//
const searchTableSuccess = (formField: string | number, searchField: string | number, val: { [x: string]: any }[], formRef: { setValues: (arg0: {}) => void }) => {
const searchTableSuccess = (
formField: string | number,
searchField: string | number,
val: { [x: string]: any }[],
formRef: { setValues: (arg0: {}) => void }
) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
@ -168,7 +194,7 @@ const getListExecute = () => {
tableObject.params.yearAndMonth = formatDate(new Date(), 'YYYY-MM')
}
getList()
tableObject.tableList.forEach(item=>item.isOpen = false)
tableObject.tableList.forEach((item) => (item.isOpen = false))
}
//
@ -178,7 +204,7 @@ const HeadButttondata = [
defaultButtons.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), //
defaultButtons.defaultSetBtn(null) //
// {
// label: '',
// name: 'zdy',
@ -191,17 +217,23 @@ const HeadButttondata = [
//
const buttonBaseClick = (val: string, item: any) => {
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') {
//
getListHead()
getListExecute()
} else if (val == 'filtrate') { //
} else { //
} else if (val == 'filtrate') {
//
} else {
//
console.log('其他按钮', item)
}
}
@ -210,7 +242,7 @@ const buttonBaseClick = (val: string, item: any) => {
const butttondata = (row) => {
const array = []
// 6
dateColumns.value.forEach(item => {
dateColumns.value.forEach((item) => {
if (row[item.field]?.length > 6) {
array.push(row)
}
@ -233,42 +265,56 @@ const butttondata = (row) => {
color: '',
link: true, //
hasPermi: ''
}
},
defaultButtons.mainListEditBtn(null) //
]
}
// -
const buttonTableClick = async (val: string, row: any) => {
if (val == 'open') { //
if (val == 'open') {
//
// openForm('update', row)
row.isOpen = true
getMaxHeight(row)
} else if (val == 'retract') { //
} else if (val == 'retract') {
//
row.isOpen = false
getMaxHeight(row)
// handleDelete(row.id)
} else if (val == 'edit') {
//
openForm('update', row)
}
}
/** 添加/修改操作 */
const basicFormRef = ref()
const openForm = (type: string, row?: any) => {
console.log('wolaile ', row)
if (type == 'update') {
SupplierDeliMain.allSchemas.formSchema.forEach((item) => {
if (item.field == 'delayDeli') {
item.value = row.delayDeli
}
})
}
basicFormRef.value.open(type, row)
}
// form
const formsSuccess = async (formType: string, data: SupplierDeliMainApi.SupplierDeliMainVO) => {
var isHave = SupplierDeliMain.allSchemas.formSchema.some(function (item) {
return item.field === 'activeTime' || item.field === 'expireTime';
});
return item.field === 'activeTime' || item.field === 'expireTime'
})
if (isHave) {
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) {
message.error('失效时间要大于生效时间')
return;
return
}
}
if(data.activeTime==0)data.activeTime = null;
if(data.expireTime==0)data.expireTime = null;
if (data.activeTime == 0) data.activeTime = null
if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') {
await SupplierDeliMainApi.createSupplierDeliMain(data)
message.success(t('common.createSuccess'))
@ -341,10 +387,11 @@ const searchFormClick = (searchData: { filters: any }) => {
const getMaxHeight = (row) => {
//
if (row.isOpen === true) { //
return 'none'; //
if (row.isOpen === true) {
//
return 'none' //
}
return '140px'; //
return '140px' //
}
/** 初始化 **/
onMounted(async () => {
@ -352,7 +399,6 @@ onMounted(async () => {
getListExecute()
importTemplateData.templateUrl = await SupplierDeliMainApi.importTemplate()
})
</script>
<style lang="scss">
// .el-table .cell.el-tooltip{

4
src/views/wms/supplierManage/supplierDeliMain/supplierDeliMain.data.ts

@ -14,6 +14,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'supplierCode',
sort: 'custom',
isSearch: true,
isForm: false,
table:{
width : 180
}
@ -23,6 +24,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'supplierAddress',
sort: 'custom',
isSearch: true,
isForm: false,
table:{
width : 180
}
@ -31,6 +33,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '受入号',
field: 'model',
sort: 'custom',
isForm: false,
isSearch: true,
table:{
width : 180
@ -50,6 +53,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'yearAndMonth',
sort: 'custom',
isTable: false,
isForm: false,
isSearch: true,
search: {
component: 'DatePicker',

Loading…
Cancel
Save