|
|
@@ -38,8 +38,8 @@
|
|
|
</template>
|
|
|
</template>
|
|
|
<template #button>
|
|
|
- <el-button type="primary" @click="onImport()">导入</el-button>
|
|
|
- <el-button type="primary" @click="onImport()">下载模版</el-button>
|
|
|
+ <el-button type="primary" @click="handleImportShow()">导入</el-button>
|
|
|
+ <el-button type="primary" @click="onImportTemplate()">下载模版</el-button>
|
|
|
<el-button type="primary" @click="onAdd()">新增</el-button>
|
|
|
<el-button type="primary" @click="onExport()">导出</el-button>
|
|
|
</template>
|
|
|
@@ -50,7 +50,9 @@
|
|
|
<el-button type="danger" link @click="onDelete(scope.row)"> 删除 </el-button>
|
|
|
</template>
|
|
|
<template v-esle>
|
|
|
- <el-button type="primary" link @click="onDelete(scope.row)"> 启用 </el-button>
|
|
|
+ <el-button type="primary" link @click="handleStatus(scope.row, '启用', '1')">
|
|
|
+ 启用
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</template>
|
|
|
</pageContent>
|
|
|
@@ -60,6 +62,11 @@
|
|
|
</el-tabs>
|
|
|
<pageDetail :modalConfig="activeTab === '1' ? detailConfig : detailNonIndustryConfig" ref="modalRef">
|
|
|
</pageDetail>
|
|
|
+ <pageImport
|
|
|
+ v-model:isVisible="importDialog.isvisible"
|
|
|
+ :title="importDialog.title"
|
|
|
+ @refresh-table="handleQuery()"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
@@ -72,10 +79,12 @@ import pageSearch from '@/components/components/pageSearch.vue';
|
|
|
import detailConfig from './config/detail.config';
|
|
|
import detailNonIndustryConfig from './config/detail.nonIndustry.config';
|
|
|
import pageDetail from './components/detail.vue';
|
|
|
+import pageImport from './components/import.vue';
|
|
|
import useSystemStore from '@/store/main';
|
|
|
import TreeSelect from './components/treeSelect.vue';
|
|
|
import { type TabsPaneContext } from 'element-plus';
|
|
|
import { outTypeList } from '@/libs/commonMeth';
|
|
|
+import { changeInventoryStatus } from '@/api/addressBook';
|
|
|
|
|
|
const bj_msg_recipient = outTypeList('bj_msg_recipient'); //短信接收人
|
|
|
const bj_ab_status: any = outTypeList('bj_ab_status'); //通讯录状态
|
|
|
@@ -86,7 +95,7 @@ const { pageDetailInfo, searchObj } = storeToRefs(systemStore);
|
|
|
const total = ref(0);
|
|
|
const pageSize = ref([10, 20, 30]);
|
|
|
const tableData = ref([]);
|
|
|
-const tableListRef = ref<InstanceType<typeof pageContent>>();
|
|
|
+const tableListRef: any = ref<InstanceType<typeof pageContent>>();
|
|
|
|
|
|
const tabs = reactive([
|
|
|
{
|
|
|
@@ -122,6 +131,20 @@ const getTreeCheck = async data => {
|
|
|
}
|
|
|
searchTableRef.value[0].handleQueryClick();
|
|
|
};
|
|
|
+
|
|
|
+const handleQuery = async () => {
|
|
|
+ loading.value = true;
|
|
|
+ setTimeout(() => {
|
|
|
+ if (treeSelectdRef.value) {
|
|
|
+ treeSelectdRef.value[0].handleReset(false);
|
|
|
+ }
|
|
|
+ if (searchTableRef.value) {
|
|
|
+ searchTableRef.value[0].handleResetClick();
|
|
|
+ }
|
|
|
+ loading.value = false;
|
|
|
+ }, 500);
|
|
|
+};
|
|
|
+
|
|
|
const treeSelectdRef = ref<InstanceType<typeof TreeSelect>>();
|
|
|
const loading = ref(false);
|
|
|
const handleClick = async (tab: TabsPaneContext) => {
|
|
|
@@ -137,6 +160,15 @@ const handleClick = async (tab: TabsPaneContext) => {
|
|
|
}, 500);
|
|
|
};
|
|
|
|
|
|
+const importDialog = reactive({
|
|
|
+ isvisible: false,
|
|
|
+ title: '通报联络员数据导入',
|
|
|
+});
|
|
|
+
|
|
|
+function handleImportShow() {
|
|
|
+ importDialog.isvisible = true;
|
|
|
+}
|
|
|
+
|
|
|
const handleEdit = async (id: string) => {
|
|
|
await handlePageDetail(id);
|
|
|
await handleEditDataClick();
|
|
|
@@ -151,7 +183,7 @@ const handleCheck = async (id: string) => {
|
|
|
const onAdd = () => {
|
|
|
handleNewDataClick();
|
|
|
};
|
|
|
-const onImport = () => {
|
|
|
+const onImportTemplate = () => {
|
|
|
const link = document.createElement('a');
|
|
|
link.href = `/assets/address-book.xlsx`;
|
|
|
link.download = '违法信息通报通讯录人员导入模板.xlsx'; // 指定下载后的文件名
|
|
|
@@ -182,6 +214,81 @@ function onDelete(row: any) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// 状态按钮
|
|
|
+function handleStatus(row: any, status: string, str: string) {
|
|
|
+ ElMessageBox.confirm(`是否${str}联络人“${row.contactName}”条条目信息吗?`, '状态提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ const postData: any = await changeInventoryStatus(row.liaisonId, status);
|
|
|
+ if (postData.code === 200) {
|
|
|
+ tableListRef.value[0].fetchPageListData({ industryType: activeTab.value });
|
|
|
+ ElMessage.success('操作成功!');
|
|
|
+ } else {
|
|
|
+ ElMessage.error('操作失败!');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ ElMessage({
|
|
|
+ type: 'info',
|
|
|
+ message: '取消操作',
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// 联络员导出
|
|
|
+const handleDownload = async () => {
|
|
|
+ ElMessageBox.confirm(`确定要导出所选数据信息?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ })
|
|
|
+ .then(async () => {
|
|
|
+ const isLoading = ElLoading.service({
|
|
|
+ lock: true,
|
|
|
+ text: 'Loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)',
|
|
|
+ });
|
|
|
+ let data: any = {};
|
|
|
+ // 获取表格数据
|
|
|
+ // data = cfgSelection.value;
|
|
|
+ try {
|
|
|
+ // 创建 Blob 对象
|
|
|
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
|
+ // 获取列名
|
|
|
+ const headers = [
|
|
|
+ { key: 'uuid', label: '目标设备码' },
|
|
|
+ { key: 'client_ip', label: '目标设备IP' },
|
|
|
+ { key: 'type', label: '适用平台' },
|
|
|
+ { key: 'remark', label: '目标设备名称' },
|
|
|
+ ];
|
|
|
+ const headerRow = headers.map(header => header.label).join(',');
|
|
|
+ // 构造 CSV 内容
|
|
|
+ const csvContent = [
|
|
|
+ headerRow,
|
|
|
+ ...data.map((row: any) => headers.map(header => row[header.key]).join(',')),
|
|
|
+ ].join('\n');
|
|
|
+
|
|
|
+ // 构造文件名
|
|
|
+ const filename = `${timestamp}.csv`; // 指定下载文件的名称;
|
|
|
+ // 创建 Blob 对象
|
|
|
+ const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8' });
|
|
|
+ // 创建下载链接
|
|
|
+ const url = URL.createObjectURL(blob);
|
|
|
+ const a = document.createElement('a');
|
|
|
+ a.href = url;
|
|
|
+ a.download = filename;
|
|
|
+ a.click();
|
|
|
+ URL.revokeObjectURL(url); // 释放 URL 对象
|
|
|
+ } finally {
|
|
|
+ isLoading.close();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+};
|
|
|
+
|
|
|
// 筛选-状态赋值 bj_notification_status
|
|
|
async function searchItem() {
|
|
|
searchConfig.formItems.forEach(item => {
|