index.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="down">
  6. <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @cert="toCert"></data-table>
  7. </el-col>
  8. </el-col>
  9. </el-row>
  10. </div>
  11. </template>
  12. <script>
  13. import dataTable from '@common/src/components/frame/filter-page-table.vue';
  14. import { mapState, createNamespacedHelpers } from 'vuex';
  15. const { mapActions: achieveApply } = createNamespacedHelpers('achieveApply');
  16. const { mapActions: verifyRecord } = createNamespacedHelpers('verifyRecord');
  17. export default {
  18. metaInfo() {
  19. return { title: this.$route.meta.title };
  20. },
  21. name: 'index',
  22. props: {},
  23. components: {
  24. dataTable,
  25. },
  26. data: function() {
  27. return {
  28. opera: [
  29. {
  30. label: '发放证书',
  31. method: 'cert',
  32. },
  33. ],
  34. fields: [
  35. { label: '成果编号', prop: 'basic.achieve_num', filter: 'input', showTip: true },
  36. { label: '成果名称', prop: 'basic.achieve_name', showTip: true },
  37. { label: '成果类别', prop: 'basic.achieve_type', showTip: true },
  38. ],
  39. list: [],
  40. total: 0,
  41. };
  42. },
  43. async created() {
  44. await this.search();
  45. },
  46. methods: {
  47. ...achieveApply(['query']),
  48. ...verifyRecord(['create']),
  49. // 查询列表
  50. async search({ skip = 0, limit = 10, ...info } = {}) {
  51. const res = await this.query({ skip, limit, ...info, status: '5' });
  52. if (this.$checkRes(res)) {
  53. this.$set(this, 'list', res.data);
  54. this.$set(this, `total`, res.total);
  55. }
  56. },
  57. async toCert({ data }) {
  58. // TODO 发证书
  59. let dup = { status: '6' };
  60. dup.apply_id = _.get(data, '_id');
  61. dup.verify = _.get(this.user, 'name');
  62. dup.verify_phone = _.get(this.user, 'phone');
  63. dup.verify_id = _.get(this.user, '_id');
  64. dup.step = '发证书';
  65. const res = await this.create(dup);
  66. if (this.$checkRes(res, '已确定发放证书', res.errmsg || '确定发放失败')) this.search();
  67. },
  68. },
  69. computed: {
  70. ...mapState(['user']),
  71. },
  72. watch: {},
  73. };
  74. </script>
  75. <style lang="less" scoped></style>