index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <template>
  2. <div v-if="detail.show" class="domain-policy-detail">
  3. <el-page-header title="返回" icon="arrow-left" :content="detail.name" @back="detail.show = false"></el-page-header>
  4. <policy-detail ref="policyDetail"></policy-detail>
  5. </div>
  6. <el-card v-else class="tjm_card_style_custom">
  7. <div class="tjm_card_title">查询表格</div>
  8. <div class="tjm_card_select">
  9. <el-form class="tjm_card_select_left" :model="params" inline label-width="80px" label-position="left">
  10. <el-form-item label="政策编号">
  11. <el-input v-model="params.businessNo" clearable placeholder="请输入政策编号"></el-input>
  12. </el-form-item>
  13. <el-form-item label="政策名称">
  14. <el-input v-model="params.name" clearable placeholder="请输入政策名称"></el-input>
  15. </el-form-item>
  16. <el-form-item label="政策等级">
  17. <el-select v-model="params.zcLevel" clearable placeholder="请选择政策等级">
  18. <el-option v-for="item in levelDic" :key="item" :label="item" :value="item"></el-option>
  19. </el-select>
  20. </el-form-item>
  21. <el-form-item label="政策类别">
  22. <el-select v-model="params.zcType" clearable placeholder="请选择政策类别">
  23. <el-option v-for="item in typeDic" :key="item" :label="item" :value="item"></el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="入库类别">
  27. <el-select v-model="params.inWhType" clearable placeholder="请选择入库类别">
  28. <el-option v-for="item in storageTypeDic" :key="item" :label="item" :value="item"></el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="发布日期">
  32. <el-date-picker v-model="createTime" type="daterange" value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="search" @click="reloadTable">搜索</el-button>
  36. <el-button icon="refresh-right" @click="reset">重置</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </div>
  40. <el-divider></el-divider>
  41. <div class="tjm_card_table">
  42. <el-table v-loading="loading" row-key="id" header-cell-class-name="tjm_card_table_header" height="400" :data="tableData" border @row-click="table_detail">
  43. <el-table-column type="index" label="序号" width="55"></el-table-column>
  44. <template v-for="(item, index) in columns" :key="index">
  45. <el-table-column :label="item.label" :prop="item.props" :min-width="item.width || 180" show-overflow-tooltip>
  46. <template #default="scope">{{ columnFormat(scope.row, item.props) }}</template>
  47. </el-table-column>
  48. </template>
  49. </el-table>
  50. </div>
  51. <div class="tjm_card_pagination">
  52. <yh-pagination v-model:pageNo="params.page" v-model:pageSize="params.size" :total="total" @paginationChange="reloadTable"></yh-pagination>
  53. </div>
  54. </el-card>
  55. </template>
  56. <script>
  57. import API from "@/api/policy/share";
  58. import { levelDic, typeDic, storageTypeDic } from "@/views/policyShare/main";
  59. import { columns } from "./main";
  60. import yhPagination from "@/components/Pagination/index.vue";
  61. import policyDetail from "@/views/home/policyDetail.vue";
  62. export default {
  63. components: {
  64. yhPagination,
  65. policyDetail
  66. },
  67. data() {
  68. return {
  69. columns, levelDic, typeDic, storageTypeDic,
  70. loading: false,
  71. createTime: [],
  72. params: {
  73. page: 1,
  74. size: 10,
  75. isInWh: 1,
  76. status: "done"
  77. },
  78. total: 0,
  79. tableData: [],
  80. detail: {
  81. show: false,
  82. name: null
  83. }
  84. }
  85. },
  86. mounted() {
  87. if (this.$route.query.zcType) this.params["zcType"] = this.$route.query.zcType;
  88. if (this.$route.query.inWhType) this.params["inWhType"] = this.$route.query.inWhType;
  89. if (this.$route.query.name) this.params["name"] = this.$route.query.name;
  90. this.reloadTable();
  91. },
  92. methods: {
  93. columnFormat(row, props) {
  94. if (props == "createTime") return row[props].split(" ")[0];
  95. return row[props];
  96. },
  97. reloadTable() {
  98. this.params.beginCreateTime = this.createTime && this.createTime.length && this.createTime[0] + " 00:00:00" || null;
  99. this.params.endCreateTime = this.createTime && this.createTime.length && this.createTime[1] + " 23:59:59" || null;
  100. this.loading = true;
  101. API.get(this.params).then(res => {
  102. this.loading = false;
  103. if (res.code === 200) {
  104. this.tableData = res.data.records;
  105. this.total = res.data.total;
  106. } else ElMessage.error(res.msg);
  107. }).catch(() => this.loading = false);
  108. },
  109. reset() {
  110. this.createTime = [];
  111. this.params = {
  112. page: 1,
  113. size: 10,
  114. isInWh: 1,
  115. status: "done"
  116. }
  117. if (this.$route.query.zcType) this.params["zcType"] = this.$route.query.zcType;
  118. if (this.$route.query.inWhType) this.params["inWhType"] = this.$route.query.inWhType;
  119. this.reloadTable();
  120. },
  121. table_detail(row) {
  122. this.detail.show = true;
  123. this.detail.name = row.name;
  124. nextTick(() => this.$refs.policyDetail.setData(row));
  125. }
  126. }
  127. }
  128. </script>
  129. <style lang="scss" scoped>
  130. .domain-policy-detail {
  131. .el-page-header {
  132. position: relative;
  133. top: calc(-1 * $base-padding);
  134. left: calc(-1 * $base-padding);
  135. width: calc(100% - $base-padding);
  136. padding: 15px;
  137. background: #fff;
  138. box-shadow: var(--el-box-shadow-light);
  139. :deep(.el-page-header__back:hover) {
  140. color: var(--el-color-primary);
  141. }
  142. }
  143. :deep(.tjm_card_style_custom) > .el-card__body {
  144. max-height: calc(
  145. $base-main-height - $base-padding - 2 * var(--el-card-padding) - 54px
  146. );
  147. overflow: auto;
  148. }
  149. }
  150. </style>