[update] 修改企标制修订流程,选择标准组件的企标的标准状态

This commit is contained in:
lideqin
2023-12-28 10:39:02 +08:00
parent 483769629b
commit b418dec7d4
9 changed files with 125 additions and 21 deletions
+1
View File
@@ -180,6 +180,7 @@ module.exports = {
atLeastSelect: '至少选择', atLeastSelect: '至少选择',
personnal: '人', personnal: '人',
pleaseEnterAPositiveInteger: '请输入正整数', pleaseEnterAPositiveInteger: '请输入正整数',
implementationNeedGreaterThan: '实施日期需要至少比发布日期大15天',
// 树右键 // 树右键
treeRight: { treeRight: {
addFolder: '新增文件夹', addFolder: '新增文件夹',
@@ -61,6 +61,14 @@
</a-tooltip> </a-tooltip>
</template> </template>
<!-- 标准状态 -->
<template slot="standardState" slot-scope="text, record">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ record.source === '3' ? (record.esStandardState_dictText || global.emptyLine) : (record.standardState_dictText || global.emptyLine) }}</template>
<div class="table-text">{{ record.source === '3' ? (record.esStandardState_dictText || global.emptyLine) : (record.standardState_dictText || global.emptyLine) }}</div>
</a-tooltip>
</template>
</a-table> </a-table>
</div> </div>
@@ -176,7 +184,8 @@ export default {
title: this.$t('standardSelect.textState'), title: this.$t('standardSelect.textState'),
dataIndex: 'standardState_dictText', dataIndex: 'standardState_dictText',
align: 'center', align: 'center',
width: 150 width: 150,
scopedSlots: { customRender: 'standardState' }
} }
], ],
dataList: [], dataList: [],
@@ -46,6 +46,7 @@
<a-date-picker :placeholder="$t('pleaseSelect') + $t('expirationDate')" <a-date-picker :placeholder="$t('pleaseSelect') + $t('expirationDate')"
v-decorator="['deadline', validatorRules.deadline]" v-decorator="['deadline', validatorRules.deadline]"
value-format="YYYY-MM-DD" value-format="YYYY-MM-DD"
format="YYYY-MM-DD"
:showTime="false" :showTime="false"
style="width: 100%" /> style="width: 100%" />
</a-form-item> </a-form-item>
@@ -130,7 +131,8 @@ export default {
if (this.confirmLoading) return if (this.confirmLoading) return
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
const value = Object.assign({}, values, this.model) console.log(values)
const value = Object.assign({}, this.model, values)
this.confirmLoading = true this.confirmLoading = true
this.$emit('ok', value) this.$emit('ok', value)
this.confirmLoading = false this.confirmLoading = false
@@ -380,6 +380,7 @@ export default {
const formInline = {} const formInline = {}
// 制修订类型 // 制修订类型
formInline.typeOfRevision = res.result.applicationCategory formInline.typeOfRevision = res.result.applicationCategory
formInline.typeOfRevision_dictText = res.result.applicationCategory_dictText
// 企标编号 // 企标编号
formInline.standard_number = res.result.newEnStandardNo formInline.standard_number = res.result.newEnStandardNo
// 企标名称 // 企标名称
@@ -441,18 +442,43 @@ export default {
await this.$refs.ruleForm.validate(valid => { await this.$refs.ruleForm.validate(valid => {
console.log(valid) console.log(valid)
if (valid) { if (valid) {
const formInline = JSON.parse(JSON.stringify(this.formInline)) if (this.formInline.release_date && this.formInline.implementation_date) {
Object.keys(formInline).forEach(res => { // 实施日期需要比发布日期至少大15天
if (formInline[res] instanceof Array) { // 发布日期15天后的日期
if (formInline[res][0] instanceof Object) { const releaseDate = new Date(Date.parse(this.formInline.release_date))
// 说明是树选择 const releaseDateAfter = releaseDate.setDate(releaseDate.getDate() + 15)
formInline[res] = formInline[res].map(item => item.value).join(',') if (new Date(Date.parse(this.formInline.implementation_date)) <= releaseDateAfter) {
} else { // 实施日期小于等于发布日期的15天后
formInline[res] = formInline[res].join(',') this.$message.warning(this.$t('implementationNeedGreaterThan'))
} data = false
} else {
const formInline = JSON.parse(JSON.stringify(this.formInline))
Object.keys(formInline).forEach(res => {
if (formInline[res] instanceof Array) {
if (formInline[res][0] instanceof Object) {
// 说明是树选择
formInline[res] = formInline[res].map(item => item.value).join(',')
} else {
formInline[res] = formInline[res].join(',')
}
}
})
data.formInline = formInline
} }
}) } else {
data.formInline = formInline const formInline = JSON.parse(JSON.stringify(this.formInline))
Object.keys(formInline).forEach(res => {
if (formInline[res] instanceof Array) {
if (formInline[res][0] instanceof Object) {
// 说明是树选择
formInline[res] = formInline[res].map(item => item.value).join(',')
} else {
formInline[res] = formInline[res].join(',')
}
}
})
data.formInline = formInline
}
} else { } else {
data = false data = false
} }
@@ -196,7 +196,10 @@ export default {
console.log(value, index) console.log(value, index)
if (index || index === 0) { if (index || index === 0) {
// 有下标,说明是编辑 // 有下标,说明是编辑
this.dataSource.splice(index, 1, value) this.$set(this.dataSource[index], 'clauseNum', value.clauseNum)
this.$set(this.dataSource[index], 'clauseName', value.clauseName)
this.$set(this.dataSource[index], 'editAdvice', value.editAdvice)
// this.dataSource.splice(index, 1, value)
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
this.dataSource.push(value) this.dataSource.push(value)
@@ -167,7 +167,10 @@ export default {
console.log(value, index) console.log(value, index)
if (index || index === 0) { if (index || index === 0) {
// 有下标,说明是编辑 // 有下标,说明是编辑
this.dataSource.splice(index, 1, value) this.$set(this.dataSource[index], 'clauseNum', value.clauseNum)
this.$set(this.dataSource[index], 'clauseName', value.clauseName)
this.$set(this.dataSource[index], 'editAdvice', value.editAdvice)
// this.dataSource.splice(index, 1, value)
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
this.dataSource.push(value) this.dataSource.push(value)
@@ -115,7 +115,21 @@ export default {
let data = {} let data = {}
await this.$refs.ruleForm.validate(valid => { await this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
data = Object.assign({}, this.formInline) if (this.formInline.releaseDate && this.formInline.implementDate) {
// 实施日期需要比发布日期至少大15天
// 发布日期15天后的日期
const releaseDate = new Date(Date.parse(this.formInline.releaseDate))
const releaseDateAfter = releaseDate.setDate(releaseDate.getDate() + 15)
if (new Date(Date.parse(this.formInline.implementDate)) <= releaseDateAfter) {
// 实施日期小于等于发布日期的15天后
this.$message.warning(this.$t('implementationNeedGreaterThan'))
data = false
} else {
data = Object.assign({}, this.formInline)
}
} else {
data = Object.assign({}, this.formInline)
}
} else { } else {
data = false data = false
} }
@@ -151,7 +151,8 @@ export default {
}, },
// 编辑 // 编辑
handleEdit (record, index) { handleEdit (record, index) {
this.modalType = 'edit' + index console.log(index)
this.modalType = 'edit' + '-' + index
this.$refs.addEditDrafterDrawer.edit(record) this.$refs.addEditDrafterDrawer.edit(record)
}, },
// 删除 // 删除
@@ -162,8 +163,9 @@ export default {
modalFormOk (value) { modalFormOk (value) {
if (this.modalType === 'add') { if (this.modalType === 'add') {
this.dataSource.push(value) this.dataSource.push(value)
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') { } else if (this.modalType && this.modalType.split('-')[0] === 'edit') {
this.dataSource.splice(Number(this.modalType.split(',')[1]), 1, value) console.log(Number(this.modalType.split('-')[1]), value)
this.dataSource.splice(Number(this.modalType.split('-')[1]), 1, value)
} }
} }
} }
@@ -32,7 +32,7 @@
</div> </div>
<a-form-model-item class="item-model" prop="authDept"> <a-form-model-item class="item-model" prop="authDept">
<j-select-depart v-model="formInline.authDept" <j-select-depart v-model="formInline.authDept"
:disabled="disabled" :disabled="disabled || authDeptDisabled"
:multi="true" :multi="true"
:backDepart="true" /> :backDepart="true" />
</a-form-model-item> </a-form-model-item>
@@ -172,6 +172,8 @@
import BaseInfoForm from './BaseInfoForm' import BaseInfoForm from './BaseInfoForm'
import UserSelection from '@/components/selection/UserSelection' import UserSelection from '@/components/selection/UserSelection'
import UploadFile from '@/components/UploadFile' import UploadFile from '@/components/UploadFile'
import { StandardGradeClassify } from '@/enums/commonEnums'
import { getStandardGradeClassification } from '../../../../api/enterpriseStandardLibraryApi'
export default { export default {
name: 'MainDrafterUploadMinuteBaseInfo', name: 'MainDrafterUploadMinuteBaseInfo',
@@ -251,14 +253,48 @@ export default {
trigger: 'change' trigger: 'change'
} }
] ]
} },
authDeptDisabled: false, // 授权部门不可编辑
departSelectRange: [], // 授权部门的可选项
standardGradeClassification: [] // 企标级别映射数据
} }
}, },
mounted () {
this.getStandardGradeClassificationArr()
},
methods: { methods: {
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了 // 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
initData (data) { initData (data) {
// 给表单赋值,在线编辑不知道要怎么赋值? // 给表单赋值,在线编辑不知道要怎么赋值?
this.formInline = Object.assign({}, data) this.formInline = Object.assign({}, data)
// 设置授权部门是否可更改和可选范围
// 基础信息中的标准等级分类
const gradeClassification = JSON.parse(data.businessJson).grade_classification
// 基础信息中的授权部门
const authDept = JSON.parse(data.businessJson).auth_dept
if (gradeClassification === StandardGradeClassify.ZERO_LEVEL.value) {
// 选的是0级,授权部门带出发起时填写的数据不可编辑
this.formInline.authDept = authDept
this.authDeptDisabled = true
} else if (gradeClassification === StandardGradeClassify.ONE_LEVEL.value) {
// 选的是1级,授权部门带出发起时填写的数据
this.formInline.authDept = authDept
// 设置可选择项
this.departSelectRange = this.standardGradeClassification.find(item => item.level + '' === '1').deptIds.split(',')
// 设置授权部门可编辑
this.authDeptDisabled = false
} else if (gradeClassification === StandardGradeClassify.TWO_LEVEL.value) {
// 选的是2级,授权部门带出发起时填写的数据
this.formInline.authDept = authDept
// 设置可选择项
this.departSelectRange = this.standardGradeClassification.find(item => item.level + '' === '2').deptIds.split(',')
// 设置授权部门可编辑
this.authDeptDisabled = false
} else if (gradeClassification === StandardGradeClassify.THREE_LEVEL.value) {
// 选的是3级,授权部门带出发起时填写的数据,不可编辑
this.formInline.authDept = authDept
this.authDeptDisabled = true
}
// 给表单赋值 // 给表单赋值
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.baseInfoForm.initData(data) this.$refs.baseInfoForm.initData(data)
@@ -282,6 +318,14 @@ export default {
}) })
return data return data
}, },
// 获取企标级别映射数据
getStandardGradeClassificationArr () {
getStandardGradeClassification().then(res => {
if (res.success) {
this.standardGradeClassification = res.result
}
})
},
// 点击文件上传 // 点击文件上传
clickButtonToUpload (fieldName) { clickButtonToUpload (fieldName) {
this.$refs.uploadFile.open(this.formInline[fieldName]) this.$refs.uploadFile.open(this.formInline[fieldName])