车辆管理系统-后台管理系统web
spring
4 天以前 9a11bff3d98aea29f37abc34a00a17f5c92ade9c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<template>
  <div class="divBox">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <div class="container">
          <el-form inline size="small" @submit.native.prevent>
            <el-form-item label="关键字">
              <el-input v-model="listPram.keywords" placeholder="请输入id,名称,描述" clearable class="selWidth" size="small">
                <el-button slot="append" icon="el-icon-search" size="small" @click="handlerSearch" />
              </el-input>
            </el-form-item>
            <el-form-item v-if="selectModel">
              <el-button type="primary" :disabled="!selectedConfigData.id" @click="handlerConfimSelect">确定选择</el-button>
            </el-form-item>
          </el-form>
        </div>
        <el-button size="mini" type="primary" @click="handlerEditData({},0)" v-if="!selectModel" v-hasPermi="['admin:system:form:save']">创建表单</el-button>
      </div>
      <el-table
        :data="dataList.list"
        :highlight-current-row="selectModel"
        size="mini"
        class="table"
        @current-change="handleCurrentRowChange"
        :header-cell-style=" {fontWeight:'bold'}"
      >
        <el-table-column label="ID" prop="id" width="80"/>
        <el-table-column label="名称" prop="name" min-width="180"/>
        <el-table-column label="描述" prop="info" min-width="220"/>
        <el-table-column label="更新时间" prop="updateTime" min-width="200" />
        <el-table-column v-if="!selectModel" label="操作" min-width="80" fixed="right">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="handlerEditData(scope.row,1)" v-hasPermi="['admin:system:form:info']">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="listPram.page"
        :page-sizes="constants.page.limit"
        :layout="constants.page.layout"
        :total="dataList.total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>
    <el-dialog
      :visible.sync="editDialogConfig.visible"
      fullscreen
      :title="editDialogConfig.isCreate === 0? '创建表单':'编辑表单'"
      destroy-on-close
      :close-on-click-modal="false"
    >
      <edit
        v-if="editDialogConfig.visible"
        :is-create="editDialogConfig.isCreate"
        :edit-data="editDialogConfig.editData"
        @hideDialog="handlerHide"
      />
    </el-dialog>
  </div>
</template>
 
<script>
import * as systemFormConfigApi from '@/api/systemFormConfig.js'
import edit from './edit'
export default {
  // name: "index"
  components: { edit },
  props: {
    selectModel: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      constants: this.$constants,
      listPram: {
        keywords: null,
        page: 1,
        limit: this.$constants.page.limit[0]
      },
      editDialogConfig: {
        visible: false,
        editData: {},
        isCreate: 0
      },
      dataList: { list: [], total: 0 },
      selectedConfigData: {}
    }
  },
  mounted() {
    this.handlerGetList(this.listPram)
  },
  methods: {
    handlerSearch() {
      this.listPram.page = 1
      this.handlerGetList(this.listPram)
    },
    handlerGetList(pram) {
      systemFormConfigApi.getFormConfigList(pram).then(data => {
        this.dataList = data
      })
    },
    handlerEditData(rowData, isCreate) {
      if (isCreate === 0) {
        this.editDialogConfig.editData = {}
      } else {
        this.editDialogConfig.editData = rowData
      }
      this.editDialogConfig.isCreate = isCreate
      this.editDialogConfig.visible = true
    },
    handlerHide() {
      this.editDialogConfig.editData = {}
      this.editDialogConfig.isCreate = 0
      this.editDialogConfig.visible = false
      this.handlerGetList(this.listPram)
    },
    handleSizeChange(val) {
      this.listPram.limit = val
      this.handlerGetList(this.listPram)
    },
    handleCurrentChange(val) {
      this.listPram.page = val
      this.handlerGetList(this.listPram)
    },
    handleCurrentRowChange(rowData) {
      this.selectedConfigData = rowData
    },
    handlerConfimSelect() {
      this.$emit('selectedRowData', this.selectedConfigData)
    }
  }
}
</script>
 
<style scoped>
 
</style>