Browse Source

要货计划

master_hella_20240701
wangyufei 5 months ago
parent
commit
6cb0258636
  1. 5
      src/api/wms/demandforecastingDetail/index.ts
  2. 123
      src/components/Search/src/Search.vue
  3. 399
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts
  4. 318
      src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

5
src/api/wms/demandforecastingDetail/index.ts

@ -50,3 +50,8 @@ export const deleteDemandforecastingDetail = async (id: number) => {
export const exportDemandforecastingDetail = async (params) => { export const exportDemandforecastingDetail = async (params) => {
return await request.download({ url: `/wms/demandforecasting-detail/export-excel`, params }) return await request.download({ url: `/wms/demandforecasting-detail/export-excel`, params })
} }
// 查询要货预测主列表
export const getPageTableHead = async (params) => {
return await request.get({ url: `/wms/demandforecasting-detail/queryPageTableHead`, params })
}

123
src/components/Search/src/Search.vue

@ -9,6 +9,7 @@ import { FormSchema } from '@/types/form'
import { useCache } from '@/hooks/web/useCache' import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache() const { wsCache } = useCache()
const message = useMessage() //
defineOptions({ name: 'Search' }) defineOptions({ name: 'Search' })
@ -40,10 +41,21 @@ const props = defineProps({
model: { model: {
type: Object as PropType<Recordable>, type: Object as PropType<Recordable>,
default: () => ({}) default: () => ({})
},
//
detailData: {
type: Object,
required: true,
default: null
},
showSearchTableQueryFields:{
type: Array,
required: false,
default: []
} }
}) })
const emit = defineEmits(['search', 'reset','onInput']) const emit = defineEmits(['search', 'reset','onInput','searchTableSuccess'])
const visible = ref(true) const visible = ref(true)
@ -92,6 +104,107 @@ const onInput = (field,value) => {
emit('onInput', field,value) emit('onInput', field,value)
} }
const searchTableRef = ref()
const opensearchTable = (
formField,
searchField,
searchTitle,
searchAllSchemas,
searchPage,
searchCondition,
multiple,
type,
row,
isConcatDetailSchemas=false,
searchDetailSchemas: any
) => {
const _searchCondition = {}
//
if (searchCondition && searchCondition.length > 0) {
//
let filters: any[] = []
for (var i=0; i< searchCondition.length; i++ ) {
// searchCondition.forEach((item) => {
// row
if (searchCondition[i].isMainValue) {
_searchCondition[searchCondition[i].key] = formRef.value.formModel[searchCondition[i].value]
? formRef.value.formModel[searchCondition[i].value]
: props.detailData
? props.detailData[searchCondition[i].value]
: row
? row[searchCondition[i].value]
: ''
//
let isNull = false
if (_searchCondition[searchCondition[i].key] == '' || _searchCondition[searchCondition[i].key] == undefined) {
isNull = true
}
if (isNull) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}else if(searchCondition[i].isTableRowValue){
if(searchCondition[i].required){
if (row[searchCondition[i].value] == '' ||row[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
row[searchCondition[i].value]
//table
_searchCondition[searchCondition[i].key] = row[searchCondition[i].value]
} else {
//
if (searchCondition[i].isSearch) {
if (searchCondition[i].isFormModel) {
//formModel
if(searchCondition[i].required){
if (formRef.value.formModel[searchCondition[i].value] == '' ||formRef.value.formModel[searchCondition[i].value] == undefined) {
message.warning(searchCondition[i].message?searchCondition[i].message:'前置条件未选择!')
return
}
}
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: formRef.value.formModel[searchCondition[i].value]
})
}else{
filters.push({
action: searchCondition[i].action,
column: searchCondition[i].key,
value: searchCondition[i].value
})
}
} else {
_searchCondition[searchCondition[i].key] = searchCondition[i].value
}
}
}
if (filters.length > 0) {
_searchCondition.isSearch = true
_searchCondition.filters = filters
}
}
const _searchTableTitle = searchTitle
const _searchTableAllSchemas = searchAllSchemas
const _searchTablePage = searchPage
searchTableRef.value.open(
_searchTableTitle,
_searchTableAllSchemas,
_searchTablePage,
formField,
searchField,
multiple,
type,
row,
_searchCondition,
undefined,
isConcatDetailSchemas,
searchDetailSchemas
)
}
const formRef = ref() const formRef = ref()
const setFormValues = (formData)=>{ const setFormValues = (formData)=>{
formRef.value.setValues(formData) formRef.value.setValues(formData)
@ -124,6 +237,11 @@ const setVisible = () => {
unref(elFormRef)?.resetFields() unref(elFormRef)?.resetFields()
visible.value = !unref(visible) visible.value = !unref(visible)
} }
//
// val row
const searchTableSuccess = (formField, searchField, val, type, row) => {
emit('searchTableSuccess', formField, searchField, val, formRef.value, type, row)
}
const Search = ref() const Search = ref()
onMounted(() => {}) onMounted(() => {})
defineExpose({setFormValues}) // open defineExpose({setFormValues}) // open
@ -143,6 +261,7 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
hide-required-asterisk hide-required-asterisk
@register="register" @register="register"
@onInput="onInput" @onInput="onInput"
@opensearchTable="opensearchTable"
> >
<template #action> <template #action>
<div v-if="layout === 'inline'"> <div v-if="layout === 'inline'">
@ -188,6 +307,8 @@ defineExpose({setFormValues}) // 提供 open 方法,用于打开弹窗
<slot name="actionMore"></slot> <slot name="actionMore"></slot>
</div> </div>
</template> </template>
<SearchTable ref="searchTableRef" :showSearchTableQueryFields="showSearchTableQueryFields" @searchTableSuccess="searchTableSuccess" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.search ::v-deep(.el-form-item) { .search ::v-deep(.el-form-item) {

399
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/demandforecastingMain.data.ts

@ -4,6 +4,8 @@ import * as SupplierApi from '@/api/wms/supplier'
import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data' import { Supplier } from '@/views/wms/basicDataManage/supplierManage/supplier/supplier.data'
import * as SupplieritemApi from '@/api/wms/supplieritem' import * as SupplieritemApi from '@/api/wms/supplieritem'
import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data' import { Supplieritem } from '@/views/wms/basicDataManage/supplierManage/supplieritem/supplieritem.data'
import * as ItembasicApi from '@/api/wms/itembasic'
import {Itembasic} from "@/views/wms/basicDataManage/itemManage/itembasic/itembasic.data";
import * as PurchaseMainApi from '@/api/wms/purchaseMain' import * as PurchaseMainApi from '@/api/wms/purchaseMain'
import * as PurchaseDetailApi from '@/api/wms/purchaseDetail' import * as PurchaseDetailApi from '@/api/wms/purchaseDetail'
import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data' import { PurchaseDetail, PurchaseMain } from '../purchaseMain/purchaseMain.data'
@ -14,15 +16,29 @@ const { t } = useI18n() // 国际化
*/ */
export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
{ {
label: '单据号', label: '计划员',
field: 'number', field: 'planerId',
sort: 'custom', sort: 'custom',
table: { table: {
width: 200, width: 150
fixed: 'left'
}, },
isTable:false,
isForm: false, isForm: false,
isSearch: true, isSearch:true,
search:{
component:'Select',
componentProps: {
showAll:true,// 备用做全选
multiple:true,
options:[{
label:'1111',
value: 1111
},{
label:'222',
value: 222
}]
}
},
}, },
{ {
label: '供应商代码', label: '供应商代码',
@ -32,8 +48,7 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
width: 150 width: 150
}, },
isSearch: true, isSearch: true,
form: { search: {
labelMessage: '影响明细中物料代码,需在供应商物料中维护',
componentProps: { componentProps: {
enterSearch:true, enterSearch:true,
isSearchList: true, // 开启查询弹窗 isSearchList: true, // 开启查询弹窗
@ -51,213 +66,91 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
} }
}, },
{ {
label: '版本号', label: '订单号',
field: 'version', field: 'poNumber',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
}, },
{ {
label: '发布时间', label: '订单行',
field: 'publishTime', field: 'poLine',
formatter: dateFormatter,
isTable: false,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '开始时间',
field: 'beginTime',
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '结束时间',
field: 'endTime',
isTable: false,
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '业务类型',
field: 'businessType',
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
},
isTable:false,
isForm: false,
form: {
value: 'PurchasePrediction',
componentProps: {
disabled: true
}
} }
}, },
{ {
label: '状态', label: '物料代码',
field: 'status', field: 'itemCode',
dictType: DICT_TYPE.PURCHASE_ORDER_STATUS,
dictClass: 'string',
isTable: true,
isForm:false,
isSearch: true,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
form: { isSearch:true,
value: '1', isTable:true,
isForm: false,
search: {
// labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
disabled: true multiple: true,
enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
} }
} }
}, },
{ {
label: '备注', label: '版本号',
field: 'remark', field: 'version',
sort: 'custom',
table: {
width: 150
},
isTable: false,
},
{
label: '创建时间',
field: 'createTime',
formatter: dateFormatter,
detail: {
dateFormat: 'YYYY-MM-DD HH:mm:ss'
},
sort: 'custom',
table: {
width: 180
},
isTable:false,
form: {
component: 'DatePicker',
componentProps: {
style: { width: '100%' },
type: 'datetime',
dateFormat: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'x',
}
},
isForm: false,
},
{
label: '创建者',
field: 'creator',
sort: 'custom',
table: {
width: 150
},
isTable:false,
isForm: false,
},
{
label: '是否可用',
field: 'available',
dictType: DICT_TYPE.TRUE_FALSE,
dictClass: 'string',
isTable: true,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
}, },
form: { isSearch:true,
component: 'Switch', search: {
value: 'TRUE', // labelMessage: '信息提示说明!!!',
componentProps: { componentProps: {
inactiveValue: 'FALSE', multiple: true,
activeValue: 'TRUE' enterSearch: true,
isSearchList: true, // 开启查询弹窗
searchListPlaceholder: '请选择物料代码', // 输入框占位文本
searchField: 'code', // 查询弹窗赋值字段
searchTitle: '物料基础信息', // 查询弹窗标题
searchAllSchemas: Itembasic.allSchemas, // 查询弹窗所需类
searchPage: ItembasicApi.getItembasicPage, // 查询弹窗所需分页方法
searchCondition: [{
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
},{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
} }
}, }
},
{
label: '计划员',
field: 'planerId',
sort: 'custom',
table: {
width: 150
},
isSearch:true,
isTable:false,
isForm: false,
},
{
label: '计划员名称',
field: 'planerUserName',
sort: 'custom',
table: {
width: 150
},
isTable:false,
isForm: false,
},
{
label: '版本',
field: 'activeVersion',
sort: 'custom',
table: {
width: 150
},
isSearch:true,
isTable:false,
isForm: false,
}, },
{ {
label: '到货日期', label: '到货日期',
field: 'dueDate', field: 'dueDate',
formatter: dateFormatter,
sort: 'custom', sort: 'custom',
table: { table: {
width: 150 width: 150
@ -265,26 +158,14 @@ export const DemandforecastingMain = useCrudSchemas(reactive<CrudSchema[]>([
isSearch:true, isSearch:true,
isTable:false, isTable:false,
isForm: false, isForm: false,
}, search: {
{ value:[],
label: '物料代码', component: 'DatePicker',
field: 'itemCode', componentProps: {
sort: 'custom', valueFormat: 'YYYY-MM-DD',
table: { type: 'daterange',
width: 150 defaultTime: [new Date('1 '), new Date('1 ')]
}, }
isSearch:true,
isTable:false,
isForm: false,
},
{
label: '操作',
field: 'action',
isDetail: false,
isForm: false,
table: {
width: 300,
fixed: 'right'
}, },
} }
])) ]))
@ -365,117 +246,7 @@ export const DemandforecastingDetail = useCrudSchemas(reactive<CrudSchema[]>([
valueFormat: 'x', valueFormat: 'x',
} }
}, },
{
label: '订单号',
field: 'poNumber',
sort: 'custom',
table: {
width: 150
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}, {
key: 'supplierCode',
value: 'supplierCode',
message: '请填写供应商代码!',
isMainValue: true
}
, {
key: 'status',
value: 2,
isMainValue: false
}
]
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择订单号',
searchField: 'number',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseMain.allSchemas,
searchPage: PurchaseMainApi.getPurchaseMainPage,
searchCondition: [{
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
}
},
{
label: '订单行',
field: 'poLine',
sort: 'custom',
table: {
width: 150
},
form: {
// labelMessage: '信息提示说明!!!',
componentProps: {
isSearchList: true,
searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPage,
searchCondition: [{
key: 'number',
value: 'poNumber',
message: '请填写订单号!',
isMainValue: true
}, {
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
tableForm: {
isInpuFocusShow: true,
searchListPlaceholder: '请选择订单行',
searchField: 'lineNumber',
searchTitle: '采购订单信息',
searchAllSchemas: PurchaseDetail.allSchemas,
searchPage: PurchaseDetailApi.getPurchaseDetailPage,
searchCondition: [{
key: 'number',
value: 'poNumber',
message: '请填写订单号!',
isMainValue: true
}, {
key: 'available',
value: 'TRUE',
isMainValue: false
}]
}
},
{
label: '物料代码',
field: 'itemCode',
sort: 'custom',
table: {
width: 150
},
form: {
componentProps: {
disabled: true
}
},
tableForm: {
disabled: true
}
},
{ {
label: '计量单位', label: '计量单位',
field: 'uom', field: 'uom',

318
src/views/wms/purchasereceiptManage/supplierdeliver/demandforecastingMain/index.vue

@ -1,7 +1,7 @@
<template> <template>
<ContentWrap> <ContentWrap>
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<Search :schema="[...DemandforecastingMain.allSchemas.searchSchema,...DemandforecastingDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> <Search :schema="DemandforecastingMain.allSchemas.searchSchema" @search="searchClick" @reset="searchClick" @searchTableSuccess="searchTableSuccess"/>
</ContentWrap> </ContentWrap>
<!-- 列表头部 --> <!-- 列表头部 -->
@ -12,7 +12,6 @@
@updataTableColumns="updataTableColumns" @updataTableColumns="updataTableColumns"
@searchFormClick="searchFormClick" @searchFormClick="searchFormClick"
:allSchemas="DemandforecastingMain.allSchemas" :allSchemas="DemandforecastingMain.allSchemas"
:detailAllSchemas="DemandforecastingDetail.allSchemas"
/> />
<!-- 列表 --> <!-- 列表 -->
@ -27,59 +26,10 @@
v-model:pageSize="tableObject.pageSize" v-model:pageSize="tableObject.pageSize"
v-model:currentPage="tableObject.currentPage" v-model:currentPage="tableObject.currentPage"
v-model:sort="tableObject.sort" v-model:sort="tableObject.sort"
> />
<template #number="{row}">
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)">
<span>{{ row.number }}</span>
</el-button>
</template>
<template #action="{ row,$index }">
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" />
</template>
</Table>
</ContentWrap> </ContentWrap>
<!-- 表单弹窗添加/修改 -->
<BasicForm
ref="formRef"
@success="getList"
:rules="DemandforecastingMainRules"
:formAllSchemas="DemandforecastingMain.allSchemas"
:tableAllSchemas="DemandforecastingDetail.allSchemas"
:tableFormRules="DemandforecastingDetailRules"
:tableData="tableData"
:apiUpdate="DemandforecastingMainApi.updateDemandforecastingMain"
:apiCreate="DemandforecastingMainApi.createDemandforecastingMain"
:isBusiness="true"
@handleAddTable="handleAddTable"
@handleDeleteTable="handleDeleteTable"
:isShowReduceButtonSelection="true"
@tableSelectionDelete="tableSelectionDelete"
@searchTableSuccess="searchTableSuccess"
@submitForm="submitForm"
/>
<!-- 详情 -->
<Detail
ref="detailRef"
:isBasic="false"
:allSchemas="DemandforecastingMain.allSchemas"
:detailAllSchemas="DemandforecastingDetail.allSchemas"
:detailAllSchemasRules="DemandforecastingDetailRules"
:apiCreate="DemandforecastingDetailApi.createDemandforecastingDetail"
:apiUpdate="DemandforecastingDetailApi.updateDemandforecastingDetail"
:apiPage="DemandforecastingDetailApi.getDemandforecastingDetailPage"
:apiDelete="DemandforecastingDetailApi.deleteDemandforecastingDetail"
:Echo="Echo"
:detailButtonIsShowAdd="false"
:detailButtonIsShowEdit="false"
:detailButtonIsShowDelete="false"
@searchTableSuccessDetail="searchTableSuccessDetail"
/>
<!-- 导入 -->
<ImportForm ref="importFormRef" url="/wms/demandforecasting-main/import" :importTemplateData="importTemplateData"
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@ -98,11 +48,23 @@ const { t } = useI18n() // 国际化
const route = useRoute() // const route = useRoute() //
const routeName = ref() const routeName = ref()
routeName.value = route.name routeName.value = route.name
const tableColumns = ref([...DemandforecastingMain.allSchemas.tableColumns,...DemandforecastingDetail.allSchemas.tableMainColumns]) const orginTableColumns = ref(DemandforecastingMain.allSchemas.tableColumns)
const tableColumns = ref(DemandforecastingMain.allSchemas.tableColumns)
// //
const updataTableColumns = (val) => { const updataTableColumns = (val) => {
tableColumns.value = val orginTableColumns.value = val
}
const updateDateTableColumns = ()=>{
console.log('tableObjectHead',tableObjectHead)
let dateColumns = []
tableObjectHead.tableList.forEach(item=>{
dateColumns.push({
field: item,
label: item,
})
})
tableColumns.value = [...orginTableColumns.value,...dateColumns]
console.log('tableColumns',tableColumns.value)
} }
// //
@ -123,19 +85,14 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) =>
} }
}) })
} }
//
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => {
nextTick(() => {
const setV = {}
setV[formField] = val[0][searchField]
setV['itemCode'] = val[0]['code']
formRef.setValues(setV)
})
}
//
// const Echo = ['ppNumber','poLine', 'batch', 'altBatch', 'itemCode', 'itemName', 'itemDesc1', 'itemDesc2', 'projectCode', 'qty', 'uom'] const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({
const Echo = [] getListApi: DemandforecastingDetailApi.getPageTableHead //
})
//
const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead
const { tableObject, tableMethods } = useTable({ const { tableObject, tableMethods } = useTable({
getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage // getListApi: DemandforecastingDetailApi.getDemandforecastingDetailPage //
@ -146,29 +103,15 @@ const { getList, setSearchParams } = tableMethods
// //
const HeadButttondata = [ const HeadButttondata = [
defaultButtons.defaultAddBtn({hasPermi:'wms:demandforecasting-main:create'}), //
defaultButtons.defaultImportBtn({hasPermi:'wms:demandforecasting-main:import'}), //
defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), // defaultButtons.defaultExportBtn({hasPermi:'wms:demandforecasting-main:export'}), //
defaultButtons.defaultFreshBtn(null), // defaultButtons.defaultFreshBtn(null), //
defaultButtons.defaultFilterBtn(null), // // defaultButtons.defaultFilterBtn(null), //
defaultButtons.defaultSetBtn(null), // defaultButtons.defaultSetBtn(null), //
// {
// label: '',
// name: 'zdy',
// hide: false,
// type: 'primary',
// icon: 'Select',
// color: ''
// },
] ]
// //
const buttonBaseClick = (val, item) => { const buttonBaseClick = async (val, item) => {
if (val == 'add') { // if (val == 'export') { //
openForm('create')
} else if (val == 'import') { //
handleImport()
} else if (val == 'export') { //
handleExport() handleExport()
} else if (val == 'refresh') { // } else if (val == 'refresh') { //
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { if (tableObject.params.filters && tableObject.params.filters.length > 0 ) {
@ -176,7 +119,10 @@ const buttonBaseClick = (val, item) => {
filters: tableObject.params.filters filters: tableObject.params.filters
}) })
} else { } else {
await getListHead()
updateDateTableColumns()
getList() getList()
} }
} else if (val == 'filtrate') { // } else if (val == 'filtrate') { //
} else { // } else { //
@ -184,148 +130,13 @@ const buttonBaseClick = (val, item) => {
} }
} }
//
const isShowMainButton = (row,val) => {
if (val.indexOf(row.status) > -1) {
return false
} else {
return true
}
}
// -
const butttondata = (row,$index) => {
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1
if(findIndex>-1&&findIndex<$index){
return []
}
return [
defaultButtons.mainListOrderCloBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderOpeBtn({ hide: isShowMainButton(row, ['3']) }), //
defaultButtons.mainListOrderPubBtn({ hide: isShowMainButton(row, ['1']) }), //
defaultButtons.mainListOrderWitBtn({ hide: isShowMainButton(row, ['2']) }), //
defaultButtons.mainListEditBtn({ hasPermi: 'wms:demandforecasting-main:update', hide: isShowMainButton(row, ['1']) }), //
]
}
// -
const buttonTableClick = async (val, row) => {
if (val == 'mainOrderClo') { //
handleClose(row.masterId)
} else if (val == 'mainOrderOpe') { //
handleOpen(row.masterId)
} else if (val == 'mainOrderPub') { //
handlePublish(row.masterId)
} else if (val == 'mainOrderWit') { //
handleWit(row.masterId)
} else if (val == 'edit') { //
openForm('update', row)
} else if (val == 'delete') { //
handleDelete(row.masterId)
}
}
/** 添加/修改操作 */
const formRef = ref()
const openForm =async (type: string, row?: number) => {
tableData.value = [] //
formRef.value.open(type, row)
}
/** 关闭按钮操作 */
const handleClose = async (id : number) => {
try {
//
await message.confirm(t('ts.是否关闭所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.closePurchaseMain(id)
message.success(t('ts.关闭成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 打开按钮操作 */
const handleOpen = async (id : number) => {
try {
//
await message.confirm(t('ts.是否打开所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.openPurchaseMain(id)
message.success(t('ts.打开成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 发布按钮操作 */
const handlePublish = async (id : number) => {
try {
//
await message.confirm(t('ts.是否发布所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.publishPurchaseMain(id)
message.success(t('ts.发布成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 下架按钮操作 */
const handleWit = async (id : number) => {
try {
//
await message.confirm(t('ts.是否下架所选中数据?'))
tableObject.loading = true
//
await DemandforecastingMainApi.witPurchaseMain(id)
message.success(t('ts.下架成功!'))
tableObject.loading = false
//
await getList()
} catch { }finally{
tableObject.loading = false
}
}
/** 详情操作 */ const searchClick = async (data)=>{
const detailRef = ref() await setSearchParamsHead(data)
const openDetail = (row: any, titleName: any, titleValue: any) => { updateDateTableColumns()
detailRef.value.openDetail(row, titleName, titleValue,'planDemandforecastingMain') setSearchParams(data)
} }
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
tableObject.loading = true
//
await DemandforecastingMainApi.deleteDemandforecastingMain(id)
message.success(t('common.delSuccess'))
tableObject.loading = false
//
await getList()
} catch {}finally{
tableObject.loading = false
}
}
/** 导出按钮操作 */ /** 导出按钮操作 */
const exportLoading = ref(false) // const exportLoading = ref(false) //
const handleExport = async () => { const handleExport = async () => {
@ -342,60 +153,6 @@ const handleExport = async () => {
} }
} }
/**
* tableForm方法
*/
const tableFormKeys = {}
DemandforecastingDetail.allSchemas.tableFormColumns.forEach(item => {
tableFormKeys[item.field] = item.default ? item.default : ''
})
const tableData = ref([])
//
const handleAddTable = () => {
tableData.value.push(JSON.parse(JSON.stringify(tableFormKeys)))
}
//
//
const handleDeleteTable = (item, index) => {
let itemIndex = tableData.value.indexOf(item)
if(itemIndex>-1){
tableData.value.splice(itemIndex, 1)
}
}
const tableSelectionDelete = (selection) => {
tableData.value = tableData.value.filter(item => !selection.includes(item))
}
//
const submitForm = async (formType, submitData) => {
let data = {...submitData}
if(data.masterId){
data.id = data.masterId
}
data.subList = tableData.value //
try {
if (formType === 'create') {
await DemandforecastingMainApi.createDemandforecastingMain(data)
message.success(t('common.createSuccess'))
} else {
data.id = data.masterId
await DemandforecastingMainApi.updateDemandforecastingMain(data)
message.success(t('common.updateSuccess'))
}
formRef.value.dialogVisible = false
//
getList()
} finally {
formRef.value.formLoading = false
}
}
/** 导入 */
const importFormRef = ref()
const handleImport = () => {
importFormRef.value.open()
}
// //
const importTemplateData = reactive({ const importTemplateData = reactive({
@ -403,11 +160,6 @@ const importTemplateData = reactive({
templateTitle: `${t('ts.要货预测主导入模版')}.xlsx` templateTitle: `${t('ts.要货预测主导入模版')}.xlsx`
}) })
//
const importSuccess = () => {
getList()
}
// //
const searchFormClick = (searchData) => { const searchFormClick = (searchData) => {
tableObject.params = { tableObject.params = {
@ -419,6 +171,8 @@ const searchFormClick = (searchData) => {
/** 初始化 **/ /** 初始化 **/
onMounted(async () => { onMounted(async () => {
await getListHead()
updateDateTableColumns()
getList() getList()
importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate() importTemplateData.templateUrl = await DemandforecastingMainApi.importTemplate()
}) })

Loading…
Cancel
Save