1.材质证件跟踪增加excel导出功能

2.修正材质证件跟踪主键格式
3.优化作业计划执行划线和切割查询条件
4.优化数据库连接
master
董哲奇 4 months ago
parent a581bc5e8a
commit a086749003

@ -60,6 +60,7 @@
<el-col :span="6"> <el-col :span="6">
<el-form-item style="float: right" > <el-form-item style="float: right" >
<el-button type="success" @click="initList"></el-button> <el-button type="success" @click="initList"></el-button>
<el-button type="success" @click="exportXls"></el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -134,6 +135,8 @@ import {null2str} from "@/utils/rpkj";
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { startLoading, endLoading } from '@/utils' import { startLoading, endLoading } from '@/utils'
import { Message } from 'element-ui' import { Message } from 'element-ui'
import * as XLSX from 'xlsx'
export default { export default {
name:'Czzjgz', name:'Czzjgz',
data() { data() {
@ -189,7 +192,7 @@ export default {
], ],
tableColumn: [ tableColumn: [
{ type: 'checkbox', width: 40 },
{ type: 'seq', width: 40, title: '序号' }, { type: 'seq', width: 40, title: '序号' },
{ {
field: 'DC_CH', field: 'DC_CH',
@ -310,15 +313,6 @@ export default {
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }], filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination' } filterRender: { name: 'FilterCombination' }
}, },
] ]
} }
}, },
@ -333,7 +327,36 @@ export default {
}, },
methods: { methods: {
exportXls(){
const data=this.$refs.xGrid.getCheckboxRecords()
if (data.length===0){
this.$message.warning('请先选择要导出excel的数据')
return
}
const {fullColumn:column}=this.$refs.xGrid.getTableColumn()
console.log(column)
const fields={}
for (const item of column) {
const name=item.field;
const value=item.title
fields[name]=value
}
const printData=[]
data.forEach((item,index)=>{
const _item={}
for (const i in fields) {
_item[fields[i]]=item[i]
}
_item.序号=index+1
printData.push(_item)
})
const workBook = XLSX.utils.book_new();
const sheet = XLSX.utils.json_to_sheet(printData)
XLSX.utils.book_append_sheet(workBook, sheet, "sheetName");
const date=XEUtils.toDateString(new Date(),'yyyyMMdd')
XLSX.writeFile(workBook, `质量跟踪${date}.xlsx`)
},
cellClickEvent({row}) { cellClickEvent({row}) {
this.queryParam.dcch = row.cbbm this.queryParam.dcch = row.cbbm
this.$refs.xDown4.hidePanel() this.$refs.xDown4.hidePanel()
@ -408,7 +431,6 @@ export default {
initBase(){ initBase(){
getPgdBase({}).then(res=>{ getPgdBase({}).then(res=>{
console.log(res.data)
this.dictData = res.data this.dictData = res.data
this.projectData=res.data.cbbm this.projectData=res.data.cbbm
this.projectData1=res.data.cbbm this.projectData1=res.data.cbbm
@ -523,18 +545,15 @@ export default {
}, },
initList() { initList() {
// if (this.queryParam.dcch === '') { if (this.queryParam.dcch === '') {
// this.$message.warning('') this.$message.warning('选择船只编号')
// return return
// } }
czzjList(this.queryParam).then((res) => { czzjList(this.queryParam).then((res) => {
console.log(res.data)
this.list = res.data this.list = res.data
if (this.$refs.xGrid) { if (this.$refs.xGrid) {
this.$refs.xGrid.loadData(this.list) this.$refs.xGrid.loadData(this.list)
console.log(this.list)
} }
}) })
}, },
selectChange(row) { selectChange(row) {

@ -165,7 +165,7 @@ export default {
} }
getBzryByBz({zyq:this.$route.query.zyq,zt:bzType}).then(res=>{ getBzryByBz({zyq:this.$route.query.zyq,zt:bzType}).then(res=>{
res.data=res.data.filter(item=>item.position==='数控'||item.position==='班长') res.data=res.data.filter(item=>item.position==='数控'||item.position==='龙门'||item.position==='班长')
this.workers=res.data this.workers=res.data
this.setWorkers(res.data) this.setWorkers(res.data)
const that=this const that=this

@ -90,7 +90,7 @@ export default {
}) })
} }
if (gx==='0'){ if (gx==='0'){
data.zt='2' data.zt='11'
getYdjhByZt(data).then(res => { getYdjhByZt(data).then(res => {
this.list=res.data this.list=res.data
this.gridOptions.data = res.data this.gridOptions.data = res.data

@ -166,7 +166,7 @@ export default {
this.layer.add(bgGroup) this.layer.add(bgGroup)
} }
getBzryByBz({zyq:this.$route.query.zyq,zt:bzType}).then(res => { getBzryByBz({zyq:this.$route.query.zyq,zt:bzType}).then(res => {
res.data=res.data.filter(item=>item.position==='数控'||item.position==='班长') res.data=res.data.filter(item=>item.position==='数控'||item.position==='龙门'||item.position==='班长')
this.workers=res.data this.workers=res.data
this.setWorkers(res.data) this.setWorkers(res.data)
const that=this const that=this

@ -87,7 +87,7 @@ export default {
}) })
} }
if (gx==='0'){ if (gx==='0'){
data.zt='2' data.zt='11'
getYdjhByZt(data).then(res => { getYdjhByZt(data).then(res => {
this.list=res.data this.list=res.data
this.gridOptions.data = res.data this.gridOptions.data = res.data

Loading…
Cancel
Save