index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <el-row :gutter="20">
  3. <el-col :span="4" :xs="24">
  4. <el-card class="box-card" v-for="(item,index) in arry1" :key="index">
  5. <template #header>
  6. <div class="card-header">
  7. <span>Card name</span>
  8. <el-button class="button" text>Operation button</el-button>
  9. </div>
  10. </template>
  11. <div v-for="o in 4" :key="o" class="text item">{{ 'List item ' + o }}</div>
  12. </el-card>
  13. </el-col>
  14. <el-col :span="16" :xs="24">
  15. <ContentWrap>
  16. <!-- 搜索工作栏 -->
  17. <el-form
  18. class="-mb-15px"
  19. :model="queryParams"
  20. ref="queryFormRef"
  21. :inline="true"
  22. label-width="68px"
  23. >
  24. <el-form-item label="资产编号" prop="deviceCode">
  25. <el-input
  26. v-model="queryParams.deviceCode"
  27. placeholder="请输入资产编号"
  28. clearable
  29. @keyup.enter="handleQuery"
  30. class="!w-240px"
  31. />
  32. </el-form-item>
  33. <el-form-item label="填写日期" prop="creDate">
  34. <el-date-picker
  35. v-model="queryParams.creDate"
  36. value-format="YYYY-MM-DD HH:mm:ss"
  37. type="daterange"
  38. start-placeholder="开始日期"
  39. end-placeholder="结束日期"
  40. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  41. class="!w-220px"
  42. />
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  46. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  47. <!-- <el-button
  48. type="primary"
  49. plain
  50. @click="openForm('create')"
  51. v-hasPermi="['rq:iot-opeation-fill:create']"
  52. >
  53. <Icon icon="ep:plus" class="mr-5px" /> 新增
  54. </el-button>-->
  55. <el-button
  56. type="success"
  57. plain
  58. @click="handleExport"
  59. :loading="exportLoading"
  60. v-hasPermi="['rq:iot-opeation-fill:export']"
  61. >
  62. <Icon icon="ep:download" class="mr-5px" /> 导出
  63. </el-button>
  64. </el-form-item>
  65. </el-form>
  66. </ContentWrap>
  67. <!-- 列表 -->
  68. <ContentWrap>
  69. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  70. <el-table-column label="资产编号" align="center" prop="deviceCode" />
  71. <el-table-column label="设备名称" align="center" prop="deviceName" />
  72. <el-table-column label="填写内容" align="center" prop="fillContent" />
  73. <el-table-column label="所属组织" align="center" prop="orgName" />
  74. <!-- <el-table-column label="项目部" align="center" prop="proName" />
  75. <el-table-column label="小队" align="center" prop="teamName" />-->
  76. <el-table-column label="负责人" align="center" prop="dutyName" />
  77. <el-table-column
  78. label="创建日期"
  79. align="center"
  80. prop="creDate"
  81. :formatter="dateFormatter2"
  82. width="180px"
  83. />
  84. <el-table-column label="操作" align="center" min-width="120px">
  85. <template #default="scope">
  86. <el-button
  87. link
  88. type="primary"
  89. @click="openForm('update', scope.row.id)"
  90. v-hasPermi="['rq:iot-opeation-fill:update']"
  91. >
  92. 编辑
  93. </el-button>
  94. <el-button
  95. link
  96. type="danger"
  97. @click="handleDelete(scope.row.id)"
  98. v-hasPermi="['rq:iot-opeation-fill:delete']"
  99. >
  100. 删除
  101. </el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <!-- 分页 -->
  106. <Pagination
  107. :total="total"
  108. v-model:page="queryParams.pageNo"
  109. v-model:limit="queryParams.pageSize"
  110. @pagination="getList"
  111. />
  112. </ContentWrap>
  113. </el-col>
  114. <!-- 表单弹窗:添加/修改 -->
  115. <IotOpeationFillForm ref="formRef" @success="getList" :dept="deptInfo"/>
  116. </el-row>
  117. </template>
  118. <script setup lang="ts">
  119. import { dateFormatter2 } from '@/utils/formatTime'
  120. import download from '@/utils/download'
  121. import { IotOpeationFillApi, IotOpeationFillVO } from '@/api/pms/iotopeationfill'
  122. import IotOpeationFillForm from './IotOpeationFillForm.vue'
  123. import Vue from "@vitejs/plugin-vue";
  124. /** 运行记录填报 列表 */
  125. defineOptions({ name: 'IotOpeationFill' })
  126. const message = useMessage() // 消息弹窗
  127. const { t } = useI18n() // 国际化
  128. const loading = ref(true) // 列表的加载中
  129. const list = ref<IotOpeationFillVO[]>([]) // 列表的数据
  130. const total = ref(0) // 列表的总页数
  131. let arry1 =[];
  132. const cards= [
  133. { title: '卡片 1', content: '这是卡片 1 的内容' },
  134. { title: '卡片 2', content: '这是卡片 2 的内容' },
  135. { title: '卡片 3', content: '这是卡片 3 的内容' }
  136. ]
  137. const queryParams = reactive({
  138. pageNo: 1,
  139. pageSize: 10,
  140. deviceCode: undefined,
  141. deviceName: undefined,
  142. fillContent: undefined,
  143. deviceType: undefined,
  144. deviceComponent: undefined,
  145. deptId: undefined,
  146. orgName: undefined,
  147. proId: undefined,
  148. proName: undefined,
  149. teamId: undefined,
  150. teamName: undefined,
  151. dutyName: undefined,
  152. creDate: [],
  153. createTime: [],
  154. })
  155. const queryFormRef = ref() // 搜索的表单
  156. const exportLoading = ref(false) // 导出的加载中
  157. let deptInfo = {deptId:'',orgName:''};
  158. /** 处理部门被点击 */
  159. const handleDeptNodeClick = async (row) => {
  160. queryParams.deptId = row.id
  161. queryParams.orgName = row.name;
  162. deptInfo.orgName = queryParams.orgName;
  163. deptInfo.deptId = queryParams.deptId;
  164. await getList()
  165. }
  166. const formatDescription = async(row, column, cellValue) =>{
  167. return cellValue.split(',').map(part => `<div>${part}</div>`).join('');
  168. }
  169. /** 查询列表 */
  170. const getList = async () => {
  171. loading.value = true
  172. try {
  173. const data = await IotOpeationFillApi.getIotOpeationFillPage(queryParams)
  174. list.value = data;
  175. list.value.forEach(function (item, index) {
  176. arry1.push({deviceName:item.deviceName,deviceCode:item.deviceCode})
  177. });
  178. alert(JSON.stringify(arry1))
  179. alert(Array.isArray(arry1));
  180. } finally {
  181. loading.value = false
  182. }
  183. }
  184. /** 搜索按钮操作 */
  185. const handleQuery = () => {
  186. queryParams.pageNo = 1
  187. getList()
  188. }
  189. /** 重置按钮操作 */
  190. const resetQuery = () => {
  191. queryFormRef.value.resetFields()
  192. handleQuery()
  193. }
  194. /** 添加/修改操作 */
  195. const formRef = ref()
  196. const openForm = (type: string, id?: number) => {
  197. formRef.value.open(type, id)
  198. }
  199. /** 删除按钮操作 */
  200. const handleDelete = async (id: number) => {
  201. try {
  202. // 删除的二次确认
  203. await message.delConfirm()
  204. // 发起删除
  205. await IotOpeationFillApi.deleteIotOpeationFill(id)
  206. message.success(t('common.delSuccess'))
  207. // 刷新列表
  208. await getList()
  209. } catch {}
  210. }
  211. /** 导出按钮操作 */
  212. const handleExport = async () => {
  213. try {
  214. // 导出的二次确认
  215. await message.exportConfirm()
  216. // 发起导出
  217. exportLoading.value = true
  218. const data = await IotOpeationFillApi.exportIotOpeationFill(queryParams)
  219. download.excel(data, '运行记录填报.xls')
  220. } catch {
  221. } finally {
  222. exportLoading.value = false
  223. }
  224. }
  225. /** 初始化 **/
  226. onMounted(() => {
  227. getList()
  228. })
  229. </script>