车辆管理系统-后台管理系统web
liding
3 天以前 e4b773b5936ec1fa3747fd3d35b85799773d5f39
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<template>
  <div class="divBox">
    <el-card class="box-card">
      <div slot="header">
        <el-form inline>
          <el-form-item>
            <el-button size="mini" type="primary" @click="handlerOpenAdd({id:0,name:'顶层目录'})">添加分类</el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-table
        ref="treeList"
        :data="treeList"
        style="width: 100%;"
        row-key="id"
        size="mini"
        class="table"
        highlight-current-row
        :tree-props="{children: 'child', hasChildren: 'hasChildren'}"
      >
        <el-table-column prop="name" label="分类昵称" min-width="300">
          <template slot-scope="scope">
            {{ scope.row.name }}
          </template>
        </el-table-column>
        <el-table-column label="英文名称" show-overflow-tooltip min-width="180">
          <template slot-scope="scope">
            <span>{{ scope.row.url }}</span>
          </template>
        </el-table-column>
        <el-table-column label="已关联的表单" show-overflow-tooltip min-width="130">
          <template slot-scope="scope">
            <span>{{ scope.row.extra }}</span>
          </template>
        </el-table-column>
        <!--            <el-table-column label="排序" prop="sort" width="150"></el-table-column>-->
        <el-table-column label="启用状态" min-width="100">
          <template slot-scope="scope">
            <span>{{ scope.row.status | filterYesOrNo }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" min-width="250" fixed="right">
          <template slot-scope="scope">
            <el-button
              type="text"
              size="small"
              :disabled="scope.row.pid > 0"
              @click="handlerOpenAdd(scope.row)"
            >添加子目录</el-button>
            <el-button type="text" size="small" @click="handleEditMenu(scope.row)">编辑</el-button>
            <el-button type="text" size="small" @click="handlerOpenFormConfig(scope.row)">配置列表</el-button>
            <el-button type="text" size="small" @click="handleDelMenu(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-dialog
      :title="editDialogConfig.isCreate === 0?'添加分类':'编辑分类'"
      :visible.sync="editDialogConfig.visible"
      destroy-on-close
      :close-on-click-modal="false"
    >
      <edit
        v-if="editDialogConfig.visible"
        :prent="editDialogConfig.prent"
        :is-create="editDialogConfig.isCreate"
        :edit-data="editDialogConfig.data"
        :biztype="editDialogConfig.biztype"
        :all-tree-list="treeList"
        @hideEditDialog="hideEditDialog"
      />
    </el-dialog>
    <el-dialog title="选择已配置的表单" :visible.sync="configFormSelectedDialog.visible">
      <span class="color-red">注意:表单不能重复关联</span>
      <form-config-list
        v-if="configFormSelectedDialog.visible"
        select-model
        @selectedRowData="handlerSelectedRowData"
      />
      <el-form>
        <el-form-item>
          <el-button type="primary" style="width:100%;" @click="handlerAddFormExtra">关联</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
 
<script>
import * as categoryApi from '@/api/categoryApi.js'
import edit from '@/views/maintain/devconfig/configCategotyEdit.vue'
import * as selfUtil from '@/utils/ZBKJIutil.js'
import configList from './configList'
import formConfigList from '@/views/maintain/formConfig'
export default {
  // name: "configCategroy"
  components: { edit, configList, formConfigList },
  props: {
 
  },
  data() {
    return {
      constants: this.$constants,
      searchPram: {
        status: null,
        type: null
      },
      editDialogConfig: {
        visible: false,
        isCreate: 0, // 0=创建,1=编辑
        prent: {}, // 父级对象
        data: {}
      },
      treeList: [],
      listPram: {
        pid: 0,
        type: this.$constants.categoryType[5].value,
        status: null,
        name: null,
        page: this.$constants.page.page,
        limit: this.$constants.page.limit[1]
      },
      configFormSelectedDialog: {
        visible: false,
        currentData: {}
      }
    }
  },
  mounted() {
    this.handlerGetTreeList()
  },
  methods: {
    handlerOpenFormConfig(rowData) {
      this.configFormSelectedDialog.currentData = rowData
      this.configFormSelectedDialog.visible = true
    },
    handlerGetList() {
      categoryApi.listCategroy(this.listPram).then(data => {
        // this.dataList = data
        this.treeList = data.list
      })
    },
    handlerOpenAdd(rowData) {
      this.editDialogConfig.isCreate = 0
      this.editDialogConfig.prent = rowData
      this.editDialogConfig.data = {}
      this.editDialogConfig.biztype = this.biztype
      this.editDialogConfig.visible = true
    },
    handleEditMenu(rowData) {
      this.editDialogConfig.isCreate = 1
      this.editDialogConfig.data = rowData
      this.editDialogConfig.prent = rowData
      this.editDialogConfig.visible = true
    },
    handleDelMenu(rowData) {
      this.$confirm('确定删除当前数据?').then(() => {
        categoryApi.deleteCategroy(rowData).then(data => {
          this.handlerGetTreeList()
          this.$message.success('删除成功')
        })
      })
    },
    hideEditDialog() {
      setTimeout(() => {
        this.editDialogConfig.prent = {}
        this.editDialogConfig.type = 0
        this.editDialogConfig.visible = false
        this.handlerGetTreeList()
      }, 200)
    },
    handlerGetTreeList() {
      // status: this.selectModel?1:-1
      const _pram = { type: this.constants.categoryType[5].value, status: -1 }
      categoryApi.treeCategroy(_pram).then(data => {
        this.treeList = this.handleAddArrt(data)
      })
    },
    handleAddArrt(treeData) {
      // let _result = this.addTreeListLabel(treeData)
      const _result = selfUtil.addTreeListLabel(treeData)
      return _result
    },
    handlerSelectedRowData(rowData) {
      this.configFormSelectedDialog.currentData.extra = rowData.id
    },
    handlerAddFormExtra() {
      categoryApi.updateCategroy(this.configFormSelectedDialog.currentData).then(data => {
        this.$message.success('关联表单成功')
        setTimeout(() => {
          this.configFormSelectedDialog.visible = false
          this.handlerGetTreeList()
        }, 800)
      })
    }
  }
}
</script>
 
<style scoped>
 
</style>