index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div v-if="show" class="reply-policy-detail">
  3. <policy-detail ref="policyDetail" @closed="show = false"></policy-detail>
  4. </div>
  5. <template v-else>
  6. <el-card class="tjm_card_style_custom">
  7. <div class="tjm_card_title">条件检索</div>
  8. <div class="tjm_card_select">
  9. <el-scrollbar>
  10. <el-form class="tjm_card_select_left" :model="params" label-width="80px" label-position="left">
  11. <el-row :gutter="15">
  12. <el-col :lg="8" :md="12" :xs="24">
  13. <el-form-item label="政策编号">
  14. <el-input v-model="params.businessNo" clearable placeholder="请输入政策编号"></el-input>
  15. </el-form-item>
  16. </el-col>
  17. <el-col :lg="8" :md="12" :xs="24">
  18. <el-form-item label="政策名称">
  19. <el-input v-model="params.name" clearable placeholder="请输入政策名称"></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :lg="8" :md="12" :xs="24">
  23. <el-form-item label="政策等级">
  24. <el-select v-model="params.zcLevel" clearable placeholder="请选择政策等级">
  25. <el-option v-for="item in levelDic" :key="item" :label="item" :value="item"></el-option>
  26. </el-select>
  27. </el-form-item>
  28. </el-col>
  29. <template v-if="paramsIsCollapse">
  30. <el-col :lg="8" :md="12" :xs="24">
  31. <el-form-item label="政策类别">
  32. <el-select v-model="params.zcType" clearable placeholder="请选择政策类别">
  33. <el-option v-for="item in typeDic" :key="item" :label="item" :value="item"></el-option>
  34. </el-select>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :lg="8" :md="12" :xs="24">
  38. <el-form-item label="是否入库">
  39. <el-select v-model="params.isInWh" clearable placeholder="请选择入库状态">
  40. <el-option v-for="(label, key) in whetherDic" :key="key" :label="label" :value="parseInt(key)"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. </el-col>
  44. <el-col :lg="8" :md="12" :xs="24">
  45. <el-form-item label="入库类别">
  46. <el-select v-model="params.inWhType" clearable placeholder="请选择入库类别">
  47. <el-option v-for="item in storageTypeDic" :key="item" :label="item" :value="item"></el-option>
  48. </el-select>
  49. </el-form-item>
  50. </el-col>
  51. <el-col :lg="8" :md="12" :xs="24">
  52. <el-form-item label="发布日期">
  53. <el-date-picker v-model="createTime" type="daterange" value-format="YYYY-MM-DD" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  54. </el-form-item>
  55. </el-col>
  56. </template>
  57. </el-row>
  58. </el-form>
  59. <div class="tjm_card_select_right">
  60. <el-button type="primary" icon="search" @click="reloadTable">搜索</el-button>
  61. <el-button icon="refresh-right" @click="reset">重置</el-button>
  62. <el-button type="primary" link @click="paramsIsCollapse = !paramsIsCollapse">
  63. <template v-if="paramsIsCollapse">收起<tjm-icon-ep-arrow-up-bold /></template>
  64. <template v-else>更多<tjm-icon-ep-arrow-down-bold /></template>
  65. </el-button>
  66. </div>
  67. </el-scrollbar>
  68. </div>
  69. <el-divider></el-divider>
  70. <div v-loading="loading" class="tjm_card_reply">
  71. <el-empty v-if="total <= 0"></el-empty>
  72. <template v-else>
  73. <template v-for="(item, index) in tableData" v-bind:key="index">
  74. <el-descriptions direction="vertical" :column="columns.length + 1" border @click="table_detail(item)">
  75. <el-descriptions-item v-for="column in columns" :key="column.props" :min-width="column.width || 180">
  76. <template #label>{{ column.label }}</template>
  77. <span v-if="column.props == 'index'">{{ index + 1 }}</span>
  78. <span v-else class="desc-cell">
  79. <yh-tooltip :content="columnFormat(item, column.props)" placement="top"></yh-tooltip>
  80. </span>
  81. </el-descriptions-item>
  82. </el-descriptions>
  83. <div class="tjm_card_reply__body">
  84. <yh-reply-card :refId="item.id" @replyAll="table_detail(item, $event)"></yh-reply-card>
  85. </div>
  86. </template>
  87. </template>
  88. </div>
  89. <div class="tjm_card_pagination">
  90. <yh-pagination v-model:pageNo="params.page" v-model:pageSize="params.size" :total="total" @paginationChange="reloadTable"></yh-pagination>
  91. </div>
  92. </el-card>
  93. </template>
  94. </template>
  95. <script>
  96. import API from "@/api/policy/share";
  97. import { levelDic, typeDic, storageTypeDic, whetherDic } from "../main";
  98. import { columns } from "./main";
  99. import yhTooltip from "@/components/Tooltip/index.vue";
  100. import yhReplyCard from "@/components/ReplyCard/index.vue";
  101. import yhPagination from "@/components/Pagination/index.vue";
  102. import policyDetail from "@/views/home/policyDetail.vue";
  103. export default {
  104. components: {
  105. yhTooltip,
  106. yhReplyCard,
  107. yhPagination,
  108. policyDetail
  109. },
  110. data() {
  111. return {
  112. columns, levelDic, typeDic, storageTypeDic, whetherDic,
  113. loading: false,
  114. paramsIsCollapse: false,
  115. createTime: [],
  116. params: {
  117. page: 1,
  118. size: 10,
  119. status: "done"
  120. },
  121. total: 0,
  122. tableData: [],
  123. show: false
  124. }
  125. },
  126. mounted() {
  127. this.reloadTable();
  128. },
  129. methods: {
  130. columnFormat(row, props) {
  131. if (props == "createTime") return row[props].split(" ")[0];
  132. if (props == "isInWh") return whetherDic[row[props]] || "";
  133. if (props == "inWhType") return row.isInWh == 1 && row[props] || "";
  134. return row[props];
  135. },
  136. reloadTable() {
  137. this.params.beginCreateTime = this.createTime && this.createTime.length && this.createTime[0] + " 00:00:00" || null;
  138. this.params.endCreateTime = this.createTime && this.createTime.length && this.createTime[1] + " 23:59:59" || null;
  139. this.loading = true;
  140. API.get(this.params).then(res => {
  141. this.loading = false;
  142. if (res.code === 200) {
  143. this.tableData = res.data.records;
  144. this.total = res.data.total;
  145. } else ElMessage.error(res.msg);
  146. }).catch(() => this.loading = false);
  147. },
  148. reset() {
  149. this.createTime = [];
  150. this.params = {
  151. page: 1,
  152. size: 10,
  153. status: "done"
  154. }
  155. this.reloadTable();
  156. },
  157. table_detail(row, count) {
  158. this.show = true;
  159. nextTick(() => this.$refs.policyDetail.setData(row, count));
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss" scoped>
  165. .reply-policy-detail :deep(.tjm_card_style_custom) > .el-card__body {
  166. max-height: calc(
  167. $base-main-height - $base-padding - 2 * var(--el-card-padding) - 54px
  168. );
  169. overflow: auto;
  170. }
  171. .tjm_card_reply .el-descriptions {
  172. overflow-x: auto;
  173. border-left: var(--el-descriptions-table-border);
  174. border-right: var(--el-descriptions-table-border);
  175. :deep(.el-descriptions__body) tr {
  176. .el-descriptions__cell:first-child {
  177. border-left: none;
  178. }
  179. .el-descriptions__cell:last-child {
  180. border-right: none;
  181. }
  182. }
  183. .desc-cell {
  184. display: inline-block;
  185. width: 100%;
  186. }
  187. }
  188. .tjm_card_reply .tjm_card_reply__body {
  189. margin-bottom: 25px;
  190. border: 1px solid var(--el-border-color-lighter);
  191. border-top: none;
  192. > :deep(.el-card.reply-card) {
  193. border-radius: 0;
  194. }
  195. }
  196. </style>