index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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" @score="toScore">
  7. <template #custom="{item,row}">
  8. <template v-if="item.prop === 'achieve_name'">
  9. <el-link size="mini" type="primary" @click="toApply(row)">{{ getProp(row, 'apply_id.basic.achieve_name') }}</el-link>
  10. </template>
  11. </template>
  12. </data-table>
  13. </el-col>
  14. </el-col>
  15. </el-row>
  16. <el-dialog title="成果详情" center width="80%" :close-on-click-modal="false" :visible.sync="applyDialog" destroy-on-close @closed="handleClose">
  17. <detail :form="apply"></detail>
  18. </el-dialog>
  19. <el-dialog title="评分" center width="30%" :visible.sync="scoreDialog" destroy-on-close @closed="handleClose">
  20. <el-form :model="verify" :rules="rules" ref="form" label-width="100px">
  21. <el-form-item label="审核评分" prop="score">
  22. <el-input-number v-model="verify.score" :min="0" :max="100" label="请打分"></el-input-number>
  23. </el-form-item>
  24. <el-form-item label="审核建议" prop="content">
  25. <el-input
  26. type="textarea"
  27. placeholder="请输入审核建议"
  28. v-model="verify.content"
  29. maxlength="200"
  30. :autosize="{ minRows: 4, maxRows: 6 }"
  31. show-word-limit
  32. >
  33. </el-input>
  34. </el-form-item>
  35. <el-form-item label="">
  36. <el-button type="primary" size="mini" @click="onSubmit('form')">提交审核</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </el-dialog>
  40. </div>
  41. </template>
  42. <script>
  43. const _ = require('lodash');
  44. import detail from '@/views/expertCenter/score/detail.vue';
  45. import dataTable from '@common/src/components/frame/filter-page-table.vue';
  46. import { mapState, createNamespacedHelpers } from 'vuex';
  47. const { mapActions: achieveApplyExpert } = createNamespacedHelpers('achieveApplyExpert');
  48. export default {
  49. name: 'index',
  50. props: {},
  51. components: { dataTable, detail },
  52. data: function() {
  53. return {
  54. list: [],
  55. total: 0,
  56. // 工作类型:1=>评分;2=>会审
  57. type: '2',
  58. opera: [
  59. {
  60. label: '评分',
  61. method: 'score',
  62. },
  63. ],
  64. fields: [
  65. { label: '成果名称', prop: 'achieve_name', showTip: true, custom: true },
  66. { label: '成果类别', prop: 'apply_id.basic.achieve_type', showTip: true },
  67. { label: '评分', prop: 'verify.score', showTip: true },
  68. { label: '状态', prop: 'verify', format: i => (_.isObject(i) ? '已评分' : '未评分') },
  69. ],
  70. applyDialog: false,
  71. apply: {},
  72. scoreDialog: false,
  73. use_id: undefined,
  74. verify: {},
  75. };
  76. },
  77. created() {
  78. this.search();
  79. },
  80. methods: {
  81. ...achieveApplyExpert(['query', 'update']),
  82. async search({ skip = 0, limit = 10, ...info } = {}) {
  83. const res = await this.query({ skip, limit, ...info, expert_id: this.user.id, type: this.type, apply: true });
  84. if (this.$checkRes(res)) {
  85. this.$set(this, `list`, res.data);
  86. this.$set(this, `total`, res.total);
  87. }
  88. },
  89. async toApply(data) {
  90. const apply = _.get(data, 'apply_id');
  91. this.$set(this, `apply`, apply);
  92. this.applyDialog = true;
  93. },
  94. toScore({ data }) {
  95. this.$set(this, `use_id`, _.get(data, '_id'));
  96. const verify = _.get(data, 'verify', { score: 0 });
  97. this.$set(this, `verify`, _.cloneDeep(verify));
  98. this.scoreDialog = true;
  99. },
  100. onSubmit(formName) {
  101. this.$refs[formName].validate(valid => {
  102. if (valid) {
  103. this.toVerify();
  104. } else {
  105. console.log('error submit!!');
  106. return false;
  107. }
  108. });
  109. },
  110. async toVerify() {
  111. const verify = _.cloneDeep(this.verify);
  112. const res = await this.update({ id: this.use_id, verify });
  113. if (this.$checkRes(res, '审核成功', res.errmsg || '审核失败')) {
  114. this.handleClose();
  115. this.search();
  116. }
  117. },
  118. getProp(data, prop) {
  119. return _.get(data, prop);
  120. },
  121. handleClose() {
  122. this.scoreDialog = false;
  123. this.applyDialog = false;
  124. this.apply = {};
  125. this.use_id = undefined;
  126. this.verify = {};
  127. },
  128. },
  129. computed: {
  130. ...mapState(['user', 'menuParams']),
  131. pageTitle() {
  132. return `${this.$route.meta.title}`;
  133. },
  134. },
  135. metaInfo() {
  136. return { title: this.$route.meta.title };
  137. },
  138. };
  139. </script>
  140. <style lang="less" scoped></style>