index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <div class="table_item">
  3. <s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.code">
  4. <template #operator>
  5. <!-- 搜索区域 -->
  6. <div class="table-search">
  7. <div class="table-search-form">
  8. <a-row :gutter="10">
  9. <a-form
  10. ref="searchFormRef"
  11. name="advanced_search"
  12. layout="inline"
  13. :label-col="{ style: { width: '70px', justifyContent: 'end' } }"
  14. :model="searchFormState"
  15. class="ant-advanced-search-form"
  16. >
  17. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8">
  18. <a-form-item label="接口类型" name="type">
  19. <a-select v-model:value="searchFormState.type" placeholder="请选择接口类型">
  20. <a-select-option value="1">甘肃疾控</a-select-option>
  21. <a-select-option value="2">唐山</a-select-option>
  22. <a-select-option value="3">世窗</a-select-option>
  23. </a-select>
  24. </a-form-item></a-col
  25. >
  26. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
  27. ><a-form-item label="设备名称" name="name">
  28. <a-input v-model:value="searchFormState.name" placeholder="请输入设备名称" /> </a-form-item
  29. ></a-col>
  30. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
  31. ><a-form-item label="所属部门" name="ssbm">
  32. <a-input v-model:value="searchFormState.ssbm" placeholder="请输入所属部门" /> </a-form-item
  33. ></a-col>
  34. </a-form>
  35. </a-row>
  36. </div>
  37. <div class="table-search-buttons">
  38. <a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
  39. <a-button class="xn-mg08" @click="reset">重置</a-button>
  40. </div>
  41. </div>
  42. <!-- 其他操作区域 -->
  43. <div class="table-head-btn">
  44. <div class="btn-left">
  45. <a-button type="primary">
  46. <template #icon><plus-outlined /></template>新增
  47. </a-button>
  48. </div>
  49. </div>
  50. </template>
  51. <template #bodyCell="{ column, record }">
  52. <template v-if="column.dataIndex === 'action'">
  53. <a-button type="link" size="small">编辑</a-button>
  54. <a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
  55. <a-button type="link" danger size="small">删除</a-button>
  56. </a-popconfirm>
  57. <a-button type="link" size="small">记录</a-button>
  58. </template>
  59. </template>
  60. </s-table>
  61. </div>
  62. </template>
  63. <script setup>
  64. import tool from '@/utils/tool'
  65. import jobApi from '@/api/dev/jobApi'
  66. const searchFormRef = ref()
  67. const searchFormState = ref({})
  68. const tableRef = ref()
  69. const columns = [
  70. {
  71. title: '接口类型',
  72. dataIndex: 'type',
  73. align: 'center',
  74. ellipsis: true
  75. },
  76. {
  77. title: '设备名称',
  78. dataIndex: 'name',
  79. align: 'center',
  80. ellipsis: true
  81. },
  82. {
  83. title: '所属部门',
  84. dataIndex: 'ssbm',
  85. align: 'center',
  86. ellipsis: true
  87. },
  88. {
  89. title: '操作',
  90. dataIndex: 'action',
  91. align: 'center',
  92. width: 150
  93. }
  94. ]
  95. const loadData = (parameter) => {
  96. return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
  97. // return res
  98. const obj = {
  99. current: 1,
  100. pages: 1,
  101. records: [
  102. {
  103. name: 'ABSL-1设备',
  104. type: '唐山',
  105. ssbm: '广州海关技术中心'
  106. },
  107. {
  108. name: 'ABSL-2设备',
  109. type: '甘肃市疾控',
  110. ssbm: '广州海关技术中心'
  111. },
  112. {
  113. name: 'ABSL-3设备',
  114. type: '唐山',
  115. ssbm: '广州海关技术中心'
  116. },
  117. {
  118. name: 'ABSL-4设备',
  119. type: '唐山',
  120. ssbm: '广州海关技术中心'
  121. },
  122. {
  123. name: 'ABSL-5设备',
  124. type: '唐山',
  125. ssbm: '广州海关技术中心'
  126. },
  127. {
  128. name: 'ABSL-6设备',
  129. type: '唐山',
  130. ssbm: '广州海关技术中心'
  131. }
  132. ],
  133. size: 10,
  134. total: 6
  135. }
  136. return obj
  137. })
  138. }
  139. // 重置
  140. const reset = () => {
  141. searchFormRef.value.resetFields()
  142. tableRef.value.refresh(true)
  143. }
  144. // 删除
  145. const deleteData = (record) => {
  146. console.log(record, '删除')
  147. }
  148. </script>
  149. <style lang="less" scoped>
  150. .table_item {
  151. padding: 15px 20px;
  152. background-color: #ffffff;
  153. :deep(.ant-table-pagination-right) {
  154. justify-content: center !important;
  155. }
  156. }
  157. .list {
  158. width: 60%;
  159. padding: 10px 20px;
  160. border-radius: 10px;
  161. background-color: #ffffff;
  162. :deep(.ant-descriptions) {
  163. margin-bottom: 10px;
  164. }
  165. :deep(.ant-descriptions-header) {
  166. margin: 0;
  167. padding: 10px;
  168. border: 1px solid #f0f0f0;
  169. border-bottom: none;
  170. }
  171. }
  172. </style>