Procházet zdrojové kódy

fix: 修改规则表单2

master
yxhc před 1 dnem
rodič
revize
3b32aa480a
2 změnil soubory, kde provedl 509 přidání a 418 odebrání
  1. +480
    -0
      src/pages/expertManage/reviewMeeting/addMeeting/components/ruleFormCom.vue
  2. +29
    -418
      src/pages/expertManage/reviewMeeting/addMeeting/index.vue

+ 480
- 0
src/pages/expertManage/reviewMeeting/addMeeting/components/ruleFormCom.vue Zobrazit soubor

@@ -0,0 +1,480 @@
<template>
<el-card class="mb-16" shadow="never">
<template #header>
<div class="card-header">
<span>抽取信息</span>
</div>
</template>
<el-row
:gutter="20"
>
<el-col :span="24">
<el-form-item
label="抽取规则"
>
<el-card
v-for="(rulesItem,index) in randomRules"
:key="index"
class="box-card w-full mb-8"
>
<template #header>
<div class="card-header flex justify-between">
<span>规则{{ index + 1 }}</span>
<el-button
type="danger"
plain
icon="Delete"
:disabled="randomRules.length === 1"
@click="delExtractionRule(index)"
>
删除规则
</el-button>
</div>
</template>
<el-row class="mt-8" :gutter="10">
<el-col :span="8">
<el-form-item
label="邀请数量"
:label-width="100"
>
<!-- :prop="`randomRules[${index}].count`"-->
<!-- :rules=" [-->
<!-- { required: true, message: ' ', trigger: 'blur' }-->
<!-- ]"-->
<el-input-number
v-model="rulesItem.count"
placeholder="请输入"
:min="1"
:controls="false"
:step="1"
step-strictly
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mt-8">
<el-col :span="8">
<el-form-item label="其他标签" :label-width="100">
<el-select
v-model="rulesItem.otherTag"
class="w-full"
clearable
placeholder="请选择"
>
<el-option
v-for="item in otherTree"
:key="item.value"
:label="item.label"
:value="item.label"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="专家级别" :label-width="100">
<el-cascader
v-model="rulesItem.expertRegionList"
clearable
:options="regionTree"
placeholder="请选择"
class="w-full"
:props="regionProps"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="内外围" :label-width="100">
<el-select
v-model="rulesItem.expertType"
placeholder="请选择"
class="w-full"
clearable
>
<el-option
v-for="(item,order) in dictList &&
dictList.length &&
dictList.find(i => i.dictionaryName === 'expert_type')
.dictionaryList"
:key="order"
:label="item.describe"
:value="item.describe"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mt-8">
<el-col :span="8">
<el-form-item label="履职意向" :label-width="100">
<el-cascader
v-model="rulesItem.intentionRegion"
:options="regionTree"
class="w-full"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="专家来源" :label-width="100">
<el-select
v-model="rulesItem.expertSource"
class="w-full"
placeholder="请选择"
clearable
>
<el-option
v-for="(item,order) in expertSource"
:key="order"
:label="item.label"
:value="item.label"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="职称级别" :label-width="100">
<el-select
v-model="rulesItem.professionalLevel"
class="w-full"
placeholder="请选择"
clearable
>
<el-option
v-for="(item,order) in dictList &&
dictList.length &&
dictList.find(i => i.dictionaryName === 'title_level')
.dictionaryList"
:key="order"
:label="item.describe"
:value="item.describe"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mt-8">
<el-col :span="8">
<el-form-item label="擅长方向" :label-width="100">
<el-select
v-model="rulesItem.goodAt"
class="w-full"
placeholder="请选择"
clearable
>
<el-option
v-for="(item,order) in goodAtTree"
:key="order"
:label="item.label"
:value="item.label"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="技术专长" :label-width="100">
<el-cascader
v-model="rulesItem.technicalExpertise"
:options="technicalExpertiseTree"
placeholder="请选择"
class="w-full"
clearable
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="行业领域" :label-width="100">
<el-cascader
v-model="rulesItem.industrySector"
:options="industrySectorTree"
placeholder="请选择"
class="w-full"
clearable
/>
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-button
class="w-full"
type="primary"
icon="plus"
plain
@click="addExtractionRule"
>添加规则
</el-button>
</el-form-item>
</el-col>
</el-row>

<el-button @click="handleParmas">测试</el-button>
</el-card>
</template>
<script setup>
import { getCurrentInstance, onMounted, ref, watch } from 'vue'
import { storeToRefs } from 'pinia'
import store from '@/store'

const { dictList } = storeToRefs(store.dictStore)
const regionTree = ref([])
const regionProps = ref({ multiple: true })
import { getDictionaryTree } from '@/http/apis/expertManage/expertStore'
import { districtList } from '@/http/apis/commonApi'
const { proxy } = getCurrentInstance()

const randomRules = defineModel({
type: Array,
default: [
{
// other##信息安全##5200000
count: '',
otherTag: '',
expertRegionList: [],
expertType: '',
intentionRegion: {},
expertSource: '',
professionalLevel: '',
goodAt: '',
technicalExpertise: '',
industrySector: ''
}
]
})
// const randomRules = ref([
// {
// // other##信息安全##5200000
// count: '',
// otherTag: '',
// expertRegionList: [],
// expertType: '',
// intentionRegion: {},
// expertSource: '',
// professionalLevel: '',
// goodAt: '',
// technicalExpertise: '',
// industrySector: ''
// }
// ])

onMounted(async () => {
// 获取履职意向数据
const res = await districtList({ regionCode: 330500, regionLevel: 2 })
const regionRes = []
regionRes.push(res.data)
regionTree.value = copeData(regionRes)

const technicalExpertiseRes = await getDictionaryTree({ rootTagCodeList: ['technical_expertise'] })
technicalExpertiseTree.value = copeDictionaryData(technicalExpertiseRes)[0].children

const industrySectorRes = await getDictionaryTree({ rootTagCodeList: ['industry_sector'] })
industrySectorTree.value = copeDictionaryData(industrySectorRes)[0].children

getDictionaryData('technical_expertise')
getDictionaryData('industry_sector')
getDictionaryData('expert_source')
getDictionaryData('good_at')
getDictionaryData('other')
})
const copeData = (val) => {
const data = val.map((item) => {
const deptData = {}
deptData.value = item.unionCode
deptData.label = item.name
if (item.children && item.children.length) {
deptData.children = item.children.map((v) => ({ value: v.unionCode, label: v.name }))
const childrenData = copeData(item.children)
deptData.children = [...childrenData]
}
return deptData
})
return data
}
const addExtractionRule = () => {
if (randomRules.value.length >= 5) {
proxy.$message.warning('最多添加5个规则')
return
}
randomRules.value.push({})
}
const delExtractionRule = (index) => {
randomRules.value.splice(index, 1)
}

// 各种字典数据
const technicalExpertiseTree = ref([])// 技术专长
const industrySectorTree = ref([])// 行业领域
const expertSource = ref([])// 专家来源
const goodAtTree = ref([])// 擅长
const otherTree = ref([])// 其他标签
// 获取各种字典数据
const getDictionaryData = async (params) => {
if (params === 'technical_expertise' && technicalExpertiseTree.value.length === 0) {
const technicalExpertiseRes = await getDictionaryTree({ rootTagCodeList: [params] })
technicalExpertiseTree.value = copeDictionaryData(technicalExpertiseRes)[0].children
} else if (params === 'industry_sector' && industrySectorTree.value.length === 0) {
const industrySectorRes = await getDictionaryTree({ rootTagCodeList: [params] })
industrySectorTree.value = copeDictionaryData(industrySectorRes)[0].children
} else if (params === 'expert_source' && expertSource.value.length === 0) {
const expertSourceRes = await getDictionaryTree({ rootTagCodeList: [params] })
expertSource.value = copeDictionaryData(expertSourceRes)[0].children
} else if (params === 'good_at' && goodAtTree.value.length === 0) {
const goodAtRes = await getDictionaryTree({ rootTagCodeList: [params] })
goodAtTree.value = copeDictionaryData(goodAtRes)[0].children
} else if (params === 'other' && otherTree.value.length === 0) {
const otherRes = await getDictionaryTree({ rootTagCodeList: [params] })
otherTree.value = copeDictionaryData(otherRes)[0].children
}
}

const copeDictionaryData = (val) => { // 处理字典数据的方法
const data = val?.map((item) => {
const deptData = {}
deptData.value = item.parentCode + '##' + item.unionCode
deptData.label = item.tagName
// deptData.isLeaf = false
if (item.children && item.children.length) {
deptData.children = item.children.map((v) => ({ value: v.parentCode + '##' + v.unionCode, label: v.tagName }))
const childrenData = copeDictionaryData(item.children)
deptData.children = [...childrenData]
}
return deptData
})
return data
}

const { detailData } = defineProps({
detailData: Object
})
console.log(detailData)
// randomRules

// 使用深度监听
watch(
() => detailData,
(newVal, oldVal) => {
if (newVal && newVal.randomRules && newVal.randomRules) {
// ruleForm.expertInviteRule.randomRules = newVal.randomRules
// console.log(ruleForm.expertInviteRule.randomRules)
// ruleForm.expertInviteRule.randomRules = handleParmas(newVal.randomRules)
showData()
}
},
{ deep: true }
)

function showData () {

}

defineExpose({
handleParmas
})

function handleParmas () {
const postdata = randomRules.value.map(item => {
return {
inviteType: 1,
count: item.count,
expertDicts: getExpertDicts(item),
expertRegionList: getExpertRegionList(item),
...getIntentionRegion(item),
expertTags: getExpertTags(item),
formEditJson: JSON.stringify(item)
}
})
console.log(postdata)
return postdata
}

function getExpertRegionList (item) {
if (item.expertRegionList && Array.isArray(item.expertRegionList) && item.expertRegionList.length > 0) {
return item.expertRegionList.map(i => {
return {
expertRegionCode: i[1].split('##')[0], expertRegionLevel: i[1].split('##')[2]
}
})
}
return []
}

function getIntentionRegion (item) {
// ["330500##湖州市##2","330503##南浔区##3"]
if (item.intentionRegion && Array.isArray(item.intentionRegion) && item.intentionRegion.length > 1) {
return {
intentionRegionCode: item.intentionRegion[1].split('##')[0],
intentionRegionLevel: item.intentionRegion[1].split('##')[2]
}
} else {
return {}
}
}

function getExpertTags (item) {
const list = []
if (item.otherTag) {
list.push({
expertTag: 'other',
tagCodes: [item.otherTag]
})
}
if (item.expertSource) {
list.push({
expertTag: 'expert_source',
tagCodes: [item.expertSource]
})
}

if (item.goodAt) {
list.push({
expertTag: 'good_at',
tagCodes: [item.goodAt]
})
}

// expert_source

// ["industry_sector##制造业##4030000","4030000##酒、饮料及精制茶制造业##4030300"]
if (item.industrySector && Array.isArray(item.industrySector) && item.industrySector.length > 1) {
list.push({
expertTag: 'industry_sector',
tagCodes: [item.industrySector[1].split('##')[1]]
})
}

if (item.technicalExpertise && Array.isArray(item.technicalExpertise) && item.technicalExpertise.length > 1) {
if (item.technicalExpertise.length === 2) {
list.push({
expertTag: 'technical_expertise',
tagCodes: [item.technicalExpertise[1].split('##')[1]]
})
} else if (item.technicalExpertise.length === 3) {
list.push({
expertTag: 'technical_expertise',
tagCodes: [item.technicalExpertise[2].split('##')[1]]
})
}
}

return list
}

function getExpertDicts (item) {
const list = []
if (item.expertType) {
list.push({
expertDict: 'expert_type',
dictCodes: [item.expertType]
})
}
if (item.professionalLevel) {
list.push({
expertDict: 'title_level',
dictCodes: [item.professionalLevel]
})
}
return list
}

</script>
<style scoped lang="less">

</style>

+ 29
- 418
src/pages/expertManage/reviewMeeting/addMeeting/index.vue Zobrazit soubor

@@ -3,19 +3,21 @@ import { reactive, ref, onMounted, getCurrentInstance } from 'vue'
import OrgTree from '@/components/orgTree/index.vue'
import AddExpertDialog from './components/addExpertDialog.vue'
import AddProjectDialog from './components/addProjectDialog.vue'
import { getDictionaryTree } from '@/http/apis/expertManage/expertStore'
import ruleFormCom from './components/ruleFormCom.vue'
import { createMeeting, randomInviteExpect } from '@/http/apis/expertManage/reviewMeeting'
import { districtList, getBusinessstripLine } from '@/http/apis/commonApi'
import { getBusinessstripLine } from '@/http/apis/commonApi'
import { storeToRefs } from 'pinia'
import store from '@/store'
import { useRouter } from 'vue-router'
import getTimeDiffer from '@/utils/getTimeDiffer.js'
import { ElMessageBox } from 'element-plus'
const { dictList } = storeToRefs(store.dictStore), { meetingTypeOptions, projectTypeOptions } = store.dictStore.globalDicts || {}
const { meetingTypeOptions, projectTypeOptions } = store.dictStore.globalDicts || {}
const { proxy } = getCurrentInstance(),
userInfo = storeToRefs(store.userStore).userInfo || {},
router = useRouter(),
ruleFormRef = ref(),
ruleFormComRef = ref(),
randowRules = ref([{}]),
ruleForm = reactive({
expertInviteRule: {
inviteType: 1,
@@ -33,58 +35,6 @@ const { proxy } = getCurrentInstance(),
isInnerProject: true
}
}),
// 处理抽取规则字典数据expertDicts
handleRandomRulesDictionary = ($event, index) => {
if (!$event) {
ruleForm.expertInviteRule.randomRules[index].expertDicts = []
return
}
const dictType = $event.split('##')[1]
const dictObj = { dictCodes: [$event.split('##')[0]], expertDict: dictType }
if (ruleForm.expertInviteRule.randomRules[index].expertDicts.length === 0) {
ruleForm.expertInviteRule.randomRules[index].expertDicts.push(dictObj)
} else {
const order = ruleForm.expertInviteRule.randomRules[index].expertDicts.findIndex(i => i.expertDict === dictType)
if (order !== -1) { ruleForm.expertInviteRule.randomRules[index].expertDicts.splice(order, 1, dictObj) } else {
ruleForm.expertInviteRule.randomRules[index].expertDicts.push(dictObj)
}
}
},
// 处理抽取规则标签数据expertTags
handleRandomRulesTags = ($event, index) => {
let tagGeneralType // 级联选择器标签总类型
let tagType // select选择器标签总类型
let dictObj
if (!$event) {
dictObj = undefined
ruleForm.expertInviteRule.randomRules[index].expertTags = []
return
} else if (Array.isArray($event)) { // 处理级联选择器,数组型数据
tagGeneralType = $event[0].split('##')[0]
tagType = $event[$event.length - 1].split('##')[0]
dictObj = { tagGeneralType, tagCodes: [$event[$event.length - 1].split('##')[2]], expertTag: tagGeneralType }
} else { // 处理select选择器,字符串型数据
tagType = $event.split('##')[0]
dictObj = { tagType, tagCodes: [$event.split('##')[2]], expertTag: tagType }
}
if (ruleForm.expertInviteRule.randomRules[index].expertTags.length === 0) {
ruleForm.expertInviteRule.randomRules[index].expertTags.push(dictObj)
} else {
if (Array.isArray($event)) {
// (级联选择器数组型)判断选择的数据是否已经存在,若存在替换之前的数据,否则直接添加当前数据
const order = ruleForm.expertInviteRule.randomRules[index].expertTags.findIndex(i => i.tagGeneralType === tagGeneralType)
if (order !== -1) { ruleForm.expertInviteRule.randomRules[index].expertTags.splice(order, 1, dictObj) } else {
ruleForm.expertInviteRule.randomRules[index].expertTags.push(dictObj)
}
} else {
// (select选择器字符串型)同理
const order = ruleForm.expertInviteRule.randomRules[index].expertTags.findIndex(i => i.tagType === tagType)
if (order !== -1) { ruleForm.expertInviteRule.randomRules[index].expertTags.splice(order, 1, dictObj) } else {
ruleForm.expertInviteRule.randomRules[index].expertTags.push(dictObj)
}
}
}
},
// 列表数据
column = reactive([
{
@@ -205,33 +155,7 @@ const { proxy } = getCurrentInstance(),
// 处理随机抽取规则数据
if (ruleForm.expertInviteRule.inviteType === 1) {
delete ruleFormClone.expertInviteRule.appointRule // 随机抽取,删除指定抽取空对象
ruleFormClone.expertInviteRule.randomRules.forEach(element => {
element['inviteType'] = ruleFormClone.expertInviteRule.inviteType
Object.keys(element).forEach(item => {
switch (item) {
case 'expertSource':
delete element[item]
break
case 'expertType':
delete element[item]
break
case 'goodAt':
delete element[item]
break
case 'otherTag':
delete element[item]
break
case 'professionalLevel':
delete element[item]
break
case 'expertRegionLists':
delete element[item]
break
default:
break
}
})
})
ruleFormClone.expertInviteRule.randomRules = ruleFormComRef.value.handleParmas()
} else { // 处理指定抽取规则数据
delete ruleFormClone.expertInviteRule.randomRules // 指定抽取,删除随机抽取空对象
ruleFormClone.expertInviteRule.appointRule['inviteType'] = ruleFormClone.expertInviteRule.inviteType
@@ -420,109 +344,7 @@ const { proxy } = getCurrentInstance(),
selectExpertType.value = 2
unitUserDialogData.visible = true
unitUserDialogData.data = ruleForm.expertInviteRule.avoidRule?.expertIds || []
},
// 添加/删除抽取规则
ExtractionRule = ref([0]),
addExtractionRule = () => {
if (ruleForm.expertInviteRule.randomRules.length >= 5) {
proxy.$message.warning('最多添加5个规则')
return
}
ExtractionRule.value.push(ExtractionRule.value.length)
ruleForm.expertInviteRule.randomRules.push({ expertDicts: [], expertTags: [] })
},
delExtractionRule = (index) => {
ruleForm.expertInviteRule.randomRules.splice(index, 1)
ExtractionRule.value.splice(index, 1)
}
// 各种字典数据
const technicalExpertiseTree = ref([])// 技术专长
const industrySectorTree = ref([])// 行业领域
const expertSource = ref([])// 专家来源
const goodAtTree = ref([])// 擅长
const otherTree = ref([])// 其他标签
const copeDictionaryData = (val) => { // 处理字典数据的方法
const data = val?.map((item) => {
const deptData = {}
deptData.value = item.parentCode + '##' + item.unionCode
deptData.label = item.tagName
// deptData.isLeaf = false
if (item.children && item.children.length) {
deptData.children = item.children.map((v) => ({ value: v.parentCode + '##' + v.unionCode, label: v.tagName }))
const childrenData = copeDictionaryData(item.children)
deptData.children = [...childrenData]
}
return deptData
})
return data
}
// 处理专家层级数据
const handleExpertRegion = ($event, index) => {
console.log(ruleForm.expertInviteRule.randomRules[index].expertRegionLists)
ruleForm.expertInviteRule.randomRules[index].expertRegionList = ruleForm.expertInviteRule.randomRules[index].expertRegionLists?.map(i => {
return {
regionCode: i[i.length - 1]?.split('##')[0],
regionLevel: i[i.length - 1]?.split('##')[2] * 1
}
}) || []
// let regionArr = []
// if (!$event) {
// regionArr = []
// } else {
// regionArr = $event.pop().split('##')
// }
// const regionCode = regionArr?.[0]
// const regionLevel = regionArr?.[2]
// ruleForm.expertInviteRule.randomRules[index].expertRegionCode = regionCode
// ruleForm.expertInviteRule.randomRules[index].expertRegionLevel = regionLevel
}
// 处理履职意向数据
const handleExpertIntentionWorkRegions = ($event, index) => {
let regionArr = []
if (!$event) {
regionArr = []
} else {
regionArr = $event.pop().split('##')
}
const regionCode = regionArr?.[0]
const regionLevel = regionArr?.[2]
ruleForm.expertInviteRule.randomRules[index].intentionRegionCode = regionCode
ruleForm.expertInviteRule.randomRules[index].intentionRegionLevel = regionLevel
}
// 获取各种字典数据
const getDictionaryData = async (params) => {
if (params === 'technical_expertise' && technicalExpertiseTree.value.length === 0) {
const technicalExpertiseRes = await getDictionaryTree({ rootTagCodeList: [params] })
technicalExpertiseTree.value = copeDictionaryData(technicalExpertiseRes)[0].children
} else if (params === 'industry_sector' && industrySectorTree.value.length === 0) {
const industrySectorRes = await getDictionaryTree({ rootTagCodeList: [params] })
industrySectorTree.value = copeDictionaryData(industrySectorRes)[0].children
} else if (params === 'expert_source' && expertSource.value.length === 0) {
const expertSourceRes = await getDictionaryTree({ rootTagCodeList: [params] })
expertSource.value = copeDictionaryData(expertSourceRes)[0].children
} else if (params === 'good_at' && goodAtTree.value.length === 0) {
const goodAtRes = await getDictionaryTree({ rootTagCodeList: [params] })
goodAtTree.value = copeDictionaryData(goodAtRes)[0].children
} else if (params === 'other' && otherTree.value.length === 0) {
const otherRes = await getDictionaryTree({ rootTagCodeList: [params] })
otherTree.value = copeDictionaryData(otherRes)[0].children
}
}
const regionTree = ref([])
const copeData = (val) => {
const data = val.map((item) => {
const deptData = {}
deptData.value = item.unionCode
deptData.label = item.name
if (item.children && item.children.length) {
deptData.children = item.children.map((v) => ({ value: v.unionCode, label: v.name }))
const childrenData = copeData(item.children)
deptData.children = [...childrenData]
}
return deptData
})
return data
}
// 切换是否为系统内项目重置数据
const isInnerProjectChange = (val) => {
if (val) {
@@ -535,42 +357,36 @@ const isInnerProjectChange = (val) => {
changeType = () => {
ruleForm.meetingBasicInfo.projectIdList = []
},
regionProps = ref({ multiple: true }),
lineListData = ref([]),
getLineList = async () => {
const res = await getBusinessstripLine()
lineListData.value = res.data
}
onMounted(async () => {
// 获取履职意向数据
const res = await districtList({ regionCode: 330500, regionLevel: 2 })
const regionRes = []
regionRes.push(res.data)
regionTree.value = copeData(regionRes)
getLineList()
})

async function beforeSubmit () {
const xx = '{"expertInviteRule":{"inviteType":1,"randomRules":[{"expertDicts":[{"dictCodes":["300000"],"expertDict":"expert_type"},{"dictCodes":["900001"],"expertDict":"title_level"}],"expertTags":[{"tagType":"other","tagCodes":["5300000"],"expertTag":"other"},{"tagType":"expert_source","tagCodes":["1020000"],"expertTag":"expert_source"},{"tagGeneralType":"industry_sector","tagCodes":["4040300"],"expertTag":"industry_sector"},{"tagGeneralType":"technical_expertise","tagCodes":["3010102"],"expertTag":"technical_expertise"},{"tagType":"good_at","tagCodes":["2010000"],"expertTag":"good_at"}],"count":12,"expertRegionList":[{"regionCode":"330502","regionLevel":3}],"intentionRegionCode":"330500","intentionRegionLevel":"3","inviteType":1}],"avoidRule":{"avoidUnitIdList":["GO_3bc86256687a4884ae410af00682b762"],"avoidOrgIdList":[],"expertIds":[172],"avoidType":2,"weekInviteCount":1}},"meetingBasicInfo":{"isInnerProject":true,"name":"测试","type":"2","projectIdList":[{"buildOrg":"发改委","createOn":"2024-08-21 17:12","declaredAmount":20,"id":1000,"projectCode":"33050000020240100074","projectName":"725预审撤回测试","projectType":"02","projectYear":2024}],"meetingUsageTime":2,"judgesAttendanceTime":"2024-09-15 00:00","meetingAddress":"111","connecter":"的","contact":"18181818181","innerProjects":[{"projectId":1000,"projectCode":"33050000020240100074"}],"startTime":"2024-09-15 00:00","endTime":"2024-09-18 00:00"}}\n'
const postData = JSON.parse(xx)
const res = await randomInviteExpect(postData)
const total = postData.expertInviteRule.randomRules.reduce((accumulator, currentItem) => {
return accumulator + currentItem.count
}, 0)
console.log(total)
if (res.data.canInvite < total) {
ElMessageBox.confirm('当前可邀请专家数量不足,是否继续邀请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// 继续邀请
console.log('继续')
})
}
}
// async function beforeSubmit () {
// const xx = '{"expertInviteRule":{"inviteType":1,"randomRules":[{"expertDicts":[{"dictCodes":["300000"],"expertDict":"expert_type"},{"dictCodes":["900001"],"expertDict":"title_level"}],"expertTags":[{"tagType":"other","tagCodes":["5300000"],"expertTag":"other"},{"tagType":"expert_source","tagCodes":["1020000"],"expertTag":"expert_source"},{"tagGeneralType":"industry_sector","tagCodes":["4040300"],"expertTag":"industry_sector"},{"tagGeneralType":"technical_expertise","tagCodes":["3010102"],"expertTag":"technical_expertise"},{"tagType":"good_at","tagCodes":["2010000"],"expertTag":"good_at"}],"count":12,"expertRegionList":[{"regionCode":"330502","regionLevel":3}],"intentionRegionCode":"330500","intentionRegionLevel":"3","inviteType":1}],"avoidRule":{"avoidUnitIdList":["GO_3bc86256687a4884ae410af00682b762"],"avoidOrgIdList":[],"expertIds":[172],"avoidType":2,"weekInviteCount":1}},"meetingBasicInfo":{"isInnerProject":true,"name":"测试","type":"2","projectIdList":[{"buildOrg":"发改委","createOn":"2024-08-21 17:12","declaredAmount":20,"id":1000,"projectCode":"33050000020240100074","projectName":"725预审撤回测试","projectType":"02","projectYear":2024}],"meetingUsageTime":2,"judgesAttendanceTime":"2024-09-15 00:00","meetingAddress":"111","connecter":"的","contact":"18181818181","innerProjects":[{"projectId":1000,"projectCode":"33050000020240100074"}],"startTime":"2024-09-15 00:00","endTime":"2024-09-18 00:00"}}\n'
//
// const postData = JSON.parse(xx)
//
// const res = await randomInviteExpect(postData)
// const total = postData.expertInviteRule.randomRules.reduce((accumulator, currentItem) => {
// return accumulator + currentItem.count
// }, 0)
// console.log(total)
// if (res.data.canInvite < total) {
// ElMessageBox.confirm('当前可邀请专家数量不足,是否继续邀请?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// // 继续邀请
// console.log('继续')
// })
// }
// }

</script>

@@ -792,212 +608,7 @@ async function beforeSubmit () {
v-if="ruleForm.expertInviteRule.inviteType == 1"
:gutter="20"
>
<el-col :span="24">
<el-form-item
label="抽取规则"
>
<el-card
v-for="(ele,index) in ExtractionRule"
:key="index"
class="box-card w-full mb-8"
>
<template #header>
<div class="card-header flex justify-between">
<span>规则{{ index+1 }}</span>
<el-button
type="danger"
plain
icon="Delete"
:disabled="ExtractionRule.length === 1"
@click="delExtractionRule(index)"
>
删除规则
</el-button>
</div>
</template>
<el-row class="mt-8" :gutter="10">
<el-col :span="8">
<el-form-item
label="邀请数量"
:label-width="100"
:prop="`expertInviteRule.randomRules[${index}].count`"
:rules=" [
{ required: true, message: ' ', trigger: 'blur' }
]"
>
<el-input-number
v-model="ruleForm.expertInviteRule.randomRules[index].count"
placeholder="请输入"
:min="1"
:controls="false"
:step="1"
step-strictly
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mt-8">
<el-col :span="8">
<el-form-item label="其他标签" :label-width="100">
<el-select
v-model="ruleForm.expertInviteRule.randomRules[index].otherTag"
class="w-full"
clearable
placeholder="请选择"
@change="handleRandomRulesTags($event, index)"
@visible-change="getDictionaryData('other')"
>
<el-option
v-for="item in otherTree"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="专家级别" :label-width="100">
<el-cascader
v-model="ruleForm.expertInviteRule.randomRules[index].expertRegionLists"
clearable
:options="regionTree"
placeholder="请选择"
class="w-full"
:props="regionProps"
@change="handleExpertRegion($event, index)"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="内外围" :label-width="100">
<el-select
v-model="ruleForm.expertInviteRule.randomRules[index].expertType"
placeholder="请选择"
class="w-full"
clearable
@change="handleRandomRulesDictionary($event, index)"
>
<el-option
v-for="(item,order) in dictList &&
dictList.length &&
dictList.find(i => i.dictionaryName === 'expert_type')
.dictionaryList"
:key="order"
:label="item.describe"
:value="item.dictionaryCode+'##'+item.dictionaryType"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mt-8">
<el-col :span="8">
<el-form-item label="履职意向" :label-width="100">
<el-cascader
:options="regionTree"
class="w-full"
clearable
@change="handleExpertIntentionWorkRegions($event,index)"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="专家来源" :label-width="100">
<el-select
v-model="ruleForm.expertInviteRule.randomRules[index].expertSource"
class="w-full"
placeholder="请选择"
clearable
@change="handleRandomRulesTags($event, index)"
@visible-change="getDictionaryData('expert_source')"
>
<el-option
v-for="(item,order) in expertSource"
:key="order"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="职称级别" :label-width="100">
<el-select
v-model="ruleForm.expertInviteRule.randomRules[index].professionalLevel"
class="w-full"
placeholder="请选择"
clearable
@change="handleRandomRulesDictionary($event, index)"
>
<el-option
v-for="(item,order) in dictList &&
dictList.length &&
dictList.find(i => i.dictionaryName === 'title_level')
.dictionaryList"
:key="order"
:label="item.describe"
:value="item.dictionaryCode+'##'+item.dictionaryType"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" class="mt-8">
<el-col :span="8">
<el-form-item label="擅长方向" :label-width="100">
<el-select
v-model="ruleForm.expertInviteRule.randomRules[index].goodAt"
class="w-full"
placeholder="请选择"
clearable
@change="handleRandomRulesTags($event, index)"
@visible-change="getDictionaryData('good_at')"
>
<el-option
v-for="(item,order) in goodAtTree"
:key="order"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="技术专长" :label-width="100">
<el-cascader
:options="technicalExpertiseTree"
placeholder="请选择"
class="w-full"
clearable
@change="handleRandomRulesTags($event, index)"
@visible-change="getDictionaryData('technical_expertise')"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="行业领域" :label-width="100">
<el-cascader
:options="industrySectorTree"
placeholder="请选择"
class="w-full"
clearable
@change="handleRandomRulesTags($event, index)"
@visible-change="getDictionaryData('industry_sector')"
/>
</el-form-item>
</el-col>
</el-row>
</el-card>
<el-button
class="w-full"
type="primary"
icon="plus"
plain
@click="addExtractionRule"
>添加规则</el-button>
</el-form-item>
</el-col>
<rule-form-com ref="ruleFormComRef" v-model="randowRules" />
</el-row>
<el-row
v-else
@@ -1195,7 +806,7 @@ async function beforeSubmit () {
提交
</el-button>
<el-button @click="router.go(-1)">返回</el-button>
<el-button @click="beforeSubmit">测试</el-button>
<!-- <el-button @click="beforeSubmit">测试</el-button>-->

</div>
</el-form>


Načítá se…
Zrušit
Uložit