| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281 | 
							- <template>
 
-   <div>
 
-         <div class="table-operator">
 
-           <a-button type="primary" icon="plus" @click="handleAddGraphRepoart">新增</a-button>
 
-           <a-popconfirm v-if="selectedRowKeys.length" :title="'确定要删除这'+selectedRowKeys.length+'项吗?'" @confirm="() => handleRemoveGraphRepoart()">
 
-             <a-button icon="minus" >删除</a-button>
 
-           </a-popconfirm>
 
-         </div>
 
-         <a-table
 
-           size="middle"
 
-           bordered
 
-           :rowKey="(record, index) => index"
 
-           :columns="columns"
 
-           :data-source="tableData_"
 
-           :pagination="false"
 
-           :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
 
-           :scroll="getScroll"
 
-         >
 
-           <template v-for="(col,i) in scopedSlots" :slot="col.name" slot-scope="text, record">
 
-               <div v-if="col.type === 'text'" :key="i" >
 
-                 <a-input
 
-                   :key="i"
 
-                   style="margin: -5px 0"
 
-                   v-model="record[col.name]"
 
-                 />
 
-               </div>
 
-               <div v-else-if="col.type === 'number'" :key="i" >
 
-                 <a-input
 
-                   :key="i"
 
-                   type="number"
 
-                   style="margin: -5px 0"
 
-                   v-model="record[col.name]"
 
-                 />
 
-               </div>
 
-               <div v-else-if="col.type === 'select'" :key="i" >
 
-                 <j-dict-select-tag
 
-                   :key="i"
 
-                   style="margin: -5px 0"
 
-                   :dict-code="col.dictCode"
 
-                   v-model="record[col.name]"
 
-                 >
 
-                 </j-dict-select-tag>
 
-               </div>
 
-               <div v-else-if="col.type === 'check'" :key="i" >
 
-                 <a-checkbox style="margin: -5px 0" :key="i" :checked="record[col.name]?true:false" @change="checkboxChange(record,col.name)"></a-checkbox>
 
-               </div>
 
-               <div v-else-if="col.type === 'JInputPop'" :key="i" >
 
-                 <j-input-pop style="margin: -5px 0" :key="i" v-model="record[col.name]"></j-input-pop>
 
-               </div>
 
-               <div v-else-if="col.type === 'JCodeEditorPop'" :key="i" >
 
-                 <j-code-editor-pop :key="i" v-model="record[col.name]"></j-code-editor-pop>
 
-               </div>
 
-           </template>
 
-         </a-table>
 
-   </div>
 
- </template>
 
- <script>
 
- import JInputPop from '@/components/jeecg/minipop/JInputPop'
 
- import JCodeEditorPop from '@/components/jeecg/minipop/JCodeEditorPop'
 
- export default {
 
-   name: 'ConfigTable',
 
-   components: {
 
-     JInputPop,
 
-     JCodeEditorPop
 
-   },
 
-   props: {
 
-     tableData: {
 
-       type: Array,
 
-       default: []
 
-     },
 
-     extendData: {
 
-       type: Object,
 
-       default: {}
 
-     }
 
-   },
 
-   data() {
 
-     return {
 
-       selectedRowKeys: [],
 
-       columns: [
 
-         {
 
-           title: '#',
 
-           dataIndex: '',
 
-           key: 'rowIndex',
 
-           width: 60,
 
-           align: 'center',
 
-           customRender: function(t, r, index) {
 
-             return parseInt(index) + 1
 
-           }
 
-         },
 
-         {
 
-           title: '字段名',
 
-           align: 'center',
 
-           dataIndex: 'fieldName',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'fieldName' }
 
-         },
 
-         {
 
-           title: '字段文本',
 
-           align: 'center',
 
-           dataIndex: 'fieldTxt',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'fieldTxt' }
 
-         },
 
-         {
 
-           title: '排序',
 
-           align: 'center',
 
-           dataIndex: 'orderNum',
 
-           width: 80,
 
-           scopedSlots: { customRender: 'orderNum' }
 
-         },
 
-         {
 
-           title: '字段类型',
 
-           align: 'center',
 
-           dataIndex: 'fieldType',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'fieldType' }
 
-         },
 
-         {
 
-           title: '控件宽度',
 
-           align: 'center',
 
-           dataIndex: 'fieldWidth',
 
-           width: 80,
 
-           scopedSlots: { customRender: 'fieldWidth' }
 
-         },
 
-         {
 
-           title: '是否显示',
 
-           align: 'center',
 
-           dataIndex: 'isShow',
 
-           width: 80,
 
-           scopedSlots: { customRender: 'isShow' }
 
-         },
 
-         {
 
-           title: '计算总计',
 
-           align: 'center',
 
-           dataIndex: 'isTotal',
 
-           width: 80,
 
-           scopedSlots: { customRender: 'isTotal' }
 
-         },
 
-         {
 
-           title: '是否查询',
 
-           align: 'center',
 
-           dataIndex: 'searchFlag',
 
-           width: 80,
 
-           scopedSlots: { customRender: 'searchFlag' }
 
-         },
 
-         {
 
-           title: '查询模式',
 
-           align: 'center',
 
-           dataIndex: 'searchMode',
 
-           width: 150,
 
-           scopedSlots: { customRender: 'searchMode' }
 
-         },
 
-         {
 
-           title: '字典CODE',
 
-           align: 'center',
 
-           dataIndex: 'dictCode',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'dictCode' }
 
-         },
 
-         {
 
-           title: '表达式',
 
-           align: 'center',
 
-           dataIndex: 'func',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'func' }
 
-         },
 
-         {
 
-           title: '表达式参数',
 
-           align: 'center',
 
-           dataIndex: 'funcParam',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'funcParam' }
 
-         },
 
-         {
 
-           title: '聚合类型',
 
-           align: 'center',
 
-           dataIndex: 'aggregateType',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'aggregateType' }
 
-         },
 
-         {
 
-           title: 'JS增强',
 
-           align: 'center',
 
-           dataIndex: 'jsEnhance',
 
-           width: 120,
 
-           scopedSlots: { customRender: 'jsEnhance' }
 
-         }
 
-       ],
 
-       scopedSlots: [
 
-         { type: 'text', name: 'fieldName' },
 
-         { type: 'text', name: 'fieldTxt' },
 
-         { type: 'text', name: 'dictCode' },
 
-         { type: 'number', name: 'orderNum' },
 
-         { type: 'select', name: 'fieldType', dictCode: 'field_type' },
 
-         { type: 'select', name: 'searchMode', dictCode: 'search_mode' },
 
-         { type: 'check', name: 'isShow' },
 
-         { type: 'check', name: 'isTotal' },
 
-         { type: 'check', name: 'searchFlag' },
 
-         { type: 'JInputPop', name: 'func' },
 
-         { type: 'JInputPop', name: 'funcParam' },
 
-         { type: 'select', name: 'aggregateType', dictCode: 'aggregate_type' },
 
-         { type: 'JCodeEditorPop', name: 'jsEnhance' },
 
-         { type: 'number', name: 'fieldWidth' }
 
-       ],
 
-       newTableData: {
 
-         'id': '',
 
-         'fieldName': '',
 
-         'fieldTxt': '',
 
-         'isShow': 1,
 
-         'isTotal': 0,
 
-         'searchFlag': 0,
 
-         'searchMode': null,
 
-         'dictCode': '',
 
-         'fieldHref': null,
 
-         'fieldType': 'String',
 
-         'orderNum': 1,
 
-         'replaceVal': null,
 
-         'createBy': '',
 
-         'createTime': '',
 
-         'updateBy': null,
 
-         'updateTime': null,
 
-         'func': null,
 
-         'funcParam': null,
 
-         'aggregateType': null
 
-       },
 
-       tableData_: JSON.parse(JSON.stringify(this.tableData))
 
-     }
 
-   },
 
-   computed: {
 
-     getScroll() {
 
-       if (this.tableData_.length >= 5) {
 
-         return { y: 200, x: 1600 }
 
-       } else {
 
-         return { x: 1600 }
 
-       }
 
-     }
 
-   },
 
-   methods: {
 
-     handleAddGraphRepoart(addData) { // 新增
 
-       let newData = JSON.parse(JSON.stringify(this.newTableData))
 
-       if (addData) {
 
-         newData = Object.assign(newData, this.extendData, addData)
 
-       } else {
 
-         newData = Object.assign(newData, this.extendData)
 
-       }
 
-       const length_ = this.tableData_.length
 
-       if (length_ !== 0) {
 
-         newData.orderNum = this.tableData_[length_ - 1]['orderNum'] + 1
 
-       }
 
-       this.tableData_.push(newData)
 
-       // this.$emit('add', newData)
 
-     },
 
-     clearTableData() {
 
-       this.tableData_ = []
 
-     },
 
-     onSelectChange(selectedRowKeys) {
 
-       this.selectedRowKeys = selectedRowKeys
 
-     },
 
-     checkboxChange(data, name) {
 
-       if (data[name]) {
 
-         data[name] = 0
 
-       } else {
 
-         data[name] = 1
 
-       }
 
-     },
 
-     handleRemoveGraphRepoart() { // 删除
 
-       var that = this
 
-       this.selectedRowKeys.sort(function(a, b) { return b - a })
 
-       this.selectedRowKeys.forEach(function(index) {
 
-         that.tableData_.splice(index, 1)
 
-       })
 
-       // this.$emit('del', this.selectedRowKeys)
 
-       this.selectedRowKeys = []
 
-     },
 
-     getTableData() {
 
-       return JSON.parse(JSON.stringify(this.tableData_))
 
-     }
 
-   }
 
- }
 
- </script>
 
 
  |