安虹睿
10 months ago
3 changed files with 346 additions and 19 deletions
@ -0,0 +1,317 @@ |
|||
<!--零件匹配关系页--> |
|||
<template> |
|||
<div class="cr-body-content"> |
|||
<div ref="box"> |
|||
<flexbox class="content-header"> |
|||
<el-form |
|||
:model="listQuery" |
|||
ref="queryForm" |
|||
v-show="showSearch" |
|||
:inline="true" |
|||
> |
|||
<el-form-item label="物料号:" prop="MaterialNum"> |
|||
<el-input |
|||
v-model="listQuery.MaterialNum" |
|||
clearable |
|||
size="small" |
|||
placeholder="" |
|||
style="width: 200px" |
|||
class="search-container" |
|||
@keyup.enter.native="handleFilter" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="物料描述:" prop="MaterialDescription"> |
|||
<el-input |
|||
v-model="listQuery.MaterialDescription" |
|||
clearable |
|||
size="small" |
|||
placeholder="" |
|||
style="width: 200px" |
|||
class="search-container" |
|||
@keyup.enter.native="handleFilter" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item label="物料组:" prop="MaterialGroup"> |
|||
<el-input |
|||
v-model="listQuery.MaterialGroup" |
|||
clearable |
|||
size="small" |
|||
placeholder="" |
|||
style="width: 200px" |
|||
class="search-container" |
|||
@keyup.enter.native="handleFilter" |
|||
/> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button |
|||
size="mini" |
|||
type="success" |
|||
icon="el-icon-search" |
|||
@click="handleFilter" |
|||
>搜索 |
|||
</el-button> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button |
|||
icon="el-icon-refresh" |
|||
size="mini" |
|||
@click="resetQuery('queryForm')" |
|||
>重置 |
|||
</el-button> |
|||
</el-form-item> |
|||
|
|||
<el-form-item> |
|||
<el-button |
|||
class="filter-item" |
|||
plain |
|||
size="mini" |
|||
type="warning" |
|||
icon="el-icon-bottom" |
|||
@click="handleDownload()" |
|||
>导出Excel |
|||
</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</flexbox> |
|||
</div> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="multipleTable" |
|||
v-loading="listLoading" |
|||
element-loading-text="拼命加载中..." |
|||
element-loading-spinner="el-icon-loading" |
|||
class="cr-table" |
|||
:data="list" |
|||
:height="tableHeight" |
|||
size="small" |
|||
stripe |
|||
border |
|||
highlight-current-row |
|||
style="width: 100%" |
|||
@sort-change="sortChange" |
|||
@selection-change="handleSelectionChange" |
|||
@row-click="handleRowClick" |
|||
> |
|||
<!-- <el-table-column type="selection" width="44px"></el-table-column> --> |
|||
<!-- <el-table-column |
|||
label="版本" |
|||
prop="version" |
|||
sortable="custom" |
|||
align="center" |
|||
width="100px" |
|||
>fixed 默认固定在左边 |
|||
<template slot-scope="scope"> |
|||
<el-tooltip :content="scope.row.version" placement="top"> |
|||
<span class="link-type">{{ scope.row.version }}</span> |
|||
</el-tooltip> |
|||
</template> |
|||
</el-table-column> --> |
|||
<!-- show-overflow-tooltip --> |
|||
<el-table-column |
|||
v-for="(item, index) in getDefaultField" |
|||
:key="index" |
|||
:prop="item.prop" |
|||
:label="item.label" |
|||
:min-width="item.width" |
|||
:formatter="fieldFormatter" |
|||
sortable="custom" |
|||
:gutter="0" |
|||
> |
|||
<template slot="header" slot-scope="scope"> |
|||
{{ scope.column.label }} |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div class="table-footer"> |
|||
<!-- 分页控件 style="margin-top: -25px;margin-bottom:-25px;float:right;"--> |
|||
<pagination |
|||
v-show="totalCount > 0" |
|||
:total="totalCount" |
|||
:page.sync="page" |
|||
:limit.sync="listQuery.MaxResultCount" |
|||
@pagination="getList" |
|||
/> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination |
|||
import permission from "@/directive/permission/index.js"; |
|||
import CRMTableHead from "../../components/CRMTableHead"; |
|||
import moment from "moment"; |
|||
import Lockr from "lockr"; |
|||
import { downloadFile } from "@/utils/crmindex.js"; |
|||
import XhJSSelect from "@/components/CreateCom/Xh-JS-Select-Label.vue"; |
|||
|
|||
export default { |
|||
name: "SAPItemConfig", |
|||
components: { Pagination, CRMTableHead, XhJSSelect }, |
|||
directives: { permission }, |
|||
data() { |
|||
return { |
|||
list: null, |
|||
totalCount: 0, |
|||
listLoading: true, |
|||
listQuery: { |
|||
SkipCount: 0, |
|||
MaxResultCount: 15, |
|||
MaterialNum:null, |
|||
MaterialDescription:null, |
|||
MaterialGroup:null, |
|||
MaterialType:3, |
|||
}, |
|||
showSearch: true, |
|||
page: 1, |
|||
multipleSelection: [], |
|||
tableHeight: document.documentElement.clientHeight - 260, |
|||
sortState:false, //标记刷新是否是排序调用 |
|||
partType1Query:{ |
|||
dicTypeName:"客户零件类型1", |
|||
}, |
|||
partType2Query:{ |
|||
dicTypeName:"客户零件类型2", |
|||
}, |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.$nextTick(() => { |
|||
var offsetHei = document.documentElement.clientHeight; |
|||
let boxH = this.$refs.box.offsetHeight; |
|||
this.tableHeight = offsetHei - boxH - 57 - 79;//57为footer高度,79为页面上部标签高度 |
|||
}); |
|||
}, |
|||
created() { |
|||
this.getList(); |
|||
}, |
|||
computed: { |
|||
/** 列表字段 */ |
|||
getDefaultField() { |
|||
var tempsTabs = [ |
|||
{ label: "物料号", prop: "materialNum",width: 160 }, |
|||
{ label: "物料描述", prop: "materialDescription",width: 180 }, |
|||
{ label: "大小量纲", prop: "materialDescription2",width: 160 }, |
|||
{ label: "补充备注", prop: "materialMemo",width: 160 }, |
|||
{ label: "物料组", prop: "materialGroup",width: 160 }, |
|||
]; |
|||
return tempsTabs; |
|||
}, |
|||
}, |
|||
methods: { |
|||
/** 格式化字段 */ |
|||
fieldFormatter(row, column) { |
|||
/* if (column.property === "state") { |
|||
return { 0: "其他", 2: "已结" }[row[column.property]]; |
|||
}*/ |
|||
return row[column.property] || "--"; |
|||
}, |
|||
//导出功能 |
|||
async handleDownload() { |
|||
this.listLoading = true; |
|||
this.$axios |
|||
.posts( |
|||
"/api/newjit/material/export", |
|||
this.listQuery |
|||
) |
|||
.then((res) => { |
|||
let filename = res.item; |
|||
this.$axios |
|||
.BolbGets("/api/newjit/exclude-part-cfg/download/" + filename) |
|||
.then((response) => { |
|||
if (filename.indexOf("_") != -1) { |
|||
let downName = |
|||
filename.slice(0, filename.lastIndexOf("_")) + |
|||
filename.slice(filename.lastIndexOf(".")); |
|||
downloadFile(response, downName); |
|||
this.$notify({ |
|||
title: "成功", |
|||
message: "数据-导出成功!", |
|||
type: "success", |
|||
duration: 2000, |
|||
}); |
|||
} else { |
|||
downloadFile(response, filename); |
|||
this.$notify({ |
|||
title: "成功", |
|||
message: "数据-导出成功!", |
|||
type: "success", |
|||
duration: 2000, |
|||
}); |
|||
} |
|||
this.listLoading = false; |
|||
}); |
|||
}); |
|||
}, |
|||
getList() { |
|||
this.listLoading = true; |
|||
this.listQuery.SkipCount = (this.page - 1) * 10; |
|||
this.$axios |
|||
.gets( |
|||
"/api/newjit/material/list", |
|||
this.listQuery |
|||
) |
|||
.then((response) => { |
|||
this.list = response.items; |
|||
this.totalCount = response.totalCount; |
|||
setTimeout(() => { |
|||
//大数据量加载时 |
|||
this.listLoading = false; |
|||
}, 500); |
|||
}) |
|||
.catch(() => { |
|||
this.listLoading = false; |
|||
}); |
|||
}, |
|||
/** 筛选操作 */ |
|||
handleFilter() { |
|||
this.page = 1; |
|||
this.getList(); |
|||
}, |
|||
/** 重置按钮操作 */ |
|||
resetQuery(refName) { |
|||
this.$refs[refName].resetFields(); |
|||
this.handleFilter(); |
|||
}, |
|||
sortChange(data) { |
|||
const { prop, order } = data; |
|||
if (!prop || !order) { |
|||
this.handleFilter(); |
|||
return; |
|||
} |
|||
this.listQuery.Sorting = prop + " " + order; |
|||
if(this.listQuery.Filters.length>0 && this.listQuery.Filters[0].column === "Enabled") |
|||
{ |
|||
this.sortState = false; |
|||
} |
|||
else |
|||
{ |
|||
this.sortState = true; |
|||
} |
|||
this.handleFilter(); |
|||
}, |
|||
handleSelectionChange(val) { |
|||
this.multipleSelection = val; |
|||
}, |
|||
handleRowClick(row, column, event) { |
|||
this.$refs.multipleTable.clearSelection(); |
|||
this.$refs.multipleTable.toggleRowSelection(row); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
|
|||
<style lang="scss" scoped> |
|||
@import "../../../pg-fis/styles/crmtable.scss"; |
|||
</style> |
|||
<style lang="scss"> |
|||
.el-table .cell.el-tooltip { |
|||
white-space: pre-wrap; |
|||
} |
|||
</style> |
|||
|
|||
|
Loading…
Reference in new issue