Browse Source

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

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

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

@ -27,20 +27,23 @@
v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort"
>
<template #code="{row}">
<template #code="{ row }">
<el-button type="primary" link @click="openDetail(row, '代码', row.code)">
<span>{{ row.code }}</span>
</el-button>
</template>
<template v-for="item in dateColumns" :key="item.field" #[item.field]="{row}">
<div :style="{ maxHeight: getMaxHeight(row)}">
<div v-for="(cur,index) in row[item.field]" :key="index">
{{cur}}
<template v-for="item in dateColumns" :key="item.field" #[item.field]="{ row }">
<div :style="{ maxHeight: getMaxHeight(row) }">
<div v-for="(cur, index) in row[item.field]" :key="index">
{{ cur }}
</div>
</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,12 +64,17 @@
<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">
import download from '@/utils/download'
import { SupplierDeliMain,SupplierDeliMainRules } from './supplierDeliMain.data'
import { SupplierDeliMain, SupplierDeliMainRules } from './supplierDeliMain.data'
import * as SupplierDeliMainApi from '@/api/wms/supplierDeliMain'
import * as defaultButtons from '@/utils/disposition/defaultButtons'
import TableHead from '@/components/TableHead/src/TableHead.vue'
@ -93,11 +101,20 @@ 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
}
const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({
const { tableObject: tableObjectHead, tableMethods: tableMethodsHead } = useTable({
getListApi: SupplierDeliMainApi.getPageTableHead //
})
@ -108,30 +125,34 @@ const search = (mold) => {
setSearchParams(mold)
}
const dateColumns = ref([])
watch(()=>tableObjectHead.tableList,()=>{
watch(
() => tableObjectHead.tableList,
() => {
updateDateTableColumns()
},{deep:true})
const updateDateTableColumns = ()=>{
},
{ deep: true }
)
const updateDateTableColumns = () => {
console.log('tableObjectHead', tableObjectHead)
dateColumns.value = []
if(tableObjectHead.tableList.length>10){
tableObjectHead.tableList.forEach(item=>{
if (tableObjectHead.tableList.length > 10) {
tableObjectHead.tableList.forEach((item) => {
dateColumns.value.push({
width:120,
width: 120,
field: item,
label: item
})
})
}else{
tableObjectHead.tableList.forEach(item=>{
} else {
tableObjectHead.tableList.forEach((item) => {
dateColumns.value.push({
field: item,
label: item
})
})
}
tableColumns.value = [...orginTableColumns.value,...dateColumns.value]
console.log('tableColumns',tableColumns.value)
tableColumns.value = [...orginTableColumns.value, ...dateColumns.value]
console.log('tableColumns', tableColumns.value)
}
const message = useMessage() //
@ -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]
@ -164,11 +190,11 @@ const { tableObject, tableMethods } = useTable({
//
const { getList, setSearchParams } = tableMethods
const getListExecute = () => {
if(!tableObject.params.yearAndMonth){
tableObject.params.yearAndMonth=formatDate(new Date(),'YYYY-MM')
if (!tableObject.params.yearAndMonth) {
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)
}
@ -219,7 +251,7 @@ const butttondata = (row) => {
{
label: t(`ts.展开更多`).replace('ts.', ''),
name: 'open',
hide: row.isOpen || array.length==0,
hide: row.isOpen || array.length == 0,
type: 'primary',
color: '',
link: true, //
@ -228,47 +260,61 @@ const butttondata = (row) => {
{
label: t(`ts.收起`).replace('ts.', ''),
name: 'retract',
hide: !row.isOpen || array.length==0,
hide: !row.isOpen || array.length == 0,
type: 'primary',
color: '',
link: true, //
hasPermi: ''
}
},
defaultButtons.mainListEditBtn(null) //
]
}
// -
const buttonTableClick = async (val: string, row:any) => {
if (val == 'open') { //
const buttonTableClick = async (val: string, row: any) => {
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';
});
if(isHave){
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){
const formsSuccess = async (formType: string, data: SupplierDeliMainApi.SupplierDeliMainVO) => {
var isHave = SupplierDeliMain.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;
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'))
@ -339,12 +385,13 @@ const searchFormClick = (searchData: { filters: any }) => {
getListExecute() //
}
const getMaxHeight=(row)=> {
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