[update] 企标更改流程保存没传onEditFile和replaceFileId字段,企标更改流程和制修订流程重新选择企标或计划如果没换不重新获取数据

This commit is contained in:
lideqin
2024-05-28 15:13:29 +08:00
parent 3ee7e177e6
commit 23f7165e94
5 changed files with 259 additions and 242 deletions
@@ -354,7 +354,7 @@ export default {
this.$message.warning(this.$t('pleaseFillInAtLeastOneItem'))
return
}
const baseInfoObj = Object.assign({}, baseInfo.formInline)
const baseInfoObj = Object.assign({}, baseInfo.formInline, { onEditFile: baseInfo.onEditFile, replaceFileId: baseInfo.replaceFileId })
if (baseInfo.dataSource) {
baseInfoObj.list = baseInfo.dataSource
}
@@ -143,7 +143,8 @@ export default {
],
dataSource: [],
loading: false,
onEditFile: ''
onEditFile: '',
replaceFileId: '' // 提交或保存时要传给replaceFileId的,防止保存丢失在这里存一下
}
},
methods: {
@@ -160,6 +161,7 @@ export default {
}
})
this.onEditFile = data.onEditFile
this.replaceFileId = data.replaceFileId
// 给表单赋值
this.$nextTick(() => {
this.$refs.baseInfoForm.initData(data)
@@ -171,6 +173,8 @@ export default {
const data = {}
data.formInline = this.$refs.baseInfoForm.getData()
data.dataSource = this.dataSource
data.onEditFile = this.onEditFile
data.replaceFileId = this.replaceFileId
return data
},
handleTableChange (pagination) {
@@ -707,7 +707,10 @@ export default {
},
// 选完企标编号了,需要回显内容
listChange (value) {
console.log(value)
if (!value[0] || this.formInline.standardId === value[0].id) {
// 说明标准没有换,不更新数据
return
}
this.loading = true
this.isEditSetData = true
this.$emit('listChange', value)
@@ -1,245 +1,247 @@
<template>
<div>
<base-info-form ref="baseInfoForm" :disabled="disabled" @processNameChange="processNameChange" @listChange="listChange"></base-info-form>
<!-- 标准文本 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.standardText')">
{{ $t('workCenter.enStandardRevision.standardText') }}
</span>
</div>
<a-form-model-item class="item-model">
<div class="online-edit-wrapper">
<p>{{ $t('enterpriseStandard') }}</p>
<a-button type="primary" @click="toOnlineEditor">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
</div>
</a-form-model-item>
</div>
<!-- 操作区域 -->
<div v-if="!disabled" class="table-operator">
<!-- 新增 -->
<a-button icon="plus" type="primary" @click="handleAdd" :disabled="disabled">
{{ $t('newlyAdded') }}
</a-button>
</div>
<a-spin :spinning="spinning">
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="uid"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
@change="handleTableChange">
<!-- 修改前 -->
<template v-slot:beforeUpdate="{text, record}">
<a-button type="primary" @click="beforeUpdateClick(record)">{{ $t('workCenter.enStandardChange.lookUpdateBeforeContent') }}</a-button>
</template>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record}" class="action-span-cell">
<a @click="handleEdit(record)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
</div>
</j-table>
</div>
<!-- 修改单需要用的字段 -->
<a-form-model class="update-list-form" :model="formInline" :rules="rules" ref="ruleForm">
<div class="form-flex-box">
<!-- 更改级别代号 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.levelCode')">
{{ $t('workCenter.enStandardChange.levelCode') }}
<base-info-form ref="baseInfoForm" :disabled="disabled" @processNameChange="processNameChange" @listChange="listChange"></base-info-form>
<!-- 标准文本 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.standardText')">
{{ $t('workCenter.enStandardRevision.standardText') }}
</span>
</div>
<a-form-model-item class="item-model" prop="levelCode">
<j-dict-select-tag class="box-input"
dict-code="change_level_code"
v-model="formInline.levelCode"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enStandardChange.levelCode')" />
</a-form-model-item>
</div>
<!-- 有无二维或三维图 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.isHasGraph')">
{{ $t('workCenter.enStandardChange.isHasGraph') }}
</span>
<a-form-model-item class="item-model">
<div class="online-edit-wrapper">
<p>{{ $t('enterpriseStandard') }}</p>
<a-button type="primary" @click="toOnlineEditor">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
</div>
<a-form-model-item class="item-model" prop="has2d3dGraph">
<a-input class="box-input"
v-model="formInline.has2d3dGraph"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.isHasGraph')" />
</a-form-model-item>
</div>
<!-- 顾客确认(适用军品) -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.customerConfirmation')">
{{ $t('workCenter.enStandardChange.customerConfirmation') }}
</span>
</div>
<a-form-model-item class="item-model" prop="customerConfirmation">
<a-input class="box-input"
v-model="formInline.customerConfirmation"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.customerConfirmation')" />
</a-form-model-item>
</div>
<!-- 刷新文件号(三维) -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.refreshFileNumber')">
{{ $t('workCenter.enStandardChange.refreshFileNumber') }}
</span>
</div>
<a-form-model-item class="item-model" prop="refreshFileNumber">
<a-input class="box-input"
v-model="formInline.refreshFileNumber"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.refreshFileNumber')" />
</a-form-model-item>
</div>
<!-- 库存 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.inventory')">
{{ $t('workCenter.enStandardChange.inventory') }}
</span>
</div>
<a-form-model-item class="item-model" prop="inventory">
<a-input class="box-input"
v-model="formInline.inventory"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.inventory')" />
</a-form-model-item>
</div>
<!-- 在制品 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.workInProgress')">
{{ $t('workCenter.enStandardChange.workInProgress') }}
</span>
</div>
<a-form-model-item class="item-model" prop="workInProgress">
<a-input class="box-input"
v-model="formInline.workInProgress"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.workInProgress')" />
</a-form-model-item>
</div>
<!-- 备件 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.spareParts')">
{{ $t('workCenter.enStandardChange.spareParts') }}
</span>
</div>
<a-form-model-item class="item-model" prop="spareParts">
<a-input class="box-input"
v-model="formInline.spareParts"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.spareParts')" />
</a-form-model-item>
</div>
<!-- 关联更改项 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.relatedChanges')">
{{ $t('workCenter.enStandardChange.relatedChanges') }}
</span>
</div>
<a-form-model-item class="item-model" prop="relatedChanges">
<a-input class="box-input"
v-model="formInline.relatedChanges"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.relatedChanges')" />
</a-form-model-item>
</div>
<!-- 更改标记 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.changeTag')">
{{ $t('workCenter.enStandardChange.changeTag') }}
</span>
</div>
<a-form-model-item class="item-model" prop="changeTag">
<a-input class="box-input"
v-model="formInline.changeTag"
:maxLength="50"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.changeTag')" />
</a-form-model-item>
</div>
<!-- 处数 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.treatmentCount')">
{{ $t('workCenter.enStandardChange.treatmentCount') }}
</span>
</div>
<a-form-model-item class="item-model" prop="treatmentCount">
<a-input-number v-model="formInline.treatmentCount"
:min="0"
:max="9999"
precision="0"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.treatmentCount')"
/>
</a-form-model-item>
</div>
<!-- 生效日期 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.effectiveDate')">
{{ $t('workCenter.enStandardChange.effectiveDate') }}
</span>
</div>
<a-form-model-item class="item-model" prop="effectiveDate">
<a-date-picker
v-model="formInline.effectiveDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
</div>
</a-form-model-item>
</div>
</a-form-model>
<update-list-modal ref="updateListModal" @ok="modalFormOk"></update-list-modal>
<!-- 修改前 弹框显示 -->
<text-content-modal ref="textContentModal" />
</div>
<!-- 操作区域 -->
<div v-if="!disabled" class="table-operator">
<!-- 新增 -->
<a-button icon="plus" type="primary" @click="handleAdd" :disabled="disabled">
{{ $t('newlyAdded') }}
</a-button>
</div>
<div>
<j-table
:can-drag="true"
:scroll="{x: '100%'}"
ref="table"
rowKey="uid"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
@change="handleTableChange">
<!-- 修改前 -->
<template v-slot:beforeUpdate="{text, record}">
<a-button type="primary" @click="beforeUpdateClick(record)">{{ $t('workCenter.enStandardChange.lookUpdateBeforeContent') }}</a-button>
</template>
<!-- 操作栏 -->
<div slot="action" slot-scope="{record}" class="action-span-cell">
<a @click="handleEdit(record)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
<a-divider type="vertical" />
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
</div>
</j-table>
</div>
<!-- 修改单需要用的字段 -->
<a-form-model class="update-list-form" :model="formInline" :rules="rules" ref="ruleForm">
<div class="form-flex-box">
<!-- 更改级别代号 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.levelCode')">
{{ $t('workCenter.enStandardChange.levelCode') }}
</span>
</div>
<a-form-model-item class="item-model" prop="levelCode">
<j-dict-select-tag class="box-input"
dict-code="change_level_code"
v-model="formInline.levelCode"
:disabled="disabled"
:placeholder="$t('pleaseSelect')+$t('workCenter.enStandardChange.levelCode')" />
</a-form-model-item>
</div>
<!-- 有无二维或三维图 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.isHasGraph')">
{{ $t('workCenter.enStandardChange.isHasGraph') }}
</span>
</div>
<a-form-model-item class="item-model" prop="has2d3dGraph">
<a-input class="box-input"
v-model="formInline.has2d3dGraph"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.isHasGraph')" />
</a-form-model-item>
</div>
<!-- 顾客确认(适用军品) -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.customerConfirmation')">
{{ $t('workCenter.enStandardChange.customerConfirmation') }}
</span>
</div>
<a-form-model-item class="item-model" prop="customerConfirmation">
<a-input class="box-input"
v-model="formInline.customerConfirmation"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.customerConfirmation')" />
</a-form-model-item>
</div>
<!-- 刷新文件号(三维) -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.refreshFileNumber')">
{{ $t('workCenter.enStandardChange.refreshFileNumber') }}
</span>
</div>
<a-form-model-item class="item-model" prop="refreshFileNumber">
<a-input class="box-input"
v-model="formInline.refreshFileNumber"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.refreshFileNumber')" />
</a-form-model-item>
</div>
<!-- 库存 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.inventory')">
{{ $t('workCenter.enStandardChange.inventory') }}
</span>
</div>
<a-form-model-item class="item-model" prop="inventory">
<a-input class="box-input"
v-model="formInline.inventory"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.inventory')" />
</a-form-model-item>
</div>
<!-- 在制品 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.workInProgress')">
{{ $t('workCenter.enStandardChange.workInProgress') }}
</span>
</div>
<a-form-model-item class="item-model" prop="workInProgress">
<a-input class="box-input"
v-model="formInline.workInProgress"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.workInProgress')" />
</a-form-model-item>
</div>
<!-- 备件 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.spareParts')">
{{ $t('workCenter.enStandardChange.spareParts') }}
</span>
</div>
<a-form-model-item class="item-model" prop="spareParts">
<a-input class="box-input"
v-model="formInline.spareParts"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.spareParts')" />
</a-form-model-item>
</div>
<!-- 关联更改项 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<!--<span class="required">*</span>-->
<span class="title-text-text" :title="$t('workCenter.enStandardChange.relatedChanges')">
{{ $t('workCenter.enStandardChange.relatedChanges') }}
</span>
</div>
<a-form-model-item class="item-model" prop="relatedChanges">
<a-input class="box-input"
v-model="formInline.relatedChanges"
:maxLength="50"
disabled
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.relatedChanges')" />
</a-form-model-item>
</div>
<!-- 更改标记 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.changeTag')">
{{ $t('workCenter.enStandardChange.changeTag') }}
</span>
</div>
<a-form-model-item class="item-model" prop="changeTag">
<a-input class="box-input"
v-model="formInline.changeTag"
:maxLength="50"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.changeTag')" />
</a-form-model-item>
</div>
<!-- 处数 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.treatmentCount')">
{{ $t('workCenter.enStandardChange.treatmentCount') }}
</span>
</div>
<a-form-model-item class="item-model" prop="treatmentCount">
<a-input-number v-model="formInline.treatmentCount"
:min="0"
:max="9999"
:precision="0"
:disabled="disabled"
:placeholder="$t('pleaseEnter')+$t('workCenter.enStandardChange.treatmentCount')"
/>
</a-form-model-item>
</div>
<!-- 生效日期 -->
<div class="box-title-text form-flex-item">
<div class="title-text">
<span class="required">*</span>
<span class="title-text-text" :title="$t('workCenter.enStandardChange.effectiveDate')">
{{ $t('workCenter.enStandardChange.effectiveDate') }}
</span>
</div>
<a-form-model-item class="item-model" prop="effectiveDate">
<a-date-picker
v-model="formInline.effectiveDate"
:showTime="false"
:disabled="disabled"
value-format="YYYY-MM-DD">
</a-date-picker>
</a-form-model-item>
</div>
</div>
</a-form-model>
<update-list-modal ref="updateListModal" @ok="modalFormOk"></update-list-modal>
<!-- 修改前 弹框显示 -->
<text-content-modal ref="textContentModal" />
</div>
</a-spin>
</template>
<script>
@@ -428,12 +430,14 @@ export default {
},
standardCanOnlineEditFile: '', // 标准文件中本身就可以在线预览的文件
replaceFileId: '', // 提交或保存时要传给replaceFileId的
onEditFile: '' // 在线编辑的文件id
onEditFile: '', // 在线编辑的文件id
spinning: false
}
},
methods: {
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
async initData (data) {
this.spinning = true
// 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.list.map(item => {
const uidGenerator = () => {
@@ -477,6 +481,7 @@ export default {
this.$nextTick(() => {
this.$refs.baseInfoForm.initData(data)
this.onEditFile = data.onEditFile || ''
this.spinning = false
})
},
// 获取标准本身的文件
@@ -612,7 +617,7 @@ export default {
const requiredField = ['implementationDate', 'releaseDate', 'standardName', 'standardNumber']
const validateResult = this.$refs.baseInfoForm.validateFormByFields(requiredField)
if (validateResult) {
console.log(this.onEditFile)
console.log('this.onEditFile', this.onEditFile)
this.onEditFile = await onlineEditor(params, this.onEditFile || this.standardCanOnlineEditFile)
// false表示保存后不返回
this.$emit('save', false)
@@ -390,7 +390,8 @@ export default {
innerDisabledField: [], // 不可更改的字段
departSelectRange: [], // 授权部门的可选范围
standardGradeClassification: [], // 企标级别映射数据,用于标准等级分类和授权部门的对应
oldMainDraftingUnit: '' // 上一次的主起草单位
oldMainDraftingUnit: '', // 上一次的主起草单位
espId: '' // 存一下选完计划的企标计划id,方便判断下一次选完企标计划有没有改企标计划
}
},
mounted () {
@@ -399,7 +400,6 @@ export default {
},
methods: {
initData (data) {
console.log(data)
this.isEditSetData = true
if ((this.flowInitType === 'auto' && !data.businessJson) || (this.$route.query.draftId && data.autoStartFlag)) {
// 说明是刚刚自动发起的流程,或者是自动发起的流程强制撤回后的草稿
@@ -626,9 +626,14 @@ export default {
},
// 4、从企标计划选择企标编号的话,把其他字段也回显
listChange (value) {
if (!value[0] || this.espId === value[0].id) {
// 没有换企标计划,不更新数据
return
}
console.log(value)
this.isEditSetData = true
this.loading = true
this.espId = value[0].id
getEnterpriseStandardPlanInfoById({ id: value[0].id }).then(res => {
if (res.success) {
const formInline = {}