Browse Source

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

intex_online20250408
叶佳兴 2 weeks 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> </div>
</template> </template>
<template #action="{ row }"> <template #action="{ row }">
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> <ButtonBase
:Butttondata="butttondata(row)"
@button-base-click="buttonTableClick($event, row)"
/>
</template> </template>
</Table> </Table>
</ContentWrap> </ContentWrap>
@ -61,7 +64,12 @@
<Detail ref="detailRef" :isBasic="true" :allSchemas="SupplierDeliMain.allSchemas" /> <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> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -93,7 +101,16 @@ defineOptions({ name: 'SupplierDeliMain' })
const orginTableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) const orginTableColumns = ref(SupplierDeliMain.allSchemas.tableColumns)
const tableColumns = 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 orginTableColumns.value = val
} }
@ -108,14 +125,18 @@ const search = (mold) => {
setSearchParams(mold) setSearchParams(mold)
} }
const dateColumns = ref([]) const dateColumns = ref([])
watch(()=>tableObjectHead.tableList,()=>{ watch(
() => tableObjectHead.tableList,
() => {
updateDateTableColumns() updateDateTableColumns()
},{deep:true}) },
{ deep: true }
)
const updateDateTableColumns = () => { const updateDateTableColumns = () => {
console.log('tableObjectHead', tableObjectHead) console.log('tableObjectHead', tableObjectHead)
dateColumns.value = [] dateColumns.value = []
if (tableObjectHead.tableList.length > 10) { if (tableObjectHead.tableList.length > 10) {
tableObjectHead.tableList.forEach(item=>{ tableObjectHead.tableList.forEach((item) => {
dateColumns.value.push({ dateColumns.value.push({
width: 120, width: 120,
field: item, field: item,
@ -123,7 +144,7 @@ const updateDateTableColumns = ()=>{
}) })
}) })
} else { } else {
tableObjectHead.tableList.forEach(item=>{ tableObjectHead.tableList.forEach((item) => {
dateColumns.value.push({ dateColumns.value.push({
field: item, field: item,
label: item label: item
@ -143,7 +164,12 @@ routeName.value = route.name
// const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) // 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(() => { nextTick(() => {
const setV = {} const setV = {}
setV[formField] = val[0][searchField] setV[formField] = val[0][searchField]
@ -168,7 +194,7 @@ const getListExecute = () => {
tableObject.params.yearAndMonth = formatDate(new Date(), 'YYYY-MM') tableObject.params.yearAndMonth = formatDate(new Date(), 'YYYY-MM')
} }
getList() 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.defaultExportBtn(null), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
// defaultButtons.defaultFilterBtn(null), // // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null) //
// { // {
// label: '', // label: '',
// name: 'zdy', // name: 'zdy',
@ -191,17 +217,23 @@ const HeadButttondata = [
// //
const buttonBaseClick = (val: string, item: any) => { const buttonBaseClick = (val: string, item: any) => {
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') {
//
getListHead() getListHead()
getListExecute() getListExecute()
} else if (val == 'filtrate') { // } else if (val == 'filtrate') {
} else { // //
} else {
//
console.log('其他按钮', item) console.log('其他按钮', item)
} }
} }
@ -210,7 +242,7 @@ const buttonBaseClick = (val: string, item: any) => {
const butttondata = (row) => { const butttondata = (row) => {
const array = [] const array = []
// 6 // 6
dateColumns.value.forEach(item => { dateColumns.value.forEach((item) => {
if (row[item.field]?.length > 6) { if (row[item.field]?.length > 6) {
array.push(row) array.push(row)
} }
@ -233,42 +265,56 @@ const butttondata = (row) => {
color: '', color: '',
link: true, // link: true, //
hasPermi: '' hasPermi: ''
} },
defaultButtons.mainListEditBtn(null) //
] ]
} }
// - // -
const buttonTableClick = async (val: string, row: any) => { const buttonTableClick = async (val: string, row: any) => {
if (val == 'open') { // if (val == 'open') {
//
// openForm('update', row) // openForm('update', row)
row.isOpen = true row.isOpen = true
getMaxHeight(row) getMaxHeight(row)
} else if (val == 'retract') { // } else if (val == 'retract') {
//
row.isOpen = false row.isOpen = false
getMaxHeight(row) getMaxHeight(row)
// handleDelete(row.id) // handleDelete(row.id)
} else if (val == 'edit') {
//
openForm('update', row)
} }
} }
/** 添加/修改操作 */ /** 添加/修改操作 */
const basicFormRef = ref() const basicFormRef = ref()
const openForm = (type: string, row?: any) => { 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) basicFormRef.value.open(type, row)
} }
// form // form
const formsSuccess = async (formType: string, data: SupplierDeliMainApi.SupplierDeliMainVO) => { const formsSuccess = async (formType: string, data: SupplierDeliMainApi.SupplierDeliMainVO) => {
var isHave = SupplierDeliMain.allSchemas.formSchema.some(function (item) { 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 (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(data.activeTime==0)data.activeTime = null; if (data.activeTime == 0) data.activeTime = null
if(data.expireTime==0)data.expireTime = null; if (data.expireTime == 0) data.expireTime = null
if (formType === 'create') { if (formType === 'create') {
await SupplierDeliMainApi.createSupplierDeliMain(data) await SupplierDeliMainApi.createSupplierDeliMain(data)
message.success(t('common.createSuccess')) message.success(t('common.createSuccess'))
@ -341,10 +387,11 @@ const searchFormClick = (searchData: { filters: any }) => {
const getMaxHeight = (row) => { const getMaxHeight = (row) => {
// //
if (row.isOpen === true) { // if (row.isOpen === true) {
return 'none'; // //
return 'none' //
} }
return '140px'; // return '140px' //
} }
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
@ -352,7 +399,6 @@ onMounted(async () => {
getListExecute() getListExecute()
importTemplateData.templateUrl = await SupplierDeliMainApi.importTemplate() importTemplateData.templateUrl = await SupplierDeliMainApi.importTemplate()
}) })
</script> </script>
<style lang="scss"> <style lang="scss">
// .el-table .cell.el-tooltip{ // .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', field: 'supplierCode',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: false,
table:{ table:{
width : 180 width : 180
} }
@ -23,6 +24,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'supplierAddress', field: 'supplierAddress',
sort: 'custom', sort: 'custom',
isSearch: true, isSearch: true,
isForm: false,
table:{ table:{
width : 180 width : 180
} }
@ -31,6 +33,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
label: '受入号', label: '受入号',
field: 'model', field: 'model',
sort: 'custom', sort: 'custom',
isForm: false,
isSearch: true, isSearch: true,
table:{ table:{
width : 180 width : 180
@ -50,6 +53,7 @@ export const SupplierDeliMain = useCrudSchemas(reactive<CrudSchema[]>([
field: 'yearAndMonth', field: 'yearAndMonth',
sort: 'custom', sort: 'custom',
isTable: false, isTable: false,
isForm: false,
isSearch: true, isSearch: true,
search: { search: {
component: 'DatePicker', component: 'DatePicker',

Loading…
Cancel
Save