index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <anji-crud ref="listPage"
  3. :option="crudOption">
  4. <template v-slot:buttonLeftOnTable>
  5. </template>
  6. <!--
  7. <template slot="rowButton" slot-scope="props">
  8. <el-button type="primary" @click="customButtom(props)">行按钮</el-button>
  9. </template>
  10. -->
  11. <!--自定义的卡片插槽,将在编辑详情页面,出现在底部新卡片-->
  12. <!--这里可以将自定义的弹出框代码,放入到page中
  13. <template v-slot:pageSection>
  14. <div>插入底部html片段</div>
  15. </template>
  16. -->
  17. </anji-crud>
  18. </template>
  19. <script>
  20. import { accessAuthorityList, accessAuthorityAdd, accessAuthorityDeleteBatch, accessAuthorityUpdate, accessAuthorityDetail } from '@/api/accessAuthority'
  21. export default {
  22. name: 'AccessAuthority',
  23. data () {
  24. return {
  25. crudOption: {
  26. // 使用菜单做为页面标题
  27. title: '权限管理',
  28. // 详情页中输入框左边文字宽度
  29. labelWidth: '120px',
  30. // 查询表单条件
  31. queryFormFields: [
  32. {
  33. inputType: 'anji-tree', // 该类型将内容区一分为二,左侧20%显示树
  34. anjiTreeOption: {
  35. url: '/accessAuthority/menuTree', // 请求接口,将响应中id字段做为tree的id,将label字段做为tree的label
  36. enableFilter: true, // tree 是否有input 过滤
  37. isOpen: true, // true tree 展开 false 关闭
  38. },
  39. label: '所属菜单',
  40. field: 'target',
  41. },
  42. {
  43. inputType: 'anji-select', //form表单类型 input|input-number|anji-select(传递url或者dictCode)|anji-tree(左侧树)|date|datetime|datetimerange
  44. anjiSelectOption: {
  45. dictCode: 'ENABLE_FLAG',
  46. },
  47. label: '启用状态',
  48. field: 'enableFlag'
  49. },
  50. {
  51. inputType: 'input',
  52. label: '菜单代码',
  53. field: 'target',
  54. },
  55. {
  56. inputType: 'input',
  57. label: '菜单名称',
  58. field: 'targetName',
  59. },
  60. {
  61. inputType: 'input',
  62. label: '按钮代码',
  63. field: 'action',
  64. },
  65. {
  66. inputType: 'input',
  67. label: '按钮名称',
  68. field: 'actionName',
  69. },
  70. ],
  71. // 操作按钮
  72. buttons: {
  73. query: {
  74. api: accessAuthorityList,
  75. permission: 'authorityManage:query'
  76. },
  77. queryByPrimarykey: {
  78. api: accessAuthorityDetail,
  79. permission: 'authorityManage:query'
  80. },
  81. add: {
  82. api: accessAuthorityAdd,
  83. permission: 'authorityManage:insert'
  84. },
  85. delete: {
  86. api: accessAuthorityDeleteBatch,
  87. permission: 'authorityManage:delete'
  88. },
  89. edit: {
  90. api: accessAuthorityUpdate,
  91. permission: 'authorityManage:update'
  92. },
  93. },
  94. // 表格列
  95. columns: [
  96. {
  97. label: '',
  98. field: 'id',
  99. primaryKey: true, // 根据主键查询详情或者根据主键删除时, 主键的
  100. tableHide: true, // 表格中不显示
  101. editHide: true, // 编辑弹框中不显示
  102. },
  103. {
  104. label: '菜单代码',//目标菜单
  105. placeholder: '',
  106. field: 'target',
  107. editField: 'target',
  108. tableHide: true, // 表格中不显示
  109. inputType: 'input',
  110. rules: [
  111. { required: true, message: '目标菜单必填', trigger: 'blur' },
  112. { min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }
  113. ],
  114. disabled: false,
  115. },
  116. {
  117. label: '菜单名称',//目标菜单名称
  118. placeholder: '',
  119. field: 'targetName',
  120. sortable: true,
  121. fieldTableRowRenderer: (row) => {
  122. return `${row['targetName']}[${row['target']}]`
  123. },
  124. editField: 'targetName',
  125. inputType: 'input',
  126. rules: [
  127. { required: true, message: '目标菜单名称必填', trigger: 'blur' },
  128. { min: 1, max: 128, message: '不超过128个字符', trigger: 'blur' }
  129. ],
  130. disabled: false,
  131. },
  132. {
  133. label: '按钮代码',//目标按钮
  134. placeholder: '',
  135. field: 'action',
  136. tableHide: true, // 表格中不显示
  137. editField: 'action',
  138. inputType: 'input',
  139. rules: [
  140. { required: true, message: '目标必填', trigger: 'blur' },
  141. { min: 1, max: 64, message: '不超过64个字符', trigger: 'blur' }
  142. ],
  143. disabled: false,
  144. },
  145. {
  146. label: '按钮名称',//目标按钮名称
  147. placeholder: '',
  148. field: 'actionName',
  149. fieldTableRowRenderer: (row) => {
  150. return `${row['actionName']}[${row['action']}]`
  151. },
  152. sortable: true,
  153. editField: 'actionName',
  154. inputType: 'input',
  155. rules: [
  156. { required: true, message: '目标按钮名称必填', trigger: 'blur' },
  157. { min: 1, max: 128, message: '不超过128个字符', trigger: 'blur' }
  158. ],
  159. disabled: false,
  160. },
  161. {
  162. label: '启用状态',//0--已禁用 1--已启用 DIC_NAME=ENABLE_FLAG
  163. placeholder: '',
  164. field: 'enableFlag',
  165. fieldTableRowRenderer: (row) => {
  166. return this.getDictLabelByCode('ENABLE_FLAG', row['enableFlag'])
  167. },
  168. editField: 'enableFlag',
  169. inputType: 'anji-select',
  170. anjiSelectOption: {
  171. dictCode: 'ENABLE_FLAG', //指定数据字典
  172. },
  173. colorStyle: {
  174. 0: 'table-danger', //key为editField渲染的值(字典的提交值)'红色': 'danger','蓝色': 'primary','绿色': 'success','黄色': 'warning','灰色': 'info','白色':''
  175. 1: 'table-success'
  176. },
  177. rules: [
  178. { required: true, message: '启用状态必填', trigger: 'blur' },
  179. ],
  180. disabled: false,
  181. },
  182. {
  183. label: '排序',//
  184. placeholder: '',
  185. field: 'sort',
  186. editField: 'sort',
  187. inputType: 'input',
  188. rules: [
  189. ],
  190. disabled: false,
  191. },
  192. {
  193. label: '创建人',
  194. placeholder: '',
  195. field: 'createBy',
  196. columnType: 'expand',
  197. editField: 'createBy',
  198. inputType: 'input',
  199. editHide: 'hideOnAdd', // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
  200. disabled: true,
  201. },
  202. {
  203. label: '创建时间',
  204. placeholder: '',
  205. field: 'createTime',
  206. columnType: 'expand',
  207. editField: 'createTime',
  208. inputType: 'input',
  209. editHide: 'hideOnAdd', // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
  210. disabled: true,
  211. },
  212. {
  213. label: '修改人',
  214. placeholder: '',
  215. field: 'updateBy',
  216. columnType: 'expand',
  217. editField: 'updateBy',
  218. inputType: 'input',
  219. editHide: 'hideOnAdd', // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
  220. disabled: true,
  221. },
  222. {
  223. label: '修改时间',
  224. placeholder: '',
  225. field: 'updateTime',
  226. columnType: 'expand',
  227. editField: 'updateTime',
  228. inputType: 'input',
  229. editHide: 'hideOnAdd', // 编辑弹框中不显示 true/false/'hideOnAdd hideOnView hideOnEdit'
  230. disabled: true,
  231. },
  232. ],
  233. },
  234. }
  235. },
  236. created () { },
  237. methods: {
  238. }
  239. }
  240. </script>