Quellcode durchsuchen

add:许可证列表

liujiayin vor 2 Jahren
Ursprung
Commit
15a9b5e27f
1 geänderte Dateien mit 107 neuen und 29 gelöschten Zeilen
  1. 107 29
      src/views/system/licence/indexCopy.vue

+ 107 - 29
src/views/system/licence/indexCopy.vue

@@ -1,36 +1,57 @@
 <template>
-    <ibps-crud
-        ref="crud"
-        :height="tableHeight"
-        :data="listData"
-        :toolbars="listConfig.toolbars"
-        :search-form="listConfig.searchForm"
-        :pk-key="pkKey"
-        :columns="listConfig.columns"
-        :pagination="pagination"
-        :loading="loading"
-        style="width:100%;"
-        @action-event="handleAction"
-        @pagination-change="handlePaginationChange"
-    />
+    <ibps-container
+        type="full"
+        header-background-color
+        class="licence"
+    >
+        <ibps-crud
+            ref="crud"
+            display-field="系统许可证"
+            :height="tableHeight"
+            :data="listData"
+            :toolbars="listConfig.toolbars"
+            :pk-key="pkKey"
+            :columns="listConfig.columns"
+            :pagination="pagination"
+            :row-handle="rowHandle"
+            :loading="loading"
+            style="width:100%;"
+            @action-event="handleAction"
+            @pagination-change="handlePaginationChange"
+        />
+        <update-licence
+            :visible="licenceFormVisible"
+            :username="account1"
+            @close="visible => licenceFormVisible = visible"
+        />
+    </ibps-container>
+
 </template>
 <script>
-
+import ActionUtils from '@/utils/action'
 export default {
     components: {
         updateLicence: () => import('@/views/system/licence/update')
     },
+    props: {
+        height: {
+            type: String,
+            default: '400px'
+        }
+    },
     data () {
         const { account = '', licence = {}} = this.$store.getters
         return {
             licenceFormVisible: false,
-            account,
+            account1:'',
             licence,
+            pkKey: 'id', // 主键  如果主键不是pk需要传主键
             status: {
                 success: '正常',
                 warning: '即将到期',
                 danger: '过期'
             },
+            loading: false,
             listConfig: {
                 // 工具栏
                 toolbars: [
@@ -49,26 +70,47 @@ export default {
                 // 表格字段配置
                 columns: [
                     { prop: 'isTrialVersion', label: '许可证信息' },
-                    { prop: 'customerInfo', label: '单位名称' },
-                    { prop: 'issuedTime', label: '发布时间' },
-                    { prop: 'notBefore', label: '生效时间' },
-                    { prop: 'notAfter', label: '失效时间' },
-                    { prop: 'reminderDays', label: '到期提醒天数' },
+                    { prop: 'customerInfo', label: '单位名称', minWidth: 200 },
+                    { prop: 'issuedTime', label: '发布时间', width: 120 },
+                    { prop: 'notBefore', label: '生效时间', width: 120 },
+                    { prop: 'notAfter', label: '失效时间', width: 120 },
+                    { prop: 'reminderDays', label: '到期提醒天数', width: 120 },
                     { prop: 'status', label: '状态' }
                 ]
             },
             listData: [
                 {
-                    isTrialVersion:'许可证信息', 
-                    customerInfo:'单位名称', 
-                    issuedTime:'发布时间', 
-                    notBefore:'生效时间', 
-                    notAfter:'失效时间', 
-                    reminderDays:'到期提醒天数', 
-                    status:'状态'
+                    id: '1',
+                    isTrialVersion: '许可证信息',
+                    customerInfo: '单位名称',
+                    issuedTime: '2024-01-01',
+                    notBefore: '2024-01-01',
+                    notAfter: '2024-01-01',
+                    reminderDays: '到期提醒天数',
+                    status: '状态'
                 }
             ],
             pagination: {},
+            rowHandle: {
+                actions: [
+                    {
+                        $index: 1,
+                        key: 'edit',
+                        button_type: 'detail',
+                        label: '更新',
+                        icon: 'ibps-icon-edit',
+                        type: 'primary',
+                        deflow: null,
+                        isEditOnHis: false,
+                        initAddDataCont: null,
+                        disabled: false,
+                        hidden: false,
+                        position: 'manage'
+                    }
+                ],
+                effect: 'display'
+
+            }
         }
     },
     computed: {
@@ -84,17 +126,53 @@ export default {
                 return 'warning'
             }
             return 'success'
+        },
+        tableHeight () {
+            const h = this.height.substr(0, this.height.length - 2)
+            return parseInt(h) - 10
         }
     },
     mounted () {
-        console.log(this.licence)
+        this.loadData()
     },
     methods: {
+        loadData () {
+            console.log('91 this.licence', this.licence)
+        },
         handUpdate () {
             this.licenceFormVisible = true
         },
         transformDate (v) {
             return v ? new Date(v).toLocaleString('zh-CN', { hour12: false }).replace(/\//g, '-') : ''
+        },
+        /**
+     * 处理按钮事件
+     */
+        handleAction (command, position, selection, data) {
+            switch (command) {
+                case 'search':// 查询
+                    ActionUtils.setFirstPagination(this.pagination)
+                    this.search()
+                    break
+                case 'edit':// 编辑许可证信息
+                    this.editLicence()
+                    break
+                default:
+                    break
+            }
+        },
+        /**
+         * 处理分页事件
+         */
+        handlePaginationChange (page) {
+            ActionUtils.setPagination(this.pagination, page)
+            this.loadData()
+        },
+        search () {
+
+        },
+        editLicence () {
+            this.licenceFormVisible = true
         }
     }
 }