index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="top">
  5. <topInfo :topTitle="topTitle" :display="display" @add="add"></topInfo>
  6. </el-col>
  7. <el-col :span="24" class="main">
  8. <el-col :span="24" class="list">
  9. <tNewAssignList :tableData="tableData" :total="total" @deleteRow="deleteRow" @select="select" @updateState="updateState"></tNewAssignList>
  10. </el-col>
  11. </el-col>
  12. </el-row>
  13. </div>
  14. </template>
  15. <script>
  16. import topInfo from '@/layout/custom/topInfo.vue';
  17. import tNewAssignList from '@/layout/tNewAssign/tNewAssignList.vue';
  18. import { mapState, createNamespacedHelpers, mapGetters } from 'vuex';
  19. const { mapActions: tNewAssign } = createNamespacedHelpers('tNewAssign');
  20. const { mapActions: dictionary } = createNamespacedHelpers('dictionary');
  21. export default {
  22. name: 'index',
  23. props: {},
  24. components: {
  25. topInfo, //头部导航
  26. tNewAssignList, //列表
  27. },
  28. data: () => ({
  29. topTitle: '企业申请信息指派',
  30. display: '',
  31. tableData: [],
  32. total: 0,
  33. }),
  34. created() {
  35. this.select();
  36. },
  37. computed: {
  38. ...mapState(['user']),
  39. },
  40. methods: {
  41. ...tNewAssign(['create', 'delete', 'update', 'fetch', 'query']),
  42. ...dictionary({dictQuery:'query'}),
  43. async select({ skip = 0, limit = 10, ...info } = {}) {
  44. const res = await this.query({ skip, limit, ...info });
  45. if (this.$checkRes(res)) {
  46. this.$set(this, `tableData`, res.data);
  47. this.$set(this, `total`, res.total);
  48. }
  49. },
  50. add() {
  51. this.$router.push({ path: '/tDeclarationApproval/detail' });
  52. },
  53. async deleteRow({ id, skip = 0, limit = 10, ...info } = {}) {
  54. const res = await this.delete(id);
  55. this.$checkRes(res, '删除成功', '删除失败');
  56. this.select({ skip, limit, ...info });
  57. },
  58. async publish({ row ,skip = 0, limit = 10, ...info } = {}){
  59. let res = await this.update({id:row.id,publish_state:1,publish_state_description:'已发布',publish_time:new Date().getTime()});
  60. this.$checkRes(res, '发布成功', '发布失败');
  61. this.select({ skip, limit, ...info });
  62. },
  63. async updateState({ id ,state ,result,skip = 0, limit = 10, ...info } = {}){
  64. let res = null;
  65. switch(state)
  66. {
  67. case '0':
  68. break ;
  69. case '1':
  70. res = await this.state({id:id,current_approval_id:this.user.uid,state:state,state_description:'',result_description:result});
  71. this.$checkRes(res, '审核成功', '审核失败');
  72. break;
  73. case '2':
  74. res = await this.state({id:id,current_approval_id:this.user.uid,state:state,state_description:'',result_description:result});
  75. this.$checkRes(res, '审核成功', '审核失败');
  76. break;
  77. case '3':
  78. res = await this.state({id:id,current_approval_id:this.user.uid,state:state,state_description:'',result_description:result});
  79. this.$checkRes(res, '停用成功', '停用失败');
  80. break;
  81. case '9':
  82. res = await this.state({id:id,current_approval_id:this.user.uid,state:state,state_description:'',result_description:result});
  83. this.$checkRes(res, '完成成功', '完成失败');
  84. break;
  85. }
  86. this.select({ skip, limit, ...info });
  87. },
  88. },
  89. };
  90. </script>
  91. <style lang="less" scoped>
  92. .top {
  93. height: 50px;
  94. margin: 0 0 10px 0;
  95. }
  96. .main {
  97. min-height: 765px;
  98. background: #ffffff;
  99. }
  100. .search {
  101. width: 97%;
  102. height: 35px;
  103. margin: 20px;
  104. }
  105. .list {
  106. padding: 0 20px;
  107. }
  108. </style>