【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.6 KiB

  1. <template>
  2. <div class="app-container container-wrap">
  3. <span class="right-top-line" />
  4. <span class="left-bottom-line" />
  5. <!--工具栏-->
  6. <div class="head-container">
  7. <crudOperation :permission="permission" />
  8. </div>
  9. <!--表格渲染-->
  10. <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="selectionChangeHandler" @row-click="clickRowHandler">
  11. <el-table-column type="selection" width="55" />
  12. <el-table-column type="index" label="序号" width="100" />
  13. <el-table-column prop="field_cn_name" label="中文名称" />
  14. <el-table-column prop="field_name" label="字段标识" />
  15. <el-table-column label="数据类型">
  16. <template slot-scope="scope">
  17. <span v-if="scope.row.is_data_type === 1">字符</span>
  18. <span v-if="scope.row.is_data_type === 2">数字</span>
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="is_column_length" label="字段长度" />
  22. <el-table-column prop="is_default_value" label="默认值" />
  23. </el-table>
  24. <!--表单渲染-->
  25. <eForm />
  26. </div>
  27. </template>
  28. <script>
  29. import crudFields from '@/api/archivesConfig/field'
  30. import eForm from './module/form'
  31. import CRUD, { presenter } from '@crud/crud'
  32. import crudOperation from '@crud/CRUD.operation'
  33. export default {
  34. name: 'CommonFields',
  35. components: { eForm, crudOperation },
  36. cruds() {
  37. return CRUD({
  38. title: '常用字段',
  39. url: 'api/field/findGroupType',
  40. crudMethod: { ...crudFields },
  41. optShow: {
  42. add: true,
  43. edit: true,
  44. del: false,
  45. download: false,
  46. group: false
  47. },
  48. query: {
  49. is_type: 2
  50. }
  51. })
  52. },
  53. mixins: [presenter()],
  54. data() {
  55. return {
  56. permission: {
  57. add: ['admin', 'commonFields:add'],
  58. edit: ['admin', 'commonFields:edit']
  59. }
  60. }
  61. },
  62. methods: {
  63. clickRowHandler(row) {
  64. this.$refs.table.clearSelection()
  65. this.$refs.table.toggleRowSelection(row)
  66. },
  67. selectionChangeHandler(val) {
  68. let finalVal
  69. if (val.length > 1) {
  70. // 取出最后val的最后一个返回出来
  71. finalVal = val.pop()
  72. // 清除所有选中
  73. this.$refs.table.clearSelection()
  74. // 给最后一个加上选中
  75. this.$refs.table.toggleRowSelection(finalVal)
  76. } else {
  77. finalVal = val
  78. }
  79. this.crud.selectionChangeHandler(finalVal)
  80. }
  81. }
  82. }
  83. </script>
  84. <style rel="stylesheet/scss" lang="scss" scoped>
  85. ::v-deep thead .el-table-column--selection .cell {
  86. display: none;
  87. }
  88. </style>