index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <template>
  2. <div id="index">
  3. <list-frame title="题库列表页" @query="search" :filter="filFields" @add="$router.push({ path: '/itembank/detail' })">
  4. <data-table :fields="fields" :data="index" :opera="opera" @edit="toEdit"></data-table>
  5. </list-frame>
  6. </div>
  7. </template>
  8. <script>
  9. import listFrame from '@frame/layout/admin/list-frame';
  10. import dataTable from '@frame/layout/admin/data-table';
  11. export default {
  12. metaInfo: { title: '题库列表页' },
  13. name: 'index',
  14. props: {},
  15. components: {
  16. listFrame,
  17. dataTable,
  18. },
  19. data: () => ({
  20. opera: [
  21. {
  22. label: '编辑',
  23. icon: 'el-icon-edit',
  24. method: 'edit',
  25. },
  26. ],
  27. fields: [
  28. { label: '题编号', prop: 'id' },
  29. { label: '题名', prop: 'name' },
  30. {
  31. label: '类型',
  32. prop: 'type',
  33. format: item => {
  34. return item === '0' ? '单选' : item === '1' ? '多选' : '问答';
  35. },
  36. },
  37. {
  38. label: '状态',
  39. prop: 'state',
  40. format: item => {
  41. return item === '0' ? '弃用' : '使用';
  42. },
  43. },
  44. ],
  45. index: [
  46. { id: '题编号', name: '礼仪题01', type: '1', state: '1' },
  47. { id: '题编号', name: 'sss', type: '0', state: '1' },
  48. { id: '题编号', name: 'test5', type: '2', state: '0' },
  49. ],
  50. filFields: [
  51. { label: '题名', model: 'name' },
  52. {
  53. label: '题类型',
  54. model: 'type',
  55. type: 'select',
  56. list: [
  57. { label: '单选', value: 0 },
  58. { label: '多选', value: 1 },
  59. { label: '问答', value: 2 },
  60. ],
  61. },
  62. {
  63. label: '题状态',
  64. model: 'state',
  65. type: 'select',
  66. list: [
  67. { label: '弃用', value: 0 },
  68. { label: '使用', value: 1 },
  69. ],
  70. },
  71. ],
  72. }),
  73. created() {},
  74. computed: {},
  75. methods: {
  76. search({ skip = 0, limit = 15, ...info } = {}) {
  77. console.log(`in search`);
  78. },
  79. toEdit(data) {
  80. console.log(`in toEdit`);
  81. console.log(data);
  82. },
  83. },
  84. };
  85. </script>
  86. <style lang="less" scoped></style>