1.增加新双周需求导入及相关功能

master
董哲奇 2 weeks ago
parent ad0212a560
commit 30d33def04

@ -0,0 +1,177 @@
import request from '@/utils/request'
import { VXETable } from 'vxe-table'
const init=function (that){
let list=[]
const initList=function (){
data.options.formConfig.data.dcCh=that.$refs.projectSelectRef.getDcch()
getData(data.options.formConfig.data).then(res=>{
list=res.data
})
}
const save=()=>{
const list=that.$refs.vGrid.getCheckboxRecords()
if(list.length>0){
saveData(list).then(()=>{
VXETable.modal.message({ content: '成功', status: 'success' })
initList()
})
}
}
const importMethod=({file})=>{
const formBody = new FormData()
formBody.append('file', file)
return fetch(`${process.env.VUE_APP_BASE_API}dmQfxq/uploadNew`, { method: 'POST', body: formBody })
.then(response => {
console.log(response)
}).then(data => {
console.log(data)
}).catch((e) => {
console.log(e)
VXETable.modal.message({ content: '导入失败,请检查数据是否正确!', status: 'error' })
})
}
const 提交=()=>{
const list=that.$refs.vGrid.getCheckboxRecords()
if(list.length>0){
const _list=list.map(item=>{
return {id:item.id,zt:item.zt}
})
submit(_list).then(()=>{
VXETable.modal.message({ content: '成功', status: 'success' })
initList()
})
}
}
const data={
options:{
height:800,
align:'center',
border: true,
resizable: true,
keepSource:true,
size:'mini',
showOverflow: true,
editConfig:{trigger: 'click', mode: 'cell', showStatus: true},
highlightCurrentRow:true,
toolbarConfig: {
import: true,
custom: true
},
importConfig: {
remote: true,
importMethod: importMethod,
types: ['xls','xlsx'],
modes: ['insert']
},
formConfig:{
data:{
dcCh:'',
},
items:[
{ field: 'dcCh', title: '船只', span: 3,slots: { default: 'name_czbh' } },
{span: 21,
children:[
{ align:'right',itemRender: {
name: '$button', props: {content:'查询',status:'primary'},events:{click:initList}
}
},
{ align:'right',itemRender: {
name: '$button', props: {content:'保存',status:'primary'},events:{click:save}
}
},
{ align:'right',itemRender: {
name: '$button', props: {content:'提交',status:'primary'},events:{click:提交}
}
},
]
},
],
},
columns:[
{ field: 'dcCh', title: '船号', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
},
{ field: 'dcPl', title: '批量', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
},
{ field: 'dcFd', title: '分段', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
},
//=============小组相关========================
{ field: 'xzcd', title: '小组场地', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
},
{ field: 'xdb', title: '大板', width: 100 },
{ field: 'xskj', title: '数控件', width: 100 },
{ field: 'xpt', title: '平铁', width: 100 },
{ field: 'xyw', title: '压弯', width: 100 },
{ field: 'xxc', title: '型材', width: 100 },
{ field: 'xok', title: '钢加回复', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
editRender: {name: '$input'}
},
{ field: 'xbz', title: '小组备注', width: 100,
editRender: {name: '$input'}
},
//=============大组相关========================
{ field: 'dzcd', title: '大组场地', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
},
{ field: 'ddb', title: '大板', width: 100 },
{ field: 'dxc', title: '型材', width: 100 },
{ field: 'dsj', title: '散件', width: 100 },
{ field: 'dr150', title: 'R150', width: 100 },
{ field: 'dqb', title: '曲外板', width: 100 },
{ field: 'dok', title: '钢加回复', width: 100,
filters: [{ data: { checks: [], sVal: '', sMenu: '', fType1: '', fVal1: '', fMode: 'and', fType2: '', fVal2: '' } }],
filterRender: { name: 'FilterCombination', },
editRender: {name: '$input'}
},
{ field: 'dbz', title: '大组备注', width: 150,
editRender: {name: '$input'}
},
],
data:list,
},
}
return data
}
const getData=(data)=>{
return request({
url: "/dmQfxq/getList",
method: "post",
data,
});
}
const saveData=(data)=>{
return request({
url: "/dmQfxq/save",
method: "post",
data,
});
}
const submit=(data)=>{
return request({
url: "/dmQfxq/qfxqTJ",
method: "post",
data,
});
}
export default init

@ -0,0 +1,100 @@
<template>
<el-container>
<el-container style="padding-top: 10">
<el-container>
<el-main>
<VxeGrid ref="vGrid" :scroll-y="{enabled: true}" :scroll-x="{enabled: true,gt:10}" v-bind="gridOptions">
<template #name_czbh="{ data }">
<ProjectSelect ref="projectSelectRef" clearable :_style="{width:'150px'}" />
</template>
</VxeGrid>
</el-main>
</el-container>
</el-container>
</el-container>
</template>
<script>
import ProjectSelect from "@/components/ProjectSelect/index.vue";
import init from "./index";
export default {
components: {ProjectSelect},
data(){
return{
gridOptions:{},
}
},
created(){
const {options}=init(this)
this.gridOptions=options
},
}
</script>
<style lang="scss" scoped >
.el-header{margin:0;padding: 5px;height:auto;
.el-input{
width: 140px;
}
.el-select{
width: 140px;
}
}
.el-container{padding: 0;margin:0;}
.el-main{padding: 0;}
.el-col{padding: 0;height: 32px;}
.el-aside{background: #fff;padding: 0}
.el-container{padding: 0}
.el-row {}
.el-row:last-child {margin-bottom: 0; }
.tableStyles{
background: #0a76a4;
}
.my-dropdown {
width: 400px;
height: 400px;
background-color: #fff;
border: 1px solid #dcdfe6;
box-shadow: 0 0 6px 2px rgba(0, 0, 0, 0.1);
font-size: 12px;
}
.mytable1{
}
.borderClass{
}
.vxe-input {
display: inline-block !important;
position: relative !important;
width: auto;
}
.el-input {
display: inline-block !important;
position: relative !important;
width: auto;
}
.keyword-lighten {
color: #000;
background-color: #FFFF00;
}
.vxe-textarea--inner {
line-height: inherit;
}
.el-form-item__label-wrap {
margin-left: 0px !important;
float: left;
}
.fontClass{
font-size: 12px;
font-weight: bold;
}
</style>
Loading…
Cancel
Save