Commit d203b03e by cwy

0406

parent 3f78e4f1
......@@ -21,6 +21,13 @@ export function excelFileApi() {
data,
});
},
multipleExportFile: (data) => {
return request({
url: '/api/multipleExportFile',
method: 'post',
data,
});
},
};
}
......
......@@ -84,41 +84,6 @@ export function systemApi() {
data
});
},
bedList: (params) => {
return request({
url: '/bed/list',
method: 'get',
params:params
});
},
disableBed: (data) => {
return request({
url: '/bed/disable',
method: 'post',
data
});
},
enableBed: (data) => {
return request({
url: '/bed/enable',
method: 'post',
data
});
},
hideBed: (data) => {
return request({
url: '/bed/hidden',
method: 'post',
data
});
},
showBed: (data) => {
return request({
url: '/bed/display',
method: 'post',
data
});
},
};
}
......
......@@ -46,6 +46,7 @@ export const useUserInfo = defineStore('userInfo', {
async setVersion() {
const versions = await this.getVersionInfo();
this.versions = versions;
Session.set('resource_address',this.versions.resource_address)
},
async getVersionInfo() {
......
import { Session } from '/@/utils/storage';
export function getHost() {
if (process.env.NODE_ENV === 'development') {
return '/dev'
......@@ -11,4 +12,15 @@ export function getUploadUrl() {
} else {
return '/data-collect-api/api/upload/picture'
}
}
export function getServerUrl() {
if (process.env.NODE_ENV === 'development') {
return '/dev/api'
} else {
return '/data-collect-api/api'
}
}
export function getServerPublic() {
return Session.get('resource_address');
}
\ No newline at end of file
......@@ -10,7 +10,7 @@
<el-option v-for="(item, index) in state.taskList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
<el-select v-model="state.apiListParam.norm_id" placeholder="请选择指标" size="default" @change="searchChange" clearable filterable style="width:300px;margin-right: 20px;">
<el-select v-model="state.apiListParam.norm_id" placeholder="请选择子任务" size="default" @change="searchChange" clearable filterable style="width:300px;margin-right: 20px;">
<el-option v-for="(item, index) in state.normList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
......@@ -25,12 +25,12 @@
ref="multipleTableRef">
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="userInfo.name" label="领取用户" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #409EFF;">{{scope.row.taskInfo.name}}</span>
<span style="color: #409EFF;">{{scope.row.userInfo.name}}</span>
</template>
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.unit" label="单位" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="norm_list_info.name" label="指标名称" show-overflow-tooltip align="center">
</el-table-column>
......
......@@ -10,7 +10,7 @@
<el-option v-for="(item, index) in state.taskList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
<el-select v-model="state.apiListParam.norm_id" placeholder="请选择指标" size="default" @change="searchChange" clearable filterable style="width:300px;margin-right: 20px;">
<el-select v-model="state.apiListParam.norm_id" placeholder="请选择子任务" size="default" @change="searchChange" clearable filterable style="width:300px;margin-right: 20px;">
<el-option v-for="(item, index) in state.normList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
......@@ -25,12 +25,12 @@
ref="multipleTableRef">
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="userInfo.name" label="领取用户" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #409EFF;">{{scope.row.taskInfo.name}}</span>
<span style="color: #409EFF;">{{scope.row.userInfo.name}}</span>
</template>
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.unit" label="单位" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="norm_list_info.name" label="指标名称" show-overflow-tooltip align="center">
</el-table-column>
......
......@@ -14,7 +14,7 @@
<el-option v-for="(item, index) in state.userList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
<el-select v-model="state.apiListParam.norm_id" placeholder="请选择指标" size="default" @change="searchChange" clearable filterable style="width:300px;margin-right: 20px;">
<el-select v-model="state.apiListParam.norm_id" placeholder="请选择子任务" size="default" @change="searchChange" clearable filterable style="width:300px;margin-right: 20px;">
<el-option v-for="(item, index) in state.normList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
......@@ -26,17 +26,17 @@
<div class="page-main" v-loading="state.tableData.loading" ref="pageMain">
<el-card shadow="hover" style="height:100%;">
<el-button size="default" type="danger" @click="settlementIndicators" style="margin-bottom: 10px;">结算</el-button>
<el-table :data="state.tableData.data" style="width: 100%" :height="state.tableHeight"
<el-table :data="state.tableData.data" :row-key="(row) => row.id" style="width: 100%" :height="state.tableHeight"
ref="multipleTableRef" @selection-change="tableSelection">
<el-table-column type="selection" width="55" />
<el-table-column type="selection" width="55" :reserve-selection="true"/>
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="userInfo.name" label="领取用户" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #409EFF;">{{scope.row.taskInfo.name}}</span>
<span style="color: #409EFF;">{{scope.row.userInfo.name}}</span>
</template>
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.unit" label="单位" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="norm_list_info.name" label="指标名称" show-overflow-tooltip align="center">
</el-table-column>
......
......@@ -25,9 +25,9 @@
<div class="page-main" v-loading="state.tableData.loading" ref="pageMain">
<el-card shadow="hover" style="height:100%;">
<el-button size="default" type="danger" @click="batchSelection" style="margin-bottom: 10px;">领取</el-button>
<el-table :data="state.tableData.data" style="width: 100%" :height="state.tableHeight"
<el-table :data="state.tableData.data" :row-key="(row) => row.id" style="width: 100%" :height="state.tableHeight"
ref="multipleTableRef" @selection-change="tableSelection">
<el-table-column type="selection" width="55" />
<el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="taskPackageInfo.name" label="任务名称1" show-overflow-tooltip align="center">
</el-table-column>
......
<template>
<div class="system-role-dialog-container">
<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="40%" @close="closeDialog" :close-on-click-modal="false">
<el-form ref="dialogFormRef" :model="state.formItem.addItem" :rules="state.rules" size="default" label-width="100px"
v-loading="state.dataLoading" label-position="right" style="width: 90%;text-align: center;">
<el-form-item label="任务名称" prop="task_name">
<el-input v-model="state.formItem.addItem.task_name" placeholder="请输入指标名称" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="指标名称" prop="name">
<el-input v-model="state.formItem.addItem.name" placeholder="请输入指标名称" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="参考信源" prop="refer">
<el-input type="textarea" v-model="state.formItem.addItem.refer" placeholder="请输入参考信源" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="参考指南" prop="guide">
<el-input type="textarea" v-model="state.formItem.addItem.guide" placeholder="请输入参考指南" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="标题" :prop="'dynamicItem.' + index+ '.name'" v-for="(item, index) in state.formItem.dynamicItem" :key="index">
<el-input v-model="item.name" placeholder="请输入标题" clearable style="width: 30%;" :disabled="true"></el-input>
<div style="width: 10%;">内容:</div>
<el-input v-model="item.value" placeholder="请输入标题对应的值" clearable style="width: 60%;" :disabled="true"></el-input>
</el-form-item>
<el-form-item label="收集备注" prop="state.normCollectInfo.remark">
<el-input type="textarea" v-model="state.normCollectInfo.remark" placeholder="请输入备注" clearable :disabled="true"></el-input>
</el-form-item>
<el-divider><span style="color: #F56C6C;">用户需填写区域</span></el-divider>
<el-form-item label="信源类型" prop="normCollectInfo.refer_type">
<el-select v-model="state.normCollectInfo.refer_type" placeholder="请选择信源等级" :disabled="true">
<el-option label="官网/政府" value="1"></el-option>
<el-option label="权威媒体" value="2"></el-option>
<el-option label="其他可信信源" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="标题" :prop="'userFilled.' + index+ '.name'" v-for="(item, index) in state.formItem.userFilled" :key="index">
<el-row style="width: 100% !important;">
<el-col :span="7">
<el-input v-model="item.name" placeholder="请输入标题" clearabl :disabled="true"></el-input>
</el-col>
<el-col :span="2">
<span style="color: red;" v-if="item.radio==1">*</span>内容:
</el-col>
<el-col :span="13">
<el-input type="textarea" v-model="item.value" placeholder="请填写内容" required :disabled="true"></el-input>
</el-col>
<el-col :span="2">
<span style="color: red;" v-if="item.radio==1">必填</span>
</el-col>
</el-row>
<el-row style="width: 100% !important; margin-left: -8%; margin-top: 10 !important;">
<el-col :span="2">
<div>备注:</div>
</el-col>
<el-col :span="22">
<el-input v-model="item.remark" placeholder="请输入备注(选填)" clearabl :disabled="true"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="用户截图" prop="state.srcList">
<span v-if="state.imgHide==false"></span>
<div class="demo-image__preview" v-for='item in state.srcList' style="margin:10px" v-if="state.imgHide">
<el-image style="width: 150px; height: 150px" :preview-src-list="state.srcList" :src="item"></el-image>
</div>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog()" size="default">取 消</el-button>
<!-- <el-button type="primary" :loading="state.btnLoading" @click="onSubmit(dialogFormRef)"
size="default">确认</el-button> -->
</span>
</template>
</el-dialog>
</div>
</template>
<script setup name="systemRoleDialog">
import { claimTasksApi } from '/@/api/claimTasks'
import { ElMessage } from 'element-plus';
// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh']);
// 定义变量内容
const dialogFormRef = ref();
const router = useRouter();
const state = reactive({
imgHide:false,
url: '',
srcList: [
],
userId: null,
index:0,
userIndex:0,
apiData: {
id:'',
},
rules: {
refer_type: [{ required: true, message: '请输入选择信源类型', trigger: 'blur' }],
},
dialog: {
isShowDialog: false,
title: '',
submitTxt: '',
},
dataLoading: false,
btnLoading: false,
// 填写内容及自定义文本框
formItem: {
addItem:{
refer_type:'',
id:'',
},
dynamicItem: [],
userFilled: []
},
normCollectInfo:{},
});
// 打开弹窗
const openDialog = (data) => {
state.columns=[];
state.collectsTableData=[];
state.collectsColumns=[];
state.dialog.isShowDialog = true;
state.dialog.title = '指标详情';
state.apiData.id = data.id;
state.formItem.addItem.norm_receive_id = data.id;
// 清空数据
wipeData();
claimTasksApi().normReceivesDetail(state.apiData).then(res => {
let addItem = res.data.addItem;
let userFilled = res.data.userFilled;
let adminFilled = res.data.adminFilled;
// 数据详情
state.formItem.addItem.task_id = addItem.task_id;
state.formItem.addItem.norm_id = addItem.norm_id;
state.formItem.addItem.norm_list_id = addItem.id;
state.formItem.addItem.name = addItem.name;
state.formItem.addItem.task_name = addItem.task_name;
state.formItem.addItem.refer = addItem.refer;
state.formItem.addItem.guide = addItem.guide;
state.userIndex = 0;
state.index = 0;
userFilled.forEach(item => {
state.formItem.userFilled.push({id:item.id,name:item.extend_name,radio:item.required+"",value:item.extend_value,remark:item.extend_remarks});
state.userIndex++
});
adminFilled.forEach(item => {
state.formItem.dynamicItem.push({id:item.id,name:item.extend_name,value:item.extend_value,});
state.index++
});
if(res.data.normCollectInfo){
state.normCollectInfo = res.data.normCollectInfo
state.refer_type = res.data.normCollectInfo.refer_type
if(state.normCollectInfo.imgPath !=""){
state.imgHide=true
// alert(state.normCollectInfo.imgPath.split(','))
//'http://gcspider.raisound.com:81/data-collect-api/'
state.srcList = state.normCollectInfo.imgPath.split(',')
state.srcList.forEach(function (item, index) {
state.srcList[index] =item
});
}
if(state.normCollectInfo.remark!=""){
state.collectInfo = true
}
}
}).catch(() => {
})
};
const onSubmit = () => {
dialogFormRef.value.validate((valid, fields) => {
let userFilledInfo = state.formItem.userFilled;
let apiIndex = 1;
for(let i=0;i<userFilledInfo.length;i++)
{
if (userFilledInfo[0].radio==1) {
if (userFilledInfo[0].value == "") {
apiIndex++;
ElMessage.error('请填写红色星号必填项!');
break;
}
}
}
if(apiIndex==1&&valid){
claimTasksApi().normCollectsAdd(JSON.stringify(state.formItem)).then(res => {
state.btnLoading = false
ElMessage.success('操作成功');
// 清空数据
wipeData();
closeDialog();
emit('refresh');
}).catch(() => {
state.btnLoading = false
// 清空数据
wipeData();
closeDialog();
emit('refresh');
})
}
})
};
// 清空数据
const wipeData = () => {
state.index=0
state.userIndex=0
state.formItem.addItem.task_id = '';
state.formItem.addItem.norm_id = '';
state.formItem.addItem.norm_list_id = '';
state.formItem.addItem.name = '';
state.formItem.addItem.task_name = '';
state.formItem.addItem.refer = '';
state.formItem.addItem.refer_type = '';
state.formItem.addItem.remark = '';
state.formItem.dynamicItem = [];
state.formItem.userFilled = [];
};
// 关闭弹窗
const closeDialog = () => {
dialogFormRef.value.resetFields();
state.dialog.isShowDialog = false;
};
// 暴露变量
defineExpose({
openDialog,
});
onMounted(() => {
if(router.currentRoute.value.query.task_id){
state.formItem.addItem.task_id = router.currentRoute.value.query.task_id
}
});
</script>
<style scoped lang="scss">
.el-dialog__body {
display: flex;
justify-content: center;
align-content: center;
}
/** el-input disabled时的背景和边框*/
.el-input.is-disabled{
background:#fff !important;
color: var(--el-radio-text-color) !important;
-webkit-text-fill-color: var(--el-radio-text-color) !important;
}
:deep(.el-input .el-input__inner){
background:#fff !important;
color: var(--el-radio-text-color) !important;
-webkit-text-fill-color: var(--el-radio-text-color) !important;
}
:deep(.el-input .el-input__wrapper){
background:#fff !important;
color: var(--el-radio-text-color) !important;
-webkit-text-fill-color: var(--el-radio-text-color) !important;
}
.el-textarea.is-disabled{
background:#fff !important;
color: var(--el-radio-text-color) !important;
-webkit-text-fill-color: var(--el-radio-text-color) !important;
}
:deep(.el-textarea .el-textarea__inner){
background:#fff !important;
color: var(--el-radio-text-color) !important;
-webkit-text-fill-color: var(--el-radio-text-color) !important;
}
:deep(.el-textarea .el-textarea__wrapper){
background:#fff !important;
color: var(--el-radio-text-color) !important;
-webkit-text-fill-color: var(--el-radio-text-color) !important;
}
</style>
<template>
<div class="system-menu-container">
<div class="breadcrumb-box">
<Breadcrumb />
</div>
<div class="header-search flex space-between">
<div>
<el-select v-model="state.apiData.search_task_id" placeholder="请选择任务" size="default" @change="searchChange" clearable filterable style="width:200px;margin-right: 20px;">
<el-option v-for="(item, index) in state.taskList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
<!-- <el-input class="search-item" placeholder="请输入子任务名称" v-model="state.apiData.name" size="default"
style="width: 220px;" clearable @change="searchChange()">
</el-input>
<el-button size="default" type="primary" @click="searchChange()" >查询</el-button>
<el-button size="default" @click="reset()" >重置</el-button> -->
</div>
</div>
<div class="page-main" v-loading="state.tableData.loading" ref="pageMain">
<el-card shadow="hover" style="height:100%;">
<el-button size="default" type="danger" @click="multipleExports" style="margin-bottom: 10px;">导出</el-button>
<el-table :scrollbar-always-on="true" :row-key="(row) => row.id" :data="state.tableData.data" style="width: 100%" :height="state.tableHeight" @selection-change="tableSelection"
ref="multipleTableRef">
<el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column v-for="column in state.columns" :key="column.prop" :label="column.label" :prop="column.prop" :width="column.width" show-overflow-tooltip align="center">
<template #default="scope">
<span v-if="scope.row[column.prop] =='' || scope.row[column.prop] ==null || scope.row[column.prop] ==undefined">--</span>
<span v-else>{{scope.row[column.prop]}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right" align="center">
<template #default="scope">
<el-button size="small" type="primary" @click="details(scope.row.id)">查看详情</el-button>
<el-button size="small" type="warning" @click="exportFile(scope.row.id)">导出数据</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-box">
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.apiData.page" background
v-model:page-size="state.apiData.limit" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
<DetailDialog ref="DetailDialogRef" @refresh="getList()" />
<AddDialog ref="AddDialogRef" @refresh="getList()" />
<EditDialog ref="EditDialogRef" @refresh="getList()" />
<ImporDialog ref="ImporDialogRef" @refresh="getList()" />
</el-card>
</div>
</div>
</template>
<script setup name="taskPackage-list">
import { getCurrentInstance } from 'vue';
import { normApi } from '/@/api/norm/index';
import { taskPackageApi } from '/@/api/taskPackage/index';
import { excelFileApi } from '/@/api/excelFile/index';
import { ElMessageBox, ElMessage } from 'element-plus';
// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));
const AddDialog = defineAsyncComponent(() => import('/@/views/norm/list/dialog.vue'));
const DetailDialog = defineAsyncComponent(() => import('/@/views/norm/list/details.vue'));
const EditDialog = defineAsyncComponent(() => import('/@/views/norm/list/edit.vue'));
const ImporDialog = defineAsyncComponent(() => import('/@/views/norm/list/impor.vue'));
const router = useRouter();
// 定义变量内容
const AddDialogRef = ref()
const DetailDialogRef = ref()
const EditDialogRef = ref()
const ImporDialogRef = ref()
const multipleTableRef = ref()
const state = reactive({
apiData: {
page: 1,
limit: 10,
name: '',
task_id:'',
search_task_id:'',
},
tableData: {
data: [],
loading: false,
total: 0
},
tableHeight: '30vh',
isHide:false,
taskList:[],
Ids:[],
columns:[],
collectsTableData:[],
collectsColumns:[],
});
// 获取任务列表
const getTaskList = () => {
taskPackageApi().taskPackageList({page:-1,limit:-1}).then(res => {
state.taskList = res.data
})
}
// 页面加载时
onMounted(() => {
// getDepatment()
if(router.currentRoute.value.query.task_id){
state.apiData.task_id = router.currentRoute.value.query.task_id
state.isHide = true // 如果有任务ID才允许发布
}
getList()
getTaskList()
state.tableHeight = getCurrentInstance().refs.pageMain.offsetHeight - 120 - 32 + "px";
});
const searchChange = () => {
state.apiData.page = 1
getList()
}
// 分页改变
const onHandleSizeChange = (val) => {
state.apiData.limit = val;
getList();
};
const onHandleCurrentChange = (val) => {
state.apiData.page = val;
getList();
};
// 获取列表
const getList = () => {
state.tableData.loading = true
normApi().normList(state.apiData).then(res => {
let listAll = res.data.data
// state.tableData.data = res.data.data
state.tableData.total = res.data.total
state.tableData.loading = false
let customTitle = []; // 自定义标题
if(listAll){
let arr = [
{ label:'ID', prop: 'id'},
{ label:'任务名称', prop: 'task_info.name',width:120},
{ label:'单位名称', prop: 'task_info.unit',width:180},
{ label:'子任务名称', prop: 'name',width:180},
{ label:'难度等级', prop: 'level',width:180},
{ label:'参考信源', prop: 'refer',width:180},
{ label:'参考指南', prop: 'guide',width:180},
{ label:'单价', prop: 'price',width:180},
{ label:'优先级', prop: 'sort',width:180},
{ label:'发布时间', prop: 'created_at',width:180},
{ label:'领取进度', prop: 'receivedQuantity',width:180},
{ label:'完成进度', prop: 'collectsQuantity',width:180},
{ label:'操作', prop: 'cao',width:280},
];
state.columns = arr;
let sign = 0;
listAll.forEach(function(item, index, arr) {
let list = {
'id':item.id,
'task_info.name': item.taskPackageInfo.name,
'task_info.unit': item.taskPackageInfo.unit,
'name': item.name,
'level': item.level,
'refer':item.refer,
'guide':item.guide,
'price':item.price,
'sort':item.sort,
'created_at':item.created_at,
'receivedQuantity': item.receivedQuantity,
'collectsQuantity': item.collectsQuantity,
'cao': 'cao',
}
item.custom.forEach(function(items, indexs, arrs) {
if(items.user_filled==0){
let vlues = customTitle.map(itemsss => itemsss.label).indexOf(items.extend_name)
if(vlues == -1){
customTitle.push( { label: items.extend_name, index: 'extend_value'+sign })
state.columns.push( { label: items.extend_name, prop: 'extend_value'+sign,width:180 })
list['extend_value'+sign] =items.extend_value;
sign++;
}else{
list[customTitle[vlues]['index']] =items.extend_value;
}
}
});
// state.columns.push({ label: '操作', width="200", prop: ''})
// list[customTitle[vlues]['index']] =items.extend_value;
// state.columns.push( { label: '操作' })
state.tableData.data.push(list);
});
console.log(customTitle)
}
}).catch(() => {
state.tableData.loading = false
})
}
// 多选按钮
const tableSelection = (val) => {
if(val){
state.Ids = [];
val.forEach(item => {
state.Ids.push(item.id);
});
}
console.log(state.Ids)
}
// 详情弹窗
const details= (norm_id) => {
DetailDialogRef.value.openDialog(norm_id);
}
// 导出文件
const exportFile= (id) => {
let query = {id:id}
excelFileApi().normExportFile(query).then(res => {
if(res.data){
let url = res.data;
const iframe = document.createElement('iframe'); // 创建一个HTML 元素
iframe.style.display = 'none'; // 隐藏iframe 防止影响页面
iframe.style.height = 0; // 高度设置0 防止影响页面
iframe.src = url;// 下载链接
document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除
setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000);
ElMessage.success('导出成功,请点击下载列表查看!');
}else{
ElMessage.error('导出失败!');
}
}).catch(() => {
})
}
// 多选导出
const multipleExports= () => {
excelFileApi().multipleExportFile({ids:state.Ids}).then(res => {
excelFileApi().multipleExportFile({ids:state.Ids}).then(res => {
if(res.data){
let url = res.data;
const iframe = document.createElement('iframe'); // 创建一个HTML 元素
iframe.style.display = 'none'; // 隐藏iframe 防止影响页面
iframe.style.height = 0; // 高度设置0 防止影响页面
iframe.src = url;// 下载链接
document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除
setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000);
ElMessage.success('导出成功,请点击下载列表查看!');
}else{
ElMessage.error('导出失败!');
}
multipleTableRef.value.clearSelection();
getList();
}).catch(() => {
getList();
})
}).catch(() => {
getList();
})
}
</script>
<style lang="scss" scoped>
.page-main {
height: calc(100vh - 90px - 75px);
}
</style>
<template>
<div class="system-menu-container">
<div class="breadcrumb-box">
<Breadcrumb />
</div>
<div class="header-search flex space-between">
<div>
<el-select v-model="state.apiData.search_task_id" placeholder="请选择任务" size="default" @change="searchChange" clearable filterable style="width:200px;margin-right: 20px;">
<el-option v-for="(item, index) in state.taskList" :key="index" :label="item.name"
:value="item.id"></el-option>
</el-select>
<!-- <el-input class="search-item" placeholder="请输入子任务名称" v-model="state.apiData.name" size="default"
style="width: 220px;" clearable @change="searchChange()">
</el-input>
<el-button size="default" type="primary" @click="searchChange()" >查询</el-button>
<el-button size="default" @click="reset()" >重置</el-button> -->
</div>
</div>
<div class="page-main" v-loading="state.tableData.loading" ref="pageMain">
<el-card shadow="hover" style="height:100%;">
<el-button size="default" type="danger" @click="multipleExports" style="margin-bottom: 10px;">导出</el-button>
<el-table :scrollbar-always-on="true" :row-key="(row) => row.id" :data="state.tableData.data" style="width: 100%" :height="state.tableHeight" @selection-change="tableSelection"
ref="multipleTableRef">
<el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="taskPackageInfo.name" width="200"label="任务名称" show-overflow-tooltip align="center">
<template #default="scope">
<el-tag type='danger' effect="plain">{{scope.row.taskPackageInfo.name}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="taskPackageInfo.unit" width="200"label="单位名称" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="name" label="子任务名称" width="200" show-overflow-tooltip align="center">
<template #default="scope">
<span @click="details(scope.row.id)">{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column prop="level" label="难度等级" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="refer" label="参考信源" width="200" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="price" label="单价" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="sort" label="优先级" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="created_at" width="180" label="发布时间" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="receivedQuantity" width="200" label="领取进度" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color:#409EFF" v-if="scope.row.type==1">--</span>
<span style="color:#409EFF" v-else>{{scope.row.receivedQuantity}}</span>
</template>
</el-table-column>
<el-table-column prop="name" label="完成进度" width="200"show-overflow-tooltip align="center">
<template #default="scope">
<span style="color:#F56C6C" v-if="scope.row.type==1">--</span>
<span style="color:#F56C6C" v-else>{{scope.row.collectsQuantity}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200" fixed="right" align="center">
<template #default="scope">
<el-button size="small" type="primary" @click="details(scope.row.id)">查看详情</el-button>
<el-button size="small" type="warning" @click="exportFile(scope.row.id)">导出数据</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination-box">
<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.apiData.page" background
v-model:page-size="state.apiData.limit" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
<DetailDialog ref="DetailDialogRef" @refresh="getList()" />
<AddDialog ref="AddDialogRef" @refresh="getList()" />
<EditDialog ref="EditDialogRef" @refresh="getList()" />
<ImporDialog ref="ImporDialogRef" @refresh="getList()" />
</el-card>
</div>
</div>
</template>
<script setup name="taskPackage-list">
import { getCurrentInstance } from 'vue';
import { normApi } from '/@/api/norm/index';
import { taskPackageApi } from '/@/api/taskPackage/index';
import { excelFileApi } from '/@/api/excelFile/index';
import { ElMessageBox, ElMessage } from 'element-plus';
// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));
const AddDialog = defineAsyncComponent(() => import('/@/views/norm/list/dialog.vue'));
const DetailDialog = defineAsyncComponent(() => import('/@/views/norm/list/details.vue'));
const EditDialog = defineAsyncComponent(() => import('/@/views/norm/list/edit.vue'));
const ImporDialog = defineAsyncComponent(() => import('/@/views/norm/list/impor.vue'));
const router = useRouter();
// 定义变量内容
const AddDialogRef = ref()
const DetailDialogRef = ref()
const EditDialogRef = ref()
const ImporDialogRef = ref()
const multipleTableRef = ref()
const state = reactive({
apiData: {
page: 1,
limit: 10,
name: '',
task_id:'',
search_task_id:'',
},
tableData: {
data: [],
loading: false,
total: 0
},
tableHeight: '30vh',
isHide:false,
taskList:[],
Ids:[],
});
// 获取任务列表
const getTaskList = () => {
taskPackageApi().taskPackageList({page:-1,limit:-1}).then(res => {
state.taskList = res.data
})
}
// 页面加载时
onMounted(() => {
// getDepatment()
if(router.currentRoute.value.query.task_id){
state.apiData.task_id = router.currentRoute.value.query.task_id
state.isHide = true // 如果有任务ID才允许发布
}
getList()
getTaskList()
state.tableHeight = getCurrentInstance().refs.pageMain.offsetHeight - 120 - 32 + "px";
});
const searchChange = () => {
state.apiData.page = 1
getList()
}
// 分页改变
const onHandleSizeChange = (val) => {
state.apiData.limit = val;
getList();
};
const onHandleCurrentChange = (val) => {
state.apiData.page = val;
getList();
};
/**
* 重置按钮
*/
const reset = () => {
state.apiData.page = 1
state.apiData.name = '';
state.apiData.search_task_id = '';
getList()
}
// 获取列表
const getList = () => {
state.tableData.loading = true
normApi().normList(state.apiData).then(res => {
state.tableData.loading = false
state.tableData.data = res.data.data
state.tableData.total = res.data.total
}).catch(() => {
state.tableData.loading = false
})
}
const tableSelection = (val) => {
if(val){
state.Ids = [];
val.forEach(item => {
state.Ids.push(item.id);
});
}
console.log(state.Ids)
}
/**
* 返回上一级页面
*/
const backToPreviousPage = () => {
// this.$router.push('/target')
router.go(-1);
}
// 发布指标弹窗
const release= () => {
AddDialogRef.value.openDialog();
}
// 详情弹窗
const details= (norm_id) => {
DetailDialogRef.value.openDialog(norm_id);
}
// 编辑弹窗
const edit= (norm_id) => {
EditDialogRef.value.openDialog(norm_id);
}
// 导入数据窗口
const importFile= () => {
ImporDialogRef.value.openDialog(state.apiData.task_id);
}
// 导出文件
const exportFile= (id) => {
let query = {id:id}
excelFileApi().normExportFile(query).then(res => {
if(res.data){
let url = res.data;
const iframe = document.createElement('iframe'); // 创建一个HTML 元素
iframe.style.display = 'none'; // 隐藏iframe 防止影响页面
iframe.style.height = 0; // 高度设置0 防止影响页面
iframe.src = url;// 下载链接
document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除
setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000);
ElMessage.success('导出成功,请点击下载列表查看!');
}else{
ElMessage.error('导出失败!');
}
}).catch(() => {
})
}
// 多选导出
const multipleExports= () => {
excelFileApi().multipleExportFile({ids:state.Ids}).then(res => {
excelFileApi().multipleExportFile({ids:state.Ids}).then(res => {
if(res.data){
let url = res.data;
const iframe = document.createElement('iframe'); // 创建一个HTML 元素
iframe.style.display = 'none'; // 隐藏iframe 防止影响页面
iframe.style.height = 0; // 高度设置0 防止影响页面
iframe.src = url;// 下载链接
document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除
setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000);
ElMessage.success('导出成功,请点击下载列表查看!');
}else{
ElMessage.error('导出失败!');
}
multipleTableRef.value.clearSelection();
getList();
}).catch(() => {
getList();
})
}).catch(() => {
getList();
})
}
</script>
<style lang="scss" scoped>
.page-main {
height: calc(100vh - 90px - 75px);
}
</style>
......@@ -24,7 +24,7 @@
<el-input type="textarea" v-model="state.formItem.addItem.refer" placeholder="请输入参考信源" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="price" prop="price">
<el-input v-model="state.formItem.addItem.price" placeholder="请输入单价" clearable :disabled="true"></el-input>
<el-input-number v-model="state.formItem.addItem.price" :precision="2" :step="0.1" :max="10" placeholder="请输入单价" :disabled="true"></el-input-number>
</el-form-item>
<el-form-item label="参考指南" prop="guide">
<el-input type="textarea" v-model="state.formItem.addItem.guide" placeholder="请输入参考指南" clearable :disabled="true"></el-input>
......
<template>
<div class="system-role-dialog-container">
<el-dialog :title="state.dialog.title" v-model="state.dialog.isShowDialog" width="60%" @close="closeDialog" :close-on-click-modal="false">
<el-form ref="dialogFormRef" :model="state.formItem.addItem" :rules="state.rules" size="default" label-width="100px"
<el-form ref="dialogFormRef" :model="state.uploadAudio" :rules="state.rules" size="default" label-width="100px"
v-loading="state.dataLoading" label-position="right" style="width: 90%;text-align: center;">
<el-form-item label="指标名称" prop="name">
<el-input type="textarea" v-model="state.formItem.addItem.name" placeholder="请输入指标名称" clearable :disabled="true"></el-input>
<el-form-item label="子任务名称" prop="name">
<el-input type="textarea" v-model="state.uploadAudio.name" placeholder="请输入子任务名称" clearable ></el-input>
</el-form-item>
<el-form-item label="难度等级">
<el-select v-model="state.formItem.addItem.level" :disabled="true" placeholder="请选择难度等级">
<el-select v-model="state.uploadAudio.level" placeholder="请选择难度等级">
<el-option label="1" value="1"></el-option>
<el-option label="2" value="2"></el-option>
<el-option label="3" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="优先级">
<el-select v-model="state.formItem.addItem.sort" :disabled="true" placeholder="请选择优先级">
<el-select v-model="state.uploadAudio.sort" placeholder="请选择优先级">
<el-option label="低" value="1"></el-option>
<el-option label="中" value="2"></el-option>
<el-option label="高" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="参考信源" prop="refer">
<el-input type="textarea" v-model="state.formItem.addItem.refer" placeholder="请输入参考信源" clearable :disabled="true"></el-input>
<el-input type="textarea" v-model="state.uploadAudio.refer" placeholder="请输入参考信源" clearable></el-input>
</el-form-item>
<el-form-item label="price" prop="price">
<el-input v-model="state.formItem.addItem.price" placeholder="请输入单价" clearable :disabled="true"></el-input>
<el-input-number v-model="state.uploadAudio.price" :precision="2" :step="0.1" :max="10" placeholder="请输入单价"></el-input-number>
</el-form-item>
<el-form-item label="参考指南" prop="guide">
<el-input type="textarea" v-model="state.formItem.addItem.guide" placeholder="请输入参考指南" clearable :disabled="true"></el-input>
<el-input type="textarea" v-model="state.uploadAudio.guide" placeholder="请输入参考指南" clearable ></el-input>
</el-form-item>
<el-upload
class="upload-demo"
ref="uploadFileRef"
:limit="1"
accept=".xlsx, .xls"
:action="state.server_url"
:before-upload="uploadFormat"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:data="state.uploadAudio"
:on-exceed="onexceed"
:on-change="handleChange"
drag>
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<template #tip>
<div class="el-upload__tip text-center">
<span>仅允许导入xls、xlsx格式文件。</span>
<el-link type="primary" :underline="false" style="font-size: 12px;" @click="importTemplate">下载模板</el-link>
</div>
</template>
</el-upload>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="onSubmit()"
size="default">确认</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
......@@ -38,13 +67,18 @@
import { normApi } from '/@/api/norm'
import { ElMessage } from 'element-plus';
import { toolsApi } from '/@/api/tools'
import { getServerUrl,getServerPublic } from "/@/utils/getHost.js";
// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh']);
// 定义变量内容
const uploadFileRef = ref();
const dialogFormRef = ref();
const router = useRouter();
const state = reactive({
// server_url:getServerUrl(),
server_url:getServerUrl()+'/importFile',
userId: null,
index:0,
userIndex:0,
......@@ -54,137 +88,94 @@ const state = reactive({
rules: {
},
uploadAudio:{
task_id:'',
name:'',
level:'',
refer:'',
price:'',
guide:'',
sort:'',
type:1,
},
selectFile:false,
dialog: {
isShowDialog: false,
title: '',
submitTxt: '',
},
tableData:[
],
columns:[
],
collectsTableData:[],
collectsColumns:[],
dataLoading: false,
btnLoading: false,
// 填写内容及自定义文本框
formItem: {
addItem:{
name:'',
level:'',
sort:'',
refer:'',
price:'',
task_id:'',
},
dynamicItem: [
//默认显示一条
// {
// name: '',
// value:''
// }
],
userFilled: [
//默认显示一条
// {
// name: '',
// radio:'1',
// }
]
}
});
// 打开弹窗
const openDialog = (norm_id) => {
const openDialog = (task_id) => {
state.selectFile = false;
state.dialog.isShowDialog = true;
state.dialog.title = '指标详情';
state.apiData.id = norm_id;
state.dialog.title = '导入指标';
// 清空数据
state.formItem.addItem.name = '';
state.formItem.addItem.level = '';
state.formItem.addItem.sort = '';
state.formItem.addItem.refer = '';
state.formItem.addItem.price = '';
state.formItem.addItem.task_id = '';
state.formItem.addItem.guide = '';
state.formItem.dynamicItem = [];
state.formItem.userFilled = [];
state.tableData=[];
state.columns=[];
state.collectsTableData=[];
state.collectsColumns=[];
normApi().normDetail(state.apiData).then(res => {
let addItem = res.data.addItem;
let custom = res.data.custom;
// 数据详情
state.formItem.addItem.name = addItem.name;
state.formItem.addItem.level = addItem.level;
state.formItem.addItem.sort = addItem.sort+'';
state.formItem.addItem.refer = addItem.refer;
state.formItem.addItem.price =addItem.price;
state.formItem.addItem.task_id= addItem.task_id
state.formItem.addItem.guide= addItem.guide
state.userIndex = 0;
state.index = 0;
custom.forEach(item => {
if(item.user_filled==1){
state.formItem.userFilled.push({name:item.extend_name,radio:item.required+"",remarks:item.extend_remarks});
state.userIndex++
}else{
state.formItem.dynamicItem.push({name:item.extend_name,value:item.extend_value});
state.index++
}
});
//领取列表
let receivesList = res.data.receivesList
if(receivesList){
let arr = [
{ label:'序号', prop: 'index',width:'80px'},
// { label:'ID', prop: 'id'},
{ label:'用户名称', prop: 'userInfo.name',width:120},
{ label:'任务名称', prop: 'task_info.name',width:180},
{ label:'指标名称', prop: 'norm_list_info.name',width:180},
];
state.columns = arr;
receivesList.forEach(function(item, index, arr) {
let list = {
'index': index+1,
// 'id':item.id,
'userInfo.name': item.userInfo.name,
'task_info.name': item.task_info.name,
'norm_list_info.name': item.norm_list_info.name,
'receives_status': item.receives_status,
'completion_status': item.completion_status,
'not_collectible_remarks': item.not_collectible_remarks?item.not_collectible_remarks:"是",
}
state.tableData.push(list);
item.norm_list_extend.forEach(function(items, indexs, arrs) {
if(state.columns.length>0){
state.columns.forEach(function(itemss, indexss, arrss) {
let vlues = state.columns.map(itemsss => itemsss.prop).indexOf('extend_value'+indexs)
if(vlues== -1){
state.columns.push( { label: items.extend_name, prop: 'extend_value'+indexs,width:180 })
}
});
}else{
state.columns.push( { label: items.extend_name, prop: 'extend_value'+indexs,width:180 })
}
list['extend_value'+indexs] =items.extend_value;
});
});
state.columns.push( { label: '领取状态', prop:'receives_status',width:100 })
state.columns.push( { label: '完成状态', prop:'completion_status',width:100 })
state.columns.push( { label: '是否可采集', prop:'not_collectible_remarks',width:200 })
}
}).catch(() => {
})
state.uploadAudio.task_id =task_id;
state.uploadAudio.name ='';
state.uploadAudio.level ='1';
state.uploadAudio.refer ='';
state.uploadAudio.price =1;
state.uploadAudio.guide ='';
state.uploadAudio.sort ='1';
};
/**模板下载 */
function importTemplate() {
let url = getServerPublic()+'/public/template.xlsx';
const iframe = document.createElement('iframe'); // 创建一个HTML 元素
iframe.style.display = 'none'; // 隐藏iframe 防止影响页面
iframe.style.height = 0; // 高度设置0 防止影响页面
iframe.src = url;// 下载链接
document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除
setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000);
ElMessage.success('下载成功,请点击下载列表查看!');
}
/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
// upload.isUploading = true;
};
const uploadFormat = () => {
if(state.uploadAudio.name == ""){
ElMessage.error('请填写子任务名称');
state.selectFile = false;
return false;
}
}
// 选择文件
const handleChange= (file, fileList) => {
if (fileList.length < 0) {
ElMessage.error('未选择文件');
state.selectFile = false;
return false;
}else{
state.selectFile = true;
}
}
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
uploadFileRef.value.clearFiles()
closeDialog();
emit('refresh');
ElMessage.success('上传成功!')
};
// 文件数量限制
const onexceed = (response, file, fileList) => {
ElMessage.error('仅可上传1个文件');
};
const onSubmit = () => {
if(state.selectFile){
uploadFileRef.value.submit()
}else{
ElMessage.error('未选择文件');
}
}
// 关闭弹窗
const closeDialog = () => {
dialogFormRef.value.resetFields();
......@@ -198,9 +189,6 @@ defineExpose({
onMounted(() => {
if(router.currentRoute.value.query.task_id){
state.formItem.addItem.task_id = router.currentRoute.value.query.task_id
}
});
</script>
......
......@@ -18,15 +18,17 @@
</div>
<div>
<el-button size="default" type="primary" @click="release()" v-if="state.isHide">发布子任务</el-button>
<el-button size="default" type="danger" @click="importFile()" v-if="state.isHide">导入数据</el-button>
<el-button @click="backToPreviousPage">返回页面</el-button>
</div>
</div>
<div class="page-main" v-loading="state.tableData.loading" ref="pageMain">
<el-card shadow="hover" style="height:100%;">
<el-table :data="state.tableData.data" style="width: 100%" :height="state.tableHeight"
<el-button size="default" type="danger" @click="multipleExports" style="margin-bottom: 10px;">导出文件</el-button>
<el-table :scrollbar-always-on="true" @selection-change="tableSelection" :row-key="(row) => row.id" :data="state.tableData.data" style="width: 100%" :height="state.tableHeight"
ref="multipleTableRef">
<el-table-column type="selection" width="55" :reserve-selection="true" />
<el-table-column label="序号" type="index" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="taskPackageInfo.name" label="任务名称" show-overflow-tooltip align="center">
<template #default="scope">
......@@ -46,19 +48,20 @@
<el-table-column prop="created_at" width="180" label="发布时间" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="receivedQuantity" label="领取进度" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color:#409EFF">{{scope.row.receivedQuantity}}</span>
<span style="color:#409EFF" v-if="scope.row.type==1">--</span>
<span style="color:#409EFF" v-else>{{scope.row.receivedQuantity}}</span>
</template>
</el-table-column>
<el-table-column prop="name" label="完成进度" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color:#F56C6C">{{scope.row.collectsQuantity}}</span>
<span style="color:#F56C6C" v-if="scope.row.type==1">--</span>
<span style="color:#F56C6C" v-else>{{scope.row.collectsQuantity}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="380" fixed="right" align="center">
<template #default="scope">
<el-button size="small" type="primary" @click="details(scope.row.id)">查看详情</el-button>
<el-button size="small" @click="edit(scope.row.id)">修改子任务</el-button>
<el-button size="small" type="danger" @click="importFile(scope.row.id)">导入数据</el-button>
<el-button size="small" type="warning" @click="exportFile(scope.row.id)">导出数据</el-button>
</template>
</el-table-column>
......@@ -100,6 +103,7 @@ const AddDialogRef = ref()
const DetailDialogRef = ref()
const EditDialogRef = ref()
const ImporDialogRef = ref()
const multipleTableRef = ref()
const state = reactive({
apiData: {
......@@ -117,6 +121,7 @@ const state = reactive({
tableHeight: '30vh',
isHide:false,
taskList:[],
Ids:[],
});
// 获取任务列表
const getTaskList = () => {
......@@ -175,6 +180,16 @@ const getList = () => {
}
const tableSelection = (val) => {
if(val){
state.Ids = [];
val.forEach(item => {
state.Ids.push(item.id);
});
}
console.log(state.Ids)
}
/**
* 返回上一级页面
*/
......@@ -199,8 +214,8 @@ const edit= (norm_id) => {
}
// 导入数据窗口
const importFile= (norm_id) => {
ImporDialogRef.value.openDialog(norm_id);
const importFile= () => {
ImporDialogRef.value.openDialog(state.apiData.task_id);
}
// 导出文件
......@@ -223,7 +238,27 @@ const exportFile= (id) => {
}).catch(() => {
})
}
// 多选导出文件
const multipleExports= () => {
excelFileApi().multipleExportFile({ids:state.Ids}).then(res => {
if(res.data){
let url = res.data;
const iframe = document.createElement('iframe'); // 创建一个HTML 元素
iframe.style.display = 'none'; // 隐藏iframe 防止影响页面
iframe.style.height = 0; // 高度设置0 防止影响页面
iframe.src = url;// 下载链接
document.body.appendChild(iframe); // 这一行必须,iframe挂在到dom树上才会发请求 // 5分钟之后删除
setTimeout(() => { iframe.remove(); }, 5 * 60 * 1000);
ElMessage.success('导出成功,请点击下载列表查看!');
}else{
ElMessage.error('导出失败!');
}
multipleTableRef.value.clearSelection();
getList();
}).catch(() => {
getList();
})
}
</script>
<style lang="scss" scoped>
......
......@@ -34,7 +34,7 @@ const viteConfig = defineConfig((mode) => {
host: '0.0.0.0',
port: env.VITE_PORT,
open: env.VITE_OPEN,
hmr: true,
hmr: true,
proxy: {
'/dev': {
target: 'http://gcspider.raisound.com:81/data-collect-api-dev',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment