index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main animate__animated animate__backInRight">
  5. <el-col :span="24" class="one">
  6. <el-col :span="24" class="one_1"><span>涉案人员</span><span>(需要提供表格填写内容)</span></el-col>
  7. <el-col :span="24" class="one_2"><span></span></el-col>
  8. </el-col>
  9. <el-col :span="24" class="two">
  10. <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @edit="toEdit" @delete="toDel">
  11. <template #selfbtn>
  12. <el-button type="primary" size="mini" @click="toAdd">添加</el-button>
  13. </template>
  14. </data-table>
  15. </el-col>
  16. </el-col>
  17. </el-row>
  18. </div>
  19. </template>
  20. <script>
  21. import { mapState, createNamespacedHelpers } from 'vuex';
  22. const { mapActions } = createNamespacedHelpers('involved');
  23. export default {
  24. name: 'index',
  25. props: {},
  26. components: {},
  27. data: function () {
  28. return {
  29. list: [],
  30. total: 0,
  31. opera: [
  32. { label: '修改', method: 'edit' },
  33. { label: '删除', method: 'delete', type: 'danger' },
  34. ],
  35. fields: [
  36. { label: '姓名', prop: 'name', filter: 'input' },
  37. { label: '曾用名', prop: 'beforename' },
  38. { label: '身份证号', prop: 'card', filter: 'input' },
  39. { label: '性别', prop: 'gender' },
  40. { label: '年龄', prop: 'age' },
  41. { label: '籍贯', prop: 'nativeaddr' },
  42. { label: '住址', prop: 'address' },
  43. { label: '工作单位', prop: 'unit' },
  44. { label: '职业', prop: 'work', filter: 'input' },
  45. { label: '社会关系', prop: 'sociology' },
  46. { label: '涉案信息', prop: 'involvedinfo' },
  47. { label: '备注', prop: 'remark' },
  48. ],
  49. };
  50. },
  51. created() {
  52. this.search();
  53. },
  54. methods: {
  55. ...mapActions(['query', 'delete']),
  56. // 查询
  57. async search({ skip = 0, limit = 10, ...info } = {}) {
  58. const condition = _.cloneDeep(this.searchForm);
  59. let res = await this.query({ skip, limit, ...condition, ...info });
  60. if (this.$checkRes(res)) {
  61. this.$set(this, `list`, res.data);
  62. this.$set(this, `total`, res.total);
  63. }
  64. },
  65. // 添加
  66. toAdd() {
  67. this.$router.push({ path: '/involved/detail' });
  68. },
  69. // 修改
  70. toEdit({ data }) {
  71. this.$router.push({ path: '/involved/detail', query: { id: data._id } });
  72. },
  73. // 删除
  74. async toDel({ data }) {
  75. let res = await this.delete(data._id);
  76. if (this.$checkRes(res)) {
  77. this.$message({ type: `success`, message: `刪除信息成功` });
  78. this.search();
  79. }
  80. },
  81. // 关闭
  82. toClose() {
  83. this.form = {};
  84. this.searchForm = {};
  85. this.dialog = { title: '信息管理', show: false, type: '1' };
  86. this.search();
  87. },
  88. // 多选
  89. handleSelect(data) {
  90. this.$set(this, `selected`, data);
  91. },
  92. },
  93. computed: {
  94. ...mapState(['user']),
  95. },
  96. metaInfo() {
  97. return { title: this.$route.meta.title };
  98. },
  99. watch: {
  100. test: {
  101. deep: true,
  102. immediate: true,
  103. handler(val) {},
  104. },
  105. },
  106. };
  107. </script>
  108. <style lang="less" scoped>
  109. .main {
  110. .one {
  111. margin: 0 0 10px 0;
  112. .one_1 {
  113. span:nth-child(1) {
  114. font-size: 20px;
  115. font-weight: 700;
  116. margin-right: 10px;
  117. }
  118. span:nth-child(2) {
  119. font-size: 14px;
  120. color: #979797;
  121. }
  122. }
  123. .one_2 {
  124. span:nth-child(1) {
  125. display: inline-block;
  126. color: #8baae7;
  127. font-size: 14px;
  128. margin-top: 10px;
  129. }
  130. }
  131. }
  132. .two {
  133. margin: 0 0 10px 0;
  134. }
  135. }
  136. </style>