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