index.vue 7.4 KB

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