[update] 生成随机数方法改成使用util中的randomUUID

This commit is contained in:
lideqin
2024-10-10 18:40:34 +08:00
parent a7fa156ca8
commit cada6fbdda
14 changed files with 43 additions and 105 deletions
@@ -83,6 +83,7 @@ import store from '@/store'
import JTable from '@/components/jero/JTable' import JTable from '@/components/jero/JTable'
import ContactEnterSendTaskModal from './ContactEnterSendTaskModal' import ContactEnterSendTaskModal from './ContactEnterSendTaskModal'
import { downloadFile } from '@/api/manage' import { downloadFile } from '@/api/manage'
import { randomUUID } from '../../../../utils/util'
// 导入的加载提示 // 导入的加载提示
let importModalLoading let importModalLoading
@@ -322,11 +323,8 @@ export default {
// 给表格赋值 // 给表格赋值
if (data && data.dataList) { if (data && data.dataList) {
this.dataSource = data.dataList.map(item => { this.dataSource = data.dataList.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -376,10 +374,7 @@ export default {
modelFormOk (value) { modelFormOk (value) {
console.log(value, this.modalType) console.log(value, this.modalType)
if (this.modalType === 'add') { if (this.modalType === 'add') {
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') { } else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1]) const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
@@ -437,11 +432,8 @@ export default {
} }
// 推入表格中 // 推入表格中
this.dataSource = info.file.response.result.map(item => { this.dataSource = info.file.response.result.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -78,6 +78,7 @@ import { downloadFile } from '@/api/manage'
import UserSelectByContact from '@/components/selection/UserSelectByContact' import UserSelectByContact from '@/components/selection/UserSelectByContact'
import UserSelectByContactModal from '@/components/selection/UserSelectByContactModal' import UserSelectByContactModal from '@/components/selection/UserSelectByContactModal'
import BaseInfoTableModal from './BaseInfoTableModal' import BaseInfoTableModal from './BaseInfoTableModal'
import { randomUUID } from '../../../../utils/util'
// 导入的加载提示 // 导入的加载提示
let importModalLoading let importModalLoading
@@ -310,11 +311,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值 // 给表格赋值
this.dataSource = data.map(item => { this.dataSource = data.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -383,10 +381,7 @@ export default {
modelFormOk (value) { modelFormOk (value) {
console.log(value, this.modalType) console.log(value, this.modalType)
if (this.modalType === 'add') { if (this.modalType === 'add') {
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') { } else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1]) const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
@@ -444,11 +439,8 @@ export default {
} }
// 推入表格中 // 推入表格中
this.dataSource = info.file.response.result.map(item => { this.dataSource = info.file.response.result.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -50,6 +50,7 @@ import { kkFilePreview } from '@/utils/kkFilePreview'
import { queryFileInfoByEditId } from '../../../../api/workCenter' import { queryFileInfoByEditId } from '../../../../api/workCenter'
import { Base64 } from 'js-base64' import { Base64 } from 'js-base64'
import { onlineEditorView } from '../../../../utils/onlyOfficeUtils' import { onlineEditorView } from '../../../../utils/onlyOfficeUtils'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'ApproveBaseInfo', name: 'ApproveBaseInfo',
@@ -152,11 +153,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.list.map(item => { this.dataSource = data.list.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -269,6 +269,7 @@ import TextContentModal from '../../../businessSupport/askForAdvice/modules/Text
import { getEnterpriseStandardInfoById } from '../../../../api/enterpriseStandardLibraryApi' import { getEnterpriseStandardInfoById } from '../../../../api/enterpriseStandardLibraryApi'
import { onlineEditor, onlineEditorView } from '../../../../utils/onlyOfficeUtils' import { onlineEditor, onlineEditorView } from '../../../../utils/onlyOfficeUtils'
import { getOnlineFileIdByFileId, getStandardEditFileByNo } from '@/api/workCenter' import { getOnlineFileIdByFileId, getStandardEditFileByNo } from '@/api/workCenter'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'MainDrafterInitBaseInfo', name: 'MainDrafterInitBaseInfo',
@@ -465,11 +466,8 @@ export default {
this.spinning = true this.spinning = true
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.list.map(item => { this.dataSource = data.list.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -624,10 +622,7 @@ export default {
this.dataSource.splice(dataIndex, 1, { ...value, uid: uid }) this.dataSource.splice(dataIndex, 1, { ...value, uid: uid })
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} }
}, },
// 修改前按钮点击 // 修改前按钮点击
@@ -286,6 +286,7 @@ import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types' import { USER_INFO } from '@/store/mutation-types'
import pick from 'lodash.pick' import pick from 'lodash.pick'
import { WorkCenterMixin } from '@/mixins/WorkCenterMixin' import { WorkCenterMixin } from '@/mixins/WorkCenterMixin'
import { randomUUID } from '../../../utils/util'
export default { export default {
name: 'PlanApprovalFlow', name: 'PlanApprovalFlow',
@@ -669,11 +670,8 @@ export default {
// 是完成时间变更或工作终止的变更 // 是完成时间变更或工作终止的变更
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.changeBaseInfo.dataSource = JSON.parse(JSON.stringify(this.model.dataList)).map(item => { this.$refs.changeBaseInfo.dataSource = JSON.parse(JSON.stringify(this.model.dataList)).map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -50,6 +50,7 @@
<script> <script>
import FinishTimeChangeBaseInfoDrawer from './FinishTimeChangeBaseInfoDrawer' import FinishTimeChangeBaseInfoDrawer from './FinishTimeChangeBaseInfoDrawer'
import JTable from '@/components/jero/JTable' import JTable from '@/components/jero/JTable'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'FinishTimeChangeBaseInfo', name: 'FinishTimeChangeBaseInfo',
@@ -213,10 +214,7 @@ export default {
changeBaseInfoDrawerOk (value) { changeBaseInfoDrawerOk (value) {
console.log(value, this.modalType) console.log(value, this.modalType)
if (this.modalType === 'add') { if (this.modalType === 'add') {
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') { } else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1]) const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
@@ -50,6 +50,7 @@
<script> <script>
import JTable from '@/components/jero/JTable' import JTable from '@/components/jero/JTable'
import JobEndBaseInfoDrawer from './JobEndBaseInfoDrawer' import JobEndBaseInfoDrawer from './JobEndBaseInfoDrawer'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'JobEndBaseInfo', name: 'JobEndBaseInfo',
components: { JobEndBaseInfoDrawer, JTable }, components: { JobEndBaseInfoDrawer, JTable },
@@ -170,10 +171,7 @@ export default {
jobEndBaseInfoDrawerOk (value) { jobEndBaseInfoDrawerOk (value) {
console.log(value, this.modalType) console.log(value, this.modalType)
if (this.modalType === 'add') { if (this.modalType === 'add') {
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') { } else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1]) const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
@@ -83,6 +83,7 @@ import { kkFilePreview } from '@/utils/kkFilePreview'
import { ACCESS_TOKEN } from '@/store/mutation-types' import { ACCESS_TOKEN } from '@/store/mutation-types'
import { queryFileInfoByEditId } from '../../../../api/workCenter' import { queryFileInfoByEditId } from '../../../../api/workCenter'
import { Base64 } from 'js-base64' import { Base64 } from 'js-base64'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'CommentObjectEnterBaseInfo', name: 'CommentObjectEnterBaseInfo',
@@ -178,11 +179,8 @@ export default {
} }
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.advices.map(item => { this.dataSource = data.advices.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -255,10 +253,7 @@ export default {
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} }
}, },
// 在线编辑的查看 // 在线编辑的查看
@@ -104,6 +104,7 @@ import JTable from '@/components/jero/JTable'
import CommentModal from './CommentModal' import CommentModal from './CommentModal'
import UserSelection from '@/components/selection/UserSelection' import UserSelection from '@/components/selection/UserSelection'
import { HaveNoOpinion } from '../../../../enums/commonEnums' import { HaveNoOpinion } from '../../../../enums/commonEnums'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'DepartLiaisonCollectBaseInfo', name: 'DepartLiaisonCollectBaseInfo',
@@ -205,11 +206,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.advices.map(item => { this.dataSource = data.advices.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -311,14 +309,11 @@ export default {
// this.dataSource.splice(index, 1, value) // this.dataSource.splice(index, 1, value)
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
if (!this.queryParam.haveNoOpinion || this.queryParam.haveNoOpinion === HaveNoOpinion.HAVE.value) { if (!this.queryParam.haveNoOpinion || this.queryParam.haveNoOpinion === HaveNoOpinion.HAVE.value) {
// 有意见或者没有筛选项的时候dataSource才增加 // 有意见或者没有筛选项的时候dataSource才增加
this.dataSource.push({ uid: uidGenerator(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value }) this.dataSource.push({ uid: randomUUID(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value })
} }
this.dataList.push({ uid: uidGenerator(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value }) this.dataList.push({ uid: randomUUID(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value })
} }
}, },
// 选择用户得到用户名 // 选择用户得到用户名
@@ -79,6 +79,7 @@ import BaseInfoForm from './BaseInfoForm'
import JTable from '@/components/jero/JTable' import JTable from '@/components/jero/JTable'
import CommentModal from './CommentModal' import CommentModal from './CommentModal'
import { HaveNoOpinion } from '../../../../enums/commonEnums' import { HaveNoOpinion } from '../../../../enums/commonEnums'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'DepartLiaisonLeaderApproveBaseInfo', name: 'DepartLiaisonLeaderApproveBaseInfo',
@@ -169,11 +170,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.advices.map(item => { this.dataSource = data.advices.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })
@@ -268,14 +266,11 @@ export default {
// this.dataSource.splice(index, 1, value) // this.dataSource.splice(index, 1, value)
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
if (!this.queryParam.haveNoOpinion || this.queryParam.haveNoOpinion === HaveNoOpinion.HAVE.value) { if (!this.queryParam.haveNoOpinion || this.queryParam.haveNoOpinion === HaveNoOpinion.HAVE.value) {
// 有意见或者没有筛选项的时候dataSource才增加 // 有意见或者没有筛选项的时候dataSource才增加
this.dataSource.push({ uid: uidGenerator(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value }) this.dataSource.push({ uid: randomUUID(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value })
} }
this.dataList.push({ uid: uidGenerator(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value }) this.dataList.push({ uid: randomUUID(), ...value, haveNoOpinion: HaveNoOpinion.HAVE.value })
} }
}, },
// 在线编辑的查看 // 在线编辑的查看
@@ -90,6 +90,7 @@ import { onlineEditor } from '../../../../utils/onlyOfficeUtils'
import { getStandardEditFileByNo } from '../../../../api/workCenter' import { getStandardEditFileByNo } from '../../../../api/workCenter'
import { ProjectType, HaveNoOpinion } from '../../../../enums/commonEnums' import { ProjectType, HaveNoOpinion } from '../../../../enums/commonEnums'
import BatchSetHandleAdviceModal from './BatchSetHandleAdviceModal' import BatchSetHandleAdviceModal from './BatchSetHandleAdviceModal'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'MainDrafterCollectBaseInfo', name: 'MainDrafterCollectBaseInfo',
@@ -224,11 +225,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.advices.map(item => { this.dataSource = data.advices.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item, ...item,
handleAdvice: item.handleAdvice ? item.handleAdvice : undefined handleAdvice: item.handleAdvice ? item.handleAdvice : undefined
} }
@@ -376,14 +374,11 @@ export default {
// 没有下标, 是新增 // 没有下标, 是新增
const currentUser = Vue.ls.get(USER_INFO) const currentUser = Vue.ls.get(USER_INFO)
const currentUserId = currentUser.realname + '(' + currentUser.username + ')' const currentUserId = currentUser.realname + '(' + currentUser.username + ')'
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
if (!this.queryParam.haveNoOpinion || this.queryParam.haveNoOpinion === HaveNoOpinion.HAVE.value) { if (!this.queryParam.haveNoOpinion || this.queryParam.haveNoOpinion === HaveNoOpinion.HAVE.value) {
// 有意见或者没有筛选项的时候dataSource才增加 // 有意见或者没有筛选项的时候dataSource才增加
this.dataSource.push({ ...value, createUserId_dictText: currentUserId, uid: uidGenerator(), haveNoOpinion: HaveNoOpinion.HAVE.value }) this.dataSource.push({ ...value, createUserId_dictText: currentUserId, uid: randomUUID(), haveNoOpinion: HaveNoOpinion.HAVE.value })
} }
this.dataList.push({ ...value, createUserId_dictText: currentUserId, uid: uidGenerator(), haveNoOpinion: HaveNoOpinion.HAVE.value }) this.dataList.push({ ...value, createUserId_dictText: currentUserId, uid: randomUUID(), haveNoOpinion: HaveNoOpinion.HAVE.value })
} }
}, },
/** /**
@@ -182,6 +182,7 @@ import { onlineEditor } from '../../../../utils/onlyOfficeUtils'
import CheckContentProcessModal from './CheckContentProcessModal' import CheckContentProcessModal from './CheckContentProcessModal'
import { getStandardEditFileByNo } from '../../../../api/workCenter' import { getStandardEditFileByNo } from '../../../../api/workCenter'
import { ProjectType } from '../../../../enums/commonEnums' import { ProjectType } from '../../../../enums/commonEnums'
import { randomUUID } from '../../../../utils/util'
// 支持预览的文件后缀 // 支持预览的文件后缀
const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx'] const CAN_PREVIEW_FILE_SUFFIX = ['jpg', 'jpeg', 'png', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx']
@@ -347,18 +348,15 @@ export default {
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了 // 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
initData (data) { initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.drafterDataSource = data.otherDraftUserVOS && data.otherDraftUserVOS.length > 0 ? data.otherDraftUserVOS.map(item => { this.drafterDataSource = data.otherDraftUserVOS && data.otherDraftUserVOS.length > 0 ? data.otherDraftUserVOS.map(item => {
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) : [] }) : []
this.dataSource = data.inspectContents && data.inspectContents.length > 0 ? data.inspectContents.map(item => { this.dataSource = data.inspectContents && data.inspectContents.length > 0 ? data.inspectContents.map(item => {
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) : [] }) : []
@@ -522,10 +520,7 @@ export default {
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
} else { } else {
// 没有下标, 是新增 // 没有下标, 是新增
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} }
}, },
/** /**
@@ -60,6 +60,7 @@ import { onlineEditor } from '../../../../utils/onlyOfficeUtils'
import { getEnterpriseStandardInfoById } from '../../../../api/enterpriseStandardLibraryApi' import { getEnterpriseStandardInfoById } from '../../../../api/enterpriseStandardLibraryApi'
import { ProjectType } from '../../../../enums/commonEnums' import { ProjectType } from '../../../../enums/commonEnums'
import { getStandardEditFileByNo } from '../../../../api/workCenter' import { getStandardEditFileByNo } from '../../../../api/workCenter'
import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'MainDrafterSentBaseInfo', name: 'MainDrafterSentBaseInfo',
@@ -134,11 +135,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值,在线编辑不知道要怎么赋值? // 给表格赋值,在线编辑不知道要怎么赋值?
this.dataSource = data.otherDraftUserVOS && data.otherDraftUserVOS.length > 0 ? data.otherDraftUserVOS.map(item => { this.dataSource = data.otherDraftUserVOS && data.otherDraftUserVOS.length > 0 ? data.otherDraftUserVOS.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) : [] }) : []
@@ -223,10 +221,7 @@ export default {
// 新增或编辑完成 // 新增或编辑完成
modalFormOk (value) { modalFormOk (value) {
if (this.modalType === 'add') { if (this.modalType === 'add') {
const uidGenerator = () => { this.dataSource.push({ uid: randomUUID(), ...value })
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
this.dataSource.push({ uid: uidGenerator(), ...value })
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') { } else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1]) const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
this.dataSource.splice(dataIndex, 1, value) this.dataSource.splice(dataIndex, 1, value)
@@ -59,7 +59,7 @@ import BaseInfoForm from './BaseInfoForm'
import UploadFile from '@/components/UploadFile' import UploadFile from '@/components/UploadFile'
import Vue from 'vue' import Vue from 'vue'
import { USER_INFO } from '@/store/mutation-types' import { USER_INFO } from '@/store/mutation-types'
import { onlineEditor } from '../../../../utils/onlyOfficeUtils' import { randomUUID } from '../../../../utils/util'
export default { export default {
name: 'OtherDrafterUploadStandardBaseInfo', name: 'OtherDrafterUploadStandardBaseInfo',
@@ -139,11 +139,8 @@ export default {
initData (data) { initData (data) {
// 给表格赋值 // 给表格赋值
this.dataSource = data.otherDraftUserVOS.map(item => { this.dataSource = data.otherDraftUserVOS.map(item => {
const uidGenerator = () => {
return '-' + parseInt(Math.random() * 10000 + 1, 10)
}
return { return {
uid: uidGenerator(), uid: randomUUID(),
...item ...item
} }
}) })