|
|
@@ -106,12 +106,22 @@
|
|
|
<el-tooltip content="删除" placement="top">
|
|
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['source:itemPush:remove']"></el-button>
|
|
|
</el-tooltip>
|
|
|
-<!-- <el-tooltip content="提交审核" placement="top">
|
|
|
- <el-button link type="primary" icon="Top" @click="handleReview(scope.row)" v-hasPermi="['source:minioData:add']"></el-button>
|
|
|
- </el-tooltip>-->
|
|
|
+ <!-- <el-tooltip content="提交审核" placement="top">
|
|
|
+ <el-button link type="primary" icon="Top" @click="handleReview(scope.row)" v-hasPermi="['source:minioData:add']"></el-button>
|
|
|
+ </el-tooltip>-->
|
|
|
<el-tooltip content="下发详情" placement="top">
|
|
|
<el-button link type="primary" icon="List" @click="handleDevice(scope.row)" v-hasPermi="['source:itemPush:edit']"></el-button>
|
|
|
</el-tooltip>
|
|
|
+ <el-tooltip content="下架" placement="top">
|
|
|
+ <el-button
|
|
|
+ link
|
|
|
+ type="primary"
|
|
|
+ icon="Bottom"
|
|
|
+ v-if="scope.row.status == 'finish'"
|
|
|
+ @click="handleRemoveItem(scope.row)"
|
|
|
+ v-hasPermi="['source:itemPush:edit']"
|
|
|
+ ></el-button>
|
|
|
+ </el-tooltip>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -199,9 +209,9 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="名称" align="left" prop="itemName" :show-overflow-tooltip="true" />
|
|
|
<el-table-column label="资源数量" align="center" prop="sourceNum" width="80" />
|
|
|
- <!--
|
|
|
- <el-table-column label="创建人" align="left" prop="createUser" width="100" :show-overflow-tooltip="true" />
|
|
|
- -->
|
|
|
+ <!--
|
|
|
+ <el-table-column label="创建人" align="left" prop="createUser" width="100" :show-overflow-tooltip="true" />
|
|
|
+ -->
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</el-col>
|
|
|
@@ -216,51 +226,50 @@
|
|
|
|
|
|
<!-- 下发详情弹窗 -->
|
|
|
<el-dialog :title="deviceDialog.title" v-model="deviceDialog.visible" width="900px" append-to-body>
|
|
|
- <el-row :gutter="20" style="height: 100%; display: flex">
|
|
|
- <!--发布名称-->
|
|
|
- <el-col :span="10" style="height: 100%; overflow: auto; padding-left: 10px">
|
|
|
- <el-form ref="itemPushFormRef" :model="form" :rules="rules" label-width="60px">
|
|
|
- <el-form-item label="名称" prop="name">
|
|
|
- <el-input v-model="form.name" placeholder="请输入名称" :disabled="true" />
|
|
|
- </el-form-item>
|
|
|
- <el-row>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="类型" prop="itemType">
|
|
|
- <el-select v-model="form.itemType" placeholder="请选择类型" @change="getItemList" :disabled="true">
|
|
|
- <el-option v-for="dict in smsb_push_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="优先级" prop="level">
|
|
|
- <el-select v-model="form.level" placeholder="请选择优先级" :disabled="true">
|
|
|
- <el-option v-for="dict in smsb_push_level" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- </el-col>
|
|
|
- <!--设备列表-->
|
|
|
- <el-col :span="14" style="height: 100%; overflow: auto; border-right: 1px solid #eee; padding-right: 10px">
|
|
|
- <el-table v-loading="loading" :data="pushDeviceList">
|
|
|
- <el-table-column label="设备名称" align="left" prop="deviceName" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column label="发布排序" align="center" prop="sortNum" width="100" :show-overflow-tooltip="true" />
|
|
|
- <el-table-column label="发布状态" align="center" prop="pushState" width="120" :show-overflow-tooltip="true">
|
|
|
- <template #default="scope">
|
|
|
- <dict-tag :options="smsb_push_device_state" :value="scope.row.pushState" />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <pagination
|
|
|
- v-show="deviceTotal > 0"
|
|
|
- :total="deviceTotal"
|
|
|
- v-model:page="dialogQueryParams.pageNum"
|
|
|
- v-model:limit="dialogQueryParams.pageSize"
|
|
|
- @pagination="getList"
|
|
|
- />
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <!--发布名称-->
|
|
|
+ <div>
|
|
|
+ <el-form ref="itemPushFormRef" :model="form" :rules="rules" label-width="70px">
|
|
|
+ <el-form-item label="发布名称" prop="name">
|
|
|
+ <el-input v-model="form.name" style="width: 500px" placeholder="请输入名称" :disabled="true" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="发布类型" prop="itemType">
|
|
|
+ <el-select v-model="form.itemType" placeholder="请选择类型" @change="getItemList" :disabled="true">
|
|
|
+ <el-option v-for="dict in smsb_push_type" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="优先级" prop="level">
|
|
|
+ <el-select v-model="form.level" placeholder="请选择优先级" :disabled="true">
|
|
|
+ <el-option v-for="dict in smsb_push_level" :key="dict.value" :label="dict.label" :value="parseInt(dict.value)"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <!--设备列表-->
|
|
|
+ <el-button type="primary" v-if="removeItemTag" icon="Bottom" :disabled="removeButtonTag" @click="handleDoRemoveItem()"> 下架 </el-button>
|
|
|
+ <el-table v-loading="deviceLoading" :data="pushDeviceList" style="height: 500px; margin-top: 10px" @selection-change="handleDeviceSelectionChange">
|
|
|
+ <el-table-column type="selection" v-if="removeItemTag" width="55" align="center" />
|
|
|
+ <el-table-column label="设备名称" align="left" prop="deviceName" :show-overflow-tooltip="true" />
|
|
|
+ <el-table-column label="发布排序" align="center" prop="sortNum" width="100" :show-overflow-tooltip="true" />
|
|
|
+ <el-table-column label="发布状态" align="center" prop="pushState" width="120" :show-overflow-tooltip="true">
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :options="smsb_push_device_state" :value="scope.row.pushState" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="发布时间" align="left" prop="createTime" width="170" :show-overflow-tooltip="true" />
|
|
|
+ <el-table-column label="操作" v-if="removeItemTag" align="center" class-name="small-padding fixed-width" width="150">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-tooltip content="下架" placement="top">
|
|
|
+ <el-button link type="primary" icon="Bottom" @click="handleDoRemoveItem(scope.row)" v-hasPermi="['source:itemPush:edit']"></el-button>
|
|
|
+ </el-tooltip>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
<el-button @click="cancel">取 消</el-button>
|
|
|
@@ -278,7 +287,7 @@ import { listDevice } from '@/api/smsb/device/device';
|
|
|
import { ItemQuery, ItemVO } from '@/api/smsb/source/item_type';
|
|
|
import { listItem } from '@/api/smsb/source/item';
|
|
|
import { ItemPushDeviceVO } from '@/api/smsb/source/item_push_device_type';
|
|
|
-import { listItemPushDeviceV2 } from '@/api/smsb/source/item_push_device';
|
|
|
+import { listItemPushDeviceV2, removeItemPushDevice } from '@/api/smsb/source/item_push_device';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { smsb_push_state, smsb_push_device_state, smsb_push_type, smsb_push_level } = toRefs<any>(
|
|
|
@@ -289,8 +298,11 @@ const itemPushList = ref<ItemPushVO[]>([]);
|
|
|
const itemList = ref<ItemVO[]>([]);
|
|
|
const buttonLoading = ref(false);
|
|
|
const loading = ref(true);
|
|
|
+const deviceLoading = ref(true);
|
|
|
const showSearch = ref(true);
|
|
|
const ids = ref<Array<string | number>>([]);
|
|
|
+const removePushId = ref<number | string>();
|
|
|
+const removeIds = ref<Array<string | number>>([]);
|
|
|
const deviceIds = ref<Array<string | number>>([]);
|
|
|
const itemIds = ref<Array<string | number>>([]);
|
|
|
const single = ref(true);
|
|
|
@@ -307,7 +319,8 @@ const deviceList = ref<DeviceVO[]>([]);
|
|
|
const pushDeviceList = ref<ItemPushDeviceVO[]>([]);
|
|
|
// 存储选中行的唯一标识
|
|
|
const selectedRowId = ref<number | null>(null);
|
|
|
-
|
|
|
+const removeItemTag = ref(false);
|
|
|
+const removeButtonTag = ref(true);
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const itemPushFormRef = ref<ElFormInstance>();
|
|
|
|
|
|
@@ -434,21 +447,57 @@ const handleQuery = () => {
|
|
|
};
|
|
|
|
|
|
const handleDevice = async (row?: ItemPushVO) => {
|
|
|
+ removeItemTag.value = false;
|
|
|
const pushId = row.id;
|
|
|
deviceDialog.title = '发布详情';
|
|
|
deviceDialog.visible = true;
|
|
|
dialogQueryParams.value.pushId = pushId;
|
|
|
+ dialogQueryParams.value.pageSize = 1000;
|
|
|
+ pushDeviceList.value = [];
|
|
|
+ const pushInfo = await getItemPush(pushId);
|
|
|
+ Object.assign(form.value, pushInfo.data);
|
|
|
+ await getItemDeviceList(pushId);
|
|
|
+};
|
|
|
+const handleRemoveItem = async (row?: ItemPushVO) => {
|
|
|
+ removeItemTag.value = true;
|
|
|
+ removeButtonTag.value = true;
|
|
|
+ removeIds.value = [];
|
|
|
+ const pushId = row.id;
|
|
|
+ deviceDialog.title = '内容下架';
|
|
|
+ deviceDialog.visible = true;
|
|
|
+ dialogQueryParams.value.pushId = pushId;
|
|
|
+ removePushId.value = pushId;
|
|
|
+ dialogQueryParams.value.pageSize = 1000;
|
|
|
+ pushDeviceList.value = [];
|
|
|
const pushInfo = await getItemPush(pushId);
|
|
|
Object.assign(form.value, pushInfo.data);
|
|
|
- getItemDeviceList(pushId);
|
|
|
+ await getItemDeviceList(pushId);
|
|
|
+};
|
|
|
+const handleDoRemoveItem = async (row?: ItemPushDeviceVO) => {
|
|
|
+ const deviceIds = Array<number | string>();
|
|
|
+ if (null != row) {
|
|
|
+ deviceIds.push(row.deviceId);
|
|
|
+ }
|
|
|
+ if (removeIds.value.length > 0) {
|
|
|
+ removeIds.value.forEach((deviceId) => {
|
|
|
+ deviceIds.push(deviceId);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ const removeParam = {
|
|
|
+ pushId: removePushId.value,
|
|
|
+ deviceIds: deviceIds
|
|
|
+ };
|
|
|
+ await removeItemPushDevice(removeParam);
|
|
|
+ await getItemDeviceList(removePushId.value);
|
|
|
};
|
|
|
|
|
|
const getItemDeviceList = async (pushId: number | string) => {
|
|
|
+ deviceLoading.value = true;
|
|
|
dialogQueryParams.value.pushId = pushId;
|
|
|
const res = await listItemPushDeviceV2(dialogQueryParams.value);
|
|
|
pushDeviceList.value = res.rows;
|
|
|
deviceTotal.value = res.total;
|
|
|
- loading.value = false;
|
|
|
+ deviceLoading.value = false;
|
|
|
};
|
|
|
|
|
|
/** 重置按钮操作 */
|
|
|
@@ -465,6 +514,11 @@ const handleSelectionChange = (selection: ItemPushVO[]) => {
|
|
|
multiple.value = !selection.length;
|
|
|
};
|
|
|
|
|
|
+const handleDeviceSelectionChange = (selection: ItemPushDeviceVO[]) => {
|
|
|
+ removeIds.value = selection.map((item) => item.deviceId);
|
|
|
+ removeButtonTag.value = removeIds.value.length == 0;
|
|
|
+};
|
|
|
+
|
|
|
/** 多选框选中数据 */
|
|
|
const handleSelectDevice = (selection: DeviceVO[]) => {
|
|
|
deviceIds.value = selection.map((item) => item.id);
|