Browse Source

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

web
安虹睿 2 months 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', responseType:'blob',
params:params 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> <template>
<el-pagination <el-pagination
:currentPage="state.currentPage" :currentPage="state.currentPage"
:page-size="props.pageParams.pageSize" :page-size="props.pager.pageSize"
:total="props.pageParams.total" :total="props.pager.total"
:background="props.pageBackGround" :background="props.pageBackGround"
:layout="props.pageLayout" :layout="props.pageLayout"
:hide-on-single-page="props.isHideOnlyOne" :hide-on-single-page="props.isHideOnlyOne"
@ -23,7 +23,7 @@
const props = defineProps({ const props = defineProps({
// table // table
pageParams: { pager: {
type: Object, type: Object,
default: {} default: {}
}, },
@ -51,7 +51,7 @@
const emits = defineEmits(['pageSizeChange', 'pageCurrentChange']) const emits = defineEmits(['pageSizeChange', 'pageCurrentChange'])
watch(props.pageParams, (val) => { watch(props.pager, (val) => {
state.currentPage = val.Page state.currentPage = val.Page
}) })

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

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

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

@ -1,66 +1,78 @@
<template> <template>
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
title="导入" title="导入"
width="600" width="600"
:close-on-click-modal="false" :close-on-click-modal="false"
:header-class="importPop" >
<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 <el-icon color="#c0c4cc" :size="60"><UploadFilled /></el-icon>
ref="uploadRef" <div class="el-upload__text">将文件拖到此处'<em>点击上传</em></div>
v-model:file-list="fileList" </el-upload>
:auto-upload="false" <template #footer>
:disabled="formLoading" <div class="footerBtns">
:headers="uploadHeaders" <div>
:limit="1" <el-button type="success" plain @click="importTemplate">
:on-error="submitFormError" <el-icon><Download /></el-icon>
:on-exceed="handleExceed" </el-button>
: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>
</div> </div>
</template> --> <div>
</el-dialog> <el-button :disabled="formLoading" type="primary" @click="submitForm">确定</el-button>
<el-button @click="dialogVisible = false">取消</el-button>
</div>
</div>
</template>
</el-dialog>
</template> </template>
<script setup> <script setup lang="ts">
defineOptions({ name: 'importPop' }) defineOptions({ name: 'importPop' })
import { reactive, ref, onMounted } from 'vue' import { reactive, ref, onMounted } from 'vue'
import { ElDialog,ElMessage } from 'element-plus' 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 dialogVisible = ref(false) //
const fileList = ref([]) // const fileList = ref([]) //
const uploadRef = ref() const uploadRef = ref()
const formLoading = ref(false) // 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({ const importUrl = `/api/${props.apiName}/import`
// //
// accept: {
// type: String,
// required: false,
// default: '.xlsx,.xls'
// },
// })
// /** */ /** 重置表单 */
const resetForm = () => { const resetForm = () => {
// //
formLoading.value = false formLoading.value = false
@ -68,78 +80,95 @@ const resetForm = () => {
fileList.value = [] fileList.value = []
} }
// /** */ /** 打开弹窗 */
const open = () => { const open = () => {
dialogVisible.value = true dialogVisible.value = true
resetForm() resetForm()
} }
defineExpose({ open }) // open defineExpose({ open }) // open
// /** */ /** 上传错误提示 */
// const submitFormError = (): void => { const submitFormError = (): void => {
// ElMessage.error('') ElMessage.error('上传失败,请您重新上传!')
// formLoading.value = false formLoading.value = false
// } }
// /** */ /** 文件数超出提示 */
// const handleExceed = (): void => { const handleExceed = (): void => {
// ElMessage.error('') ElMessage.error('最多只能上传一个文件!')
// } }
// /** */ /** 下载模板操作 */
// const importTemplate = () => { const importTemplate = () => {
// // todo formLoading.value = true
// // downloadByData(res.data,route.meta.title+'.xlsx') getCommonImportTemplate(props.apiName)
// // const res = importTemplateData.value.templateUrl .then(res=>{
// // download.excel(res, importTemplateData.value.templateTitle) downloadByData(res.data,route.meta.title+'_模板.xlsx')
// } })
.finally(() => (formLoading.value = false))
}
// /** */ // /** */
// const submitForm = async () => { const submitForm = async () => {
// if (fileList.value.length == 0) { if (fileList.value.length == 0) {
// ElMessage.error('') ElMessage.error('请上传文件')
// return return
// } }
// file.value = fileList.value[0].name //
// // // uploadHeaders.value = {
// uploadHeaders.value = { // Authorization: 'Bearer ' + getAccessToken(),
// Authorization: 'Bearer ' + getAccessToken(), // 'tenant-id': getTenantId()
// 'tenant-id': getTenantId() // }
// } formLoading.value = true
// formLoading.value = true uploadRef.value!.submit()
// uploadRef.value!.submit() }
// }
// /** */ // /** */
// const emits = defineEmits(['success']) const emits = defineEmits(['success'])
// const submitFormSuccess = (response: any) => { // todo:
// formLoading.value = true const submitFormSuccess = (response: any) => {
// if (response) { formLoading.value = true
// if (response.code == 500) { if (response) {
// uploadRef.value!.clearFiles() if(response.code == '200'){
// ElMessage.error('') ElMessage.success('导入成功!')
// formLoading.value = false }else{
// return ElMessage.error(response.msg)
// } else if (response.code == 0) { }
// if (response.data.errorCount > 0) { // if (response.code == 500) {
// ElMessage.confirm('').then(async () => { // uploadRef.value!.clearFiles()
// // todo: // ElMessage.error('')
// window.open( // formLoading.value = false
// getJmreportBaseUrl() + response.data.errorFile, // return
// 'TITLE' // }
// ) // // todo:
// }) // else if (response.code == 0) {
// } else { // if (response.data.errorCount > 0) {
// ElMessage.success('') // ElMessage.confirm('').then(async () => {
// } // // todo:
// }else if(response.data == null){ // window.open(
// ElMessage.error(response.msg) // getJmreportBaseUrl() + response.data.errorFile,
// } // 'TITLE'
// } // )
// })
// } else {
// ElMessage.success('')
// }
// }
// else if(response.data == null){
// ElMessage.error(response.msg)
// }
}
// // //
// formLoading.value = false formLoading.value = false
// emits('success') emits('success')
// dialogVisible.value = false dialogVisible.value = false
// } }
</script> </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> <template>
<elTable <div class="app-container" v-loading="state.loading">
:columnWidth="props.columnWidth" <el-card class="search-container">
:columnHeaderAlign="props.columnHeaderAlign" <el-form :inline="true">
:columnAlign="props.columnAlign" <el-form-item
:tableData="props.tableData" v-for="(item,index) in props.searchOptions"
:tableColumns="props.tableColumns" :key="index"
></elTable> :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 <el-card class="paged-table-container">
style="margin-top: 15px;float:right" <elTable
:pageParams="props.pageParams" :columnWidth="props.columnWidth"
@pageSizeChange="pageSizeChange" :columnHeaderAlign="props.columnHeaderAlign"
@pageCurrentChange="pageCurrentChange" :columnAlign="props.columnAlign"
></elPager> :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> </template>
<script setup> <script setup>
defineOptions({ name: 'tablePage' }) defineOptions({ name: 'tablePage' })
import { reactive, ref, onMounted } from 'vue' import { reactive, ref, onMounted } from 'vue'
import { getCommonPaged,postCommonExport } from '@/api/common/index'
import { ElMessageBox, ElMessage,ElTable, ElTableColumn } from 'element-plus' import { ElMessageBox, ElMessage,ElTable, ElTableColumn } from 'element-plus'
import elTable from '@/components/elTable/index.vue' import elTable from '@/components/elTable/index.vue'
import elPager from '@/components/elPager/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({ const props = defineProps({
// table // api
tableData: { apiName: {
type: Object, type: String,
default: [] default: null
}, },
// table // table
tableColumns: { tableColumns: {
type: Object, type: Object,
default: [] default: []
}, },
// table //
pageParams: { searchOptions: {
type: Object,
default: []
},
//
searchButtons: {
type: Object,
default: ['search','import','export']
},
// tablefilter
searchFilter: {
type: Object, type: Object,
default: {} default: {}
}, },
// //
columnWidth:{ columnWidth:{
type: Number, type: Number,
default: 100 default: 120
}, },
// //
columnHeaderAlign:{ columnHeaderAlign:{
@ -56,22 +129,93 @@
default: 'center' 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 // size-change
function pageSizeChange(page){ function pageSizeChange(page){
emits('pageSizeChange',page) getTableData(page)
// emits('pageSizeChange',page)
} }
// current-change // current-change
function pageCurrentChange(page){ function pageCurrentChange(page){
emits('pageCurrentChange',page) getTableData(page)
// emits('pageCurrentChange',page)
} }
onMounted(() => {})
</script> onMounted(() => {
getTableData()
<style></style> })
</script>

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

@ -1,59 +1,28 @@
<template> <template>
<div class="app-container" v-loading="state.loading"> <tablePage
<!-- M+6月物料需求计划 --> :apiName="state.apiName"
<el-card class="search-container"> :searchOptions="state.searchOptions"
<el-form :inline="true"> :tableColumns="state.tableColumns"
<el-form-item label="零件号"> :searchFilter="state.searchFilter"
<el-input ></tablePage>
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>
</template> </template>
<script setup> <script setup>
defineOptions({ name: 'supplierMrpMonth' }) defineOptions({ name: 'supplierMrpMonth' })
import { reactive, ref, onMounted } from 'vue' 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 tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList' import EnumList from '@/utils/common/enumList'
import { getPageParamsForFilter } from '@/utils/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({ const state = reactive({
apiName:'cherysuppliermrpmonth', apiName:'cherysuppliermrpmonth',
loading: false, searchFilter: {
pageParams: { materialCode: null
page: 1,
pageSize: 10,
total: 1,
filters: {
materialCode: null
},
}, },
searchOptions:[
{type:'input',prop:'materialCode',label:'零件号'}
],
tableColumns: [ tableColumns: [
{prop:'releaseEdition',title:'需求发布版次',width:120}, {prop:'releaseEdition',title:'需求发布版次',width:150},
{prop:'materialCode',title:'零件号'}, {prop:'materialCode',title:'零件号'},
{prop:'materialDescription',title:'零件名称'}, {prop:'materialDescription',title:'零件名称'},
{prop:'plantId',title:'工厂代码'}, {prop:'plantId',title:'工厂代码'},
@ -68,46 +37,16 @@ const state = reactive({
{prop:'quantityDemand7',title:'需求数量7'}, {prop:'quantityDemand7',title:'需求数量7'},
{prop:'quantityDemand8',title:'需求数量8'}, {prop:'quantityDemand8',title:'需求数量8'},
{prop:'quantityDemand9',title:'需求数量9'}, {prop:'quantityDemand9',title:'需求数量9'},
{prop:'quantityDemand10',title:'需求数量10'}, {prop:'quantityDemand10',title:'需求数量10',width:130},
{prop:'quantityDemand11',title:'需求数量11'}, {prop:'quantityDemand11',title:'需求数量11',width:130},
{prop:'quantityDemand12',title:'需求数量12'}, {prop:'quantityDemand12',title:'需求数量12',width:130},
{prop:'isUpdate',title:'是否更新',type:'tagFilter',options:EnumList.whether}, {prop:'isUpdate',title:'是否更新',type:'tagFilter',options:EnumList.whether},
{prop:'createByUser',title:'创建人'}, {prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',type:'datetime',width:180}, {prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'}, {prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',type:'datetime',width:180}, {prop:'updateTime',title:'修改时间',width:180},
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether}, {prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'}, {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> </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> <template>
<div class="app-container" v-loading="state.loading"> <tablePage
<!-- 整车月度生产计划2 --> :apiName="state.apiName"
<el-card class="search-container"> :searchOptions="state.searchOptions"
<el-form :inline="true"> :tableColumns="state.tableColumns"
<el-form-item label="零件号"> :searchFilter="state.searchFilter"
<el-input ></tablePage>
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>
</template> </template>
<script setup> <script setup>
defineOptions({ name: 'supplierProPlaning' }) defineOptions({ name: 'supplierProPlaning' })
import { reactive, ref, onMounted } from 'vue' 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 tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList' import EnumList from '@/utils/common/enumList'
import { getPageParamsForFilter } from '@/utils/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({ const state = reactive({
apiName:'supplierproplaning', apiName:'supplierproplaning',
loading: false, searchFilter: {
pageParams: { materialCode: null
page: 1,
pageSize: 10,
total: 1,
filters: {
materialCode: null
},
}, },
searchOptions:[
{type:'input',prop:'materialCode',label:'零件号'}
],
tableColumns: [ tableColumns: [
{prop:'releaseEdition',title:'需求发布版次',width:120}, {prop:'releaseEdition',title:'需求发布版次',width:150},
{prop:'models',title:'车型'}, {prop:'models',title:'车型'},
{prop:'salseDepartment',title:'销售单位'}, {prop:'salseDepartment',title:'销售单位'},
{prop:'type',title:'类型'}, {prop:'type',title:'类型'},
@ -70,42 +39,11 @@ const state = reactive({
{prop:'quantity6',title:'数量6'}, {prop:'quantity6',title:'数量6'},
{prop:'plant',title:'工厂'}, {prop:'plant',title:'工厂'},
{prop:'createByUser',title:'创建人'}, {prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',type:'datetime',width:180}, {prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'}, {prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',type:'datetime',width:180}, {prop:'updateTime',title:'修改时间',width:180},
//(0:,1)
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether}, {prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'}, {prop:'version',title:'版本号'},
], ],
tableData: []
})
onMounted(() => {
handleQuery(1)
}) })
</script>
//
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>

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

@ -1,58 +1,26 @@
<template> <template>
<div class="app-container" v-loading="state.loading"> <tablePage
<!-- M+6月物料需求计划 --> :apiName="state.apiName"
<el-card class="search-container"> :searchOptions="state.searchOptions"
<el-form :inline="true"> :tableColumns="state.tableColumns"
<el-form-item label="计划协议号"> :searchFilter="state.searchFilter"
<el-input ></tablePage>
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>
</template> </template>
<script setup> <script setup>
defineOptions({ name: 'supplierSaWeek' }) defineOptions({ name: 'supplierSaWeek' })
import { reactive, ref, onMounted } from 'vue' 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 tablePage from '@/components/tablePage/index.vue'
import EnumList from '@/utils/common/enumList' import EnumList from '@/utils/common/enumList'
import { getPageParamsForFilter } from '@/utils/common/index'
import { useRoute } from 'vue-router'
const route = useRoute()
const state = reactive({ const state = reactive({
apiName:'cherysuppliersaweek', apiName:'cherysuppliersaweek',
loading: false, searchFilter: {
pageParams: { scheduleAgreement: null
page: 1,
pageSize: 10,
total: 1,
filters: {
scheduleAgreement: null
},
}, },
searchOptions:[
{type:'input',prop:'scheduleAgreement',label:'计划协议号'}
],
tableColumns: [ tableColumns: [
{prop:'scheduleAgreement',title:'计划协议号',width:120}, {prop:'scheduleAgreement',title:'计划协议号',width:120},
{prop:'serialNumber',title:'行项目号'}, {prop:'serialNumber',title:'行项目号'},
@ -61,43 +29,13 @@ const state = reactive({
{prop:'purchasingGroup',title:'采购组'}, {prop:'purchasingGroup',title:'采购组'},
{prop:'plantId',title:'工厂代码'}, {prop:'plantId',title:'工厂代码'},
{prop:'quantityDemand',title:'需求数量'}, {prop:'quantityDemand',title:'需求数量'},
{prop:'dateReceived',title:'交货日期',type:'datetime',width:180}, {prop:'dateReceived',title:'交货日期',width:180},
{prop:'createByUser',title:'创建人'}, {prop:'createByUser',title:'创建人'},
{prop:'createTime',title:'创建时间',type:'datetime',width:180}, {prop:'createTime',title:'创建时间',width:180},
{prop:'updateByUser',title:'修改人'}, {prop:'updateByUser',title:'修改人'},
{prop:'updateTime',title:'修改时间',type:'datetime',width:180}, {prop:'updateTime',title:'修改时间',width:180},
{prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether}, {prop:'isDelete',title:'是否删除',type:'tagFilter',options:EnumList.whether},
{prop:'version',title:'版本号'}, {prop:'version',title:'版本号'},
], ],
tableData: []
})
onMounted(() => {
handleQuery(1)
}) })
</script>
//
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>
Loading…
Cancel
Save