Browse Source

Merge remote-tracking branch 'origin/master'

master
qiezi 1 year ago
parent
commit
a494485c75
  1. 8
      src/api/part/partInformation.js
  2. 100
      src/views/modules/part/partInformation.vue
  3. 61
      src/views/modules/project/projectInfo/com_project_info_part.vue
  4. 150
      src/views/modules/project/projectInfo/project_part_upload.vue

8
src/api/part/partInformation.js

@ -290,4 +290,12 @@ export const getNextPartNo = data => createAPI(`/plm/partInformation/getNextPart
export const queryPart = (data) => createAPI(`/plm/partInformation`,'post',data); export const queryPart = (data) => createAPI(`/plm/partInformation`,'post',data);
// 导入项目物料
export const uploadProjectPartExcel = data => createAPI(`/plm/partInformation/uploadProjectPartExcel`,'post',data)
// 查询文件ID
export const queryFileId = data => createAPI(`/plm/partInformation/queryFileId`,'post',data)
// 下载文件
export const downLoadFile = data => createAPI(`/plm/partInformation/downLoadFile?id=`+data.id,'post','download')

100
src/views/modules/part/partInformation.vue

@ -1164,7 +1164,7 @@
</el-dialog> </el-dialog>
<!-- 默认库位-> 快速新增 --> <!-- 默认库位-> 快速新增 -->
<el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="locationModelFlag" width="900px">
<el-dialog title="新增" @close="refreshDetailList" :close-on-click-modal="false" v-drag :visible.sync="locationModelFlag" width="945px">
<div style="font-size: 12px"> <div style="font-size: 12px">
<el-form :inline="true" label-position="top" :model="locationData"> <el-form :inline="true" label-position="top" :model="locationData">
<el-form-item :label="'库位编码'"> <el-form-item :label="'库位编码'">
@ -1179,7 +1179,7 @@
</el-form> </el-form>
</div> </div>
<el-container style="margin-top: 0px;"> <el-container style="margin-top: 0px;">
<el-main style="width: 350px; padding: 1px">
<el-main style="width: 400px; padding: 1px">
<span style="font-size: 12px" >可选库位:</span> <span style="font-size: 12px" >可选库位:</span>
<el-table <el-table
height="400px" height="400px"
@ -1218,16 +1218,26 @@
label="库位类型"> label="库位类型">
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 分页插件 -->
<el-pagination
@size-change="locationSizeChangeHandle"
@current-change="locationCurrentChangeHandle"
:current-page="locationPageIndex"
:page-sizes="[20, 50, 100, 200, 500]"
:page-size="locationPageSize"
:total="locationTotalPage"
layout="total, sizes, prev, pager, next, jumper">
</el-pagination>
</el-main> </el-main>
<el-main style="width: 111px;padding: -1px"> <el-main style="width: 111px;padding: -1px">
<div style="margin-top: 182px;margin-left: 18px">
<div style="margin-top: 182px;margin-left: 5px">
<el-button type="primary" @click="addLocation()">添加>></el-button> <el-button type="primary" @click="addLocation()">添加>></el-button>
</div> </div>
<div style="margin-top: 15px;margin-left: 18px">
<div style="margin-top: 15px;margin-left: 5px">
<el-button type="primary" @click="deleteLocation()">删除<<</el-button> <el-button type="primary" @click="deleteLocation()">删除<<</el-button>
</div> </div>
</el-main> </el-main>
<el-main style="width: 350px;padding: 1px">
<el-main style="width: 400px;padding: 1px">
<span style="font-size: 12px" >已有库位:</span> <span style="font-size: 12px" >已有库位:</span>
<el-table <el-table
height="400px" height="400px"
@ -1506,6 +1516,9 @@
pageIndex: 1, pageIndex: 1,
pageSize: 50, pageSize: 50,
totalPage: 0, totalPage: 0,
locationPageIndex: 1,
locationPageSize: 50,
locationTotalPage: 0,
selectedDataNum: 0, selectedDataNum: 0,
tempCodeNo: '', tempCodeNo: '',
// //
@ -1667,6 +1680,9 @@
site: this.$store.state.user.site, site: this.$store.state.user.site,
locationId: '', locationId: '',
locationName: '', locationName: '',
partNo: '',
page: 1,
limit: 10
}, },
copyPartData: { copyPartData: {
site: '', site: '',
@ -3198,14 +3214,14 @@
this.$message.warning('请选择生效日期(Phase In)!') this.$message.warning('请选择生效日期(Phase In)!')
return return
} }
if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate === '' || this.revisionData.effPhaseOutDate == null)) {
this.$message.warning('请选择失效日期(Phase Out)!')
return
}
if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate < this.revisionData.effPhaseInDate)) {
this.$message.warning('失效日期不能早于生效日期!')
return
}
// if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate === '' || this.revisionData.effPhaseOutDate == null)) {
// this.$message.warning('(Phase Out)')
// return
// }
// if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate < this.revisionData.effPhaseInDate)) {
// this.$message.warning('')
// return
// }
if (this.revisionData.flag === '1') { if (this.revisionData.flag === '1') {
saveRevision(this.revisionData).then(({data}) => { saveRevision(this.revisionData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@ -3561,6 +3577,24 @@
this.getDataList() this.getDataList()
}, },
/**
* 每页数
* @param val
*/
locationSizeChangeHandle (val) {
this.locationPageSize = val
this.locationPageIndex = 1
this.getLocationList()
},
/**
* 当前页
* @param val
*/
locationCurrentChangeHandle (val) {
this.locationPageIndex = val
this.getLocationList()
},
// ======== ======== // ======== ========
/** /**
* 未知 * 未知
@ -4259,14 +4293,17 @@
* 选择默认库位 * 选择默认库位
*/ */
getLocationList () { getLocationList () {
//
this.locationData.limit = this.locationPageSize
this.locationData.page = this.locationPageIndex
this.locationData.partNo = this.partCurrentRow.partNo
getLocationListBy(this.locationData).then(({data}) => { getLocationListBy(this.locationData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.locationList1 = data.rows
this.locationList1 = data.page.list
this.locationPageIndex = data.page.currPage
this.locationPageSize = data.page.pageSize
this.locationTotalPage = data.page.totalCount
} else { } else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
this.locationList1 = []
} }
}) })
}, },
@ -4417,14 +4454,23 @@
saveDefaultLocation () { saveDefaultLocation () {
this.locationSelections1 = null this.locationSelections1 = null
this.locationSelections2 = null this.locationSelections2 = null
getLocationList(this.partCurrentRow).then(({data}) => {
this.locationList1 = data.row1
this.locationData.limit = this.locationPageSize
this.locationData.page = this.locationPageIndex
this.locationData.partNo = this.partCurrentRow.partNo
getLocationList(this.locationData).then(({data}) => {
this.locationList1 = data.row1.list
this.locationList2 = data.row2 this.locationList2 = data.row2
this.locationPageIndex = data.row1.currPage
this.locationPageSize = data.row1.pageSize
this.locationTotalPage = data.row1.totalCount
}) })
this.locationData = { this.locationData = {
site: this.$store.state.user.site, site: this.$store.state.user.site,
locationId: '', locationId: '',
locationName: '', locationName: '',
partNo: this.partCurrentRow.partNo,
page: 1,
limit: 10
} }
this.locationModelFlag = true this.locationModelFlag = true
}, },
@ -4455,9 +4501,12 @@
} }
addDefaultLocation(inData).then(({data}) => { addDefaultLocation(inData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
getLocationList(this.partCurrentRow).then(({data}) => {
this.locationList1 = data.row1
getLocationList(this.locationData).then(({data}) => {
this.locationList1 = data.row1.list
this.locationList2 = data.row2 this.locationList2 = data.row2
this.locationPageIndex = data.row1.currPage
this.locationPageSize = data.row1.pageSize
this.locationTotalPage = data.row1.totalCount
}) })
this.locationSelections1 = [] this.locationSelections1 = []
} else { } else {
@ -4480,9 +4529,12 @@
} }
deleteDefaultLocation(inData).then(({data}) => { deleteDefaultLocation(inData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
getLocationList(this.partCurrentRow).then(({data}) => {
this.locationList1 = data.row1
getLocationList(this.locationData).then(({data}) => {
this.locationList1 = data.row1.list
this.locationList2 = data.row2 this.locationList2 = data.row2
this.locationPageIndex = data.row1.currPage
this.locationPageSize = data.row1.pageSize
this.locationTotalPage = data.row1.totalCount
}) })
this.locationSelections2 = [] this.locationSelections2 = []
} else { } else {

61
src/views/modules/project/projectInfo/com_project_info_part.vue

@ -4,6 +4,7 @@
<el-form :inline="true" label-position="top" style="margin-top: 0px"> <el-form :inline="true" label-position="top" style="margin-top: 0px">
<el-button type="primary" @click="addModal">新增</el-button> <el-button type="primary" @click="addModal">新增</el-button>
<el-button type="primary" @click="partImportModal">料号导入</el-button> <el-button type="primary" @click="partImportModal">料号导入</el-button>
<el-button type="primary" icon="el-icon-upload" @click="projectPartUpload">Excel导入</el-button>
<download-excel <download-excel
:fields="fields()" :fields="fields()"
:data="exportData" :data="exportData"
@ -18,7 +19,6 @@
class="el-button el-button--primary el-button--medium"> class="el-button el-button--primary el-button--medium">
{{ '导出' }} {{ '导出' }}
</download-excel> </download-excel>
<!-- <el-button type="primary" @click="partImportModal">Excel导入</el-button>-->
</el-form> </el-form>
</el-form> </el-form>
@ -576,7 +576,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="itemSaveData()">保存</el-button>
<el-button type="primary" @click="itemSaveData()">保存</el-button>
<el-button type="primary" @click="itemModalFlag = false">关闭</el-button> <el-button type="primary" @click="itemModalFlag = false">关闭</el-button>
</span> </span>
</el-dialog> </el-dialog>
@ -716,7 +716,10 @@
</el-footer> </el-footer>
</el-dialog> </el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<!-- 导入 -->
<project-part-upload ref="projectPartUpload" @refreshPageTables="searchTable" v-drag></project-part-upload>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
</div> </div>
</template> </template>
@ -751,11 +754,14 @@
} from '@/api/part/partInformation.js' } from '@/api/part/partInformation.js'
import {verifyData} from "@/api/chooselist/chooselist.js" import {verifyData} from "@/api/chooselist/chooselist.js"
import Chooselist from '@/views/modules/common/Chooselist' import Chooselist from '@/views/modules/common/Chooselist'
import DictDataSelect from "../../sys/dict-data-select.vue";
import DictDataSelect from "../../sys/dict-data-select.vue"
import ProjectPartUpload from "./project_part_upload.vue";
export default { export default {
components: { components: {
ProjectPartUpload,
DictDataSelect, DictDataSelect,
Chooselist
Chooselist,
}, },
watch: { watch: {
modalData: { modalData: {
@ -791,9 +797,9 @@
projectId: '', projectId: '',
customerId: '' customerId: ''
}, },
visible:false,
visible: false,
dataListLoading: false, dataListLoading: false,
currentRow:'',
currentRow: '',
columnList:[ columnList:[
{ {
userId: this.$store.state.user.name, userId: this.$store.state.user.name,
@ -2686,14 +2692,14 @@
this.$message.warning('请选择生效日期(Phase In)!') this.$message.warning('请选择生效日期(Phase In)!')
return return
} }
if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate === '' || this.revisionData.effPhaseOutDate == null)) {
this.$message.warning('请选择失效日期(Phase Out)!')
return
}
if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate < this.revisionData.effPhaseInDate)) {
this.$message.warning('失效日期不能早于生效日期!')
return
}
// if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate === '' || this.revisionData.effPhaseOutDate == null)) {
// this.$message.warning('(Phase Out)')
// return
// }
// if (this.revisionData.flag === '2' && (this.revisionData.effPhaseOutDate < this.revisionData.effPhaseInDate)) {
// this.$message.warning('')
// return
// }
if (this.revisionData.flag === '1') { if (this.revisionData.flag === '1') {
saveRevision(this.revisionData).then(({data}) => { saveRevision(this.revisionData).then(({data}) => {
if (data && data.code === 0) { if (data && data.code === 0) {
@ -3102,13 +3108,28 @@
this.modalData.durabilityWeek = this.modalData.durabilityDay / 7 this.modalData.durabilityWeek = this.modalData.durabilityDay / 7
}, },
toPartMenu(partNo){
if (this.$router.resolve(`/part-partInformation`).resolved.name === '404'){
this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',});
}else {
toPartMenu (partNo) {
if (this.$router.resolve(`/part-partInformation`).resolved.name === '404') {
this.$alert('权限不足,访问失败', '警告', {confirmButtonText: '确定',})
} else {
this.$router.push({name:`part-partInformation`,params:{partNo:partNo},}) this.$router.push({name:`part-partInformation`,params:{partNo:partNo},})
} }
}
},
//
projectPartUpload () {
let currentData = {
createBy: this.$store.state.user.name,
site: this.searchData.site,
projectId: this.searchData.projectId,
customerNo: this.searchData.customerId,
}
//
this.$nextTick(() => {
this.$refs.projectPartUpload.init(currentData)
})
},
}, },
} }
</script> </script>

150
src/views/modules/project/projectInfo/project_part_upload.vue

@ -0,0 +1,150 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;" class="customer-dialog">
<el-form :inline="true" label-position="top" label-width="80px">
<el-button type="primary" @click="downloadFile()">下载文件模板</el-button>
<el-row>
<el-col :span="24">
<el-upload class="customer-upload" drag action="javascript:void(0);" ref="uploadFile" :limit="1" accept=".xlsx,.xls"
:before-upload="beforeUploadHandle" :on-change="onChange" :auto-upload="false" style="text-align: left;">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
</el-upload>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveUploadFile()">保存</el-button>
<el-button type="primary" @click="closeDialog">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import {
uploadProjectPartExcel, //
queryFileId, // ID
downLoadFile, //
} from '@/api/part/partInformation.js'
export default {
name:'projectPartUpload',
data() {
return {
titleCon: '文件导入',
visible: false,
fileList: [],
pageData: {
projectId: '',
createBy: '',
site: '',
customerNo: ''
},
}
},
methods: {
//
init(currentRow) {
//
this.pageData = JSON.parse(JSON.stringify(currentRow))
//
this.visible = true
},
//
beforeUploadHandle(file) {
let extName = file[0].name.substring(file[0].name.lastIndexOf('.')).toLowerCase()
if (!(extName === '.xlsx' || extName === '.xls')) {
this.$message.error('数据导入失败,请选择正确的xlsx模板文件')
return false
}
},
//
onChange (file) {
this.fileList.push(file)
},
//modal
closeDialog () {
this.fileList = []
//
this.$refs.uploadFile.clearFiles()
//
this.$emit('refreshPageTables')
//
this.visible = false
},
//
saveUploadFile () {
//
if (null == this.fileList || 0 === this.fileList.length) {
this.$message.error("请先上传文件!")
return false
}
const formData = new FormData()
formData.append("file", this.fileList[0].raw)
formData.append("createBy", this.pageData.createBy)
formData.append("orderRef1", this.pageData.site)
formData.append("orderRef2", this.pageData.projectId)
formData.append("orderRef3", this.pageData.customerNo)
uploadProjectPartExcel(formData).then(({data}) => {
if (data.code === 0) {
this.$message.success(data.msg)
//
this.$refs.uploadFile.clearFiles()
//
this.closeDialog()
} else {
this.$message.warning(data.msg)
}
})
},
//
async downloadFile () {
let file = {
id: 0,
fileName: ''
}
let tempData = {
orderRef1: this.pageData.site,
orderRef2: 'projectPart'
}
await queryFileId(tempData).then(({data}) => {
if (data && data.code === 0) {
file.id = data.data.id
file.fileName = data.data.fileName
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
await downLoadFile(file).then(({data}) => {
//
const blob = new Blob([data], {type: "application/octet-stream"})
//
const fileName = file.fileName
// a
const linkNode = document.createElement('a')
// adownload
linkNode.download = fileName
linkNode.style.display = 'none'
// Blob URL
linkNode.href = URL.createObjectURL(blob)
document.body.appendChild(linkNode)
//
linkNode.click()
// URL
URL.revokeObjectURL(linkNode.href)
document.body.removeChild(linkNode)
})
},
}
}
</script>
<style scoped lang="scss">
</style>
Loading…
Cancel
Save