123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <s-table
- size="middle"
- bordered
- row-key="id"
- :columns="columns"
- :data="loadData_"
- >
- <!-- <template slot="graphType" slot-scope="text, record">
- <div v-if="text">
- <template v-for="(t,i) in getGraphType(text)">
- <a-tag color="cyan" :key="i">{{t}}</a-tag>
- </template>
- </div>
- </template> -->
- <template slot="action" slot-scope="text, record">
- <a @click="handleAdd(record)" :disabled="layoutCodes.indexOf(record.code)>=0">添加</a>
- <!-- <a-divider type="vertical" />
- <a @click="handleDel(record)" >移除</a> -->
- </template>
- </s-table>
- </template>
- <script>
- import STable from '@/components/Xtable'
- import { getAction } from '@/api/manage'
- // 引入相关的依赖
- export default {
- name: 'ChartList',
- components: {
- STable
- },
- props: {
- layout: {
- type: Array,
- default: () => []
- }
- },
- watch: {
- 'layout.length': {
- handler(newValue, oldValue) {
- this.layoutCodes = []
- this.layout.forEach(item => {
- this.layoutCodes.push(item.data.code)
- })
- }
- }
- },
- data() {
- return {
- queryParam: {},
- graphTypeDictOptions: {
- bar: '柱状图',
- line: '曲线图',
- pie: '饼图',
- transverseBarMuiltid: '条形图',
- radar: '雷达图',
- funnel: '漏斗图',
- table: '数据表格'
- },
- columns: [
- {
- title: '#',
- dataIndex: '',
- key: 'rowIndex',
- width: 60,
- align: 'center',
- customRender: function(t, r, index) {
- return parseInt(index) + 1
- }
- },
- {
- title: '图表名称',
- align: 'center',
- dataIndex: 'name'
- },
- {
- title: '编码',
- align: 'center',
- dataIndex: 'code'
- },
- {
- title: '图表类型',
- align: 'center',
- dataIndex: 'graphType',
- scopedSlots: { customRender: 'graphType' }
- },
- {
- title: '操作',
- dataIndex: 'action',
- align: 'center',
- scopedSlots: { customRender: 'action' }
- }
- ],
- url: {
- list: '/diagram/diagramConfiguration/list'
- },
- layoutCodes: [],
- loadData_: parameter => {
- return getAction(this.url.list, Object.assign(parameter, this.queryParam)).then(res => {
- return res.result
- })
- }
- }
- },
- methods: {
- handleDel(data) {
- this.$emit('delete', data.i)
- },
- handleAdd(data) {
- this.$emit('add', {
- code: data.code,
- title: data.name,
- url: '/online/cggraphreport/chart/' + data.code,
- comp: 'OnlGraphreportAutoChart'
- })
- },
- getGraphType(graphTypes) {
- if (graphTypes) {
- var arry = []
- graphTypes.split(',').forEach(item => {
- this.graphTypeDictOptions[item] ? arry.push(this.graphTypeDictOptions[item]) : ''
- })
- return arry
- } else {
- return []
- }
- }
- },
- mounted() {
- this.layout.forEach(item => {
- this.layoutCodes.push(item.code)
- })
- }
- }
- </script>
- <style scoped>
- </style>
|