|
@@ -1,5 +1,143 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div>
|
|
<div>
|
|
|
- <Toptitle title="包装统计表"></Toptitle>
|
|
|
|
|
|
|
+ <Toptitle title="包装统计表">
|
|
|
|
|
+ <Button type="primary">导出</Button>
|
|
|
|
|
+ </Toptitle>
|
|
|
|
|
+ <Form :label-width='100' class="form_content">
|
|
|
|
|
+ <FormItem label='时间:'>
|
|
|
|
|
+ <DatePicker type='date' v-model="searchData.start_time" class="form_item"></DatePicker>~
|
|
|
|
|
+ <DatePicker type='date' v-model="searchData.end_time" class="form_item"></DatePicker>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem label='包装班组:'>
|
|
|
|
|
+ <Select v-model="searchData.employee" filterable clearable class="form_item">
|
|
|
|
|
+ <Option :value="1" :label="1"/>
|
|
|
|
|
+ </Select>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem label='项目名称:'>
|
|
|
|
|
+ <Select v-model="searchData.project_title" filterable multiple :max-tag-count='1' class="form_item">
|
|
|
|
|
+ <Option :value="1" :label='1'/>
|
|
|
|
|
+ </Select>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ <FormItem :label-width='40'>
|
|
|
|
|
+ <Button style="primary" type="primary">搜索</Button>
|
|
|
|
|
+ </FormItem>
|
|
|
|
|
+ </Form>
|
|
|
|
|
+ <Table :data='tableData' :columns='setTableColumns' border max-height='550' :span-method="handleSpan">
|
|
|
|
|
+
|
|
|
|
|
+ </Table>
|
|
|
</div>
|
|
</div>
|
|
|
-</template>
|
|
|
|
|
|
|
+</template>
|
|
|
|
|
+<script>
|
|
|
|
|
+export default {
|
|
|
|
|
+ data(){
|
|
|
|
|
+ return{
|
|
|
|
|
+ tableSlice:[],
|
|
|
|
|
+ tableData:[
|
|
|
|
|
+ {time:'123',A:"600",B:'700',C:'800',D:'900',E:'1000',F:'1100',G:"1200",H:'1300',I:"1400"}
|
|
|
|
|
+ ],
|
|
|
|
|
+ tableColumns:[
|
|
|
|
|
+ {title:'时间',key:'time',align:'center',minWidth:100}
|
|
|
|
|
+ ],
|
|
|
|
|
+ otherColumns:[],
|
|
|
|
|
+ searchData:{
|
|
|
|
|
+ start_time:'',
|
|
|
|
|
+ end_time:'',
|
|
|
|
|
+ project_title:'',
|
|
|
|
|
+ employee:''
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ computed:{
|
|
|
|
|
+ setTableColumns(){
|
|
|
|
|
+ let arr;
|
|
|
|
|
+ arr = [
|
|
|
|
|
+ ...this.tableColumns,...this.otherColumns
|
|
|
|
|
+ ]
|
|
|
|
|
+ return arr
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted(){
|
|
|
|
|
+ this.initData();
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ methods:{
|
|
|
|
|
+ handleSpan({ row, column, rowIndex, columnIndex }){
|
|
|
|
|
+ if (rowIndex ===this.tableData.length-2 && columnIndex === 0) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ rowspan: 2,
|
|
|
|
|
+ colspan: 1
|
|
|
|
|
+ };
|
|
|
|
|
+ } else if (rowIndex === this.tableData.length-1 && columnIndex === 0) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ rowspan: 0,
|
|
|
|
|
+ colspan: 0
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+ if(rowIndex===this.tableData.length-1){
|
|
|
|
|
+ return this.totalColumns(rowIndex,columnIndex)
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ totalColumns(rowIndex,columnIndex){
|
|
|
|
|
+ let arr = [];
|
|
|
|
|
+ if(0<columnIndex<=this.tableSlice[this.tableSlice.length-1]){
|
|
|
|
|
+ arr = [0,0];
|
|
|
|
|
+ this.tableSlice.forEach((v,index)=>{
|
|
|
|
|
+
|
|
|
|
|
+ if(index!=this.tableSlice.length-1){
|
|
|
|
|
+ if(columnIndex===1){
|
|
|
|
|
+ arr = [1,this.tableSlice[0]]
|
|
|
|
|
+ }
|
|
|
|
|
+ if(columnIndex===v+1){
|
|
|
|
|
+ console.log(v)
|
|
|
|
|
+ arr = [v+1,3]
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return arr;
|
|
|
|
|
+ },
|
|
|
|
|
+ initData(){
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ let data=[
|
|
|
|
|
+ {title:'包装一组',children:[{title:'项目A',key:'A'},{title:'项目B',key:'B'},{title:'项目C',key:'C'}],total_price:'1750'},
|
|
|
|
|
+ {title:'包装二组',children:[{title:'项目D',key:'D'},{title:'项目E',key:'E'},{title:'项目F',key:'F'}],total_price:'1800'},
|
|
|
|
|
+ {title:'包装三组',children:[{title:'项目G',key:'G'},{title:'项目H',key:'H'},{title:'项目I',key:'I'}],total_price:'1900'},
|
|
|
|
|
+ ];
|
|
|
|
|
+ let totalData = {time:'合计',A:"600",B:'700',C:'800',D:'900',E:'1000',F:'1100',G:"1200",H:'1300',I:"1400"};
|
|
|
|
|
+ let totalSure = {};
|
|
|
|
|
+ let sum = 0;
|
|
|
|
|
+ data.forEach(v=>{
|
|
|
|
|
+ totalSure[v.children[0].key] = v.total_price;
|
|
|
|
|
+ sum+=v.children.length;
|
|
|
|
|
+ this.tableSlice.push(sum)
|
|
|
|
|
+ let obj = {};
|
|
|
|
|
+ obj.title = v.title;
|
|
|
|
|
+ obj.align = 'center';
|
|
|
|
|
+ v.children.forEach(val=>{
|
|
|
|
|
+ val.align='center';
|
|
|
|
|
+ val.minWidth=100;
|
|
|
|
|
+ })
|
|
|
|
|
+ obj.children = v.children
|
|
|
|
|
+ this.otherColumns.push(obj);
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ this.tableData.push(totalData);
|
|
|
|
|
+ this.tableData.push(totalSure);
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</script>
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
|
+.form_content{
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
|
|
+ margin-top: 20px;
|
|
|
|
|
+ .form_item{
|
|
|
|
|
+ width: 200px;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|