From 2473f4ce35cda8dcd1194618c5d22c2e5b0354e3 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 01 三月 2024 17:38:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/plan/productionschedul/index.vue | 771 +++++++++++++++++++-----------------------------------
src/views/common/ztt-table.vue | 52 ++-
2 files changed, 306 insertions(+), 517 deletions(-)
diff --git a/src/views/common/ztt-table.vue b/src/views/common/ztt-table.vue
index 717635e..0701521 100644
--- a/src/views/common/ztt-table.vue
+++ b/src/views/common/ztt-table.vue
@@ -568,6 +568,11 @@
return 'id'
}
},
+ //闇�瑕佸悎骞剁殑瀛楁闆嗗悎
+ mergeSpanArr: {
+ type: Array,
+ default: []
+ },
toolbarMaxLength: {
type: Number,
default: 5,
@@ -928,22 +933,41 @@
},
objectSpanMethod({ row, column, rowIndex, columnIndex }) {
if (this.options.tableCellMerge) {
- let result = ''
- this.$emit(
- 'objectSpanMethod',
- row,
- column,
- rowIndex,
- columnIndex,
- (val) => {
- if (val) {
- result = val
+ const propName = column.property
+ if (propName) {
+ if(this.mergeSpanArr.includes(propName)){
+ if (rowIndex > 0 && row[propName] === this.tableData[rowIndex - 1][propName]) {
+ return { rowspan: 0, colspan: 0 };
+ } else {
+ let rowspan = 1;
+ for (let i = rowIndex + 1; i < this.tableData.length; i++) {
+ if (this.tableData[i][propName] === row[propName]) {
+ rowspan++;
+ } else {
+ break;
+ }
+ }
+ return { rowspan: rowspan, colspan: 1 };
+ }
}
- }
- )
- if (result) {
- return result
}
+ // let result = ''
+ // this.$emit(
+ // 'objectSpanMethod',
+ // row,
+ // column,
+ // rowIndex,
+ // columnIndex,
+ // (val) => {
+ // console.log(val);
+ // if (val) {
+ // result = val
+ // }
+ // }
+ // )
+ // if (result) {
+ // return result
+ // }
}
},
getDataList(selectedId) {
diff --git a/src/views/plan/productionschedul/index.vue b/src/views/plan/productionschedul/index.vue
index 1037dd2..98e9d55 100644
--- a/src/views/plan/productionschedul/index.vue
+++ b/src/views/plan/productionschedul/index.vue
@@ -1,87 +1,31 @@
<template>
<div class="mod-config">
<basic-container>
- <el-row>
- <el-col :span="24">
- <el-row style="padding:0px 10px;">
- <el-col :span="24" style="margin: 0;">
- <div style="display:flex;height:36px;justify-content: space-between;align-items:center;">
- <div>
- <el-dropdown @command="changeTable">
- <span :style="dropdownTitleStyle" class="el-dropdown-link">
- {{dropdownTitle}}<i class="el-icon-arrow-down el-icon--right"></i>
- </span>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="undone">寰呭畬鎴愯皟搴�</el-dropdown-item>
- <el-dropdown-item command="done">宸插畬鎴愯皟搴�</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- </div>
- <div>
- <el-button @click="tagFinished" v-if="showUnDownTable" size="mini" round type="success">鏍囪宸插畬鎴�</el-button>
- <el-button size="mini" round type="primary"
- v-if="permissions.plan_productionschedul_edit_line && showUnDownTable"
- @click="openEditDialog">缂栬緫鏃堕棿绾�</el-button>
- <el-tooltip content="鍒锋柊">
- <el-button circle icon="el-icon-refresh" @click="getDataList"></el-button>
- </el-tooltip>
- </div>
- </div>
- <!-- 寰呭畬鎴愯皟搴﹁〃鏍� -->
- <avue-crud
- v-if="showUnDownTable"
- class="unfinished-crud"
- :data="tableData"
- ref="unfinished"
- :option="option"
- :span-method="spanMethod"
- @refresh-change="getDataList"
- @current-change="handleCurrentChange"
- @size-change="handleSizeChange"
- @cell-click="handleClickCell"
- :page="page"
- @selection-change="selectionRow"
- :table-loading="loading">
- <template slot="product" slot-scope="scope">
- <el-link type="primary">{{ scope.row.product }}</el-link>
- </template>
- <template #menu="{ row, index }">
- <el-button
- v-if="permissions.plan_productionschedul_edit"
- type="text"
- icon="el-icon-edit"
- size="small"
- @click="editHandle(row, index)">缂栬緫</el-button>
- <el-button
- v-if="permissions.plan_productionschedul_del"
- type="text"
- icon="el-icon-delete"
- size="small"
- @click="deleteHandle(row, index)">鍒犻櫎</el-button>
- </template>
- </avue-crud>
- <!-- 宸插畬鎴愯皟搴﹁〃鏍� -->
- <avue-crud
- v-else
- class="finished-crud"
- :data="finishedTableData"
- ref="finished"
- :option="finishedOption"
- :span-method="spanMethod"
- @refresh-change="getFinishedData"
- @current-change="handleCurrentChange"
- @cell-click="handleClickCell"
- @size-change="handleSizeChange"
- :page="finishedPage"
- @selection-change="selectionFinishedRow">
- <template slot="product" slot-scope="scope">
- <el-link type="primary">{{ scope.row.product }}</el-link>
- </template>
- </avue-crud>
- </el-col>
- </el-row>
- </el-col>
- </el-row>
+ <ttable
+ :rowKey="'mid'"
+ :table="table"
+ :prelang="prelang"
+ :options="options"
+ @handleSelectionChange="selectionRow"
+ :ajaxFun="ajaxFun"
+ :paramObj="queryParams"
+ :mergeSpanArr="spanArr"
+ ref="ttable">
+ <template #toolbar>
+ <el-dropdown @command="changeTable">
+ <span :style="dropdownTitleStyle" class="el-dropdown-link">
+ {{dropdownTitle}}<i class="el-icon-arrow-down el-icon--right"></i>
+ </span>
+ <el-dropdown-menu slot="dropdown">
+ <el-dropdown-item command="undone">寰呭畬鎴愯皟搴�</el-dropdown-item>
+ <el-dropdown-item command="done">宸插畬鎴愯皟搴�</el-dropdown-item>
+ </el-dropdown-menu>
+ </el-dropdown>
+ <el-button v-if="showUnDownTable" @click="tagFinished" type="success">鏍囪宸插畬鎴�</el-button>
+ <el-button v-if="permissions.plan_productionschedul_edit_line && showUnDownTable"
+ @click="openEditDialog" type="primary">缂栬緫鏃堕棿绾�</el-button>
+ </template>
+ </ttable>
</basic-container>
<!-- 缂栬緫鏃堕棿绾� -->
<el-dialog
@@ -172,7 +116,7 @@
<el-timeline-item
placement="top"
:color="(item.actualTime) ? '#34BD66' :null"
- :icon="(item.actualTime) ? 'el-icon-circle-check' :null"
+ :icon="(item.planTime || item.actualTime) ? 'el-icon-circle-check' :null"
v-for="(item, index) in scheduleList"
:key="index"
:timestamp="item.title">
@@ -205,9 +149,193 @@
} from '@/api//plan/productionschedul'
import ttable from '@/views/common/ztt-table.vue'
import { mapGetters } from 'vuex'
+import { remote } from '@/api/admin/dict'
export default {
data() {
return {
+ queryParams: {
+ state: false
+ },
+ ajaxFun: fetchScheduleList,
+ prelang: 'productSchedul',
+ options: {
+ height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾
+ stripe: true, // 鏄惁涓烘枒椹汗 table
+ highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈
+ border: true, // 鏄惁鏈夌旱鍚戣竟妗�
+ lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇
+ fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮�
+ multiSelect: true, //
+ seqNo: true,
+ isRefresh: true, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
+ isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳H
+ isSearch: true, // 楂樼骇鏌ヨ鎸夐挳
+ defaultOrderBy: { column: 'createdTime', direction: 'desc' },
+ cancelRunCreated: false,
+ tableCellMerge: true
+ },
+ table: {
+ total: 0,
+ currentPage: 1,
+ pageSize: 20,
+ data: [],
+ // 鏍囬
+ column: [
+ {
+ minWidth: 120,
+ prop: 'projectName',
+ label: '椤圭洰鍚嶇О',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: 100,
+ prop: 'contractNo',
+ label: '鍚堝悓鍙�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: 120,
+ prop: 'orderTime',
+ label: '鎺ュ崟鏃ユ湡',
+ sort: true,
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'date',
+ format: (row,columnValue)=> this.formatDate(row,columnValue)
+ },
+ {
+ minWidth: 120,
+ prop: 'customerName',
+ label: '瀹㈡埛鍚嶇О',
+ isTrue: true,
+ searchInfoType: 'text',
+ isSearch: true,
+ },
+ {
+ minWidth: 120,
+ prop: 'deliveryDate',
+ label: '浜よ揣鏃ユ湡',
+ isTrue: true,
+ sort: true,
+ isSearch: true,
+ searchInfoType: 'date',
+ format: (row,columnValue)=> this.formatDate(row,columnValue)
+ },
+ {
+ minWidth: 120,
+ prop: 'productType',
+ label: '浜у搧绫诲瀷',
+ isTrue: true,
+ searchInfoType: 'text',
+ isSearch: true,
+ },
+ {
+ minWidth: 120,
+ prop: 'product',
+ label: '浜у搧鍚�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ render: { fun: this.handleClickCell }
+ },
+ {
+ minWidth: 120,
+ prop: 'status',
+ label: '褰撳墠鐘舵��',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'select',
+ optList: ()=>{
+ return [
+ { label: '鏂囦欢绛惧彂', value: '鏂囦欢绛惧彂' },
+ { label: '涓嬭揪鐗╂枡闇�姹�', value: '涓嬭揪鐗╂枡闇�姹�' },
+ { label: '閲囪喘璇环+鍚堝悓绛捐', value: '閲囪喘璇环+鍚堝悓绛捐' },
+ { label: '鐗╂枡閲囪喘鍒拌揣', value: '鐗╂枡閲囪喘鍒拌揣' },
+ { label: '鐗╂枡鍒拌揣妫�楠�', value: '鐗╂枡鍒拌揣妫�楠�' },
+ { label: '棰嗘枡銆佽绠卞叆搴�', value: '棰嗘枡銆佽绠卞叆搴�' },
+ ]
+ }
+ },
+ {
+ minWidth: 120,
+ prop: 'time',
+ label: '涓存湡鏃堕棿',
+ isTrue: true,
+ sort: true,
+ isSearch: true,
+ searchInfoType: 'date',
+ format: (row,columnValue)=> this.formatDate(row,columnValue)
+ },
+ {
+ minWidth: 120,
+ prop: 'specs',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ label: '瑙勬牸鍨嬪彿',
+ },
+ {
+ minWidth: 120,
+ prop: 'unit',
+ label: '鍗曚綅',
+ searchInfoType: 'text',
+ isTrue: true,
+ isSearch: true,
+ },
+ {
+ minWidth: 120,
+ prop: 'number',
+ label: '鏁伴噺',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: 120,
+ prop: 'productionStatus',
+ label: '鐢熶骇鎯呭喌',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: 120,
+ prop: 'productionRoutine',
+ label: '鐢熶骇绋嬪害',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: 120,
+ prop: 'projectLeader',
+ label: '椤圭洰璐熻矗浜�',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ },
+ {
+ minWidth: 150,
+ prop: 'remark',
+ label: '澶囨敞',
+ isTrue: true,
+ isSearch: true,
+ searchInfoType: 'text',
+ }
+ ],
+ toolbar: [],
+ operator: null,
+ operatorConfig: {
+ fixed: 'right',
+ label: '鎿嶄綔',
+ width: 100,
+ minWidth: 100
+ }
+ },
dropdownTitleStyle: {
color: '#E84738',
fontWeight: 'bold'
@@ -224,285 +352,9 @@
dialogVisible: false,
scheduleList: [],
scheduleEditList: [],
- typeOptions: [],
multipleSelection: [],
loading: true,
- tableData: [],
- finishedTableData: [],
- page: {
- total: 0,
- currentPage: 1,
- pageSize: 10,
- pagerCount: 5
- },
- finishedPage: {
- total: 0,
- currentPage: 1,
- pageSize: 10,
- pagerCount: 5
- },
- option: {
- defaultSort:{
- prop:'id',
- order:'descending'
- },
- height: 530,
- selection: true,
- columnBtn: false,
- index: true,
- indexFixed: false,
- selectionFixed: false,
- rowKey: 'mid',
- indexLabel: '搴忓彿',
- menuAlign: 'center',
- menuWidth: 130,
- editBtn: false,
- delBtn: false,
- addBtn: false,
- border: true,
- align: 'center',
- column: [
- {
- minWidth: 120,
- prop: 'projectName',
- label: '椤圭洰鍚嶇О',
- overHidden: true,
- },
- {
- minWidth: 100,
- prop: 'contractNo',
- label: '鍚堝悓鍙�',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'orderTime',
- label: '鎺ュ崟鏃ユ湡',
- overHidden: true,
- formatter: (row,columnValue)=> this.formatDate(row,columnValue)
- },
- {
- minWidth: 120,
- prop: 'customerName',
- label: '瀹㈡埛鍚嶇О',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'deliveryDate',
- label: '浜よ揣鏃ユ湡',
- overHidden: true,
- formatter: (row,columnValue)=> this.formatDate(row,columnValue)
- },
- {
- minWidth: 120,
- prop: 'productType',
- label: '浜у搧绫诲瀷',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'product',
- label: '浜у搧鍚�',
- overHidden: true,
- slot: true
- },
- {
- minWidth: 120,
- prop: 'status',
- label: '褰撳墠鐘舵��',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'time',
- label: '涓存湡鏃堕棿',
- overHidden: true,
- formatter: (row,columnValue)=> this.formatDate(row,columnValue)
- },
- {
- minWidth: 120,
- prop: 'specs',
- label: '瑙勬牸鍨嬪彿',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'unit',
- label: '鍗曚綅',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'number',
- label: '鏁伴噺',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'productionStatus',
- label: '鐢熶骇鎯呭喌',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'productionRoutine',
- label: '鐢熶骇绋嬪害',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'projectLeader',
- label: '椤圭洰璐熻矗浜�',
- overHidden: true,
- },
- {
- minWidth: 150,
- prop: 'remark',
- label: '澶囨敞',
- overHidden: true,
- }
- ],
- },
- finishedOption: {
- refreshBtn: false, // 鏄惁鏄剧ず鍒锋柊鎸夐挳
- defaultSort:{
- prop:'id',
- order:'descending'
- },
- height: 230,
- selection: true,
- columnBtn: false,
- index: true,
- indexFixed: false,
- selectionFixed: false,
- rowKey: 'mid',
- indexLabel: '搴忓彿',
- menu: false,
- menuAlign: 'center',
- menuWidth: 130,
- editBtn: false,
- delBtn: false,
- addBtn: false,
- border: true,
- align: 'center',
- column: [
- {
- minWidth: 120,
- prop: 'projectName',
- label: '椤圭洰鍚嶇О',
- overHidden: true,
- },
- {
- minWidth: 100,
- prop: 'contractNo',
- label: '鍚堝悓鍙�',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'orderTime',
- label: '鎺ュ崟鏃ユ湡',
- overHidden: true,
- formatter: (row,columnValue)=> this.formatDate(row,columnValue)
- },
- {
- minWidth: 120,
- prop: 'customerName',
- label: '瀹㈡埛鍚嶇О',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'deliveryDate',
- label: '浜よ揣鏃ユ湡',
- overHidden: true,
- formatter: (row,columnValue)=> this.formatDate(row,columnValue)
- },
- {
- minWidth: 120,
- prop: 'productType',
- label: '浜у搧绫诲瀷',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'product',
- label: '浜у搧鍚�',
- overHidden: true,
- slot: true
- },
- {
- minWidth: 120,
- prop: 'specs',
- label: '瑙勬牸鍨嬪彿',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'unit',
- label: '鍗曚綅',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'number',
- label: '鏁伴噺',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'productionStatus',
- label: '鐢熶骇鎯呭喌',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'productionRoutine',
- label: '鐢熶骇绋嬪害',
- overHidden: true,
- },
- {
- minWidth: 120,
- prop: 'projectLeader',
- label: '椤圭洰璐熻矗浜�',
- overHidden: true,
- },
- {
- minWidth: 150,
- prop: 'remark',
- label: '澶囨敞',
- overHidden: true,
- }
- ],
- },
- spanArr: [{
- prop: 'id',
- span: []
- },{
- prop: 'projectName',
- span: []
- }, {
- prop: 'contractNo',
- span: []
- },
- {
- prop: 'orderTime',
- span: []
- },
- {
- prop: 'customerName',
- span: []
- },
- {
- prop: 'deliveryDate',
- span: []
- },
- {
- prop: 'productType',
- span: []
- },
- ],
+ spanArr: ['id','projectName', 'contractNo','orderTime','customerName','deliveryDate','productType'],
}
},
components: {
@@ -512,19 +364,8 @@
...mapGetters(['permissions']),
},
created(){
- if(!this.permissions.plan_productionschedul_edit && !this.permissions.plan_productionschedul_del){
- this.option.menu = false
- }
+ this.showOperator()
this.loading = true
- this.getUnFinishedData()
- this.getFinishedData()
- this.getParamType()
- // this.rowSort()
- this.rowCalc()
- },
- beforeUpdate() {
- // this.rowSort()
- this.rowCalc()
},
watch:{
editDialogVisible(newVal){
@@ -542,25 +383,73 @@
}
}
},
- mounted() {},
- beforeDestroy() {},
methods: {
- handleClickCell(row, column, cell, event){
- if(column.label === '浜у搧鍚�'){
- this.getScheduleById(row.mid)
- this.showTimeLineDialog = true
+ getProductionSchedulStaffDict(){
+ const _than = this
+ remote('productionschedul_staff').then((response) => {
+ if (response.status === 200) {
+ response.data.data.map((ele)=>{
+ _than.productionSchedulStaffOptions.push(ele.value)
+ })
+ } else {
+ _than.productionSchedulStaffOptions = []
+ }
+ })
+ },
+ showOperator(){
+ if(this.showUnDownTable){
+ if(this.permissions.plan_productionschedul_edit){
+ this.table.operator = [{
+ text: '缂栬緫',
+ type: 'text',
+ size: 'small',
+ fun: this.editHandle
+ }]
+ }
+ if(this.permissions.plan_productionschedul_del){
+ if(this.table.operator == null){
+ this.table.operator = [{
+ text: '鍒犻櫎',
+ type: 'text',
+ size: 'small',
+ fun: this.deleteHandle
+ }]
+ }else{
+ this.table.operator.push({
+ text: '鍒犻櫎',
+ type: 'text',
+ size: 'small',
+ fun: this.deleteHandle
+ })
+ }
+ }
+ }else{
+ this.table.operator = null
}
},
+ handleClickCell(row){
+ this.getScheduleById(row.mid)
+ this.showTimeLineDialog = true
+ },
changeTable(command){
+ const _than = this
if(command === 'undone'){
this.dropdownTitle = '寰呭畬鎴愯皟搴�'
this.dropdownTitleStyle = {color:'#E84738',fontWeight: 'bold'}
this.showUnDownTable = true
+ this.queryParams.state = false
+
}else if(command === 'done'){
this.dropdownTitle = '宸插畬鎴愯皟搴�'
this.dropdownTitleStyle = {color:'#34BD66',fontWeight: 'bold'}
this.showUnDownTable = false
+ this.table.operator = null
+ this.queryParams.state = true
}
+ this.$nextTick(()=>{
+ _than.showOperator()
+ _than.getDataList()
+ })
},
tagFinished(){
if(this.multipleSelection.length < 1){
@@ -647,8 +536,8 @@
}else{
_than.$message.error("鏇存柊澶辫触")
}
- // _than.getScheduleById(orderObj.id)
_than.dialogVisible = false
+ _than.getDataList()
}).catch(error=>{
console.error(error);
})
@@ -703,20 +592,6 @@
},
selectionRow(val){
this.multipleSelection = val
- // if(this.multipleSelection.length>0){
- // this.getScheduleById(val[val.length-1].mid)
- // this.showTimeLineDialog = true
- // }
- },
- selectionFinishedRow(val){
- if (val.length > 1) {
- const preVal = val.shift();
- this.$refs.finished.toggleRowSelection(preVal, false);
- }
- else{
- this.scheduleList=[]
- }
- this.getScheduleById(val[0].mid)
},
formatDate(row, cellValue){
if (cellValue) {
@@ -727,55 +602,9 @@
}
return ''
},
- handleSizeChange(val){
- if(val){
- this.page.pageSize=val
- this.getUnFinishedData()
- }
- },
- handleCurrentChange(val){
- if(val){
- this.page.currentPage=val
- this.getUnFinishedData()
- }
- },
// 鑾峰彇鏁版嵁鍒楄〃
getDataList(){
- this.getUnFinishedData()
- this.getFinishedData()
- this.$nextTick(()=>{
- this.rowCalc()
- })
- },
- getUnFinishedData() {
- this.loading = true
- let param = {
- size: this.page.pageSize,
- current: this.page.currentPage,
- state: false
- }
- fetchScheduleList(param).then((res) => {
- this.tableData = res.data.data.records
- this.page.total = res.data.data.total
- this.page.currentPage = res.data.data.records.pages
- this.scheduleList = []
- })
- this.loading = false
- },
- getFinishedData() {
- this.loading = true
- let param = {
- size: this.finishedPage.pageSize,
- current: this.finishedPage.currentPage,
- state: true
- }
- fetchScheduleList(param).then((res) => {
- this.finishedTableData = res.data.data.records
- this.finishedPage.total = res.data.data.total
- this.finishedPage.currentPage = res.data.data.records.pages
- this.scheduleList = []
- })
- this.loading = false
+ this.$refs.ttable.getDataList()
},
// 鍒犻櫎
deleteHandle(row,index) {
@@ -795,70 +624,6 @@
})
})
},
- //鍔ㄦ�佸悎骞舵柟娉�
- rowCalc() {
- this.spanArr.forEach((ele, index) => {
- let parent
- if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span
- ele.span = this.rowSpan(ele.prop, parent)
- })
- },
- rowSort() {
- let propList = this.spanArr.map(ele => ele.prop)
- this.spanArr.forEach((ele, index) => {
- let key = ele.prop
- this.tableData = this.tableData.sort((a, b) => {
- let flag = true;
- for (let i = 0; i < index; i++) {
- let prop = this.spanArr[i].prop
- flag = flag && a[prop] == b[prop]
- }
- if (flag) {
- if (a[key] < b[key]) { return 1; }
- else if (a[key] > b[key]) { return -1; }
- return 0;
- }
- return 0;
- })
- })
- },
- rowSpan(key, parent) {
- let list = [];
- let position = 0;
- this.tableData.forEach((item, index) => {
- if (index === 0) {
- list.push(1)
- let position = 0;
- } else {
- if (this.tableData[index][key] === this.tableData[index - 1][key]) {
- if (parent && parent[index] !== 0) {
- list.push(1)
- position = index
- } else {
- list[position] += 1;
- list.push(0)
- }
- } else {
- list.push(1)
- position = index
- }
- }
- })
- return list
- },
- spanMethod({ row, column, rowIndex, columnIndex }) {
- for (let i = 0; i < this.spanArr.length; i++) {
- const ele = this.spanArr[i]
- if (column.property == ele.prop) {
- const _row = ele.span[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- }
- }
- }
- }
}
}
</script>
--
Gitblit v1.9.3