index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <script lang="ts">
  2. // 声明额外的选项
  3. export default {
  4. name: "PageUpdateInfo"
  5. };
  6. </script>
  7. <script setup lang="ts">
  8. import { provide } from "vue";
  9. import { usePageUpdateInfo } from "./hook";
  10. import { http } from "@/utils/http";
  11. import { useRenderIcon, hasAuth, PureTableBar } from "@/utils/importUsed";
  12. import Add from "./components/add/index.vue";
  13. import EditUpdate from "./components/update/index.vue";
  14. import EditUpVersion from "./components/upVersion/index.vue";
  15. import Search from "@iconify-icons/ep/search";
  16. import Addicon from "@iconify-icons/ep/document-add";
  17. import Delete from "@iconify-icons/ep/delete";
  18. import EditPen from "@iconify-icons/ep/edit-pen";
  19. import More from "@iconify-icons/ep/more-filled";
  20. const {
  21. form,
  22. loading,
  23. columns,
  24. dataList,
  25. pagination,
  26. onSearch,
  27. handleSizeChange,
  28. handleCurrentChange,
  29. handleSelectionChange,
  30. ruleFormRef,
  31. handleAdd,
  32. addVisible,
  33. handleUpdate,
  34. editUpdateVisible,
  35. editUpdateFormData,
  36. handleDelete,
  37. handleUpVersion,
  38. handleUpdateTemplate,
  39. editUpVersionVisible,
  40. editUpVersionFormData,
  41. kindOptionList
  42. } = usePageUpdateInfo();
  43. // 关闭添加
  44. const closeAddVisible = () => {
  45. onSearch(ruleFormRef.value);
  46. addVisible.value = false;
  47. };
  48. provide("closeAddVisible", closeAddVisible);
  49. // 关闭修改
  50. const closeEditUpdateVisible = () => {
  51. onSearch(ruleFormRef.value);
  52. editUpdateVisible.value = false;
  53. };
  54. provide("closeEditUpdateVisible", closeEditUpdateVisible);
  55. // 关闭修改
  56. const closeEditUpVersionVisible = () => {
  57. onSearch(ruleFormRef.value);
  58. editUpVersionVisible.value = false;
  59. };
  60. provide("closeEditUpVersionVisible", closeEditUpVersionVisible);
  61. </script>
  62. <template lang="pug">
  63. .main
  64. div
  65. //- 搜索表格组件条件
  66. el-form.bg-bg_color.pl-8.pt-4.pr-8(
  67. label-position="left"
  68. label-width="100px"
  69. :inline="true",
  70. :model="form",
  71. class="w-[99/100]"
  72. ref="ruleFormRef"
  73. :rules="rules"
  74. )
  75. el-form-item(label="分类", prop="kind")
  76. el-select(
  77. v-model="form.kind",
  78. placeholder="请选择分类",
  79. clearable,
  80. )
  81. el-option(:label="item.label", :value="item.id" v-for="(item,index) in kindOptionList")
  82. el-form-item(label='版本号' prop="appVersion")
  83. el-input(v-model='form.appVersion' autocomplete='off'
  84. placeholder="请输入版本号")
  85. el-form-item(label='标题' prop="title")
  86. el-input(v-model='form.title' autocomplete='off'
  87. placeholder="请输入标题")
  88. el-form-item(label='文件名' prop="modulePath")
  89. el-input(v-model='form.modulePath' autocomplete='off'
  90. placeholder="请输入文件名")
  91. el-form-item
  92. el-button(
  93. type="primary",
  94. :icon="useRenderIcon(Search)",
  95. :loading="loading",
  96. @click="onSearch(ruleFormRef)"
  97. ) 查询
  98. //- 表格组件
  99. PureTableBar(title="页面模板更新信息", @refresh="onSearch(ruleFormRef)" )
  100. template(#buttons)
  101. el-button(type="primary" :icon="useRenderIcon(Addicon)" @click="handleAdd()") 同步配置至新版本
  102. el-button(type="primary" :icon="useRenderIcon(Addicon)" @click="handleUpdateTemplate()" v-if="hasAuth(['updateTemplate'])") 同步文件
  103. template(v-slot="{ size, checkList }")
  104. pure-table(
  105. row-key="id"
  106. ref="tableRef"
  107. adaptive
  108. align-whole="center"
  109. table-layout="auto"
  110. :loading="loading"
  111. :size="size",
  112. :data="dataList",
  113. :columns="columns",
  114. :checkList="checkList",
  115. :pagination="pagination",
  116. :paginationSmall="size === 'default' ? true : false",
  117. :header-cell-style="{ background: 'var(--el-table-row-hover-bg-color)', color: 'var(--el-text-color-primary)' }",
  118. @selection-change="handleSelectionChange",
  119. @size-change="handleSizeChange",
  120. @current-change="handleCurrentChange"
  121. )
  122. template(#operation="{ row }")
  123. el-button.reset-margin(
  124. link
  125. type="primary"
  126. size="small"
  127. @click="handleUpdate(row)"
  128. :icon="useRenderIcon(Delete)"
  129. v-if="hasAuth(['update'])"
  130. ) 编辑
  131. el-button.reset-margin(
  132. link
  133. type="primary"
  134. size="small"
  135. @click="handleDelete(row)"
  136. :icon="useRenderIcon(Delete)"
  137. v-if="hasAuth(['delete'])"
  138. ) 删除
  139. el-dropdown(trigger="click", :hide-on-click="false")
  140. el-button.ml-3(class="mt-[2px]" link type='primary' :size='size' :icon='useRenderIcon(More)')
  141. template(#dropdown)
  142. el-dropdown-menu
  143. el-dropdown-item
  144. el-button.reset-margin.edit-btn(
  145. link
  146. type="primary"
  147. size="small"
  148. @click="handleUpVersion(row)"
  149. :icon="useRenderIcon(EditPen)"
  150. v-if="hasAuth(['version'])"
  151. ) 更新版本号码
  152. Add(:addVisible="addVisible")
  153. EditUpdate(:editVisible="editUpdateVisible" :formData="editUpdateFormData")
  154. EditUpVersion(:editVisible="editUpVersionVisible" :formData="editUpVersionFormData")
  155. </template>
  156. <style scoped lang="scss">
  157. :deep(.el-dropdown-menu__item i) {
  158. margin: 0;
  159. }
  160. :deep(.el-form-item__label) {
  161. font-weight: 700;
  162. }
  163. :deep(.el-pagination) {
  164. flex-flow: wrap;
  165. }
  166. :deep(.is-draggable) {
  167. max-height: 80vh;
  168. overflow: auto;
  169. }
  170. :deep(.el-dialog__header) {
  171. position: sticky;
  172. top: 0;
  173. z-index: 2;
  174. background: #fff;
  175. }
  176. :deep(.el-descriptions__header) {
  177. margin: 16px 0 !important;
  178. }
  179. </style>