You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
5.5 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <script setup lang="ts">
  2. import type { logQuery } from 'apis/log'
  3. import { del, list } from 'apis/log'
  4. import { list as matrixList } from 'apis/matrix'
  5. import { list as matrixCraftList } from 'apis/matrixCraft'
  6. import FtButton from 'components/common/FTButton/index.vue'
  7. import SprayParams from 'components/spray/sprayParams/index.vue'
  8. import { ElMessageBox } from 'element-plus'
  9. import { FtMessage } from 'libs/message'
  10. import { onMounted, ref } from 'vue'
  11. onMounted(() => {
  12. getList()
  13. })
  14. const selectedData = ref<any[]>([])
  15. const handleSelectionChange = (val: any[]) => {
  16. console.log(val)
  17. selectedData.value = val
  18. }
  19. const tableData = ref([])
  20. const total = ref(0)
  21. const query = ref<logQuery>({
  22. pageNum: 1,
  23. pageSize: 10,
  24. })
  25. const loading = ref(false)
  26. const MatrixList = ref([])
  27. const MatrixCraftList = ref([])
  28. const getList = async () => {
  29. loading.value = true
  30. const res = await list(query.value)
  31. tableData.value = res.list
  32. tableData.value = tableData.value.map((item: any) => {
  33. return {
  34. ...item,
  35. ...JSON.parse(item.matrixInfo),
  36. }
  37. })
  38. const res1 = await matrixList({ pageNum: 1, pageSize: 1000 })
  39. MatrixList.value = res1.list
  40. const res2 = await matrixCraftList({ pageNum: 1, pageSize: 1000 })
  41. MatrixCraftList.value = res2.list
  42. console.log(tableData.value)
  43. total.value = res.total
  44. loading.value = false
  45. }
  46. const pageChange = (pageNum: number, pageSize: number) => {
  47. query.value.pageNum = pageNum
  48. query.value.pageSize = pageSize
  49. getList()
  50. }
  51. const delHandle = async () => {
  52. const ids = selectedData.value.map((item: any) => item.id)
  53. ElMessageBox.confirm('确认删除?', '提示', {
  54. type: 'warning',
  55. confirmButtonText: '确定',
  56. cancelButtonText: '取消',
  57. showCancelButton: true,
  58. showClose: false,
  59. closeOnClickModal: false,
  60. closeOnPressEscape: false,
  61. closeOnHashChange: false,
  62. }).then(async () => {
  63. await del(ids.join(','))
  64. FtMessage.success('删除成功')
  65. await getList()
  66. })
  67. }
  68. const selectCraftVisible = ref(false)
  69. const currentFormData = ref<any>({})
  70. const viewParams = (row: any) => {
  71. currentFormData.value = row
  72. selectCraftVisible.value = true
  73. }
  74. </script>
  75. <template>
  76. <div>
  77. <el-row class="search-box">
  78. <el-col :span="12">
  79. <!-- <el-input v-model="query.matrixName" class="my-input" placeholder="请输入基质名称" clearable @input="inputChange" /> -->
  80. </el-col>
  81. <el-col :span="12">
  82. <div style="float: right">
  83. <!-- <FtButton type="primary" @click="addHandle"> -->
  84. <!-- 新增 -->
  85. <!-- </FtButton> -->
  86. <!-- <FtButton :disabled="selectedData.length !== 1" @click="editHandle"> -->
  87. <!-- 编辑 -->
  88. <!-- </FtButton> -->
  89. <FtButton :disabled="selectedData.length === 0" @click="delHandle">
  90. 删除
  91. </FtButton>
  92. </div>
  93. </el-col>
  94. </el-row>
  95. <div class="table-box">
  96. <el-table v-loading="loading" show-overflow-tooltip :data="tableData" header-row-class-name="table-header" height="100%" @selection-change="handleSelectionChange">
  97. <el-table-column type="selection" />
  98. <el-table-column prop="createTime" label="创建时间" />
  99. <el-table-column prop="status" label="任务状态">
  100. <template #default="scope">
  101. <el-tag v-if="scope.row.status === 0" type="info">
  102. 进行中
  103. </el-tag>
  104. <el-tag v-if="scope.row.status === 1" type="success">
  105. 已完成
  106. </el-tag>
  107. <el-tag v-if="scope.row.status === 2" type="warning">
  108. 手动暂停
  109. </el-tag>
  110. <el-tag v-if="scope.row.status === 3" type="danger">
  111. 手动停止
  112. </el-tag>
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="">
  116. <template #default="scope">
  117. <div class="scope-box">
  118. <FtButton type="primary" @click="viewParams(scope.row)">
  119. 喷涂参数
  120. </FtButton>
  121. </div>
  122. </template>
  123. </el-table-column>
  124. </el-table>
  125. </div>
  126. <div class="table-footer">
  127. <el-pagination size="large" background layout="prev, pager, next, total" :total @change="pageChange" />
  128. </div>
  129. <SprayParams
  130. v-if="selectCraftVisible"
  131. disabled
  132. :form-data="currentFormData"
  133. @cancel="selectCraftVisible = false"
  134. />
  135. </div>
  136. </template>
  137. <style scoped lang="scss">
  138. .table-header {
  139. background: #E8ECF7;
  140. }
  141. .my-input {
  142. height: 100px;
  143. width: 400px;
  144. margin-right: 20px;
  145. background: #E8ECF7;
  146. border: 0;
  147. .el-input__wrapper {
  148. background: #E8ECF7;
  149. border: 0;
  150. .el-input__inner {
  151. height: calc(100% - 2px);
  152. }
  153. }
  154. }
  155. :deep(.el-input__inner)::placeholder {
  156. color: #a8abb2;
  157. font-size: 40px;
  158. }
  159. .my-select {
  160. width: 400px;
  161. .el-select__input {
  162. height: 80px !important;
  163. }
  164. .el-select__wrapper {
  165. min-height: 80px;
  166. background: #E8ECF7;
  167. border: 0;
  168. font-size: 40px;
  169. line-height:40px;
  170. }
  171. .el-select__placeholder {
  172. color: #0349A8;
  173. font-weight: 500;
  174. }
  175. .el-select-dropdown__item {
  176. height: 80px;
  177. line-height: 40px;
  178. padding: 20px;
  179. font-size: 40px;
  180. }
  181. .el-select-dropdown__empty {
  182. font-size: 40px;
  183. line-height: 40px;
  184. padding: 20px;
  185. }
  186. }
  187. .search-box {
  188. height: 120px;
  189. }
  190. .table-footer {
  191. height: 100px;
  192. display: flex;
  193. justify-content: flex-end;
  194. }
  195. .table-box {
  196. height: calc(100% - 100px - 120px);
  197. }
  198. :deep(.el-tag) {
  199. }
  200. </style>