index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <div
  3. :class="isStatus || isStatuser ? 'flex' : 'flex-end'"
  4. class="data-table-btn"
  5. >
  6. <div v-if="isStatus || isStatuser" class="vStatus flex-act">
  7. <slot name="header" />
  8. <el-date-picker
  9. v-if="isTime"
  10. v-model="startTime"
  11. type="date"
  12. placeholder="开始日期"
  13. size="default"
  14. >
  15. </el-date-picker>
  16. <el-date-picker
  17. v-if="isTime"
  18. class="L12"
  19. size="default"
  20. v-model="endTime"
  21. type="date"
  22. placeholder="结束日期"
  23. >
  24. </el-date-picker>
  25. </div>
  26. <!-- <div class="">
  27. <el-date-picker v-model="startTime" type="date" placeholder="选择日期">
  28. </el-date-picker>
  29. <el-date-picker v-model="endTime" type="date" placeholder="选择日期">
  30. </el-date-picker>
  31. </div> -->
  32. <div v-if="isBtn" class="rb">
  33. <template v-if="isSearch">
  34. <!-- <div class="serlog">
  35. <div class="log"></div>
  36. </div> -->
  37. <!-- <el-input
  38. v-model="input"
  39. class="inputcas"
  40. placeholder="请输入您要搜索的内容"
  41. clearable
  42. /> -->
  43. <Search @clear="clear" @search="search" />
  44. <!-- <el-button type="danger" size="default" class="br L12">搜索</el-button> -->
  45. </template>
  46. <template v-if="isSlot">
  47. <el-button
  48. type="danger"
  49. size="default"
  50. class="br L12"
  51. @click="addslot()"
  52. >1个插槽</el-button
  53. >
  54. </template>
  55. <template v-if="isJournal">
  56. <el-button
  57. size="default"
  58. plain
  59. class="btn-white P12"
  60. @click="addJournal()"
  61. >查看日志</el-button
  62. >
  63. </template>
  64. <template v-if="isMeasure">
  65. <el-button size="default" plain class="btn-white br" @click="addBbut()"
  66. >测试</el-button
  67. >
  68. </template>
  69. <template v-if="isPreser">
  70. <el-button
  71. type="danger"
  72. size="default"
  73. class="br L12"
  74. @click="preserBtn"
  75. >保存</el-button
  76. >
  77. </template>
  78. <template v-if="isAuth">
  79. <el-button size="default" plain class="btn-white br" @click="addBbut()"
  80. >新增</el-button
  81. >
  82. </template>
  83. <template v-if="isShow">
  84. <img
  85. class="btn-img"
  86. src="@/assets/baggage/ic_setting.png"
  87. title="列设置"
  88. @click="show"
  89. />
  90. </template>
  91. </div>
  92. </div>
  93. </template>
  94. <script setup lang="ts">
  95. import Search from "@/components/search/index.vue";
  96. import { ElMessage } from "element-plus";
  97. const props = defineProps({
  98. //是否显示新增按钮
  99. isBtn: {
  100. type: Boolean,
  101. default: true,
  102. },
  103. //是否启用权限按钮
  104. isAuth: {
  105. type: Boolean,
  106. default: false,
  107. },
  108. //是否显示状态
  109. isStatus: {
  110. type: Boolean,
  111. default: false,
  112. },
  113. //是否显示名称
  114. isStatuser: {
  115. type: Boolean,
  116. default: false,
  117. },
  118. //是否显示搜索
  119. isSearch: {
  120. type: Boolean,
  121. default: false,
  122. },
  123. //是否显示保存
  124. isPreser: {
  125. type: Boolean,
  126. default: false,
  127. },
  128. //是否显示测试
  129. isMeasure: {
  130. type: Boolean,
  131. default: false,
  132. },
  133. //是否显示日志
  134. isJournal: {
  135. type: Boolean,
  136. default: false,
  137. },
  138. //是否显示插槽
  139. isSlot: {
  140. type: Boolean,
  141. default: false,
  142. },
  143. //是否显示列设置
  144. isShow: {
  145. type: Boolean,
  146. default: false,
  147. },
  148. //是否显示时间
  149. isTime: {
  150. type: Boolean,
  151. default: false,
  152. },
  153. });
  154. //搜索内容
  155. const input = ref("");
  156. const startTime = ref<String>(""); //时间
  157. const endTime = ref<String>(""); //时间
  158. const emits = defineEmits([
  159. "addForm",
  160. "preserForm",
  161. "addJournalForm",
  162. "addslotForm",
  163. "showForm",
  164. ]);
  165. const addBbut = () => {
  166. emits("addForm");
  167. };
  168. const search = (val) => {
  169. ElMessage.success(`搜索成功:${val}`);
  170. };
  171. const clear = () => {
  172. ElMessage.success(`清除`);
  173. };
  174. //保存
  175. const preserBtn = () => {
  176. emits("preserForm");
  177. };
  178. //日志
  179. const addJournal = () => {
  180. emits("addJournalForm");
  181. };
  182. //插槽
  183. const addslot = () => {
  184. emits("addslotForm");
  185. };
  186. //列设置
  187. const show = () => {
  188. emits("showForm");
  189. };
  190. </script>
  191. <style lang="scss" scoped>
  192. .data-table-btn {
  193. line-height: 32px;
  194. margin-bottom: 20px;
  195. }
  196. .inputcas {
  197. width: 240px;
  198. height: 32px;
  199. background: #ffffff;
  200. // border: 1px solid #d2d6df;
  201. // box-shadow: 0px 3px 3px 0px rgba(0, 0, 0, 0.06);
  202. border-top-right-radius: 4px;
  203. border-bottom-right-radius: 4px;
  204. border: none;
  205. // box-shadow: 0 0 0 0;
  206. }
  207. ::v-deep .el-input__wrapper {
  208. box-shadow: none;
  209. }
  210. .rb {
  211. display: flex;
  212. align-items: center;
  213. }
  214. .serlog {
  215. width: 32px;
  216. height: 32px;
  217. background: #fff;
  218. border-top-left-radius: 4px;
  219. border-bottom-left-radius: 4px;
  220. display: flex;
  221. align-items: center;
  222. > .log {
  223. width: 14px;
  224. height: 14px;
  225. background: url("../../assets/header/ic_search_top.png") no-repeat;
  226. background-size: 100% 100%;
  227. margin-left: 16px;
  228. }
  229. }
  230. .btn-img {
  231. cursor: pointer;
  232. }
  233. </style>