Commit aa2ae34d by wenyi.chen

导入pdf

parent a6b6410f
......@@ -42,6 +42,13 @@ export function normApi() {
data,
});
},
normDele: (data) => {
return request({
url: '/api/norm/delete',
method: 'post',
data,
});
},
};
}
......
......@@ -24,6 +24,13 @@ export function taskPackageApi() {
data,
});
},
taskPackagDele: (data) => {
return request({
url: '/api/taskPackage/delete',
method: 'post',
data,
});
},
};
}
......
<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-divider><span style="color: #F56C6C;">用户需填写区域</span></el-divider>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">不可采集,原因:{{state.not_collectible_remarks}}</span>
<span style="color: #909399" v-else effect="plain" size="small"></span>
</template>
</el-form-item>
<el-form-item label="信源类型" prop="state.refer_type">
<el-select v-model="state.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="normCollectInfo.remark" v-if="state.collectInfo">
<el-input type="textarea" v-model="state.normCollectInfo.remark" placeholder="请输入备注" clearable :disabled="true"></el-input>
</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-item label="上传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link>
</div>
</el-form-item>
<!-- <el-form-item label="是否可采集:" prop="state.not_collectible_remarks">
<span v-if="state.not_collectible_remarks !=''">{{ state.not_collectible_remarks }}</span>
<span v-if="state.not_collectible_remarks =='' || state.not_collectible_remarks ==null">可采集</span>
</el-form-item> -->
</el-form>
<template #footer>
<div style="margin-bottom: 30px; float: left; width: 70%;">
<el-input v-model="state.review.review_remarks" placeholder="请输入备注" clearable style="width: 50%;margin-right: 15px;"></el-input>
<el-button @click="reviewTask(2)" type="danger" style="margin-right: 15px;">不通过</el-button>
<el-button @click="reviewTask(3)" type="primary">通过</el-button>
</div>
<div style="width: 25%; float: right;">
<span class="dialog-footer">
<el-button @click="closeDialog()" size="default">取 消</el-button>
</span>
</div>
</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,
collectInfo:false,
refer_type:'',
srcList: [
],
userId: null,
index:0,
userIndex:0,
apiData: {
id:'',
},
rules: {
},
dialog: {
isShowDialog: false,
title: '',
submitTxt: '',
},
review:{
id:'',
review_remarks:'',
status:'',
},
dataLoading: false,
btnLoading: false,
normCollectInfo:{},
// 填写内容及自定义文本框
formItem: {
addItem:{
},
dynamicItem: [],
userFilled: [],
originalUpload:[],
},
not_collectible:'',
not_collectible_remarks:'',
});
// 打开弹窗
const openDialog = (data) => {
state.dialog.isShowDialog = true;
state.dialog.title = '指标详情';
state.apiData.id = data.id;
state.review.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;
let review = res.data.review;
// 数据详情
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.not_collectible_remarks = data.not_collectible_remarks
state.not_collectible = data.not_collectible
state.review.review_remarks = review.review_remarks;
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
state.srcList = state.normCollectInfo.imgPath.split(',')
}
if(state.normCollectInfo.remark!=""){
state.collectInfo = true
}
}
// 文件回显
if(res.data.normCollectInfo.fileListPdf){
let file_name = res.data.normCollectInfo.file_name.split(",");
let fileList = res.data.normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
url: item
}
state.formItem.originalUpload.push(ob)
})
}
}).catch(() => {
})
};
/**
* 审核任务
*/
const reviewTask = (status) => {
state.review.status = status
claimTasksApi().normReceivesReviewTask(state.review).then(res => {
ElMessage.success('操作成功!');
closeDialog()
emit('refresh');
}).catch(() => {
closeDialog()
emit('refresh');
})
}
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.dynamicItem = [];
state.formItem.userFilled = [];
state.normCollectInfo = {};
state.formItem.originalUpload = [];
state.srcList = [];
state.imgHide = false;
state.collectInfo =false;
};
// 关闭弹窗
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.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.apiListParam.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-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>
</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" border style="width: 100%" :height="state.tableHeight"
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="领取用户" width="200" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #409EFF;">{{scope.row.userInfo.name}}</span>
</template>
</el-table-column>
<el-table-column prop="taskInfo.name" label="任务名称" width="200" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="taskInfo.unit" label="单位" width="200" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="normInfo.name" label="子任务名称" width="300" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="norm_list_info.name" label="指标名称" width="200" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="norm_list_info.sort" label="优先级" width="100" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #909399;" v-if="scope.row.norm_list_info.sort=='1'"></span>
<span style="color: #409EFF;" v-if="scope.row.norm_list_info.sort=='2'"></span>
<span style="color: #F56C6C;" v-if="scope.row.norm_list_info.sort=='3'"></span>
</template>
</el-table-column>
<el-table-column prop="norm_list_info.level" label="难度等级" width="100" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="norm_list_info.refer" label="参考信源" width="200" show-overflow-tooltip align="center">
<template #default="scope">
<el-link type="danger" v-if="checkUrl(scope.row.norm_list_info.refer)" :href="scope.row.norm_list_info.refer" target ="_blank">点击查看</el-link>
<span v-else>{{scope.row.norm_list_info.refer}}</span>
</template>
</el-table-column>
<el-table-column prop="norm_list_info.guide" label="参考指南" width="200" show-overflow-tooltip align="center">
<template #default="scope">
<el-link type="danger" v-if="checkUrl(scope.row.norm_list_info.guide)" :href="scope.row.norm_list_info.guide" target ="_blank">点击查看</el-link>
<span v-else>{{scope.row.norm_list_info.guide}}</span>
</template>
</el-table-column>
<el-table-column prop="norm_list_info.price" label="单价" width="150" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="status" label="审核情况" width="250" show-overflow-tooltip align="center">
<template #default="scope">
<el-tag type='warning' v-if="scope.row.status==0" size="medium">已领取未填写</el-tag>
<el-tag type='success' v-if="scope.row.status==1" size="medium">已完成未审核</el-tag>
<el-tag type='danger' v-if="scope.row.status==2" size="medium">审核未通过</el-tag>
<el-tag type='success' v-if="scope.row.status==3" size="medium">已通过未结算</el-tag>
<el-tag type='info' v-if="scope.row.status==4" size="medium">已结算</el-tag>
</template>
</el-table-column>
<el-table-column prop="not_collectible" label="是否可采集" width="150" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #F56C6C" v-if="scope.row.not_collectible==1" effect="plain" size="small">{{scope.row.not_collectible_remarks}}</span>
<span style="color: #909399" v-else effect="plain" size="small"></span>
</template>
</el-table-column>
<el-table-column prop="review_remarks" label="审核备注" width="150" show-overflow-tooltip align="center">
<template #default="scope">
<span style="color: #409EFF;" effect="plain" size="small">{{scope.row.review_remarks}}</span>
</template>
</el-table-column>
<el-table-column prop="review_time" label="审核时间" width="250" show-overflow-tooltip align="center"></el-table-column>
<el-table-column label="操作" width="300" fixed="right" align="center">
<template #default="scope">
<el-button size="small" @click="details(scope.row)">查看详情</el-button>
<!-- <el-button size="small" @click="reviewTask(scope.row.id,2)" type="danger">不通过</el-button>
<el-button size="small" @click="reviewTask(scope.row.id,3)" type="primary">通过</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.apiListParam.page" background
v-model:page-size="state.apiListParam.limit" layout="total, sizes, prev, pager, next, jumper"
:total="state.tableData.total">
</el-pagination>
</div>
</el-card>
</div>
<DetailDialog ref="DetailDialogRef" @refresh="getList()" />
</div>
</template>
<script setup name="taskPackage-list">
import { getCurrentInstance } from 'vue';
import { claimTasksApi } from '/@/api/claimTasks/index';
import { normApi } from '/@/api/norm/index';
import { taskPackageApi } from '/@/api/taskPackage/index';
import { ElMessageBox, ElMessage } from 'element-plus';
import { Session } from '/@/utils/storage';
// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));
const DetailDialog = defineAsyncComponent(() => import('/@/views/auditManagement/admin/notPassed/details.vue'));
// 定义变量内容
const DetailDialogRef = ref()
const state = reactive({
// 查询列表参数
apiListParam: {
page: 1,
limit: 10,
name: '',
status:'2',
task_id:'',
admin:1,
norm_id:'',
},
// 任务领取参数
apiAuditingParam: {
id:'',
status:'',
},
tableData: {
data: [],
loading: false,
total: 0
},
tableHeight: '30vh',
normListExtend:[],
testIndex:0,
taskList:[],
normList:[],
});
// 获取任务列表
const getTaskList = () => {
taskPackageApi().taskPackageList({page:-1,limit:-1}).then(res => {
state.taskList = res.data
})
}
// 获取指标列表
const getNormList = () => {
normApi().normList({page:-1,limit:-1}).then(res => {
state.normList = res.data
})
}
// 页面加载时
onMounted(() => {
getTaskList()
getNormList()
getList()
state.tableHeight = getCurrentInstance().refs.pageMain.offsetHeight - 130 - 52 + "px";
});
//校验链接
const checkUrl = (vlaue) =>{
if (/^https?:\/\//.test(vlaue)) {
return true;
} else {
return false;
}
}
/**
* 搜索按钮
*/
const test = () => {
return state.testIndex+1;
}
/**
* 搜索按钮
*/
const searchChange = () => {
state.apiListParam.page = 1
getList()
}
/**
* 重置按钮
*/
const reset = () => {
state.apiListParam.page = 1
state.apiListParam.name = '';
getList()
}
// 分页改变
const onHandleSizeChange = (val) => {
state.apiListParam.limit = val;
getList();
};
const onHandleCurrentChange = (val) => {
state.apiListParam.page = val;
getList();
};
// 获取列表
const getList = () => {
state.tableData.loading = true
claimTasksApi().normReceivesList(state.apiListParam).then(res => {
state.tableData.loading = false
let data =res.data.data;
state.tableData.data = res.data.data
state.tableData.total = res.data.total
}).catch(() => {
state.tableData.loading = false
})
}
/**
* 审核任务
*/
const reviewTask = (id,status) => {
state.apiAuditingParam.id = id
state.apiAuditingParam.status = status
claimTasksApi().normReceivesReviewTask(state.apiAuditingParam).then(res => {
ElMessage.success('操作成功!');
getList();
}).catch(() => {
state.tableData.loading = false
getList();
})
}
/**
* 点击查看
*/
const details = (data) => {
DetailDialogRef.value.openDialog(data);
}
</script>
<style lang="scss" scoped>
.page-main {
height: calc(100vh - 50px - 106px);
}
</style>
......@@ -21,6 +21,12 @@
<el-input v-model="item.value" placeholder="请输入标题对应的值" clearable style="width: 60%;" :disabled="true"></el-input>
</el-form-item>
<el-divider><span style="color: #F56C6C;">用户需填写区域</span></el-divider>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">不可采集,原因:{{state.not_collectible_remarks}}</span>
<span style="color: #909399" v-else effect="plain" size="small"></span>
</template>
</el-form-item>
<el-form-item label="信源类型" prop="state.refer_type">
<el-select v-model="state.refer_type" placeholder="请选择信源等级" :disabled="true">
<el-option label="官网/政府" value="1"></el-option>
......@@ -61,9 +67,11 @@
<el-image style="width: 150px; height: 150px" :preview-src-list="state.srcList" :src="item"></el-image>
</div>
</el-form-item>
<el-form-item label="是否可采集:" prop="state.not_collectible_remarks">
<span v-if="state.not_collectible_remarks !=''">{{ state.not_collectible_remarks }}</span>
<span v-if="state.not_collectible_remarks =='' || state.not_collectible_remarks ==null">可采集</span>
<el-form-item label="上传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link>
</div>
</el-form-item>
</el-form>
<template #footer>
......@@ -124,7 +132,9 @@ const state = reactive({
},
dynamicItem: [],
userFilled: [],
originalUpload:[],
},
not_collectible:'',
not_collectible_remarks:'',
});
......@@ -152,6 +162,7 @@ const openDialog = (data) => {
state.formItem.addItem.refer = addItem.refer;
state.formItem.addItem.guide = addItem.guide;
state.not_collectible_remarks = data.not_collectible_remarks
state.not_collectible = data.not_collectible
state.review.review_remarks = review.review_remarks;
state.userIndex = 0;
state.index = 0;
......@@ -163,6 +174,7 @@ const openDialog = (data) => {
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
......@@ -174,6 +186,18 @@ const openDialog = (data) => {
state.collectInfo = true
}
}
// 文件回显
if(res.data.normCollectInfo.fileListPdf){
let file_name = res.data.normCollectInfo.file_name.split(",");
let fileList = res.data.normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
url: item
}
state.formItem.originalUpload.push(ob)
})
}
}).catch(() => {
......@@ -240,6 +264,7 @@ const wipeData = () => {
state.formItem.dynamicItem = [];
state.formItem.userFilled = [];
state.normCollectInfo = {};
state.formItem.originalUpload = [];
state.srcList = [];
state.imgHide = false;
state.collectInfo =false;
......
......@@ -57,7 +57,7 @@
</template>
</el-table-column>
<el-table-column prop="norm_list_info.price" label="单价" width="150" show-overflow-tooltip align="center"></el-table-column>
<el-table-column prop="status" label="完成情况" width="250"show-overflow-tooltip align="center">
<el-table-column prop="status" label="完成情况" width="250" show-overflow-tooltip align="center">
<template #default="scope">
<el-tag type='warning' v-if="scope.row.status==0" size="medium">已领取未填写</el-tag>
<el-tag type='success' v-if="scope.row.status==1" size="medium">已完成未审核</el-tag>
......@@ -77,6 +77,7 @@
<span style="color: #409EFF;" effect="plain" size="small">{{scope.row.review_remarks}}</span>
</template>
</el-table-column>
<el-table-column prop="review_time" label="审核时间" width="250" show-overflow-tooltip align="center"></el-table-column>
<el-table-column label="操作" width="300" fixed="right" align="center">
<template #default="scope">
<el-button size="small" @click="details(scope.row)">查看详情</el-button>
......@@ -119,7 +120,7 @@ const state = reactive({
page: 1,
limit: 10,
name: '',
status:'2,3',
status:'3',
task_id:'',
admin:1,
norm_id:'',
......
......@@ -19,8 +19,14 @@
<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>
<el-divider><span style="color: #F56C6C;">用户需填写区域</span></el-divider>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">不可采集,原因:{{state.not_collectible_remarks}}</span>
<span style="color: #909399" v-else effect="plain" size="small"></span>
</template>
</el-form-item>
<el-form-item label="信源类型" prop="state.refer_type">
<el-select v-model="state.refer_type" placeholder="请选择信源等级" :disabled="true">
<el-option label="官网/政府" value="1"></el-option>
......@@ -43,7 +49,7 @@
<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-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>
......@@ -54,26 +60,29 @@
<div>备注:</div>
</el-col>
<el-col :span="22">
<el-input v-model="item.remark" placeholder="请输入备注(选填)" clearabl :disabled="true"></el-input>
<el-input v-model="item.remark" placeholder="" clearabl :disabled="true"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="收集备注" prop="normCollectInfo.remark" v-if="state.collectInfo">
<el-input type="textarea" v-model="state.normCollectInfo.remark" placeholder="请输入备注" clearable :disabled="true"></el-input>
<el-input type="textarea" v-model="state.normCollectInfo.remark" placeholder="" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="收集备注" prop="normCollectInfo.remark" v-if="state.collectInfo ==false">
<el-input type="textarea" placeholder="未填写" clearable :disabled="true"></el-input>
</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-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">{{state.not_collectible_remarks}}</span>
<span style="color: #909399" v-else effect="plain" size="small"></span>
</template>
<el-form-item label="上传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link>
</div>
</el-form-item>
</el-form>
<template #footer>
......@@ -134,7 +143,8 @@ const state = reactive({
addItem:{
},
dynamicItem: [],
userFilled: []
userFilled: [],
originalUpload:[],
},
not_collectible:'',
not_collectible_remarks:'',
......@@ -188,6 +198,18 @@ const openDialog = (data) => {
if(state.normCollectInfo.remark!=""){
state.collectInfo = true
}
// 文件回显
if(state.normCollectInfo.fileListPdf){
let file_name = state.normCollectInfo.file_name.split(",");
let fileList = state.normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
url: item
}
state.formItem.originalUpload.push(ob)
})
}
}
}).catch(() => {
......@@ -254,6 +276,7 @@ const wipeData = () => {
state.formItem.addItem.remark = '';
state.formItem.dynamicItem = [];
state.formItem.userFilled = [];
state.formItem.originalUpload = [];
state.srcList = [];
state.imgHide = false;
state.collectInfo =false;
......
......@@ -20,10 +20,13 @@
<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="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">不可采集,原因:{{state.not_collectible_remarks}}</span>
<span style="color: #909399" v-else effect="plain" size="small"></span>
</template>
</el-form-item>
<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>
......@@ -40,7 +43,7 @@
<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-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>
......@@ -51,16 +54,25 @@
<div>备注:</div>
</el-col>
<el-col :span="22">
<el-input v-model="item.remark" placeholder="请输入备注(选填)" clearabl :disabled="true"></el-input>
<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.normCollectInfo.remark">
<el-input type="textarea" v-model="state.normCollectInfo.remark" placeholder="未填写" clearable :disabled="true"></el-input>
</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-item label="上传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link>
</div>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
......@@ -110,9 +122,12 @@ const state = reactive({
id:'',
},
dynamicItem: [],
userFilled: []
userFilled: [],
originalUpload:[],
},
normCollectInfo:{},
not_collectible:'',
not_collectible_remarks:'',
});
// 打开弹窗
......@@ -137,6 +152,8 @@ const openDialog = (data) => {
state.formItem.addItem.task_name = addItem.task_name;
state.formItem.addItem.refer = addItem.refer;
state.formItem.addItem.guide = addItem.guide;
state.not_collectible_remarks = data.not_collectible_remarks
state.not_collectible = data.not_collectible
state.userIndex = 0;
state.index = 0;
userFilled.forEach(item => {
......@@ -157,6 +174,18 @@ const openDialog = (data) => {
if(state.normCollectInfo.remark!=""){
state.collectInfo = true
}
// 文件回显
if(res.data.normCollectInfo.fileListPdf){
let file_name = res.data.normCollectInfo.file_name.split(",");
let fileList = res.data.normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
url: item
}
state.formItem.originalUpload.push(ob)
})
}
}
}).catch(() => {
......
......@@ -46,7 +46,7 @@
<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-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>
......@@ -57,13 +57,13 @@
<div>备注:</div>
</el-col>
<el-col :span="22">
<el-input v-model="item.remark" placeholder="请输入备注(选填)" clearabl :disabled="true"></el-input>
<el-input v-model="item.remark" placeholder="" clearabl :disabled="true"></el-input>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="收集备注" prop="remark">
<el-input type="textarea" v-model="state.formItem.addItem.remark" placeholder="请输入备注" clearable :disabled="true"></el-input>
<el-input type="textarea" v-model="state.formItem.addItem.remark" placeholder="未填写" clearable :disabled="true"></el-input>
</el-form-item>
<el-form-item label="网页截图">
<div style="border: 1px solid #ccc; width: 100%;">
......@@ -82,6 +82,12 @@
/>
</div>
</el-form-item>
<el-form-item label="已传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link>
</div>
</el-form-item>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">{{state.not_collectible_remarks}}</span>
......@@ -154,6 +160,7 @@ const state = reactive({
editorContent:'', // 富文本所有内容
not_collectible:'',
not_collectible_remarks:'',
originalUpload:[],
}
});
......@@ -193,7 +200,18 @@ const openDialog = (data) => {
state.formItem.editorContent = '请输入截图'
}
}
// 文件回显
if(res.data.normCollectInfo.fileListPdf){
let file_name = res.data.normCollectInfo.file_name.split(",");
let fileList = res.data.normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
url: item
}
state.formItem.originalUpload.push(ob)
})
}
state.userIndex = 0;
state.index = 0;
userFilled.forEach(item => {
......@@ -229,6 +247,7 @@ const closeDialog = () => {
state.formItem.editorContent = '';
state.not_collectible_remarks = ''
state.not_collectible = ''
state.formItem.originalUpload = [];
if(state.formItem.addItem.refer_type){
state.formItem.addItem.refer_type ='';
}
......
......@@ -72,6 +72,26 @@
/>
</div>
</el-form-item>
<el-form-item label="已传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-tag size="small" closable style="margin-right:10px" @close="handleClose(item.url)"><el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link></el-tag>
</div>
</el-form-item>
<el-form-item label="上传文件">
<el-upload
class="upload-demo"
:action="state.server_pdf"
:on-success="handleFileSuccess"
multiple
:limit="10"
:on-exceed="onexceed"
:before-remove="beforeRemove"
:file-list="state.formItem.fileListPdf">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip" style="margin-left: 10px;">只能上传pdf文件</div>
</el-upload>
</el-form-item>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">{{state.not_collectible_remarks}}</span>
......@@ -105,8 +125,8 @@
import '@wangeditor/editor/dist/css/style.css' // 引入 css
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { claimTasksApi } from '/@/api/claimTasks'
import { ElMessage } from 'element-plus';
import { getUploadUrl } from "/@/utils/getHost.js";
import { ElMessage,ElMessageBox } from 'element-plus';
import { getUploadUrl,getServerUrl } from "/@/utils/getHost.js";
// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh']);
......@@ -114,6 +134,7 @@ const emit = defineEmits(['refresh']);
const dialogFormRef = ref();
const router = useRouter();
const state = reactive({
server_pdf:getServerUrl()+'/uploadPdf',
userId: null,
index:0,
userIndex:0,
......@@ -158,6 +179,8 @@ const state = reactive({
editorContent:'', // 富文本所有内容
not_collectible:'',
not_collectible_remarks:'',
fileListPdf:[],
originalUpload:[],
}
});
......@@ -188,14 +211,27 @@ const openDialog = (data) => {
if(res.data.normCollectInfo)
{
let normCollectInfo = res.data.normCollectInfo;
state.formItem.addItem.refer_type = normCollectInfo.refer_type;
state.formItem.addItem.remark = normCollectInfo.remark;
if(normCollectInfo.editorContent){
state.formItem.editorContent = normCollectInfo.editorContent
}else{
state.formItem.editorContent = '请输入截图'
}
let normCollectInfo = res.data.normCollectInfo;
state.formItem.addItem.refer_type = normCollectInfo.refer_type;
state.formItem.addItem.remark = normCollectInfo.remark;
if(normCollectInfo.editorContent){
state.formItem.editorContent = normCollectInfo.editorContent
}else{
state.formItem.editorContent = '请输入截图'
}
// 文件回显
if(normCollectInfo.fileListPdf){
let file_name = normCollectInfo.file_name.split(",");
let fileList = normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
id: state.notCollectibleData.id,
url: item
}
state.formItem.originalUpload.push(ob)
})
}
}
state.userIndex = 0;
......@@ -214,6 +250,52 @@ const openDialog = (data) => {
})
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
ElMessage.success('上传成功!')
state.formItem.fileListPdf.push({name:response.data.name,url:response.data.url})
console.log(state.formItem.fileListPdf)
};
/**
*
* 删除已删除的文件
* @param {*} tsg
*/
const handleClose= (tsg) => {
return ElMessageBox.confirm(
`确定移除该文件?`
).then(
() =>{
let index = state.formItem.originalUpload.map(item => item.url).indexOf(tsg);
if(index !=-1){
state.formItem.originalUpload.splice(index,1)
}
},
() => false
)
}
// 删除文件
const beforeRemove = (file, fileList) => {
return ElMessageBox.confirm(
`确定移除该文件?`
).then(
() =>{
console.log(file)
let index = state.formItem.fileListPdf.map(item => item.url).indexOf(file.response.data.url);
if(index !=-1){
state.formItem.fileListPdf.splice(index,1)
}
},
() => false
)
};
// 文件数量限制
const onexceed = (response, file, fileList) => {
ElMessage.error('仅可上传10个文件');
};
// 数据不可采集
const notCollectible = () =>{
const editor = editorRef.value;
......@@ -324,6 +406,8 @@ const closeDialog = () => {
state.formItem.editorContent = '';
state.not_collectible_remarks = ''
state.not_collectible = ''
state.formItem.fileListPdf = [];
state.formItem.originalUpload = [];
if(state.formItem.addItem.refer_type){
state.formItem.addItem.refer_type ='';
}
......
......@@ -82,6 +82,12 @@
/>
</div>
</el-form-item>
<el-form-item label="已传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link>
</div>
</el-form-item>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">{{state.not_collectible_remarks}}</span>
......@@ -154,6 +160,7 @@ const state = reactive({
editorContent:'', // 富文本所有内容
not_collectible:'',
not_collectible_remarks:'',
originalUpload:[],
}
});
......@@ -193,6 +200,18 @@ const openDialog = (data) => {
state.formItem.editorContent = '请输入截图'
}
}
// 文件回显
if(res.data.normCollectInfo.fileListPdf){
let file_name = res.data.normCollectInfo.file_name.split(",");
let fileList = res.data.normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
url: item
}
state.formItem.originalUpload.push(ob)
})
}
state.userIndex = 0;
state.index = 0;
......@@ -226,6 +245,7 @@ const closeDialog = () => {
state.formItem.dynamicItem = [];
state.formItem.userFilled = [];
state.formItem.editorImgList = [];
state.formItem.originalUpload = [];
state.formItem.editorContent = '';
state.not_collectible_remarks = ''
state.not_collectible = ''
......
......@@ -75,6 +75,26 @@
/>
</div>
</el-form-item>
<el-form-item label="已传文件">
<span v-if="state.formItem.originalUpload == ''"></span>
<div v-for="(item, index) in state.formItem.originalUpload">
<el-tag size="small" closable style="margin-right:10px" @close="handleClose(item.url)"><el-link type="primary" :href="item.url" target="_blank">{{item.name}}</el-link></el-tag>
</div>
</el-form-item>
<el-form-item label="上传文件">
<el-upload
class="upload-demo"
:action="state.server_pdf"
:on-success="handleFileSuccess"
multiple
:limit="10"
:on-exceed="onexceed"
:before-remove="beforeRemove"
:file-list="state.formItem.fileListPdf">
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip" style="margin-left: 10px;">只能上传pdf文件</div>
</el-upload>
</el-form-item>
<el-form-item label="是否可采集:" prop="state.not_collectible">
<template #default="scope">
<span style="color: #F56C6C" v-if="state.not_collectible==1" effect="plain" size="small">{{state.not_collectible_remarks}}</span>
......@@ -108,8 +128,8 @@
import '@wangeditor/editor/dist/css/style.css' // 引入 css
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
import { claimTasksApi } from '/@/api/claimTasks'
import { ElMessage } from 'element-plus';
import { getUploadUrl } from "/@/utils/getHost.js";
import { ElMessage,ElMessageBox } from 'element-plus';
import { getUploadUrl,getServerUrl } from "/@/utils/getHost.js";
// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh']);
......@@ -137,6 +157,7 @@ const state = reactive({
},
dataLoading: false,
btnLoading: false,
server_pdf:getServerUrl()+'/uploadPdf',
// 填写内容及自定义文本框
formItem: {
addItem:{
......@@ -161,6 +182,8 @@ const state = reactive({
editorContent:'', // 富文本所有内容
not_collectible:'',
not_collectible_remarks:'',
fileListPdf:[],
originalUpload:[],
}
});
......@@ -200,8 +223,20 @@ const openDialog = (data) => {
}else{
state.formItem.editorContent = '请输入截图'
}
// 文件回显
if(normCollectInfo.fileListPdf){
let file_name = normCollectInfo.file_name.split(",");
let fileList = normCollectInfo.fileListPdf.split(",");
fileList.forEach(function(item,index,array) {
let ob = {
name:file_name[index],
id: state.notCollectibleData.id,
url: item
}
state.formItem.originalUpload.push(ob)
})
}
}
state.userIndex = 0;
state.index = 0;
console.log(state.formItem.addItem)
......@@ -218,6 +253,52 @@ const openDialog = (data) => {
})
};
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
ElMessage.success('上传成功!')
state.formItem.fileListPdf.push({name:response.data.name,url:response.data.url})
console.log(state.formItem.fileListPdf)
};
/**
*
* 删除已删除的文件
* @param {*} tsg
*/
const handleClose= (tsg) => {
return ElMessageBox.confirm(
`确定移除该文件?`
).then(
() =>{
let index = state.formItem.originalUpload.map(item => item.url).indexOf(tsg);
if(index !=-1){
state.formItem.originalUpload.splice(index,1)
}
},
() => false
)
}
// 删除文件
const beforeRemove = (file, fileList) => {
return ElMessageBox.confirm(
`确定移除该文件?`
).then(
() =>{
console.log(file)
let index = state.formItem.fileListPdf.map(item => item.url).indexOf(file.response.data.url);
if(index !=-1){
state.formItem.fileListPdf.splice(index,1)
}
},
() => false
)
};
// 文件数量限制
const onexceed = (response, file, fileList) => {
ElMessage.error('仅可上传10个文件');
};
// 数据不可采集
const notCollectible = () =>{
const editor = editorRef.value;
......@@ -337,6 +418,8 @@ const closeDialog = () => {
}
dialogFormRef.value.resetFields();
state.dialog.isShowDialog = false;
state.formItem.fileListPdf = [];
state.formItem.originalUpload = [];
};
......
......@@ -211,15 +211,24 @@ const handleCreated = (editor) => {
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
ElMessage.success('上传成功!')
state.formItem.fileListPdf.push(response.data.url)
state.formItem.fileListPdf.push({name:response.data.name,url:response.data.url})
console.log(state.formItem.fileListPdf)
};
// 删除文件
const beforeRemove = (file, fileList) => {
console.log(state.formItem.fileListPdf)
let index = state.formItem.fileListPdf.map(item => item).indexOf(file.response.data.url);
state.formItem.fileListPdf.splice(index,1)
return ElMessageBox.confirm(
`确定移除该文件?`
).then(
() =>{
console.log(file)
let index = state.formItem.fileListPdf.map(item => item.url).indexOf(file.response.data.url);
if(index !=-1){
state.formItem.fileListPdf.splice(index,1)
}
},
() => false
)
};
// 文件数量限制
......@@ -463,6 +472,7 @@ const wipeData = () => {
state.formItem.editorImgList = [];
state.formItem.editorContent = '';
state.formItem.fileListPdf = [];
state.formItem.originalUpload = [];
};
......
......@@ -29,7 +29,7 @@
ref="multipleTableRef" @selection-change="tableSelection">
<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 prop="taskPackageInfo.name" label="任务名称" show-overflow-tooltip align="center">
</el-table-column>
<el-table-column prop="normInfo.name" label="子任务名称" show-overflow-tooltip align="center">
</el-table-column>
......
......@@ -159,10 +159,18 @@ const handleChange= (file, fileList) => {
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
uploadFileRef.value.clearFiles()
closeDialog();
emit('refresh');
ElMessage.success('上传成功!')
console.log(response)
if(response.code ==200){
uploadFileRef.value.clearFiles()
closeDialog();
emit('refresh');
ElMessage.success('导入成功!')
}else{
uploadFileRef.value.clearFiles()
closeDialog();
emit('refresh');
ElMessage.error(response.message)
}
};
// 文件数量限制
const onexceed = (response, file, fileList) => {
......
......@@ -63,11 +63,12 @@
<span style="color:#F56C6C" v-else>{{scope.row.collectsQuantity}}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="380" fixed="right" align="center">
<el-table-column label="操作" width="480" 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="warning" @click="exportFile(scope.row.id)">导出数据</el-button>
<el-button size="small" v-if="state.admin==1" type="danger" @click="deleteNorm(scope.row.id)">删除子任务</el-button>
</template>
</el-table-column>
</el-table>
......@@ -94,7 +95,7 @@ import { normApi } from '/@/api/norm/index';
import { taskPackageApi } from '/@/api/taskPackage/index';
import { excelFileApi } from '/@/api/excelFile/index';
import { ElMessageBox, ElMessage } from 'element-plus';
import { Session } from '/@/utils/storage';
// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));
const AddDialog = defineAsyncComponent(() => import('/@/views/norm/list/dialog.vue'));
......@@ -127,6 +128,7 @@ const state = reactive({
isHide:false,
taskList:[],
Ids:[],
admin:Session.get('userInfo').id, // 1管理员
});
// 获取任务列表
const getTaskList = () => {
......@@ -192,7 +194,21 @@ const getList = () => {
})
}
const deleteNorm = (id) => {
return ElMessageBox.confirm(
`确定删除该子任务,以及该子任务下的所有指标信息吗?`
).then(
() =>{
let query = {'norm_id':id};
normApi().normDele(query).then(res => {
ElMessage.success('删除成功');
getList();
}).catch(() => {
})
},
() => false
)
}
const tableSelection = (val) => {
if(val){
state.Ids = [];
......
......@@ -46,6 +46,7 @@
<el-button size="small" type="primary" @click="details(scope.row.id)">发布子任务</el-button>
<el-button size="small" type="danger" @click="edit(scope.row)">修改任务</el-button>
<el-button size="small" type="warning" @click="exportFile(scope.row.id)">导出数据</el-button>
<el-button size="small" v-if="state.admin==1" type="danger" @click="deleteTask(scope.row.id)">删除任务</el-button>
</template>
</el-table-column>
</el-table>
......@@ -69,7 +70,7 @@ import { getCurrentInstance } from 'vue';
import { taskPackageApi } from '/@/api/taskPackage/index';
import { excelFileApi } from '/@/api/excelFile/index';
import { ElMessageBox, ElMessage } from 'element-plus';
import { Session } from '/@/utils/storage';
// 引入组件
const Breadcrumb = defineAsyncComponent(() => import('/@/layout/navBars/breadcrumb/breadcrumb.vue'));
const AddDialog = defineAsyncComponent(() => import('/@/views/taskPackage/list/dialog.vue'));
......@@ -88,18 +89,20 @@ const state = reactive({
total: 0
},
tableHeight: '30vh',
admin:Session.get('userInfo').id, // 1管理员
});
// 页面加载时
onMounted(() => {
// getDepatment()
getList()
state.tableHeight = getCurrentInstance().refs.pageMain.offsetHeight - 130 - 52 + "px";
});
const searchChange = () => {
state.apiData.page = 1
getList()
getList()
}
// 分页改变
......@@ -112,6 +115,21 @@ const onHandleCurrentChange = (val) => {
getList();
};
const deleteTask = (id) => {
return ElMessageBox.confirm(
`确定删除该任务,以及该任务下的所有指标信息吗?`
).then(
() =>{
let query = {'task_id':id};
taskPackageApi().taskPackagDele(query).then(res => {
ElMessage.success('删除成功');
getList();
}).catch(() => {
})
},
() => false
)
}
/**
* 重置按钮
*/
......
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