Browse Source

首次提交

LIrui
ruanqi 2 years ago
parent
commit
0ef43261da
  1. 506
      src/views/modules/material/poReceiving.vue

506
src/views/modules/material/poReceiving.vue

@ -0,0 +1,506 @@
<template>
<div class="mod-config">
<el-form label-position="top" style="margin-top: 1px; margin-left: 0px;">
<el-form :inline="true" label-position="top" style="margin-top: 0px">
<el-button type="primary" @click="addModal()">新增</el-button>
<download-excel
:fields="fields()"
:data="exportData"
type="xls"
:name="exportName"
:header="exportHeader"
:footer="exportFooter"
:fetch="createExportData"
:before-generate="startDownload"
:before-finish="finishDownload"
worksheet="导出信息"
class="el-button el-button--primary el-button--medium">
{{ '导出' }}
</download-excel>
</el-form>
</el-form>
<el-table
:data="dataList"
height="240"
border
v-loading="dataListLoading"
style="width: 100%; ">
<el-table-column
v-for="(item,index) in columnList1" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed==''?false:item.fixed"
:min-width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
<el-table-column
header-align="center"
align="center"
width="150"
fixed="right"
label="操作">
<template slot-scope="scope">
<a type="text" size="small" @click="updateModel(scope.row)">修改</a>
<a type="text" size="small" @click="deleteData(scope.row)">删除</a>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[20, 50, 100, 1000]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div>
</template>
<script>
import {
getProjectInfoPartList,
saveProjectPart,
deleteProjectPartWithId,
} from "@/api/project/project.js"
import Chooselist from '@/views/modules/common/Chooselist'
export default {
components: {
Chooselist
},
data() {
return {
dataList: [],
searchData: {
page: 1,
limit: 100,
site:this.$store.state.user.site,
username: this.$store.state.user.name,
projectId: '',
},
exportList:[],
pageIndex: 1,
pageSize: 100,
totalPage: 0,
visible:false,
dataListLoading: false,
currentRow:'',
columnList1:[
{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4TestPartNo',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "testPartNo",
headerAlign: "center",
align: "left",
columnLabel: "物料编码",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4PartType',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "partType",
headerAlign: "center",
align: "left",
columnLabel: "物料分类",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 60
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4PartTypeDesc',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "partTypeDesc",
headerAlign: "center",
align: "left",
columnLabel: "物料分类名称",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4PartName',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "partName",
headerAlign: "center",
align: "left",
columnLabel: "物料名称",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4PartDesc',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "partDesc",
headerAlign: "center",
align: "left",
columnLabel: "物料描述",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4PartSpec',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "partSpec",
headerAlign: "center",
align: "left",
columnLabel: "规格型号",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4MaterialNumber',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "materialNumber",
headerAlign: "center",
align: "left",
columnLabel: "物料图号",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4Remark',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "remark",
headerAlign: "center",
align: "left",
columnLabel: "备注",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 120
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4CreateDate',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "createDate",
headerAlign: "center",
align: "left",
columnLabel: "创建时间",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4CreateBy',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "createBy",
headerAlign: "center",
align: "left",
columnLabel: "创建人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4UpdateDate',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "updateDate",
headerAlign: "center",
align: "left",
columnLabel: "上次修改日期",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 160
},{
userId: this.$store.state.user.name,
functionId: 101002003,
serialNumber: '101002003Table4UpdateBy',
tableId: "101002003Table4",
tableName: "项目物料",
columnProp: "updateBy",
headerAlign: "center",
align: "left",
columnLabel: "修改人",
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 80
},
],
dataForm:{
id:'',
site: '',
projectId: '',
testPartNo:'',
partType:'',
partTypeDesc:'',
partName:'',
partDesc:'',
partSpec:'',
remark:'',
materialNumber:'',
username:'',
},
dataRole: {
partTypeDesc: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
partName: [
{
required: true,
message: ' ',
trigger: 'change'
}
],
},
// start
exportData: [],
exportName: '项目物料'+this.dayjs().format('YYYYMMDDHHmmss'),
exportHeader: ["项目物料"],
exportFooter: [],
// end
}
},
methods: {
// S
getBaseList (val, type) {
this.tagNo = val
this.tagNo1 = type
this.$nextTick(() => {
let strVal = ''
if (val === 1013) {
if(type==1) {
strVal = this.dataForm.partType
}
}
this.$refs.baseList.init(val, strVal)
})
},
/* 列表方法的回调 */
getBaseData (val) {
if (this.tagNo === 1013) {
if(this.tagNo1==1) {
this.dataForm.partType = val.Base_id
this.dataForm.partTypeDesc = val.Base_desc
}
}
},
//
init(inData) {
//
this.searchData = JSON.parse(JSON.stringify(inData));
//
this.searchTable();
},
//
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.search()
},
//
currentChangeHandle (val) {
this.pageIndex = val
this.search()
},
search(){
this.searchData.limit = this.pageSize
this.searchData.page = this.pageIndex
// projectInfoSearch(this.searchData).then(({data}) => {
// if (data.code == 0) {
// this.dataList1 = data.page.list
// this.pageIndex = data.page.currPage
// this.pageSize = data.page.pageSize
// this.totalPage = data.page.totalCount
// if(this.dataList1.length>0){
// this.$refs.mainTable.setCurrentRow(this.dataList1[0]);
// this.changeData(this.dataList1[0])
// }
// }
// this.dataListLoading = false
// })
},
searchTable(){
getProjectInfoPartList(this.searchData).then(({data}) => {
//
if (data && data.code == 0) {
this.dataList = data.rows;
} else {
this.dataList = [];
}
});
},
addModal(){
if(this.searchData.projectId==""||this.searchData.projectId==null){
this.$alert('请选择项目!', '错误', {
confirmButtonText: '确定'
})
return false;
}
this.dataForm={
id:0,
site: this.searchData.site,
projectId: this.searchData.projectId,
testPartNo:'',
partType:'',
partTypeDesc:'',
partName:'',
partDesc:'',
partSpec:'',
remark:'',
materialNumber:'',
username:this.$store.state.user.name,
}
this.visible=true;
},
updateModel(row){
this.dataForm={
id:row.id,
site: row.site,
projectId: row.projectId,
testPartNo:row.testPartNo,
partType:row.partType,
partTypeDesc:row.partTypeDesc,
partName:row.partName,
partDesc:row.partDesc,
partSpec:row.partSpec,
remark:row.remark,
materialNumber:row.materialNumber,
username:this.$store.state.user.name,
}
this.visible=true;
},
deleteData(){
this.$confirm('确定要删除这条数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteProjectPartWithId(this.dataForm).then(({data}) => {
if (data && data.code === 0) {
this.$message.success( '操作成功')
this.searchTable();
} else {
this.$message.error(data.msg)
}
})
}).catch(() => {
})
},
//excel
//excel
async createExportData() {
this.searchData.limit = -1
this.searchData.page = 1
await projectInfoSearch(this.searchData).then(({data}) => {
this.exportList= data.page.list;
})
return this.exportList;
},
startDownload() {
// this.exportData = this.dataList
},
finishDownload() {
},
fields() {
let json = "{"
this.columnList1.forEach((item, index) => {
if (index == this.columnList1.length - 1) {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\""
} else {
json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + ","
}
})
json += "}"
let s = eval("(" + json + ")")
return s
},
},
}
</script>
<style scoped>
</style>
Loading…
Cancel
Save