Rap 原分销系统代码Web
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

116 linhas
4.0KB

  1. <template>
  2. <div>
  3. <div v-if="query.dictName === ''">
  4. <div class="my-code">点击字典查看详情</div>
  5. </div>
  6. <div v-else>
  7. <!--工具栏-->
  8. <div class="head-container">
  9. <div v-if="crud.props.searchToggle">
  10. <!-- 搜索 -->
  11. <el-input v-model="query.label" clearable size="small" placeholder="输入字典标签查询" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery" />
  12. <rrOperation />
  13. </div>
  14. </div>
  15. <!--表单组件-->
  16. <el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title" width="500px">
  17. <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
  18. <el-form-item label="字典标签" prop="label">
  19. <el-input v-model="form.label" style="width: 370px;" />
  20. </el-form-item>
  21. <el-form-item label="字典值" prop="value">
  22. <el-input v-model="form.value" style="width: 370px;" />
  23. </el-form-item>
  24. <el-form-item label="排序" prop="dictSort">
  25. <el-input-number v-model.number="form.dictSort" :min="0" :max="999" controls-position="right" style="width: 370px;" />
  26. </el-form-item>
  27. </el-form>
  28. <div slot="footer" class="dialog-footer">
  29. <el-button type="text" @click="crud.cancelCU">取消</el-button>
  30. <el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
  31. </div>
  32. </el-dialog>
  33. <!--表格渲染-->
  34. <el-table ref="table" v-loading="crud.loading" :data="crud.data" highlight-current-row style="width: 100%;" @selection-change="crud.selectionChangeHandler">
  35. <el-table-column label="所属字典">
  36. {{ query.dictName }}
  37. </el-table-column>
  38. <el-table-column prop="label" label="字典标签" />
  39. <el-table-column prop="value" label="字典值" />
  40. <el-table-column prop="dictSort" label="排序" />
  41. <el-table-column v-if="checkPer(['admin','dict:edit','dict:del'])" label="操作" width="130px" align="center" fixed="right">
  42. <template slot-scope="scope">
  43. <udOperation
  44. :data="scope.row"
  45. :permission="permission"
  46. />
  47. </template>
  48. </el-table-column>
  49. </el-table>
  50. <!--分页组件-->
  51. <pagination />
  52. </div>
  53. </div>
  54. </template>
  55. <script>
  56. import crudDictDetail from '@/api/system/dictDetail'
  57. import CRUD, { presenter, header, form } from '@crud/crud'
  58. import pagination from '@crud/Pagination'
  59. import rrOperation from '@crud/RR.operation'
  60. import udOperation from '@crud/UD.operation'
  61. const defaultForm = { id: null, label: null, value: null, dictSort: 999 }
  62. export default {
  63. components: { pagination, rrOperation, udOperation },
  64. cruds() {
  65. return [
  66. CRUD({ title: '字典详情', url: 'api/dictDetail', query: { dictName: '' }, sort: ['dictSort,asc', 'id,desc'],
  67. crudMethod: { ...crudDictDetail },
  68. optShow: {
  69. add: true,
  70. edit: true,
  71. del: true,
  72. reset: false
  73. },
  74. queryOnPresenterCreated: false
  75. })
  76. ]
  77. },
  78. mixins: [
  79. presenter(),
  80. header(),
  81. form(function() {
  82. return Object.assign({ dict: { id: this.dictId }}, defaultForm)
  83. })],
  84. data() {
  85. return {
  86. dictId: null,
  87. rules: {
  88. label: [
  89. { required: true, message: '请输入字典标签', trigger: 'blur' }
  90. ],
  91. value: [
  92. { required: true, message: '请输入字典值', trigger: 'blur' }
  93. ],
  94. dictSort: [
  95. { required: true, message: '请输入序号', trigger: 'blur', type: 'number' }
  96. ]
  97. },
  98. permission: {
  99. add: ['admin', 'dict:add'],
  100. edit: ['admin', 'dict:edit'],
  101. del: ['admin', 'dict:del']
  102. }
  103. }
  104. }
  105. }
  106. </script>
  107. <style rel="stylesheet/scss" lang="scss" scoped>
  108. ::v-deep .el-input-number .el-input__inner {
  109. text-align: left;
  110. }
  111. </style>