Browse Source

【接口看板】更换AG可行性开发暂存

faster_AG_grid
安虹睿 1 year ago
parent
commit
ea783b8a6d
  1. 27
      PC/InterFace.Dash/src/components/AGTable/agGridBtn.vue
  2. 42
      PC/InterFace.Dash/src/components/AGTable/btnControls.js
  3. 10
      PC/InterFace.Dash/src/components/AGTable/index.vue
  4. 1
      PC/InterFace.Dash/src/components/tablePagination/index.vue

27
PC/InterFace.Dash/src/components/AGTable/agGridBtn.vue

@ -1,23 +1,42 @@
<template> <template>
<div> <div>
<el-button @click="clickHandle('edit')" size="small" type="text">编辑</el-button> <el-button
<el-button @click="clickHandle('delete')" size="small" type="text">删除</el-button> v-if="!item.hide"
v-for="(item,index) in buttons"
:key="index"
@click="clickHandle(item)"
:size="item.size"
:type="item.type"
:style="'color:'+item.color"
>{{item.label}}</el-button>
</div> </div>
</template> </template>
<script> <script>
import AGTableBttons from "@/components/AGTable/btnControls.js"
export default { export default {
data() { data() {
return { return {
propsInit:null,//
buttons:[
AGTableBttons.tableEditBtn,
AGTableBttons.tableDeleteBtn,
],
cellValue:null cellValue:null
}; };
}, },
mounted(){ mounted(){
console.log(16,this.params.api.getRowNode(2)) this.propsInit = this.params.colDef.cellRendererParams
console.log(33,this.propsInit.currency)
this.cellValue = this.params.data; this.cellValue = this.params.data;
}, },
methods:{ methods:{
clickHandle(data){ clickHandle(data){
console.log(data,this.cellValue) if(data.name == 'delete'){
AGTableBttons.deleteHandle(()=>{
console.log(33,this.cellValue)
})
}
// console.log(data,this.cellValue)
}, },
// getValueToDisplay(params) { // getValueToDisplay(params) {
// return this.params.api.getRowNode(params.rowIndex).data // return this.params.api.getRowNode(params.rowIndex).data

42
PC/InterFace.Dash/src/components/AGTable/btnControls.js

@ -0,0 +1,42 @@
// 页面基础按钮样式
import i18n from "@/lang"
import { MessageBox } from 'element-ui';
// 编辑按钮
const tableEditBtn= {
type: "text",
icon: "el-icon-edit",
label: i18n.t('btns.edit'),
name: "edit",
size: "small",
color: "#ff9000",
}
// 删除按钮
const tableDeleteBtn= {
type: "text",
icon: "el-icon-delete",
label: i18n.t('btns.delete'),
name: "delete",
size: "small",
color: "red",
}
const deleteHandle = (callback) => {
MessageBox.confirm('您确定删除吗, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 确定操作
if(callback)callback()
}).catch(() => {
//取消操作
});
}
export default {
tableEditBtn,
tableDeleteBtn,
deleteHandle
}

10
PC/InterFace.Dash/src/components/AGTable/index.vue

@ -22,6 +22,11 @@ export default {
agGridBtn agGridBtn
}, },
props:{ props:{
//
agGridBtnName:{
type: String,
default:'agGridBtn'
},
// app-main100% // app-main100%
setUTableHeight: { setUTableHeight: {
type: Number, type: Number,
@ -58,7 +63,10 @@ export default {
{ {
field:'操作', field:'操作',
lockPosition: 'left', lockPosition: 'left',
cellRenderer: 'agGridBtn', cellRenderer: this.agGridBtnName,
cellRendererParams: {
currency: 'EUREUREUREUREUREUR'
},
cellClass: 'locked-col', cellClass: 'locked-col',
width: 120, width: 120,
suppressNavigable: true, suppressNavigable: true,

1
PC/InterFace.Dash/src/components/tablePagination/index.vue

@ -45,6 +45,7 @@
<AGTable <AGTable
ref="tablePaginationTableRef" ref="tablePaginationTableRef"
:setUTableHeight="uTableTopHeight" :setUTableHeight="uTableTopHeight"
:agGridBtnName="'agGridBtn'"
></AGTable> ></AGTable>
<!-- <umyTable <!-- <umyTable
:isUpdate="isUpdate" :isUpdate="isUpdate"

Loading…
Cancel
Save