question.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <div id="index">
  3. <admin-frame @search="search" :limt="limit" :total="total" topType="3" @back="back" :useNav="false">
  4. <template v-slot:info>
  5. <list-1 :list="list" @toView="toView" @toAssign="toAssign" @toIssue="toIssue"></list-1>
  6. </template>
  7. </admin-frame>
  8. <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
  9. <info-1 :info="info" v-if="dialog.type == '1'"></info-1>
  10. <assign-1 :form="info" v-else-if="dialog.type == '2'" @onSubmit="onSubmit"></assign-1>
  11. </van-dialog>
  12. </div>
  13. </template>
  14. <script>
  15. import list1 from '@/layout/question/list-1.vue';
  16. import info1 from '@/layout/question/info-1.vue';
  17. import assign1 from '@/layout/question/assign-1.vue';
  18. import adminFrame from '@frame/src/components/mobile-frame/mobile-main.vue';
  19. import { mapState, createNamespacedHelpers } from 'vuex';
  20. const { mapActions: problem_service } = createNamespacedHelpers('problem_service');
  21. export default {
  22. name: 'index',
  23. props: {},
  24. components: {
  25. adminFrame,
  26. list1,
  27. info1,
  28. assign1,
  29. },
  30. data: function () {
  31. return {
  32. list: [],
  33. limit: 4,
  34. total: 0,
  35. dialog: { show: false, title: '详细信息', type: '1' },
  36. // 详细信息
  37. info: {},
  38. };
  39. },
  40. async created() {
  41. this.search();
  42. },
  43. methods: {
  44. ...problem_service(['query', 'update']),
  45. async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
  46. let res = await this.query({ skip, limit, ...info });
  47. if (this.$checkRes(res)) {
  48. this.$set(this, `list`, res.data);
  49. this.$set(this, `total`, res.total);
  50. }
  51. },
  52. // 查看信息
  53. toView(data) {
  54. this.$set(this, `info`, data);
  55. this.dialog = { show: true, title: '详细信息', type: '1' };
  56. },
  57. // 工作分配
  58. toAssign(data) {
  59. this.$set(this, `info`, data);
  60. this.dialog = { show: true, title: '工作分配', type: '2' };
  61. },
  62. // 工作分派提交
  63. async onSubmit({ data }) {
  64. data.status = '1';
  65. let res = await this.update(data);
  66. if (this.$checkRes(res)) {
  67. this.$toast({ type: `success`, message: `操作成功` });
  68. this.search();
  69. this.dialog = { show: false, title: '工作分配', type: '2' };
  70. }
  71. },
  72. // 答案下发
  73. async toIssue(data) {
  74. data.status = '3';
  75. let res = await this.update(data);
  76. if (this.$checkRes(res)) {
  77. this.$toast({ type: `success`, message: `操作完成` });
  78. this.search();
  79. }
  80. },
  81. // 返回
  82. back() {
  83. this.$router.push({ path: '/patent/index' });
  84. },
  85. },
  86. computed: {
  87. ...mapState(['user']),
  88. },
  89. metaInfo() {
  90. return { title: this.$route.meta.title };
  91. },
  92. watch: {
  93. test: {
  94. deep: true,
  95. immediate: true,
  96. handler(val) {},
  97. },
  98. },
  99. };
  100. </script>
  101. <style lang="less" scoped>
  102. .dialog {
  103. /deep/.van-dialog__content {
  104. max-height: 350px;
  105. overflow-y: auto;
  106. }
  107. }
  108. </style>