|
@@ -1,6 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
import { useTableComponents } from '@/components/ZmTable/useTableComponents'
|
|
import { useTableComponents } from '@/components/ZmTable/useTableComponents'
|
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
|
|
|
|
|
+import { IotOperationPlanApi } from '@/api/pms/iotopeationfill/plan'
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
import { DICT_TYPE, getStrDictOptions } from '@/utils/dict'
|
|
|
import download from '@/utils/download'
|
|
import download from '@/utils/download'
|
|
@@ -21,6 +22,7 @@ interface QueryParams extends PageParam {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const { t } = useI18n()
|
|
const { t } = useI18n()
|
|
|
|
|
+const message = useMessage()
|
|
|
const { push } = useRouter()
|
|
const { push } = useRouter()
|
|
|
const { ZmTable, ZmTableColumn } = useTableComponents<IotDeviceVO>()
|
|
const { ZmTable, ZmTableColumn } = useTableComponents<IotDeviceVO>()
|
|
|
|
|
|
|
@@ -44,6 +46,7 @@ const queryParams = reactive<QueryParams>({ ...initQuery })
|
|
|
const queryFormRef = ref()
|
|
const queryFormRef = ref()
|
|
|
const loading = ref(false)
|
|
const loading = ref(false)
|
|
|
const exportLoading = ref(false)
|
|
const exportLoading = ref(false)
|
|
|
|
|
+const generatingDeviceId = ref<number>()
|
|
|
const ifShow = ref(false)
|
|
const ifShow = ref(false)
|
|
|
const list = ref<IotDeviceVO[]>([])
|
|
const list = ref<IotDeviceVO[]>([])
|
|
|
const total = ref(0)
|
|
const total = ref(0)
|
|
@@ -129,6 +132,20 @@ const handleView = async (deviceId: number) => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const handleGenerateRecord = async (row: IotDeviceVO) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await message.confirm(
|
|
|
|
|
+ `将为“${row.deviceName}”所属部门重新生成今日运行记录,如已有记录将先删除再生成,是否继续?`
|
|
|
|
|
+ )
|
|
|
|
|
+ generatingDeviceId.value = row.id
|
|
|
|
|
+ const result = await IotOperationPlanApi.manualGenerateByDeviceId(row.id)
|
|
|
|
|
+ message.success(result)
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ generatingDeviceId.value = undefined
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const handleExport = async () => {
|
|
const handleExport = async () => {
|
|
|
exportLoading.value = true
|
|
exportLoading.value = true
|
|
|
try {
|
|
try {
|
|
@@ -300,7 +317,7 @@ onMounted(() => {
|
|
|
<dict-tag :type="DICT_TYPE.PMS_DEVICE_STATUS" :value="row.deviceStatus" />
|
|
<dict-tag :type="DICT_TYPE.PMS_DEVICE_STATUS" :value="row.deviceStatus" />
|
|
|
</template>
|
|
</template>
|
|
|
</ZmTableColumn>
|
|
</ZmTableColumn>
|
|
|
- <ZmTableColumn :label="t('deviceStatus.operation')" width="150" fixed="right" action>
|
|
|
|
|
|
|
+ <ZmTableColumn :label="t('deviceStatus.operation')" width="230" fixed="right" action>
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
<el-button
|
|
<el-button
|
|
|
link
|
|
link
|
|
@@ -309,6 +326,15 @@ onMounted(() => {
|
|
|
v-hasPermi="['rq:iot-device:query']">
|
|
v-hasPermi="['rq:iot-device:query']">
|
|
|
{{ t('deviceStatus.adjustmentRecords') }}
|
|
{{ t('deviceStatus.adjustmentRecords') }}
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ link
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :loading="generatingDeviceId === row.id"
|
|
|
|
|
+ :disabled="generatingDeviceId !== undefined && generatingDeviceId !== row.id"
|
|
|
|
|
+ @click="handleGenerateRecord(row)"
|
|
|
|
|
+ v-hasPermi="['rq:iot-operation-plan:create']">
|
|
|
|
|
+ 生成记录
|
|
|
|
|
+ </el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</ZmTableColumn>
|
|
</ZmTableColumn>
|
|
|
</ZmTable>
|
|
</ZmTable>
|