Browse Source

明细添加前端模拟筛选功能暂存

master
安虹睿 1 year ago
parent
commit
36cedb4ddc
  1. 92
      Code/Fe/src/components/commonTabel-drawer/index.vue
  2. 10
      Code/Fe/src/components/commonTabel-drawer/style/index.scss
  3. 26
      Code/Fe/src/components/searchOverall/index.vue
  4. 58
      Code/Fe/src/mixins/TableMixins.js
  5. 3
      Code/Fe/src/views/interfaceBoard/TestSchool.vue

92
Code/Fe/src/components/commonTabel-drawer/index.vue

@ -75,12 +75,14 @@
v-if="showDetailColumnsSet" v-if="showDetailColumnsSet"
class="rowDropNotHideItem" class="rowDropNotHideItem"
@click="columnsSettingHandle()" @click="columnsSettingHandle()"
size="mini"
>字段设置</el-button> >字段设置</el-button>
<!-- <el-button <el-button
type="primary" type="primary"
v-if="showDetailFilters" v-if="showDetailFilters"
@click="detailFiltersHandle()" @click="detailFiltersHandle()"
>筛选</el-button> --> size="mini"
>筛选</el-button>
</div> </div>
<!-- 字段设置弹窗 --> <!-- 字段设置弹窗 -->
<rowDrop <rowDrop
@ -91,6 +93,23 @@
:source="'detail_api'" :source="'detail_api'"
:innerMaxHeight="'calc(90vh - 400px)'" :innerMaxHeight="'calc(90vh - 400px)'"
></rowDrop> ></rowDrop>
<!-- 全面搜索普通+高级整合 -->
<searchOverall
ref="searchOverallRef"
class="detailFiltersPopPage"
:showSearchOverall="detailFiltersVisible"
@getShowSearchOverall="getShowSearchOverall"
:showMoreSearch="true"
:tableColumns="tableColumns"
@overallSearchFormClick="detailFiltersSearch"
:filterActionOptions="filterActionOptions"
:httpOverallSearchData="detailSearchDataFE"
:disabledAction="true"
:disabledLogic="true"
>
<!-- 插槽预留 -->
<slot name="searchPrimarySlot"></slot>
</searchOverall>
<!-- currenTableDetails 组件 明细中带分页功能 --> <!-- currenTableDetails 组件 明细中带分页功能 -->
<umyTable <umyTable
v-if="scope.value == 'mx'" v-if="scope.value == 'mx'"
@ -101,7 +120,7 @@
:tableColumns="tableColumns" :tableColumns="tableColumns"
:selectionTable="selectionTable" :selectionTable="selectionTable"
:requiredRules="false" :requiredRules="false"
:setUTableHeight="showDetailColumnsSet ? 305 : 260" :setUTableHeight="showDetailColumnsSet ? 300 : 260"
@sortChange="sortChange" @sortChange="sortChange"
@handleSelectionChange="handleSelectionChange" @handleSelectionChange="handleSelectionChange"
@inlineDialog="inlineDialog" @inlineDialog="inlineDialog"
@ -193,6 +212,7 @@
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import searchOverall from "@/components/searchOverall"
import { getListByItemcode,byItem,byProduct,byComponent,bySupplierCode,byLocation,byLocationCode, import { getListByItemcode,byItem,byProduct,byComponent,bySupplierCode,byLocation,byLocationCode,
relationByLocationCode,byComponentCJ,purRecNoteCustomInfo,EnumPurchaseReceiptInspect relationByLocationCode,byComponentCJ,purRecNoteCustomInfo,EnumPurchaseReceiptInspect
} from "@/api/wms-api" } from "@/api/wms-api"
@ -211,6 +231,7 @@ export default {
currenDescriptions, currenDescriptions,
currenTabs, currenTabs,
currenTable, currenTable,
searchOverall,
rowDrop rowDrop
}, },
props: { props: {
@ -224,6 +245,11 @@ export default {
type: Boolean, type: Boolean,
default: true default: true
}, },
// --
detailSearchDataFE:{
type: Object,
default: null
},
title: { title: {
type: Array, type: Array,
default: () => { default: () => {
@ -330,36 +356,24 @@ export default {
return this.dropdownTabsData return this.dropdownTabsData
} else { } else {
// //
if (Object.keys(this.propsData).length != 0) { // if (Object.keys(this.propsData).length != 0) {
if (Object.keys(this.propsData)) {
this.initDropdownTabsData = [{ this.initDropdownTabsData = [{
label: "详情", label: "详情",
name: 'xq' name: 'xq'
}, }]
{ // 使
if(this.propsData.details){
this.initDropdownTabsData.push({
label: "明细", label: "明细",
name: 'mx' name: 'mx'
}, })
{ }
if(this.propsData.summaryDetails && this.propsData.summaryDetails.length > 0){
this.initDropdownTabsData.push({
label: "汇总", label: "汇总",
name: 'hz' name: 'hz'
}] })
if (this.propsData.details == undefined || !this.propsData.details.length) {
this.initDropdownTabsData = [{
label: "详情",
name: 'xq'
}]
return this.initDropdownTabsData
}
if (this.propsData.summaryDetails == undefined || !this.propsData.summaryDetails.length ) {
this.initDropdownTabsData = [{
label: "详情",
name: 'xq'
},
{
label: "明细",
name: 'mx'
}]
return this.initDropdownTabsData
} }
} }
return this.initDropdownTabsData return this.initDropdownTabsData
@ -402,7 +416,15 @@ export default {
label: "汇总", label: "汇总",
name: 'hz' name: 'hz'
} }
] ],
detailFiltersVisible:false,//
filterActionOptions:[{
value: '==',
label: '等于'
}, {
value: '!=',
label: '不等于'
}],
} }
}, },
methods: { methods: {
@ -416,9 +438,17 @@ export default {
}, },
// - // -
detailFiltersHandle(){ detailFiltersHandle(){
this.detailFiltersVisible = !this.detailFiltersVisible
},
// -/showSearchOverall
getShowSearchOverall(val){
this.detailFiltersVisible = val || false
},
// -
detailFiltersSearch(options){
this.$emit('detailFiltersSearch', options)
}, },
// // -
closeRowDrop() { closeRowDrop() {
this.rowDropVisible = false this.rowDropVisible = false
}, },

10
Code/Fe/src/components/commonTabel-drawer/style/index.scss

@ -125,3 +125,13 @@
text-align: right; text-align: right;
padding: 0 10px 10px 0; padding: 0 10px 10px 0;
} }
.detailFiltersPopPage{
position: absolute;
right: 0;
left: 0;
height: 240px;
.fullPageCover{
height: calc(100vh - 300px) !important;
}
}

26
Code/Fe/src/components/searchOverall/index.vue

@ -70,7 +70,7 @@
<el-select <el-select
v-model="item.action" v-model="item.action"
placeholder="请选择条件" placeholder="请选择条件"
:disabled="item.column == '' || item.hide ? true : false" :disabled="disabledAction || item.column == '' || item.hide ? true : false"
> >
<!-- moreListOptions.action --> <!-- moreListOptions.action -->
<el-option <el-option
@ -137,7 +137,7 @@
<el-select <el-select
v-model="item.logic" v-model="item.logic"
placeholder="请选择关系" placeholder="请选择关系"
:disabled="item.column == '' || item.hide ? true : false" :disabled="disabledLogic || item.column == '' || item.hide ? true : false"
> >
<el-option <el-option
v-for="item in moreListOptions.logic" v-for="item in moreListOptions.logic"
@ -233,6 +233,16 @@ export default {
} }
}, },
props: { props: {
//
disabledAction:{
type: Boolean,
default: false
},
//
disabledLogic:{
type: Boolean,
default: false
},
// //
showSearchOverall:{ showSearchOverall:{
type: Boolean, type: Boolean,
@ -268,7 +278,12 @@ export default {
httpOverallSearchData:{ httpOverallSearchData:{
type: Object, type: Object,
default: null default: null
} },
//
filterActionOptions:{
type: Array,
default: null
},
}, },
data() { data() {
return { return {
@ -419,6 +434,11 @@ export default {
}, },
// //
formatMoreListOptions(val) { formatMoreListOptions(val) {
// filterActionOptions
if(this.filterActionOptions){
this.moreListOptions.action = this.filterActionOptions
return this.moreListOptions.action
}
if (val) { if (val) {
for(var i =0; i< this.tableColumns.length; i++) { for(var i =0; i< this.tableColumns.length; i++) {
if (val == this.tableColumns[i].prop) { if (val == this.tableColumns[i].prop) {

58
Code/Fe/src/mixins/TableMixins.js

@ -35,7 +35,7 @@ export const tableMixins = {
//每页最大显示数 //每页最大显示数
MaxResultCountDetails: 20, MaxResultCountDetails: 20,
// 明细数据临时存储 // 明细数据临时存储
tableDataDetails:[], tableDataDetails:null,
//默认tag //默认tag
firstTabs:'xq', firstTabs:'xq',
// api的表头数据 // api的表头数据
@ -46,6 +46,8 @@ export const tableMixins = {
URLOption_base:allUrlOption[this.$route.name].baseURL, URLOption_base:allUrlOption[this.$route.name].baseURL,
//主表-明细 //主表-明细
URLOption_detail:allUrlOption[this.$route.name].detailURL, URLOption_detail:allUrlOption[this.$route.name].detailURL,
// 主表-明细-筛选数据同步回显
detailSearchDataFE:null,
// 主表-操作列 // 主表-操作列
operationButtonsTable:[{label:'查看详情',name:'info'}] operationButtonsTable:[{label:'查看详情',name:'info'}]
} }
@ -110,14 +112,9 @@ export const tableMixins = {
let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base
getDetailed(val.id, _url).then(res => { getDetailed(val.id, _url).then(res => {
if (res.details) { if (res.details) {
// 前端分页处理
this.tableDataDetails = JSON.parse(JSON.stringify(res)) this.tableDataDetails = JSON.parse(JSON.stringify(res))
let linshiTableDataDetails = JSON.parse(JSON.stringify(this.tableDataDetails)) // 前端分页处理
this.totalCountDetails = res.details.length this.propsData = this.detailListPageFromFE(res)
// 删除除当前页面最大数以外数据
linshiTableDataDetails.details.splice(this.MaxResultCountDetails,this.totalCountDetails);
// this.oldSkipCountDetails = 1
this.propsData = linshiTableDataDetails
} else { } else {
this.propsData = res this.propsData = res
} }
@ -126,6 +123,14 @@ export const tableMixins = {
this.Loading.DrawerLoading = false this.Loading.DrawerLoading = false
}) })
}, },
// 前端分页处理
detailListPageFromFE(data){
let linshiTableDataDetails = JSON.parse(JSON.stringify(data))
this.totalCountDetails = data.details.length
// 删除除当前页面最大数以外数据
linshiTableDataDetails.details.splice(this.MaxResultCountDetails,this.totalCountDetails);
return linshiTableDataDetails
},
// 明细 分页 接收分页组件emit改变每页最大页数 // 明细 分页 接收分页组件emit改变每页最大页数
alterResultCountDetails(val) { alterResultCountDetails(val) {
this.Loading.DrawerLoading = true this.Loading.DrawerLoading = true
@ -276,6 +281,43 @@ export const tableMixins = {
if(callback)callback() if(callback)callback()
// this.getSupplierByCodesHandle_table() // this.getSupplierByCodesHandle_table()
}, },
// 筛选前端查询
detailFiltersSearch(options){
let _item = options.item;
// 重置
if(_item.name == 'reset' || _item.name == 'moreList-reset'){
this.propsData = this.detailListPageFromFE(this.tableDataDetails)
//关闭高级筛选
if(options.vm_moreList){options.vm_moreList.changeMoreListShow(false)}
// 同步当前列表数据请求接口的筛选条件
this.detailSearchDataFE = {}
this.detailSearchDataFE.moreList = {filters:JSON.parse(JSON.stringify([]))}
}
// 查询
if( _item.name == 'search' || _item.name == 'moreList-search'){
let _searchObj = {}
let searchData = options.data_moreList.filters;
console.log(299,searchData)
searchData.forEach(item=>{
_searchObj[item.column] = item.value
})
const productFilter = (data, params) => data.filter(function(item){
return Object.keys(params).every(function(key){
return item[key]!=undefined && item[key]==params[key] //可以相应修改条件
})
})
let _allData = JSON.parse(JSON.stringify(this.tableDataDetails))
let _filterList = productFilter(_allData.details,_searchObj)
_allData.details = _filterList
this.propsData = this.detailListPageFromFE(_allData)
//关闭高级筛选
if(options.vm_moreList){options.vm_moreList.changeMoreListShow(false)}
// 同步当前列表数据请求接口的筛选条件
this.detailSearchDataFE = {}
this.detailSearchDataFE.moreList = {filters:JSON.parse(JSON.stringify(searchData))}
}
// return res
},
// 点击抽屉,获取明细后全局通用操作 // 点击抽屉,获取明细后全局通用操作
inlineDialogCallback(){ inlineDialogCallback(){
this.Loading.DrawerLoading = false this.Loading.DrawerLoading = false

3
Code/Fe/src/views/interfaceBoard/TestSchool.vue

@ -35,6 +35,8 @@
:drawer="displayDialog.detailsDialog" :drawer="displayDialog.detailsDialog"
:dropdownData="dropdownData" :dropdownData="dropdownData"
:propsData="propsData" :propsData="propsData"
@detailFiltersSearch="detailFiltersSearch"
:detailSearchDataFE="detailSearchDataFE"
@drawerShut="(val) => (displayDialog.detailsDialog = val)" @drawerShut="(val) => (displayDialog.detailsDialog = val)"
@drawerbutton="drawerbutton" @drawerbutton="drawerbutton"
@handleCommand="drawerHandle" @handleCommand="drawerHandle"
@ -62,6 +64,7 @@
@close="FormClose" @close="FormClose"
@goBack="goBack" @goBack="goBack"
></newAndEdiDialog> ></newAndEdiDialog>
<!-- 明细查询页面 -->
<filterForDetailPage <filterForDetailPage
v-if="filterForDetailShow" v-if="filterForDetailShow"
:listColumns="apiColumns_DetailsTable" :listColumns="apiColumns_DetailsTable"

Loading…
Cancel
Save