[update] 市场清单发布流程

This commit is contained in:
lideqin
2024-07-11 11:24:03 +08:00
parent 86e345ddfe
commit 9ea44f5804
6 changed files with 108 additions and 61 deletions
@@ -73,7 +73,8 @@ module.exports = {
historicalVersion: 'Historical version', historicalVersion: 'Historical version',
standardExist: 'The standard already exists', standardExist: 'The standard already exists',
haveStandardExist: 'Some standards already exist', haveStandardExist: 'Some standards already exist',
pleaseSelectAListPublish: 'Please select a list to publish' pleaseSelectAListPublish: 'Please select a list to publish',
pleaseSelectCorrectData: 'Select an unpublished or modified list to publish'
}, },
// 市场清单详情列表字段 // 市场清单详情列表字段
marketListField: { marketListField: {
@@ -74,7 +74,8 @@ module.exports = {
historicalVersion: '历史版本', historicalVersion: '历史版本',
standardExist: '标准已经存在', standardExist: '标准已经存在',
haveStandardExist: '部分标准已存在', haveStandardExist: '部分标准已存在',
pleaseSelectAListPublish: '请选择一个清单进行发布' pleaseSelectAListPublish: '请选择一个清单进行发布',
pleaseSelectCorrectData: '请选择未发布或者修改中的清单进行发布'
}, },
// 市场清单详情列表字段 // 市场清单详情列表字段
marketListField: { marketListField: {
@@ -289,6 +289,11 @@ export default {
this.$message.warning(this.$t('standardRegulationLibrary.marketRegulationsList.pleaseSelectAListPublish')) this.$message.warning(this.$t('standardRegulationLibrary.marketRegulationsList.pleaseSelectAListPublish'))
return return
} }
if (this.selectionRows[0].manifestStatus === ListState.RELEASED.value) {
// 提示请选择未发布或修改中的数据
this.$message.warning(this.$t('standardRegulationLibrary.marketRegulationsList.pleaseSelectCorrectData'))
return
}
// 跳转市场清单发布流程 // 跳转市场清单发布流程
this.$router.push({ this.$router.push({
path: '/workCenter/MarketListReleaseProcess', path: '/workCenter/MarketListReleaseProcess',
@@ -80,10 +80,14 @@
<!-- 国家/地区 --> <!-- 国家/地区 -->
<a-col :span="24"> <a-col :span="24">
<a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('countryRegion')" :colon="formItemColon"> <a-form-item :labelCol="longLabelCol" :wrapperCol="longWrapperCol" :label="$t('countryRegion')" :colon="formItemColon">
<a-input :placeholder="$t('pleaseEnter') + $t('countryRegion')" <s-tree-select v-decorator="['country', validatorRules.country]"
disabled :getPopupContainer="triggerNode=> triggerNode.parentNode"
:maxLength="50" style="width: 100%"
v-decorator="['country', validatorRules.country]" /> :tree-data="countryOptions"
tree-checkable
treeCheckStrictly
disabled
:placeholder="isGetDataAfter ? '' : $t('pleaseSelect')+$t('countryRegion')" />
</a-form-item> </a-form-item>
</a-col> </a-col>
</template> </template>
@@ -93,7 +97,7 @@
<!-- 业务基本信息 --> <!-- 业务基本信息 -->
<div class="process-part-title">{{ $t('basicServiceInformation') }}</div> <div class="process-part-title">{{ $t('basicServiceInformation') }}</div>
<!-- 节点1法规工程师发起 --> <!-- 节点1法规工程师发起 -->
<base-info-form v-if="currentNode === 1" ref="baseInfoRef" :current-node="currentNode" @processNameChange="processNameChange"></base-info-form> <base-info-form v-if="currentNode === 1" ref="baseInfoRef" :current-node="currentNode" @processNameChange="processNameChange" :countryOptions="countryOptions"></base-info-form>
<!-- 节点2会签 --> <!-- 节点2会签 -->
<!-- 节点3高级经理审核 --> <!-- 节点3高级经理审核 -->
<!-- 节点4总监批准 --> <!-- 节点4总监批准 -->
@@ -166,6 +170,8 @@ import {
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
import { marketRegulationDetailPublish } from '../../../api/standardRegulationLibraryApi' import { marketRegulationDetailPublish } from '../../../api/standardRegulationLibraryApi'
import { getDataDraft, processTransfer } from '../../../api/workCenter'
import { getFormDictTreeList } from '../../../api/api'
export default { export default {
name: 'MarketListReleaseProcess', name: 'MarketListReleaseProcess',
@@ -183,6 +189,8 @@ export default {
} }
}, },
mounted () { mounted () {
// 获取国家/地区下拉数据
this.getCountryOption()
// 初始化节点 // 初始化节点
const nodeId = this.$route.query.nodeId const nodeId = this.$route.query.nodeId
if (nodeId) { if (nodeId) {
@@ -300,10 +308,19 @@ export default {
}, },
formInline: {}, formInline: {},
approvalInfoForm: this.$form.createForm(this), // 审批信息表单 approvalInfoForm: this.$form.createForm(this), // 审批信息表单
personnelInfoData: [] personnelInfoData: [],
countryOptions: [] // 国家/地区下拉框
} }
}, },
methods: { methods: {
// 获取国家/地区下拉框数据
getCountryOption () {
getFormDictTreeList({ dictId: '1801130851452059649' }).then(res => {
if (res.success) {
this.countryOptions = res.result
}
})
},
// 根据流程id获取数据并回显 // 根据流程id获取数据并回显
getProcessData (type, param) { getProcessData (type, param) {
this.loading = true this.loading = true
@@ -313,7 +330,7 @@ export default {
func = marketListReleaseGetDataById func = marketListReleaseGetDataById
params = param.taskId params = param.taskId
} else { } else {
func = marketListReleaseGetDataDraft func = getDataDraft
params = param params = param
} }
func(params).then(res => { func(params).then(res => {
@@ -322,27 +339,36 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
if (type === 'todo') { if (type === 'todo') {
// 初始化流程信息 // 初始化流程信息
this.processInfoForm.setFieldsValue(pick(this.model.common, 'processName', 'processDueDate', 'processDescription')) const processInfo = Object.assign({}, this.model.basicProcessInfoDTO)
// 清单编号
processInfo.manifestNo = this.model.businessInfoDTO.manifestNo
// 清单名称
processInfo.manifestName = this.model.businessInfoDTO.manifestName
// 国家/地区
processInfo.country = this.model.businessInfoDTO.country
this.processInfoForm.setFieldsValue(pick(processInfo, 'processName', 'processDueDate', 'processDescription', 'manifestNo', 'manifestName', 'country'))
} }
// 有草稿json按草稿进来的回显 // 有草稿json按草稿进来的回显
if (this.model.infoJsonStr) { if (this.model.infoJsonStr) {
this.draftModel = JSON.parse(this.model.infoJsonStr)
// 初始化流程信息 // 初始化流程信息
const prcObj = Object.assign({}, this.model) const processInfo = Object.assign({}, this.draftModel.basicProcessInfoDTO)
prcObj.processDueDate = this.model.processDueDate // 清单编号
prcObj.processDescription = this.model.processDescription processInfo.manifestNo = this.draftModel.businessInfoDTO.manifestNo
this.processInfoForm.setFieldsValue(pick(prcObj, 'processName', 'processDueDate', 'processDescription')) // 清单名称
processInfo.manifestName = this.draftModel.businessInfoDTO.manifestName
// 国家/地区
processInfo.country = this.draftModel.businessInfoDTO.country
this.processInfoForm.setFieldsValue(pick(processInfo, 'processName', 'processDueDate', 'processDescription', 'manifestNo', 'manifestName', 'country'))
// 初始化流程审批信息 // 初始化流程审批信息
prcObj.handleText = this.model.handleText this.approvalInfoForm.setFieldsValue(pick(this.draftModel.basicTaskInfoDTO, 'handleText', 'handleFile'))
prcObj.handleFile = this.model.handleFile
this.approvalInfoForm.setFieldsValue(pick(prcObj, 'handleText', 'handleFile'))
this.model.data = JSON.parse(this.model.infoJsonStr).data
// 如果是节点1的保存回显人员信息 // 如果是节点1的保存回显人员信息
if (this.currentNode === 1) { if (this.currentNode === 1) {
this.draftInitPersonInfo(JSON.parse(this.model.infoJsonStr).personnelObj) this.draftInitPersonInfo(this.draftModel.userInfoMap)
} }
} }
if (this.$refs.baseInfoRef) { if (this.$refs.baseInfoRef) {
this.$refs.baseInfoRef.initData(this.model.data) this.$refs.baseInfoRef.initData(this.draftModel.businessInfoDTO || this.model.businessInfoDTO)
} }
}) })
// 初始化业务基本信息中组件内容 // 初始化业务基本信息中组件内容
@@ -378,6 +404,7 @@ export default {
const personnelObj = this.$refs.personnelInfo.getDataObj() const personnelObj = this.$refs.personnelInfo.getDataObj()
// 业务基本信息 // 业务基本信息
const baseInfo = this.$refs.baseInfoRef.getData() const baseInfo = this.$refs.baseInfoRef.getData()
// 判断是否每一项都没填
const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj } const param = { ...processInfoForm, ...baseInfo.formInline, ...approvalInfoForm, ...personnelObj }
const flag = Object.values(param).some(v => !!v || v === 0) const flag = Object.values(param).some(v => !!v || v === 0)
if (!flag) { if (!flag) {
@@ -393,15 +420,16 @@ export default {
// 流程审批信息 // 流程审批信息
paramObj.basicTaskInfoDTO = Object.assign({}, approvalInfoForm) paramObj.basicTaskInfoDTO = Object.assign({}, approvalInfoForm)
paramObj.basicTaskInfoDTO.taskId = this.$route.query.taskId paramObj.basicTaskInfoDTO.taskId = this.$route.query.taskId
// 业务信息
paramObj.businessInfoDTO = baseInfo
// 人员信息
paramObj.userInfoMap = personnelObj
// 草稿id // 草稿id
if (this.model.infoJsonStr) { if (this.model.infoJsonStr) {
paramObj.draftId = this.model.id paramObj.draftId = this.model.id
} }
// 业务基本信息和人员信息 // 草稿JSON
paramObj.infoJsonStr = JSON.stringify({ paramObj.infoJsonStr = JSON.stringify(paramObj)
data: baseInfo.formInline,
personnelObj: personnelObj
})
this.loading = true this.loading = true
// 保存到草稿 // 保存到草稿
marketListReleaseSave(paramObj).then(res => { marketListReleaseSave(paramObj).then(res => {
@@ -416,13 +444,13 @@ export default {
}, },
// 节点一时候的提交 // 节点一时候的提交
handleStart () { handleStart () {
marketRegulationDetailPublish({id: this.$route.query.marketRegulationId}).then(res => { // marketRegulationDetailPublish({id: this.$route.query.marketRegulationId}).then(res => {
if (res.success) { // if (res.success) {
this.$message.success(res.message) // this.$message.success(res.message)
} else { // } else {
this.$message.warning(res.message) // this.$message.warning(res.message)
} // }
}) // })
if (this.loading) return if (this.loading) return
// 流程信息的校验 // 流程信息的校验
this.processInfoForm.validateFields((err, values) => { this.processInfoForm.validateFields((err, values) => {
@@ -457,7 +485,7 @@ export default {
if (this.$route.query.taskId) { if (this.$route.query.taskId) {
// 有taskId说明是驳回的提交 // 有taskId说明是驳回的提交
func = marketListReleaseAgree func = marketListReleaseAgree
paramObj.common.taskId = this.$route.query.taskId paramObj.basicTaskInfoDTO.taskId = this.$route.query.taskId
} else { } else {
func = marketListReleaseApproval func = marketListReleaseApproval
} }
@@ -490,7 +518,7 @@ export default {
const param = Object.assign({}, values) const param = Object.assign({}, values)
param.userId = userIds param.userId = userIds
param.taskId = this.$route.query.taskId param.taskId = this.$route.query.taskId
marketListReleaseTurnTo(param).then(res => { processTransfer(param).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
this.goBack() this.goBack()
@@ -513,8 +541,8 @@ export default {
if (!err) { if (!err) {
this.loading = true this.loading = true
const param = {} const param = {}
param.common = Object.assign({}, values) param.basicTaskInfoDTO = Object.assign({}, values)
param.common.taskId = this.$route.query.taskId param.basicTaskInfoDTO.taskId = this.$route.query.taskId
marketListReleaseAgree(param).then(res => { marketListReleaseAgree(param).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
@@ -540,8 +568,8 @@ export default {
if (!err) { if (!err) {
this.loading = true this.loading = true
const param = {} const param = {}
param.common = Object.assign({}, values) param.basicTaskInfoDTO = Object.assign({}, values)
param.common.taskId = this.$route.query.taskId param.basicTaskInfoDTO.taskId = this.$route.query.taskId
marketListReleaseReject(param).then(res => { marketListReleaseReject(param).then(res => {
if (res.success) { if (res.success) {
this.$message.success(res.message) this.$message.success(res.message)
@@ -10,12 +10,12 @@
{{ $t('listNumber') }} {{ $t('listNumber') }}
</span> </span>
</div> </div>
<a-form-model-item class="item-model" prop="listId"> <a-form-model-item class="item-model" prop="manifestId">
<market-regulations-list-selection type="radio" <market-regulations-list-selection type="radio"
selectOnly selectOnly
:name-str="formInline.manifestNo" :name-str="formInline.manifestNo"
:placeholder="$t('pleaseSelect') + $t('listNumber')" :placeholder="$t('pleaseSelect') + $t('listNumber')"
v-model="formInline.listId" /> v-model="formInline.manifestId" />
</a-form-model-item> </a-form-model-item>
</div> </div>
<!-- 清单名称 --> <!-- 清单名称 -->
@@ -106,12 +106,10 @@
import MarketRegulationsListSelection from '@/components/selection/MarketRegulationsListSelection' import MarketRegulationsListSelection from '@/components/selection/MarketRegulationsListSelection'
import UserSelection from '@/components/selection/UserSelection' import UserSelection from '@/components/selection/UserSelection'
import JTable from '@/components/jero/JTable' import JTable from '@/components/jero/JTable'
import { StandardSource } from '../../../../enums/commonEnums'
import { import {
getMarketRegulationListById, getMarketRegulationListById,
marketRegulationDetailListById marketRegulationDetailListById
} from '@/api/standardRegulationLibraryApi' } from '@/api/standardRegulationLibraryApi'
import { getFormDictTreeList } from '../../../../api/api'
import STreeSelect from '@/components/STreeSelect' import STreeSelect from '@/components/STreeSelect'
export default { export default {
@@ -127,6 +125,13 @@ export default {
type: Number, type: Number,
required: false, required: false,
default: 1 default: 1
},
countryOptions: {
type: Array,
required: false,
default: () => {
return []
}
} }
}, },
data () { data () {
@@ -136,7 +141,7 @@ export default {
userFormInline: {}, userFormInline: {},
rules: { rules: {
// 清单编号 // 清单编号
listId: [ manifestId: [
{ {
required: true, required: true,
message: this.$t('listNumber') + this.$t('cannotEmpty'), message: this.$t('listNumber') + this.$t('cannotEmpty'),
@@ -297,22 +302,10 @@ export default {
showSizeChanger: true, showSizeChanger: true,
total: 0 total: 0
}, },
countryOptions: [], // 国家/地区下拉框
isGetDataAfter: false // 是否获取完数据了,获取完数据有的字段不显示placeholder isGetDataAfter: false // 是否获取完数据了,获取完数据有的字段不显示placeholder
} }
}, },
mounted () {
this.getCountryOption()
},
methods: { methods: {
// 获取国家/地区下拉框数据
getCountryOption () {
getFormDictTreeList({ dictId: '1801130851452059649' }).then(res => {
if (res.success) {
this.countryOptions = res.result
}
})
},
// 从市场法规清单 // 从市场法规清单
setFormById (marketRegulationId) { setFormById (marketRegulationId) {
this.loading = true this.loading = true
@@ -324,7 +317,7 @@ export default {
const result = Object.assign({}, res.result.manifest) const result = Object.assign({}, res.result.manifest)
const formInline = {} const formInline = {}
// 清单编号id // 清单编号id
formInline.listId = result.id formInline.manifestId = result.id
// 清单编号 // 清单编号
formInline.manifestNo = result.manifestNo formInline.manifestNo = result.manifestNo
// 清单名称 // 清单名称
@@ -344,12 +337,20 @@ export default {
} }
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
this.$emit('processNameChange', (this.formInline.manifestName || '') + '-' + (this.formInline.manifestVersion || '') + '-' + '发布') let manifestVersion = ''
if (this.formInline.manifestVersion) {
console.log('this.formInline.manifestVersion', this.formInline.manifestVersion)
manifestVersion = this.getStringBetween(this.formInline.manifestVersion, 'V', '.')
console.log('-----manifestVersion1', manifestVersion)
manifestVersion = 'V' + (Number(manifestVersion) + 1) + '.0'
console.log('-----manifestVersion2', manifestVersion)
}
this.$emit('processNameChange', (this.formInline.manifestName || '') + '-' + (manifestVersion || 'V1.0') + '-' + '发布')
}) })
} }
}) })
}, },
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了 // 拿到外面传进来的businessInfoDTO
initData (data) { initData (data) {
// 给表单赋值 // 给表单赋值
this.formInline = Object.assign({}, data) this.formInline = Object.assign({}, data)
@@ -403,7 +404,7 @@ export default {
const result = Object.assign({}, res.result.manifest) const result = Object.assign({}, res.result.manifest)
const formInline = {} const formInline = {}
// 清单编号id // 清单编号id
formInline.listId = result.id formInline.manifestId = result.id
// 清单编号 // 清单编号
formInline.manifestNo = result.manifestNo formInline.manifestNo = result.manifestNo
// 清单名称 // 清单名称
@@ -423,12 +424,24 @@ export default {
} }
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false
this.$emit('processNameChange', (this.formInline.manifestName || '') + '-' + (this.formInline.manifestVersion || '') + '-' + '发布') let manifestVersion = ''
if (this.formInline.manifestVersion) {
manifestVersion = this.getStringBetween(this.formInline.manifestVersion, 'V', '.')
manifestVersion = 'V' + (Number(manifestVersion) + 1) + '.0'
}
this.$emit('processNameChange', (this.formInline.manifestName || '') + '-' + (manifestVersion || 'V1.0') + '-' + '发布')
}) })
} }
}) })
} }
}, },
// 截取某两个字符之间的字符串
getStringBetween (text, start, end) {
const startIndex = text.indexOf(start)
const endIndex = text.indexOf(end)
const str = text.slice(startIndex + 1, endIndex)
return str || ''
},
handleTableChange (pagination, filters, sorter) { handleTableChange (pagination, filters, sorter) {
this.ipagination = pagination this.ipagination = pagination
}, },
@@ -295,7 +295,6 @@ export default {
// 有草稿json按草稿进来的回显 // 有草稿json按草稿进来的回显
if (this.model.infoJsonStr) { if (this.model.infoJsonStr) {
this.draftModel = JSON.parse(this.model.infoJsonStr) this.draftModel = JSON.parse(this.model.infoJsonStr)
console.log('=========draftModel', this.draftModel)
// 初始化流程信息 // 初始化流程信息
this.processInfoForm.setFieldsValue(pick(this.draftModel.basicProcessInfoDTO, 'processName', 'processDueDate', 'processDescription')) this.processInfoForm.setFieldsValue(pick(this.draftModel.basicProcessInfoDTO, 'processName', 'processDueDate', 'processDescription'))
// 初始化流程审批信息 // 初始化流程审批信息