Merge pull request 'master' (#693) from master into prod
Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/693
This commit is contained in:
@@ -2,13 +2,13 @@
|
|||||||
<div v-loading="loading">
|
<div v-loading="loading">
|
||||||
<el-form :model="formData" ref="form" class="query-form" :rules="rules">
|
<el-form :model="formData" ref="form" class="query-form" :rules="rules">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="6" style="padding-left: 0">
|
||||||
<el-form-item label="分摊名称" prop="shareName">
|
<el-form-item label="分摊名称" prop="shareName">
|
||||||
<el-input v-model="formData.shareName" placeholder="请输入分摊名称" clearable>
|
<el-input v-model="formData.shareName" placeholder="请输入分摊名称" clearable>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="6">
|
||||||
<el-form-item label="分摊月份" prop="apportionmentMonth">
|
<el-form-item label="分摊月份" prop="apportionmentMonth">
|
||||||
<el-date-picker
|
<el-date-picker
|
||||||
v-model="formData.apportionmentMonth"
|
v-model="formData.apportionmentMonth"
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
<el-table-column prop="projectId" label="项目名称" min-width="230">
|
<el-table-column prop="projectId" label="项目名称" min-width="230">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId">
|
<el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId">
|
||||||
<el-select v-model="scope.row.projectId" placeholder="请选择项目名称" clearable filterable remote>
|
<el-select v-model="scope.row.projectId" placeholder="请选择项目名称" clearable filterable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in nameOptions"
|
v-for="item in nameOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@@ -98,18 +98,19 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="oper" label="操作" min-width="130">
|
<el-table-column prop="oper" label="操作" min-width="130">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 18px">复制</el-button>
|
<el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 16px">复制</el-button>
|
||||||
<el-button type="primary" @click="handleDelete(scope.$index)" link style="font-size: 18px">删除</el-button>
|
<el-button type="primary" @click="handleDelete(scope.$index)" link style="font-size: 16px">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<user-picker :multiple="false" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"
|
<user-picker :multiple="false" ref="userPicker" title="请选择研发人员" v-model:value="userList"
|
||||||
|
@ok="selectedResearchPersonnel"
|
||||||
:setNullToSelectList="true" :isResearch="true"/>
|
:setNullToSelectList="true" :isResearch="true"/>
|
||||||
|
|
||||||
<div style="width:100%;text-align: center;padding: 10px">
|
<div style="width:100%;text-align: center;padding: 10px">
|
||||||
<el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button>
|
<el-button type="primary" @click="handleAdd" link style="font-size: 16px">添加一行</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="approval-record">
|
<div class="approval-record">
|
||||||
<div class="approval-title">
|
<div class="approval-title">
|
||||||
@@ -120,11 +121,12 @@
|
|||||||
<div class="base-title">流程图</div>
|
<div class="base-title">流程图</div>
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="changeDiagram"
|
v-model="changeDiagram"
|
||||||
style="--el-switch-on-color:#BEA266 ; --el-switch-off-color:#cecdcd"
|
style="--el-switch-on-color:#BEA266 ; --el-switch-off-color:#cecdcd;margin-top: 1px"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-empty :image-size="100" description="暂无审批记录" v-if="processDiagramViewer&& !opentionData?.operationList&&!changeDiagram"/>
|
<el-empty :image-size="100" description="暂无审批记录"
|
||||||
|
v-if="processDiagramViewer&& !opentionData?.operationList&&!changeDiagram"/>
|
||||||
<div class="process">
|
<div class="process">
|
||||||
<operation-render
|
<operation-render
|
||||||
v-if="processDiagramViewer&& opentionData?.operationList && opentionData?.operationList.length > 0&&!changeDiagram"
|
v-if="processDiagramViewer&& opentionData?.operationList && opentionData?.operationList.length > 0&&!changeDiagram"
|
||||||
@@ -209,7 +211,8 @@ const researchOptions = ref([])
|
|||||||
const showPersonnelPicker = (row, index) => {
|
const showPersonnelPicker = (row, index) => {
|
||||||
currentRow.value = row
|
currentRow.value = row
|
||||||
currentIndex.value = index
|
currentIndex.value = index
|
||||||
if (row.companyName) {
|
console.log('row',row)
|
||||||
|
if (row.companyName&&row.researchPersonnelId) {
|
||||||
let userObj = {
|
let userObj = {
|
||||||
id: row.researchPersonnelId,
|
id: row.researchPersonnelId,
|
||||||
name: row.researchPersonnel,
|
name: row.researchPersonnel,
|
||||||
@@ -224,7 +227,7 @@ const showPersonnelPicker = (row, index) => {
|
|||||||
userPicker.value.showUserPicker()
|
userPicker.value.showUserPicker()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const selected = (select) => {
|
const selectedResearchPersonnel = (select) => {
|
||||||
if (!select || select.length === 0) {
|
if (!select || select.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -236,7 +239,54 @@ const selected = (select) => {
|
|||||||
item.accountType = select[0].accountType
|
item.accountType = select[0].accountType
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
userList.value = select
|
//以下是为" 同一项目下,同一人不能分摊多次 "
|
||||||
|
const projectIdArray = formData.value.tableData.map(item => item.projectId)
|
||||||
|
const researchPersonnelIdArray = formData.value.tableData.map(item => item.researchPersonnelId)
|
||||||
|
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
|
||||||
|
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
|
||||||
|
let repeatProjectName=''
|
||||||
|
for (let projectIdKey in projectNumObj) {
|
||||||
|
// console.log('projectNumObjKey', projectIdKey, projectNumObj[projectIdKey])
|
||||||
|
if(projectNumObj[projectIdKey]>1){
|
||||||
|
// console.log('getProjectName(projectIdKey)',getProjectName(projectIdKey))
|
||||||
|
repeatProjectName=getProjectName(projectIdKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (let researchPersonnelIdKey in researchPersonnelNumObj) {
|
||||||
|
// console.log('researchPersonnelIdKey', researchPersonnelIdKey, researchPersonnelNumObj[researchPersonnelIdKey])
|
||||||
|
if(researchPersonnelNumObj[researchPersonnelIdKey]>1&&repeatProjectName){
|
||||||
|
ElNotification({
|
||||||
|
title: '警告',
|
||||||
|
message: `${repeatProjectName} 项目下,同一个研发人员不能分摊多次!`,
|
||||||
|
type: 'warning',
|
||||||
|
})
|
||||||
|
formData.value.tableData.forEach((item,index)=>{
|
||||||
|
if (index === currentIndex.value) {
|
||||||
|
item.researchPersonnelId = ''
|
||||||
|
item.researchPersonnel = ''
|
||||||
|
item.companyName = ''
|
||||||
|
item.accountType = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
|
||||||
|
userList.value = select
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取一个项目/研发人员的选择次数
|
||||||
|
* @param projectIdArray
|
||||||
|
* @returns {{}}
|
||||||
|
*/
|
||||||
|
const getSelectProjectAndResearchPersonnelNum = (projectIdArray) => {
|
||||||
|
const obj = {};
|
||||||
|
for (let i = 0, l = projectIdArray.length; i < l; i++) {
|
||||||
|
const item = projectIdArray[i];
|
||||||
|
obj[item] = (obj[item] + 1) || 1;
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
}
|
}
|
||||||
const getResearchOptions = async () => {
|
const getResearchOptions = async () => {
|
||||||
const res = await getResearchUser()
|
const res = await getResearchUser()
|
||||||
@@ -249,7 +299,7 @@ const getProjectOptions = async () => {
|
|||||||
const getProjectName = (id) => {
|
const getProjectName = (id) => {
|
||||||
let label = ''
|
let label = ''
|
||||||
nameOptions.value.forEach(item => {
|
nameOptions.value.forEach(item => {
|
||||||
if (item.value === id) {
|
if (item.value == id) {
|
||||||
label = item.label
|
label = item.label
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -276,10 +326,10 @@ const handleCopy = (row) => {
|
|||||||
let copyObj = {
|
let copyObj = {
|
||||||
projectId: row.projectId,
|
projectId: row.projectId,
|
||||||
projectName: '',
|
projectName: '',
|
||||||
accountType: row.accountType,
|
// accountType: row.accountType,
|
||||||
companyName: row.companyName,
|
// companyName: row.companyName,
|
||||||
researchPersonnelId: row.researchPersonnelId,
|
// researchPersonnelId: row.researchPersonnelId,
|
||||||
researchPersonnel: row.researchPersonnel,
|
// researchPersonnel: row.researchPersonnel,
|
||||||
wagesPayable: row.wagesPayable,
|
wagesPayable: row.wagesPayable,
|
||||||
performance: row.performance,
|
performance: row.performance,
|
||||||
reserveFund: row.reserveFund,
|
reserveFund: row.reserveFund,
|
||||||
@@ -294,6 +344,7 @@ const handleDelete = (index) => {
|
|||||||
formData.value.tableData.splice(index, 1)
|
formData.value.tableData.splice(index, 1)
|
||||||
}
|
}
|
||||||
const handleSubmit = (instance) => {
|
const handleSubmit = (instance) => {
|
||||||
|
console.log('tableData', formData.value.tableData)
|
||||||
if (!instance) return
|
if (!instance) return
|
||||||
instance.validate(async (valid) => {
|
instance.validate(async (valid) => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
@@ -326,7 +377,7 @@ const handleSubmit = (instance) => {
|
|||||||
usrAllocations: formData.value.tableData,
|
usrAllocations: formData.value.tableData,
|
||||||
deploymentId: processInstanceData.value.deploymentId,
|
deploymentId: processInstanceData.value.deploymentId,
|
||||||
}
|
}
|
||||||
// console.log('params', params, formData.value.tableData)
|
console.log('params', params, formData.value.tableData)
|
||||||
const {code, msg} = await addAllocation(params)
|
const {code, msg} = await addAllocation(params)
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
|
|||||||
Reference in New Issue
Block a user