scrap.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <div class="table_item">
  3. <s-table ref="tableRef" :columns="columns" :data="loadData" :row-key="(record) => record.code" bordered>
  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="dxcode">
  19. <a-input v-model:value="searchFormState.dxcode" placeholder="请输入对象编号" /> </a-form-item
  20. ></a-col>
  21. <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="8"
  22. ><a-form-item label="对象名称" name="name">
  23. <a-input v-model:value="searchFormState.name" placeholder="请输入对象名称" /> </a-form-item
  24. ></a-col>
  25. </a-form>
  26. </a-row>
  27. </div>
  28. <div class="table-search-buttons">
  29. <a-button type="primary" @click="tableRef.refresh(true)">查询</a-button>
  30. <a-button class="xn-mg08" @click="reset">重置</a-button>
  31. </div>
  32. </div>
  33. <!-- 其他操作区域 -->
  34. <div class="table-head-btn">
  35. <div class="btn-left">
  36. <a-button type="primary">
  37. <template #icon><plus-outlined /></template>新增
  38. </a-button>
  39. </div>
  40. <div class="btn-right">
  41. <a-button>
  42. <template #icon><download-outlined /></template>导出
  43. </a-button>
  44. </div>
  45. </div>
  46. </template>
  47. <template #bodyCell="{ column, record, index }">
  48. <!-- 序号 -->
  49. <template v-if="column.dataIndex === 'index'">{{ index + 1 }} </template>
  50. <template v-if="column.dataIndex === 'sfxf'">
  51. <span>
  52. <a-tag :color="record.sfxf == '1' ? '#87d068' : '#cd201f'">
  53. {{ record.sfxf == '1' ? '是' : '否' }}
  54. </a-tag>
  55. </span>
  56. </template>
  57. <template v-if="column.dataIndex === 'action'">
  58. <a-button type="link" size="small">编辑</a-button>
  59. <a-popconfirm title="确定要删除吗?" @confirm="deleteData(record)">
  60. <a-button type="link" danger size="small">删除</a-button>
  61. </a-popconfirm>
  62. <a-button type="link" size="small">记录</a-button>
  63. </template>
  64. </template>
  65. </s-table>
  66. </div>
  67. </template>
  68. <script setup>
  69. import tool from '@/utils/tool'
  70. import jobApi from '@/api/dev/jobApi'
  71. const searchFormRef = ref()
  72. const searchFormState = ref({})
  73. const tableRef = ref()
  74. const columns = [
  75. {
  76. title: '序号',
  77. dataIndex: 'index',
  78. align: 'center',
  79. width: 50
  80. },
  81. {
  82. title: '对象编号',
  83. dataIndex: 'code',
  84. align: 'center',
  85. ellipsis: true
  86. },
  87. {
  88. title: '对象名称',
  89. dataIndex: 'name',
  90. align: 'center',
  91. ellipsis: true
  92. },
  93. {
  94. title: '品牌',
  95. dataIndex: 'pp',
  96. align: 'center',
  97. ellipsis: true
  98. },
  99. {
  100. title: '规则型号',
  101. dataIndex: 'gzxh',
  102. align: 'center',
  103. ellipsis: true
  104. },
  105. {
  106. title: '所处位置',
  107. dataIndex: 'scwz',
  108. align: 'center',
  109. ellipsis: true
  110. },
  111. {
  112. title: '设备折旧',
  113. dataIndex: 'sbzj',
  114. align: 'center',
  115. ellipsis: true
  116. },
  117. {
  118. title: '设备净值',
  119. dataIndex: 'wxrq',
  120. align: 'center',
  121. ellipsis: true
  122. },
  123. {
  124. title: '单位负责人确认时间',
  125. dataIndex: 'dwfzrqrsj',
  126. align: 'center',
  127. ellipsis: true
  128. },
  129. {
  130. title: '单位负责人',
  131. dataIndex: 'dwfzr',
  132. align: 'center',
  133. ellipsis: true
  134. },
  135. {
  136. title: '检验部门负责人确认时间',
  137. dataIndex: 'jybmfzrqrsj',
  138. align: 'center',
  139. ellipsis: true
  140. },
  141. {
  142. title: '检验部门负责人',
  143. dataIndex: 'jybmfzr',
  144. align: 'center',
  145. ellipsis: true
  146. },
  147. {
  148. title: '报废时间',
  149. dataIndex: 'bfsj',
  150. align: 'center',
  151. ellipsis: true
  152. },
  153. {
  154. title: '报废理由',
  155. dataIndex: 'bfly',
  156. align: 'center',
  157. ellipsis: true
  158. },
  159. {
  160. title: '操作',
  161. dataIndex: 'action',
  162. align: 'center',
  163. width: 150
  164. }
  165. ]
  166. const loadData = (parameter) => {
  167. return jobApi.jobPage(Object.assign(parameter, searchFormState.value)).then((res) => {
  168. // return res
  169. const obj = {
  170. current: 1,
  171. pages: 1,
  172. records: [
  173. {
  174. code: 'Y6578945621',
  175. name: 'ABSL-1超低温冰箱',
  176. pp: '海尔1',
  177. dwfzrqrsj: 'HEGZXH-202411120920',
  178. scwz: '实验室一号楼301室',
  179. sbzj: '',
  180. wxrq: '',
  181. shrq: '2024-09-28 01:03:24',
  182. dwfzr: '欧阳天添',
  183. jybmfzrqrsj: '2024-09-30 11:51:02',
  184. jybmfzr: '欧阳天添',
  185. bfsj: '2024-09-30 11:51:02',
  186. bfly: '报废'
  187. },
  188. {
  189. code: 'Y6578945622',
  190. name: 'ABSL-2超低温冰箱',
  191. pp: '海尔',
  192. dwfzrqrsj: 'HEGZXH-202411120920',
  193. scwz: '实验室一号楼302室',
  194. sbzj: '',
  195. wxrq: '',
  196. shrq: '2024-09-28 02:03:24',
  197. dwfzr: '欧阳天添',
  198. jybmfzrqrsj: '2024-09-30 11:51:02',
  199. jybmfzr: '欧阳天添',
  200. bfsj: '2024-09-30 11:51:02',
  201. bfly: '报废'
  202. },
  203. {
  204. code: 'Y6578945623',
  205. name: 'ABSL-3超低温冰箱',
  206. pp: '海尔',
  207. dwfzrqrsj: 'HEGZXH-202411120920',
  208. scwz: '实验室一号楼303室',
  209. sbzj: '',
  210. wxrq: '',
  211. shrq: '2024-09-28 03:03:24',
  212. dwfzr: '欧阳天添',
  213. jybmfzrqrsj: '2024-09-30 11:51:02',
  214. jybmfzr: '欧阳天添',
  215. bfsj: '2024-09-30 11:51:02',
  216. bfly: '报废'
  217. },
  218. {
  219. code: 'Y6578945624',
  220. name: 'ABSL-4超低温冰箱',
  221. pp: '海尔',
  222. dwfzrqrsj: 'HEGZXH-202411120920',
  223. scwz: '实验室一号楼304室',
  224. sbzj: '',
  225. wxrq: '',
  226. shrq: '2024-09-28 04:03:24',
  227. dwfzr: '欧阳天添',
  228. jybmfzrqrsj: '2024-09-30 11:51:02',
  229. jybmfzr: '欧阳天添',
  230. bfsj: '2024-09-30 11:51:02',
  231. bfly: '报废'
  232. },
  233. {
  234. code: 'Y6578945625',
  235. name: 'ABSL-5超低温冰箱',
  236. pp: '海尔',
  237. dwfzrqrsj: 'HEGZXH-202411120920',
  238. scwz: '实验室一号楼305室',
  239. sbzj: '',
  240. wxrq: '',
  241. shrq: '2024-09-28 05:03:24',
  242. dwfzr: '欧阳天添',
  243. jybmfzrqrsj: '2024-09-30 11:51:02',
  244. jybmfzr: '欧阳天添',
  245. bfsj: '2024-09-30 11:51:02',
  246. bfly: '报废'
  247. },
  248. {
  249. code: 'Y6578945626',
  250. name: 'ABSL-6超低温冰箱',
  251. pp: '海尔',
  252. dwfzrqrsj: 'HEGZXH-202411120920',
  253. scwz: '实验室一号楼306室',
  254. sbzj: '',
  255. wxrq: '',
  256. shrq: '2024-09-28 06:03:24',
  257. dwfzr: '欧阳天添',
  258. jybmfzrqrsj: '2024-09-30 11:51:02',
  259. jybmfzr: '欧阳天添',
  260. bfsj: '2024-09-30 11:51:02',
  261. bfly: '报废'
  262. }
  263. ],
  264. size: 10,
  265. total: 6
  266. }
  267. return obj
  268. })
  269. }
  270. // 重置
  271. const reset = () => {
  272. searchFormRef.value.resetFields()
  273. tableRef.value.refresh(true)
  274. }
  275. // 删除
  276. const deleteData = (record) => {
  277. console.log(record, '删除')
  278. }
  279. </script>
  280. <style lang="less" scoped>
  281. .table_item {
  282. padding: 15px 20px;
  283. :deep(.ant-table-pagination-right) {
  284. justify-content: center !important;
  285. }
  286. }
  287. </style>