Browse Source

12.13 Part Export 优化

dev
yuejiayang 1 year ago
parent
commit
6fbdb84e34
  1. 6
      src/api/chooselist/chooselist.js
  2. 271
      src/views/modules/common/Chooselist_eam.vue
  3. 2
      src/views/modules/manufacturer/manufacturerInformation.vue
  4. 115
      src/views/modules/part/external.vue

6
src/api/chooselist/chooselist.js

@ -5,3 +5,9 @@ export const getChooselist = data => createAPI(`/chooselist/getChooselist/${data
export const getChooselistData = data => createAPI(`/chooselist/getChooselistData`,'post',data)
export const getChooselistEam = data => createAPI(`/chooselist/getChooselist/${data.tagNo}`,'get',data)
export const getChooselistDataEam = data => createAPI(`/chooselist/getChooselistData`,'post',data)

271
src/views/modules/common/Chooselist_eam.vue

@ -0,0 +1,271 @@
<template>
<el-dialog class="yzzInput" :title="baseListData.description" append-to-body :close-on-click-modal="false" :close-on-press-escape="false" @close="closeDialog" :visible.sync="visible" width="685px" v-drag>
<el-form label-position="top" inline="inline" size="mini" >
<el-row :gutter="10">
<el-col :span="6" >
<el-form-item :label="baseListData.caption1" v-if="baseListData.caption1 != '' && baseListData.caption1 != null">
<el-input v-model="param1"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item :label="baseListData.caption2" v-if="baseListData.caption2 != '' && baseListData.caption2 != null">
<el-input v-model="param2"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item :label="baseListData.caption3" v-if="baseListData.caption3 != '' && baseListData.caption3 != null">
<el-input v-model="param3"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item :label="baseListData.caption4" v-if="baseListData.caption4 != '' && baseListData.caption4 != null">
<el-input v-model="param4"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item :label="baseListData.caption5" v-if="baseListData.caption5 != '' && baseListData.caption5 != null">
<el-input v-model="param5"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item :label="baseListData.caption6" v-if="baseListData.caption6 != '' && baseListData.caption6 != null ">
<el-select v-model="param6" style="width: 120px">
<el-option label="全部" value=""></el-option>
<el-option label="在用" value="Y"></el-option>
<el-option label="不在用" value="N"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-form-item :label="baseListData.caption7" v-if="baseListData.caption7 != '' && baseListData.caption7 != null">
<el-input v-model="param7"></el-input>
</el-form-item>
</el-col>
<el-col :span="6" >
<el-button style="margin-top: 18px" type="primary" @click="getDataList(false)">查询
</el-button>
</el-col>
</el-row>
</el-form>
<el-table
:height="height"
:data="dataList"
border
@row-dblclick="getRowData"
v-loading="dataListLoading"
style="width: 100%;">
<el-table-column
v-for="(item,index) in columnList" :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">
{{ scope.row[item.columnProp] }}
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false" type="primary">关闭</el-button>
</span>
</el-dialog>
</template>
<script>
import {
getChooselistEam,
getChooselistDataEam,
} from "@/api/chooselist/chooselist.js"
export default {
data() {
return {
height: 200,
tagNo: '',
title: '列表',
columnList: [],
queryTable: {},
visible: false,
dataListLoading: true,
fullscreenLoading: false,
param1: '',
param2: '',
param3: '',
param4: '',
param5: '',
param6: '',
param7: this.$store.state.user.name,
param: '',
conSql: '',
dataList: [],
baseListData: {
caption1: '',
caption2: '',
caption3: '',
caption4: '',
caption5: '',
caption6: '',
caption7: '',
description: '',
fieldname1: '',
fieldname2: '',
fieldname3: '',
fieldname4: '',
fieldname5: '',
fieldname6: '',
sqlcode: '',
tagno: '',
},
defaultParam: false
}
},
methods: {
//
init (tagNo, param, conSql) {
this.tagNo = tagNo
this.visible = true
this.param = param
this.conSql = conSql ? conSql : ''
// tagNo
getChooselistEam({"tagNo": tagNo}).then(({data}) => {
this.columnList = []
this.baseListData = data.data
let start = data.data.sqlcode.toUpperCase().indexOf("Select".toUpperCase())
let end = data.data.sqlcode.toUpperCase().indexOf("from".toUpperCase())
let length = end - start
let columns = data.data.sqlcode.trim().substring(start + 6, length).trim()
let props = columns.split(",")
props.forEach((item, index) => {
let name = '信息列'
switch (index) {
case 0:
name = this.baseListData.caption1
break;
case 1:
name = this.baseListData.caption2
break;
case 2:
name = this.baseListData.caption3
break;
case 3:
name = this.baseListData.caption4
break;
case 4:
name = this.baseListData.caption5
break;
case 5:
name = this.baseListData.caption6
break;
case 6:
name = this.baseListData.caption7
break;
}
let index1 = item.indexOf(" as ")
let index2 = item.indexOf(".")
let l = item.length
let prop = item
if (index1 > 0) {
prop = item.substring(index1 + 3, l).trim()
}
if (index1 < 0 && index2 > 0) {
prop = item.substring(index2 + 1, l)
}
let column = {
"columnProp": prop.trim(),
"columnLabel": name,
"columnHidden": false,
"columnImage": false,
"columnSortable": false,
"columnWidth": null,
"format": null,
"sortLv": index,
"status": true,
"fixed": false,
"serialNumber": null,
"columnType": null,
"align": null
}
this.columnList.push(column)
})
this.getDataList(true)
})
this.dataListLoading = false
},
getDataList (bool) {
let sql = this.baseListData.sqlcode
if (bool) {
sql += " and (" + this.baseListData.fieldname1 + " like '%" + this.param + "%' OR " + this.baseListData.fieldname2 + " like '%" + this.param + "%'" + " ) "
}
if (this.param1) {
sql += " and " + this.baseListData.fieldname1 + " like '%" + this.param1 + "%'"
}
if (this.param2) {
sql += " and " + this.baseListData.fieldname2 + " like '%" + this.param2 + "%'"
}
if (this.param3) {
sql += " and " + this.baseListData.fieldname3 + " like '%" + this.param3 + "%'"
}
if (this.param4) {
sql += " and " + this.baseListData.fieldname4 + " like '%" + this.param4 + "%'"
}
if (this.param5) {
sql += " and " + this.baseListData.fieldname5 + " like '%" + this.param5 + "%'"
}
if (this.param6 ) {
sql += " and active like '%" + this.param6 + "%'"
}
if (this.tagNo <= 500 && this.tagNo !== 93) {
if (this.param7) {
sql += " and site in (select site from eam_access_site where username = '" + this.param7 + "') " + " and (site + '-' + bu_no) in (select (a.site + '-' + a.bu_no) from AccessBu as a left join eam_access_site as b on a.site = b.site and a.username = b.username where a.username = '" + this.param7 + "')"
}
}
if (this.tagNo > 500 && this.tagNo < 1000) {
if (this.param7) {
sql += " and site in (select site from eam_access_site where username = '" + this.param7 + "') "
}
}
sql += this.conSql
getChooselistDataEam({"sqlcode": sql}).then(({data}) => {
if (data.code == 0) {
this.dataList = data.baseListData;
} else {
this.$message.error(data.msg)
}
})
},
getRowData (row) {
this.visible = false
this.$emit('getBaseData',row)
},
closeDialog () {
this.param1 = ''
this.param2 = ''
this.param3 = ''
this.param4 = ''
this.param5 = ''
this.param6 = ''
this.param7 = this.$store.state.user.name
this.param = ''
this.dataList = []
}
}
}
</script>
<style>
</style>

2
src/views/modules/manufacturer/manufacturerInformation.vue

@ -150,7 +150,7 @@ export default {
totalPage: 0,
//
searchData: {
site: '',
site: this.$store.state.user.site,
userName: this.$store.state.user.name,
buDesc: '',
manufacturerNo: '',

115
src/views/modules/part/external.vue

@ -8,6 +8,7 @@ import {
selectUnitList,
updateExternalPart
} from '../../../api/part/external'
import Chooselist from '@/views/modules/common/Chooselist_eam'
import dayjs from 'dayjs'
import PictureModule from './picture/picture.vue'
import LinkedCustomer from './customer/linkedCustomer.vue'
@ -46,7 +47,7 @@ let part = {
}
export default {
name: 'ExternalPart',
components: {LabelTemplate, LinkedManufacturer, LinkedCustomer, PictureModule},
components: {LabelTemplate, LinkedManufacturer, LinkedCustomer, PictureModule,Chooselist},
props: {
height: {
type: Number,
@ -83,6 +84,11 @@ export default {
...part,
active: 'Y',
},
tempData:{
orderRef1: 'partInfo',
orderRef2: 'partInfoFormat',
site: this.$store.state.user.site,
},
partCategoryList: [],
category: {},
partRules: {
@ -762,6 +768,15 @@ export default {
columnWidth: 80
},
],
rules: {
site: [
{
required: true,
message: ' ',
trigger: ['blur', 'change']
}
],
},
activeName: 'partPicture',
currentPart: {},
externalPartCustomerList: [],
@ -816,6 +831,27 @@ export default {
},
},
methods: {
// S
getBaseList (val,type) {
this.tagNo = val
this.$nextTick(() => {
let strVal = ''
let conSql = ''
if (val === 93 ) {
strVal = this.tempData.site ? this.tempData.site : ''
}
this.$refs.baseList.init(val, strVal,conSql)
})
},
/* 列表方法的回调 */
getBaseData (val) {
if (this.tagNo === 93) {
this.tempData.site = val.SiteID
}
},
getExternalPartPictureList (val) {
let params = {
partNo: this.currentPart.partNo,
@ -1262,35 +1298,40 @@ export default {
saveUploadFile () {
//
if (null == this.fileList || 0 === this.fileList.length) {
this.$message.error("请先上传文件!")
this.$message.error("Please upload the file first!")
return false
}
//
this.$confirm('Do you confirm the upload? If the Part Info already exists, we will delete it!', 'Warning', {
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
const formData = new FormData()
formData.append("file", this.fileList[0].raw)
formData.append("createBy", this.$store.state.user.name)
formData.append("site", this.$store.state.user.site.toString())
this.isLoading = true
savePartInfoByExcel(formData).then(({data}) => {
if (data.code === 0) {
//
this.provisionalDataDialogHandle()
} else {
this.isLoading = false
this.$message.warning(data.msg)
//
this.$confirm('Do you confirm the upload? If the Part Info already exists, we will delete it!', 'Warning', {
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
//
if (null == this.fileList || 0 === this.fileList.length) {
this.$message.error("请先上传文件!")
return false
}
})
}).catch(() => {
this.$message({
type: 'info',
message: 'Cancel upload'
})
})
const formData = new FormData()
formData.append("file", this.fileList[0].raw)
formData.append("createBy", this.$store.state.user.name)
formData.append("site", this.tempData.site.toString())
this.isLoading = true
savePartInfoByExcel(formData).then(({data}) => {
if (data.code === 0) {
//
this.provisionalDataDialogHandle()
} else {
this.isLoading = false
this.$message.warning(data.msg)
}
})
}).catch(() => {
this.$message({
type: 'info',
message: 'Cancel upload'
})
});
},
provisionalDataDialogHandle () {
@ -1329,10 +1370,7 @@ export default {
id: 0,
fileName: ''
}
let tempData = {
orderRef1: 'partInfo',
orderRef2: 'partInfoFormat'
}
let tempData = this.tempData
await queryFileId(tempData).then(({data}) => {
if (data && data.code === 0) {
file.id = data.data.id
@ -1664,10 +1702,13 @@ export default {
</div>
</el-dialog>
<el-dialog title="File Import" @close="closeUploadDialog" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;">
<el-dialog title="File Import" :z-index="1999" @close="closeUploadDialog" :close-on-click-modal="false" :visible.sync="visible" width="390px" style="height: 520px;">
<el-form :inline="true" label-position="top" label-width="80px">
<el-form-item label="Site">
<el-input v-model="this.$store.state.user.site" disabled></el-input>
<el-form-item prop="site" :rules="rules.site">
<span slot="label" style="" class="big-label">
<a herf="#" @click="getBaseList(93)">Site</a>
</span>
<el-input v-model="tempData.site" style="width: 130px"></el-input>
</el-form-item>
<el-form-item label=" ">
<el-button type="primary" @click="downloadFile()">Download file template</el-button>
@ -1713,6 +1754,8 @@ export default {
</span>
</el-dialog>
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
<div v-show="false">
<img :src="item" v-for="(item,index) in base64List" :key="index" style="display: none">
</div>
@ -1720,5 +1763,7 @@ export default {
</template>
<style scoped>
.big-label {
font-size: medium; /* 调整字号 */
}
</style>
Loading…
Cancel
Save