Browse Source

【EQI前端】普通头部查询,及通用导出功能封装开发,已开发页面使用新封装联调开发,表格排序封装开发

web
安虹睿 2 weeks ago
parent
commit
36d57e116d
  1. 9
      Web/src/api/common/index.js
  2. 8
      Web/src/components/elPager/index.vue
  3. 18
      Web/src/components/elTable/index.vue
  4. 251
      Web/src/components/importPop/index.vue
  5. 204
      Web/src/components/tablePage/index.vue
  6. 95
      Web/src/views/logisticsPlan/supplierMrpMonth/index.vue
  7. 52
      Web/src/views/logisticsPlan/supplierPo/index.vue
  8. 92
      Web/src/views/logisticsPlan/supplierProPlaning/index.vue
  9. 92
      Web/src/views/logisticsPlan/supplierSaWeek/index.vue

9
Web/src/api/common/index.js

@ -18,4 +18,13 @@ export function postCommonExport(urlName,params) {
responseType:'blob',
params:params
})
}
// 获取导入模板
export function getCommonImportTemplate(urlName) {
return request({
url: `/api/${urlName}/getimporttemplate`,
method: 'get',
responseType:'blob',
})
}

8
Web/src/components/elPager/index.vue

@ -1,8 +1,8 @@
<template>
<el-pagination
:currentPage="state.currentPage"
:page-size="props.pageParams.pageSize"
:total="props.pageParams.total"
:page-size="props.pager.pageSize"
:total="props.pager.total"
:background="props.pageBackGround"
:layout="props.pageLayout"
:hide-on-single-page="props.isHideOnlyOne"
@ -23,7 +23,7 @@
const props = defineProps({
// table
pageParams: {
pager: {
type: Object,
default: {}
},
@ -51,7 +51,7 @@
const emits = defineEmits(['pageSizeChange', 'pageCurrentChange'])
watch(props.pageParams, (val) => {
watch(props.pager, (val) => {
state.currentPage = val.Page
})

18
Web/src/components/elTable/index.vue

@ -1,11 +1,17 @@
<template>
<el-table ref="tableRef" row-key="id" :data="props.tableData" :border="true">
<el-table
ref="tableRef"
row-key="id"
:data="props.tableData"
:border="true"
@sort-change="sortChange"
>
<el-table-column
v-for="(item, index) in props.tableColumns"
:key="index"
:label="item.title"
:prop="item.prop"
:sortable="item.sortable"
:sortable="item.sortable || 'custom'"
:fixed="item.fixed"
:width="item.width || props.columnWidth"
:align="item.align || props.columnAlign"
@ -50,7 +56,7 @@
//
columnWidth:{
type: Number,
default: 100
default: null
},
//
columnHeaderAlign:{
@ -76,6 +82,12 @@
let _op = item.options.filter(op=>op.value == row[item.prop])
if(_op && _op.length > 0){ return _op[0][type] }
}
const emits = defineEmits(['sortChange'])
//
function sortChange(data) {
emits('sortChange',data)
}
onMounted(() => {})

251
Web/src/components/importPop/index.vue

@ -1,66 +1,78 @@
<template>
<el-dialog
v-model="dialogVisible"
title="导入"
width="600"
:close-on-click-modal="false"
:header-class="importPop"
<el-dialog
v-model="dialogVisible"
title="导入"
width="600"
:close-on-click-modal="false"
>
<el-upload
ref="uploadRef"
v-model:file-list="fileList"
:action="importUrl"
:auto-upload="false"
:disabled="formLoading"
:headers="uploadHeaders"
:limit="1"
:on-error="submitFormError"
:on-exceed="handleExceed"
:on-success="submitFormSuccess"
:accept="accept"
drag
style="width: 300px; margin: 0 auto"
v-loading="formLoading"
>
<!-- <el-upload
ref="uploadRef"
v-model:file-list="fileList"
:auto-upload="false"
:disabled="formLoading"
:headers="uploadHeaders"
:limit="1"
:on-error="submitFormError"
:on-exceed="handleExceed"
:on-success="submitFormSuccess"
:accept="accept"
drag
style="width: 300px; margin: 0 auto"
v-loading="formLoading"
>
<Icon icon="ep:upload-filled" color="#c0c4cc" :size="60" />
<div class="el-upload__text">将文件拖到此处'<em>点击上传</em></div>
</el-upload>
<template #footer>
<div class="flex items-center">
<div class="flex-1 text-left">
<el-button type="primary" plain @click="importTemplate">
<Icon icon="ep:download" /> 下载模板
</el-button>
</div>
<el-button :disabled="formLoading" type="primary" @click="submitForm">{{ t('ts.确 ') }}</el-button>
<el-button @click="dialogVisible = false">{{ t('ts.取 消') }}</el-button>
<el-icon color="#c0c4cc" :size="60"><UploadFilled /></el-icon>
<div class="el-upload__text">将文件拖到此处'<em>点击上传</em></div>
</el-upload>
<template #footer>
<div class="footerBtns">
<div>
<el-button type="success" plain @click="importTemplate">
<el-icon><Download /></el-icon>
</el-button>
</div>
</template> -->
</el-dialog>
<div>
<el-button :disabled="formLoading" type="primary" @click="submitForm">确定</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</div>
</div>
</template>
</el-dialog>
</template>
<script setup>
<script setup lang="ts">
defineOptions({ name: 'importPop' })
import { reactive, ref, onMounted } from 'vue'
import { ElDialog,ElMessage } from 'element-plus'
// import { downloadByData } from '@/utils/download'
import { downloadByData } from '@/utils/download'
import { getCommonImportTemplate } from '@/api/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
// import { useRoute } from 'vue-router'
// const route = useRoute()
const dialogVisible = ref(false) //
const fileList = ref([]) //
const uploadRef = ref()
const formLoading = ref(false) //
// const uploadHeaders = ref() // Header
const uploadHeaders = ref() // Header
// const importUrl = getBaseUrl() + import.meta.env.VITE_API_URL + (props.url || '/finance/common-excel-in/import')
const props = defineProps({
// api
apiName: {
type: String,
default: null
},
//
accept: {
type: String,
required: false,
default: '.xlsx,.xls'
},
})
// const props = defineProps({
// //
// accept: {
// type: String,
// required: false,
// default: '.xlsx,.xls'
// },
// })
const importUrl = `/api/${props.apiName}/import`
// /** */
/** 重置表单 */
const resetForm = () => {
//
formLoading.value = false
@ -68,78 +80,95 @@ const resetForm = () => {
fileList.value = []
}
// /** */
/** 打开弹窗 */
const open = () => {
dialogVisible.value = true
resetForm()
}
defineExpose({ open }) // open
// /** */
// const submitFormError = (): void => {
// ElMessage.error('')
// formLoading.value = false
// }
/** 上传错误提示 */
const submitFormError = (): void => {
ElMessage.error('上传失败,请您重新上传!')
formLoading.value = false
}
// /** */
// const handleExceed = (): void => {
// ElMessage.error('')
// }
/** 文件数超出提示 */
const handleExceed = (): void => {
ElMessage.error('最多只能上传一个文件!')
}
// /** */
// const importTemplate = () => {
// // todo
// // downloadByData(res.data,route.meta.title+'.xlsx')
// // const res = importTemplateData.value.templateUrl
// // download.excel(res, importTemplateData.value.templateTitle)
// }
/** 下载模板操作 */
const importTemplate = () => {
formLoading.value = true
getCommonImportTemplate(props.apiName)
.then(res=>{
downloadByData(res.data,route.meta.title+'_模板.xlsx')
})
.finally(() => (formLoading.value = false))
}
// /** */
// const submitForm = async () => {
// if (fileList.value.length == 0) {
// ElMessage.error('')
// return
// }
// file.value = fileList.value[0].name
// //
// uploadHeaders.value = {
// Authorization: 'Bearer ' + getAccessToken(),
// 'tenant-id': getTenantId()
// }
// formLoading.value = true
// uploadRef.value!.submit()
// }
const submitForm = async () => {
if (fileList.value.length == 0) {
ElMessage.error('请上传文件')
return
}
//
// uploadHeaders.value = {
// Authorization: 'Bearer ' + getAccessToken(),
// 'tenant-id': getTenantId()
// }
formLoading.value = true
uploadRef.value!.submit()
}
// /** */
// const emits = defineEmits(['success'])
// const submitFormSuccess = (response: any) => {
// formLoading.value = true
// if (response) {
// if (response.code == 500) {
// uploadRef.value!.clearFiles()
// ElMessage.error('')
// formLoading.value = false
// return
// } else if (response.code == 0) {
// if (response.data.errorCount > 0) {
// ElMessage.confirm('').then(async () => {
// // todo:
// window.open(
// getJmreportBaseUrl() + response.data.errorFile,
// 'TITLE'
// )
// })
// } else {
// ElMessage.success('')
// }
// }else if(response.data == null){
// ElMessage.error(response.msg)
// }
// }
const emits = defineEmits(['success'])
// todo:
const submitFormSuccess = (response: any) => {
formLoading.value = true
if (response) {
if(response.code == '200'){
ElMessage.success('导入成功!')
}else{
ElMessage.error(response.msg)
}
// if (response.code == 500) {
// uploadRef.value!.clearFiles()
// ElMessage.error('')
// formLoading.value = false
// return
// }
// // todo:
// else if (response.code == 0) {
// if (response.data.errorCount > 0) {
// ElMessage.confirm('').then(async () => {
// // todo:
// window.open(
// getJmreportBaseUrl() + response.data.errorFile,
// 'TITLE'
// )
// })
// } else {
// ElMessage.success('')
// }
// }
// else if(response.data == null){
// ElMessage.error(response.msg)
// }
}
// //
// formLoading.value = false
// emits('success')
// dialogVisible.value = false
// }
</script>
//
formLoading.value = false
emits('success')
dialogVisible.value = false
}
</script>
<style lang="scss" scoped>
.footerBtns{
display: flex;
padding: 20px;
justify-content: space-between;
}
</style>

204
Web/src/components/tablePage/index.vue

@ -1,49 +1,122 @@
<template>
<elTable
:columnWidth="props.columnWidth"
:columnHeaderAlign="props.columnHeaderAlign"
:columnAlign="props.columnAlign"
:tableData="props.tableData"
:tableColumns="props.tableColumns"
></elTable>
<div class="app-container" v-loading="state.loading">
<el-card class="search-container">
<el-form :inline="true">
<el-form-item
v-for="(item,index) in props.searchOptions"
:key="index"
:label="item.label">
<el-input
v-if="item.type == 'input'"
v-model="props.searchFilter[item.prop]"
:placeholder="item.label"
:clearable="!item.noClear"
/>
</el-form-item>
<el-form-item>
<el-button
v-for="(btn,btn_key) in props.searchButtons"
:key="btn_key"
:icon="state.searchBtnOptions[btn].icon"
v-auth="state.searchBtnOptions[btn].sAuth || props.apiName + state.searchBtnOptions[btn].auth"
:type="state.searchBtnOptions[btn].type"
@click="searchBtnHandle(btn)"
>{{state.searchBtnOptions[btn].label}}</el-button>
</el-form-item>
</el-form>
</el-card>
<elPager
style="margin-top: 15px;float:right"
:pageParams="props.pageParams"
@pageSizeChange="pageSizeChange"
@pageCurrentChange="pageCurrentChange"
></elPager>
<el-card class="paged-table-container">
<elTable
:columnWidth="props.columnWidth"
:columnHeaderAlign="props.columnHeaderAlign"
:columnAlign="props.columnAlign"
:tableData="state.tableData"
:tableColumns="props.tableColumns"
@sortChange="sortChange"
></elTable>
<elPager
style="margin-top: 15px;float:right"
:pager="state.pager"
@pageSizeChange="pageSizeChange"
@pageCurrentChange="pageCurrentChange"
></elPager>
</el-card>
<!-- 导入弹窗 -->
<importPop
ref="importPopRef"
:apiName="props.apiName"
@success="importSuccess"
/>
</div>
</template>
<script setup>
defineOptions({ name: 'tablePage' })
import { reactive, ref, onMounted } from 'vue'
import { getCommonPaged,postCommonExport } from '@/api/common/index'
import { ElMessageBox, ElMessage,ElTable, ElTableColumn } from 'element-plus'
import elTable from '@/components/elTable/index.vue'
import elPager from '@/components/elPager/index.vue'
import { getPageParamsForFilter } from '@/utils/common/index'
import { downloadByData } from '@/utils/download'
import importPop from '@/components/importPop/index.vue'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({})
const state = reactive({
loading:false,
searchBtnOptions:{
search:{icon:'Search',auth:':page',label:'查询',type:null},
import:{icon:'BottomRight',auth:':import',label:'导入',type:'warning'},
export:{icon:'TopRight',auth:':export',label:'导出',type:'success'},
},
tableData:[],
// table
sortFilter:{
sortBy:null,
isAscending:null
},
pager:{
page: 1,
pageSize: 10,
total: 1,
}
})
const props = defineProps({
// table
tableData: {
type: Object,
default: []
// api
apiName: {
type: String,
default: null
},
// table
tableColumns: {
type: Object,
default: []
},
// table
pageParams: {
//
searchOptions: {
type: Object,
default: []
},
//
searchButtons: {
type: Object,
default: ['search','import','export']
},
// tablefilter
searchFilter: {
type: Object,
default: {}
},
//
columnWidth:{
type: Number,
default: 100
default: 120
},
//
columnHeaderAlign:{
@ -56,22 +129,93 @@
default: 'center'
},
})
//
function getPageParams(){
console.log(136,props.searchFilter)
let _pageParams = getPageParamsForFilter({
pageNumber:state.pager.page,
pageSize:state.pager.pageSize,
sortBy:state.sortFilter.sortBy,
isAscending:state.sortFilter.isAscending,
filters:props.searchFilter
})
return _pageParams
}
//
function getTableData(page) {
state.loading = true
if(!page)page = state.pager.page
if(page)state.pager.page = page
getCommonPaged(props.apiName,getPageParams())
.then((resp) => {
state.tableData = resp.data.data
state.pager.total = resp.data.totalPages
})
.finally(() => (state.loading = false))
}
const importPopRef = ref()
//
function searchBtnHandle(btn){
console.log(btn)
//
if(btn == 'search'){
getTableData()
}
//
else if (btn == 'import'){
importPopRef.value.open()
}
//
else if (btn == 'export'){
state.loading = true
getTableData()//
postCommonExport(props.apiName,getPageParams())
.then((res) => {
downloadByData(res.data,route.meta.title+'.xlsx')
})
.finally(() => (state.loading = false))
}
}
const emits = defineEmits(['pageSizeChange', 'pageCurrentChange'])
//
function sortChange(data) {
const { prop, order } = data;
if (!prop || !order) {
state.sortFilter.sortBy = null;
state.sortFilter.isAscending = null;
getTableData();
return;
}
state.sortFilter.sortBy = prop;
state.sortFilter.isAscending = (order == "ascending");
getTableData();
}
// todo
function importSuccess(response,importDate){
getTableData()
}
//
// const emits = defineEmits(['pageSizeChange', 'pageCurrentChange'])
// size-change
function pageSizeChange(page){
emits('pageSizeChange',page)
getTableData(page)
// emits('pageSizeChange',page)
}
// current-change
function pageCurrentChange(page){
emits('pageCurrentChange',page)
getTableData(page)
// emits('pageCurrentChange',page)
}
onMounted(() => {})
</script>
<style></style>
onMounted(() => {
getTableData()
})
</script>

95
Web/src/views/logisticsPlan/supplierMrpMonth/index.vue

@ -1,59 +1,28 @@
<template>
<div class="app-container" v-loading="state.loading">
<!-- M+6月物料需求计划 -->
<el-card class="search-container">
<el-form :inline="true">
<el-form-item label="零件号">
<el-input
v-model="state.pageParams.filters.materialCode"
placeholder="零件号"
clearable
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery(1)" icon="Search" v-auth="state.apiName + ':page'">查询</el-button>
<el-button @click="handleExport()" icon="TopRight" v-auth="state.apiName + ':export'" type="success">导出</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="paged-table-container">
<tablePage
:tableData="state.tableData"
:tableColumns="state.tableColumns"
:pageParams="state.pageParams"
@pageSizeChange="handleQuery"
@pageCurrentChange="handleQuery"
></tablePage>
</el-card>
</div>
<tablePage
:apiName="state.apiName"
:searchOptions="state.searchOptions"
:tableColumns="state.tableColumns"
:searchFilter="state.searchFilter"
></tablePage>
</template>
<script setup>
defineOptions({ name: 'supplierMrpMonth' })
import { reactive, ref, onMounted } from 'vue'
import { getCommonPaged,postCommonExport } from '@/api/common/index'
import { downloadByData } from '@/utils/download'
import { ElMessageBox, ElMessage } from 'element-plus'
import tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList'
import { getPageParamsForFilter } from '@/utils/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({
apiName:'cherysuppliermrpmonth',
loading: false,
pageParams: {
page: 1,
pageSize: 10,
total: 1,
filters: {
materialCode: null
},
searchFilter: {
materialCode: null
},
searchOptions:[
{type:'input',prop:'materialCode',label:'零件号'}
],
tableColumns: [
{prop:'releaseEdition',title:'需求发布版次',width:120},
{prop:'releaseEdition',title:'需求发布版次',width:150},
{prop:'materialCode',title:'零件号'},
{prop:'materialDescription',title:'零件名称'},
{prop:'plantId',title:'工厂代码'},
@ -68,46 +37,16 @@ const state = reactive({
{prop:'quantityDemand7',title:'需求数量7'},
{prop:'quantityDemand8',title:'需求数量8'},
{prop:'quantityDemand9',title:'需求数量9'},
{prop:'quantityDemand10',title:'需求数量10'},
{prop:'quantityDemand11',title:'需求数量11'},
{prop:'quantityDemand12',title:'需求数量12'},
{prop:'quantityDemand10',title:'需求数量10',width:130},
{prop:'quantityDemand11',title:'需求数量11',width:130},
{prop:'quantityDemand12',title:'需求数量12',width:130},
{prop:'isUpdate',title:'是否更新',type:'tagFilter',options:EnumList.whether},
{prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',type:'datetime',width:180},
{prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',type:'datetime',width:180},
{prop:'updateTime',title:'修改时间',width:180},
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'},
],
tableData: []
})
onMounted(() => {
handleQuery(1)
})
//
function handleQuery(page) {
state.loading = true
state.pageParams.page = page
getCommonPaged(state.apiName,Object.assign({}, getPageParamsForFilter(state.pageParams)))
.then((resp) => {
state.tableData = resp.data.data
state.pageParams.total = resp.data.totalPages
})
.finally(() => (state.loading = false))
}
//
function handleExport(){
state.loading = true
postCommonExport(state.apiName,Object.assign({}, getPageParamsForFilter(state.pageParams)))
.then((res) => {
downloadByData(res.data,route.meta.title+'.xlsx')
})
.finally(() => (state.loading = false))
}
</script>
<style></style>

52
Web/src/views/logisticsPlan/supplierPo/index.vue

@ -0,0 +1,52 @@
<template>
<tablePage
:apiName="state.apiName"
:searchOptions="state.searchOptions"
:tableColumns="state.tableColumns"
:searchFilter="state.searchFilter"
></tablePage>
</template>
<script setup>
defineOptions({ name: 'supplierPo' })
import { reactive, ref, onMounted } from 'vue'
import tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList'
const state = reactive({
apiName:'cherysupplierpo',
searchFilter: {
purchaseOrder: null
},
searchOptions:[
{type:'input',prop:'purchaseOrder',label:'采购订单号'}
],
tableColumns: [
{prop:'purchaseOrder',title:'采购订单号',width:120},
{prop:'serialNumber',title:'行项目号'},
{prop:'plantId',title:'工厂代码'},
{prop:'plantName',title:'工厂名称'},
{prop:'voucherDate',title:'凭证日期',width:180},
{prop:'purchaser',title:'需方联系人'},
{prop:'supplier',title:'供方联系人'},
{prop:'materialCode',title:'物料编码'},
{prop:'materialDescription',title:'物料描述'},
{prop:'quantityDemand',title:'需求数量'},
{prop:'materialUnit',title:'物料单位'},
{prop:'deliveryDate',title:'交货日期',width:180},
{prop:'deliveryPlace',title:'交货地点'},
{prop:'quantityDelivery',title:'到货数量'},
{prop:'note',title:'备注'},
{prop:'itemType',title:'项目类别文本',width:150},
{prop:'tradeTerms',title:'国际贸易条件',width:150},
{prop:'country',title:'出口国家'},
{prop:'batch',title:'批次'},
{prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',width:180},
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'},
],
})
</script>

92
Web/src/views/logisticsPlan/supplierProPlaning/index.vue

@ -1,59 +1,28 @@
<template>
<div class="app-container" v-loading="state.loading">
<!-- 整车月度生产计划2 -->
<el-card class="search-container">
<el-form :inline="true">
<el-form-item label="零件号">
<el-input
v-model="state.pageParams.filters.materialCode"
placeholder="零件号"
clearable
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery(1)" icon="Search" v-auth="state.apiName + ':page'">查询</el-button>
<el-button @click="handleExport()" icon="TopRight" v-auth="state.apiName + ':export'" type="success">导出</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="paged-table-container">
<tablePage
:tableData="state.tableData"
:tableColumns="state.tableColumns"
:pageParams="state.pageParams"
@pageSizeChange="handleQuery"
@pageCurrentChange="handleQuery"
></tablePage>
</el-card>
</div>
<tablePage
:apiName="state.apiName"
:searchOptions="state.searchOptions"
:tableColumns="state.tableColumns"
:searchFilter="state.searchFilter"
></tablePage>
</template>
<script setup>
defineOptions({ name: 'supplierProPlaning' })
import { reactive, ref, onMounted } from 'vue'
import { getCommonPaged,postCommonExport } from '@/api/common/index'
import { downloadByData } from '@/utils/download'
import { ElMessageBox, ElMessage } from 'element-plus'
import tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList'
import { getPageParamsForFilter } from '@/utils/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({
apiName:'supplierproplaning',
loading: false,
pageParams: {
page: 1,
pageSize: 10,
total: 1,
filters: {
materialCode: null
},
searchFilter: {
materialCode: null
},
searchOptions:[
{type:'input',prop:'materialCode',label:'零件号'}
],
tableColumns: [
{prop:'releaseEdition',title:'需求发布版次',width:120},
{prop:'releaseEdition',title:'需求发布版次',width:150},
{prop:'models',title:'车型'},
{prop:'salseDepartment',title:'销售单位'},
{prop:'type',title:'类型'},
@ -70,42 +39,11 @@ const state = reactive({
{prop:'quantity6',title:'数量6'},
{prop:'plant',title:'工厂'},
{prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',type:'datetime',width:180},
{prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',type:'datetime',width:180},
//(0:,1)
{prop:'updateTime',title:'修改时间',width:180},
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'},
],
tableData: []
})
onMounted(() => {
handleQuery(1)
})
//
function handleQuery(page) {
state.loading = true
state.pageParams.page = page
getCommonPaged(state.apiName,Object.assign({}, getPageParamsForFilter(state.pageParams)))
.then((resp) => {
state.tableData = resp.data.data
state.pageParams.total = resp.data.totalPages
})
.finally(() => (state.loading = false))
}
//
function handleExport(){
state.loading = true
postCommonExport(state.apiName,Object.assign({}, getPageParamsForFilter(state.pageParams)))
.then((res) => {
downloadByData(res.data,route.meta.title+'.xlsx')
})
.finally(() => (state.loading = false))
}
</script>
<style></style>
</script>

92
Web/src/views/logisticsPlan/supplierSaWeek/index.vue

@ -1,58 +1,26 @@
<template>
<div class="app-container" v-loading="state.loading">
<!-- M+6月物料需求计划 -->
<el-card class="search-container">
<el-form :inline="true">
<el-form-item label="计划协议号">
<el-input
v-model="state.pageParams.filters.scheduleAgreement"
placeholder="计划协议号"
clearable
/>
</el-form-item>
<el-form-item>
<el-button @click="handleQuery(1)" icon="Search" v-auth="state.apiName + ':page'">查询</el-button>
<el-button @click="handleExport()" icon="TopRight" v-auth="state.apiName + ':export'" type="success">导出</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card class="paged-table-container">
<tablePage
:columnWidth="null"
:tableData="state.tableData"
:tableColumns="state.tableColumns"
:pageParams="state.pageParams"
@pageSizeChange="handleQuery"
@pageCurrentChange="handleQuery"
></tablePage>
</el-card>
</div>
<tablePage
:apiName="state.apiName"
:searchOptions="state.searchOptions"
:tableColumns="state.tableColumns"
:searchFilter="state.searchFilter"
></tablePage>
</template>
<script setup>
defineOptions({ name: 'supplierSaWeek' })
import { reactive, ref, onMounted } from 'vue'
import { getCommonPaged,postCommonExport } from '@/api/common/index'
import { downloadByData } from '@/utils/download'
import { ElMessageBox, ElMessage } from 'element-plus'
import tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList'
import { getPageParamsForFilter } from '@/utils/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({
apiName:'cherysuppliersaweek',
loading: false,
pageParams: {
page: 1,
pageSize: 10,
total: 1,
filters: {
scheduleAgreement: null
},
searchFilter: {
scheduleAgreement: null
},
searchOptions:[
{type:'input',prop:'scheduleAgreement',label:'计划协议号'}
],
tableColumns: [
{prop:'scheduleAgreement',title:'计划协议号',width:120},
{prop:'serialNumber',title:'行项目号'},
@ -61,43 +29,13 @@ const state = reactive({
{prop:'purchasingGroup',title:'采购组'},
{prop:'plantId',title:'工厂代码'},
{prop:'quantityDemand',title:'需求数量'},
{prop:'dateReceived',title:'交货日期',type:'datetime',width:180},
{prop:'dateReceived',title:'交货日期',width:180},
{prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',type:'datetime',width:180},
{prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',type:'datetime',width:180},
{prop:'updateTime',title:'修改时间',width:180},
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'},
],
tableData: []
})
onMounted(() => {
handleQuery(1)
})
//
function handleQuery(page) {
state.loading = true
state.pageParams.page = page
getCommonPaged(state.apiName,Object.assign({}, getPageParamsForFilter(state.pageParams)))
.then((resp) => {
state.tableData = resp.data.data
state.pageParams.total = resp.data.totalPages
})
.finally(() => (state.loading = false))
}
//
function handleExport(){
state.loading = true
postCommonExport(state.apiName,Object.assign({}, getPageParamsForFilter(state.pageParams)))
.then((res) => {
downloadByData(res.data,route.meta.title+'.xlsx')
})
.finally(() => (state.loading = false))
}
</script>
<style></style>
</script>
Loading…
Cancel
Save