Commit abfeddf1 by wenyi.chen

V1确定版本

parent d203b03e
<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-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"
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 label="子任务名称" prop="name">
<el-input type="textarea" v-model="state.formItem.addItem.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 label="难度等级">
<el-select v-model="state.formItem.addItem.level" :disabled="true" 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-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-form-item>
<el-form-item label="price" prop="price">
<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>
</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 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: 40%;" :disabled="true"></el-input>
<div style="width: 20%;">内容:</div>
<el-input v-model="item.value" placeholder="请输入标题对应的值" clearable style="width: 40%;" :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-col :span="12">
<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 :span="6">
<div>是否必填:</div>
</el-col>
<el-col :span="2">
<span style="color: red;" v-if="item.radio==1">必填</span>
<el-col :span="6">
<div>
<el-radio v-model="item.radio" label="1" :disabled="true"></el-radio>
<el-radio v-model="item.radio" label="0" :disabled="true"></el-radio>
</div>
</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 :span="18">
<el-input v-model="item.remarks" 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>
<el-divider style="width: 90%;"><span style="color: #F56C6C;">用户已领取列表</span></el-divider>
<el-table :data="state.tableData" border style="width: 100%" :height="state.tableHeight"
ref="multipleTableRef">
<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 style="color:#409EFF" v-if="column.label =='用户名称'">{{scope.row[column.prop]}}</span> -->
<span style="color:#909399" v-if="column.label =='指标状态' && scope.row[column.prop] ==0">已领取、未完成</span>
<span style="color:#E6A23C" v-if="column.label =='指标状态' && scope.row[column.prop] ==1">已完成、未审核</span>
<span style="color:#409EFF" v-if="column.label =='指标状态' && scope.row[column.prop] ==2">审核不通过</span>
<span style="color:#409EFF" v-if="column.label =='指标状态' && scope.row[column.prop] ==3">审核通过、未结算</span>
<span style="color:#409EFF" v-if="column.label =='指标状态' && scope.row[column.prop] ==4">审核通过、已结算</span>
<span style="color:#909399" v-if="scope.row[column.prop] =='' && column.label !='指标状态'">/</span>
<!-- <span v-else>{{scope.row[column.prop]}}</span> -->
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script setup name="systemRoleDialog">
import { claimTasksApi } from '/@/api/claimTasks'
import { normApi } from '/@/api/norm'
import { ElMessage } from 'element-plus';
import { toolsApi } from '/@/api/tools'
// 定义子组件向父组件传值/事件
const emit = defineEmits(['refresh']);
......@@ -83,10 +92,6 @@ const emit = defineEmits(['refresh']);
const dialogFormRef = ref();
const router = useRouter();
const state = reactive({
imgHide:false,
url: '',
srcList: [
],
userId: null,
index:0,
userIndex:0,
......@@ -94,130 +99,157 @@ const state = reactive({
id:'',
},
rules: {
refer_type: [{ required: true, message: '请输入选择信源类型', trigger: 'blur' }],
},
dialog: {
isShowDialog: false,
title: '',
submitTxt: '',
},
tableData:[
],
columns:[
],
collectsTableData:[],
collectsColumns:[],
dataLoading: false,
btnLoading: false,
// 填写内容及自定义文本框
formItem: {
addItem:{
refer_type:'',
id:'',
},
dynamicItem: [],
userFilled: []
name:'',
level:'',
sort:'',
refer:'',
price:'',
task_id:'',
},
normCollectInfo:{},
dynamicItem: [
//默认显示一条
// {
// name: '',
// value:''
// }
],
userFilled: [
//默认显示一条
// {
// name: '',
// radio:'1',
// }
]
}
});
// 打开弹窗
const openDialog = (data) => {
const openDialog = (norm_id) => {
state.dialog.isShowDialog = true;
state.dialog.title = '子任务详情';
state.apiData.id = norm_id;
// 清空数据
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=[];
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 => {
normApi().normDetail(state.apiData).then(res => {
let addItem = res.data.addItem;
let userFilled = res.data.userFilled;
let adminFilled = res.data.adminFilled;
let custom = res.data.custom;
// 数据详情
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.level = addItem.level;
state.formItem.addItem.sort = addItem.sort+'';
state.formItem.addItem.refer = addItem.refer;
state.formItem.addItem.guide = addItem.guide;
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;
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});
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++
});
adminFilled.forEach(item => {
state.formItem.dynamicItem.push({id:item.id,name:item.extend_name,value:item.extend_value,});
}else{
state.formItem.dynamicItem.push({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
});
//领取列表
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,
'status': item.status,
'not_collectible_remarks': item.not_collectible_remarks?item.not_collectible_remarks:"是",
'remark': item.remark,
}
if(item.refer_type == 1){
list['refer_type']='官网/政府';
}else if(item.refer_type ==2 ){
list['refer_type']='权威媒体';
}else if(item.refer_type ==3 ){
list['refer_type']='其他可信信源';
}else{
list['refer_type']='/';
}
}).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;
state.tableData.push(list);
item.norm_list_extend.forEach(function(items, indexs, arrs) {
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 })
}
});
list['extend_value'+indexs] =items.extend_value;
});
let sign = 0;
item.normCollectsExtend.forEach(function(items, indexs, arrs) {
state.columns.forEach(function(itemss, indexss, arrss) {
let vlues = state.columns.map(iteml => iteml.prop).indexOf('extend_value'+sign+'_')
if(vlues== -1){
state.columns.push( { label: items.extend_name, prop: 'extend_value'+sign+'_',width:180 })
}
});
list['extend_value'+sign+'_'] =items.extend_value;
sign++
// list['extend_value'+'_'+sign] =items.extend_value;
});
});
state.columns.push( { label: '信源类型', prop:'refer_type',width:200 })
state.columns.push( { label: '采集备注', prop:'remark',width:230 })
state.columns.push( { label: '指标状态', prop:'status',width:300 })
// state.columns.push( { label: '图片', prop:'imgPath',width:230 })
// state.columns.push( { label: '是否可采集', prop:'not_collectible_remarks',width:200 })
}
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();
......@@ -248,7 +280,6 @@ onMounted(() => {
align-content: center;
}
/** el-input disabled时的背景和边框*/
.el-input.is-disabled{
background:#fff !important;
color: var(--el-radio-text-color) !important;
......@@ -264,7 +295,6 @@ onMounted(() => {
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;
......
......@@ -65,7 +65,7 @@ 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 DetailDialog = defineAsyncComponent(() => import('/@/views/dataScreening/list/details.vue'));
const EditDialog = defineAsyncComponent(() => import('/@/views/norm/list/edit.vue'));
const ImporDialog = defineAsyncComponent(() => import('/@/views/norm/list/impor.vue'));
const router = useRouter();
......@@ -157,7 +157,6 @@ const getList = () => {
{ 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;
......@@ -175,7 +174,6 @@ const getList = () => {
'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){
......@@ -190,9 +188,6 @@ const getList = () => {
}
}
});
// 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)
......
......@@ -37,7 +37,7 @@ const viteConfig = defineConfig((mode) => {
hmr: true,
proxy: {
'/dev': {
target: 'http://gcspider.raisound.com:81/data-collect-api-dev',
target: 'http://gcspider.raisound.com:81/data-collect-api',
// target: 'https://data-collect.raisound.com/smart-detection',
// target: 'http://192.168.10.168/data-collect-api',
ws: true,
......
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