index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <el-form ref="searchForm" :model="searchForm" label-width="80px">
  7. <el-col :span="8">
  8. <el-form-item label="购买人">
  9. <el-input v-model="searchForm.buy_name"></el-input>
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="8">
  13. <el-form-item label="审批时间">
  14. <el-date-picker
  15. type="date"
  16. placeholder="请选择"
  17. v-model="searchForm.examine_time"
  18. value-format="yyyy-MM-dd"
  19. format="yyyy-MM-dd"
  20. style="width: 100%"
  21. ></el-date-picker>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="8">
  25. <el-form-item label="审批状态">
  26. <el-select v-model="searchForm.status" placeholder="请选择" style="width: 100%">
  27. <el-option label="待审中" value="0"></el-option>
  28. <el-option label="审核通过" value="1"></el-option>
  29. <el-option label="审核未通过" value="2"></el-option>
  30. </el-select>
  31. </el-form-item>
  32. </el-col>
  33. <el-col :span="24" class="btn">
  34. <el-button type="primary" size="small" @click="search()">查询</el-button>
  35. <download-excel :data="selected" :fields="excel_fields.fields" :name="excel_fields.name" style="display: inline; margin: 0 0 0 10px">
  36. <el-button type="primary" size="mini">批量导出</el-button>
  37. </download-excel>
  38. </el-col>
  39. </el-form>
  40. </el-col>
  41. <el-col :span="24" class="two">
  42. <data-table :fields="fields" :opera="opera" :data="list" :total="total" :select="true" :selected="selected" @handleSelect="handleSelect">
  43. </data-table>
  44. </el-col>
  45. </el-col>
  46. </el-row>
  47. </div>
  48. </template>
  49. <script>
  50. const { examine_fields } = require('@common/src/layout/deploy/dict');
  51. import { mapState, createNamespacedHelpers } from 'vuex';
  52. const { mapActions: examine } = createNamespacedHelpers('examine');
  53. export default {
  54. name: 'index',
  55. props: {},
  56. components: {},
  57. data: function () {
  58. return {
  59. searchForm: {},
  60. list: [],
  61. total: 0,
  62. fields: [
  63. { label: '审批单号', prop: 'order_num' },
  64. { label: '购买人', prop: 'buy_name' },
  65. { label: '购买总价(元)', prop: 'totalMoney' },
  66. { label: '审批人', prop: 'personal' },
  67. { label: '审批时间', prop: 'examine_time' },
  68. {
  69. label: '审批结果',
  70. prop: 'status',
  71. format: (item) => {
  72. return item === '0' ? '待审' : item === '1' ? '审核通过' : '审核未通过';
  73. },
  74. },
  75. ],
  76. excel_fields: examine_fields,
  77. opera: [],
  78. selected: [],
  79. };
  80. },
  81. async created() {
  82. this.search();
  83. },
  84. methods: {
  85. ...examine(['query']),
  86. async search({ skip = 0, limit = 10, ...info } = {}) {
  87. let res = await this.query({ skip, limit, ...this.searchForm, ...info });
  88. if (this.$checkRes(res)) {
  89. this.$set(this, `list`, res.data);
  90. this.$set(this, `total`, res.total);
  91. }
  92. },
  93. handleSelect(data) {
  94. this.$set(this, `selected`, data);
  95. },
  96. },
  97. computed: {
  98. ...mapState(['user']),
  99. },
  100. metaInfo() {
  101. return { title: this.$route.meta.title };
  102. },
  103. watch: {
  104. test: {
  105. deep: true,
  106. immediate: true,
  107. handler(val) {},
  108. },
  109. },
  110. };
  111. </script>
  112. <style lang="less" scoped>
  113. .main {
  114. .one {
  115. margin: 0 0 10px 0;
  116. .btn {
  117. text-align: right;
  118. }
  119. }
  120. }
  121. </style>