[update] 修改bug80447
This commit is contained in:
+43
-22
@@ -29,7 +29,7 @@
|
||||
:can-drag="true"
|
||||
:scroll="{x: '100%'}"
|
||||
ref="table"
|
||||
:rowKey="(record, index) => { return (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index }"
|
||||
rowKey="uid"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="ipagination"
|
||||
@@ -47,10 +47,10 @@
|
||||
</template>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
|
||||
<div slot="action" slot-scope="{record}" class="action-span-cell">
|
||||
<a @click="handleEdit(record)" class="table-ope-btn">{{ $t('edit') }}</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="handleDelete(record.id, index)" class="table-ope-btn">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -256,7 +256,7 @@ export default {
|
||||
// 不是被驳回的待办,可以设置联络人
|
||||
return <user-select-by-contact v-model={row.contactUser}
|
||||
nameStr={row.contactUser_dictText} showBtn={false}
|
||||
filedName={(Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index}
|
||||
filedName={row.uid}
|
||||
onNameChange={this.lineNameChange}
|
||||
disabled={this.disabled} type={'radio'} placeholder={this.$t('pleaseSelect')} />
|
||||
}
|
||||
@@ -303,7 +303,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值
|
||||
this.dataSource = data
|
||||
this.dataSource = data.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
},
|
||||
// 外层要获取数据
|
||||
getData () {
|
||||
@@ -346,8 +354,9 @@ export default {
|
||||
})
|
||||
},
|
||||
// 行内联络人变化的回调
|
||||
lineNameChange (value, fieldName) {
|
||||
this.dataSource[fieldName].contactUser_dictText = value
|
||||
lineNameChange (value, uid) {
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.dataSource[dataIndex].contactUser_dictText = value
|
||||
},
|
||||
handleTableChange (pagination) {
|
||||
this.ipagination = pagination
|
||||
@@ -368,9 +377,13 @@ export default {
|
||||
modelFormOk (value) {
|
||||
console.log(value, this.modalType)
|
||||
if (this.modalType === 'add') {
|
||||
this.dataSource.push(value)
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.dataSource.push({ uid: uidGenerator(), ...value })
|
||||
} else if (this.modalType && this.modalType.split(',')[0] === 'edit') {
|
||||
this.dataSource.splice(Number(this.modalType.split(',')[1]), 1, value)
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
|
||||
this.dataSource.splice(dataIndex, 1, value)
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
@@ -423,7 +436,15 @@ export default {
|
||||
this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
|
||||
}
|
||||
// 推入表格中
|
||||
this.dataSource = info.file.response.result
|
||||
this.dataSource = info.file.response.result.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (Array.isArray(info.file.response.result) && info.file.response.result.length > 0) {
|
||||
this.messageLineFeed(this.$t('fileImportError'), info.file.response.result)
|
||||
@@ -458,9 +479,8 @@ export default {
|
||||
}
|
||||
},
|
||||
// 编辑
|
||||
handleEdit (record, index) {
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.modalType = 'edit' + ',' + dataIndex
|
||||
handleEdit (record) {
|
||||
this.modalType = 'edit' + ',' + record.uid
|
||||
this.$refs.baseInfoTableModal.edit(record)
|
||||
},
|
||||
// 查看
|
||||
@@ -468,12 +488,12 @@ export default {
|
||||
this.$refs.baseInfoTableModal.look(record)
|
||||
},
|
||||
// 删除
|
||||
handleDelete (id, index) {
|
||||
handleDelete (uid) {
|
||||
this.$confirm({
|
||||
title: this.$t('confirmDeletion'),
|
||||
content: this.$t('areYouSure'),
|
||||
onOk: () => {
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.dataSource.splice(dataIndex, 1)
|
||||
}
|
||||
})
|
||||
@@ -488,10 +508,10 @@ export default {
|
||||
title: this.$t('confirmBatchDeletion'),
|
||||
content: this.$t('deleteAData'),
|
||||
onOk: () => {
|
||||
for (let i = 0; i < this.selectedRowKeys.length; i++) {
|
||||
this.dataSource.splice(this.selectedRowKeys[i], 1, false)
|
||||
for (const i of this.selectedRowKeys) {
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === i)
|
||||
this.dataSource.splice(dataIndex, 1)
|
||||
}
|
||||
this.dataSource = this.dataSource.filter(item => !!item)
|
||||
this.selectedRowKeys = []
|
||||
}
|
||||
})
|
||||
@@ -507,9 +527,10 @@ export default {
|
||||
},
|
||||
// 批量设置联络人选择人后的回调
|
||||
userSelectModalChange (value) {
|
||||
for (const item of this.selectedRowKeys) {
|
||||
this.dataSource[item].contactUser = value
|
||||
this.dataSource[item].contactUser_dictText = this.selectNames
|
||||
for (const i of this.selectedRowKeys) {
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === i)
|
||||
this.dataSource[dataIndex].contactUser = value
|
||||
this.dataSource[dataIndex].contactUser_dictText = this.selectNames
|
||||
}
|
||||
this.dataSource = JSON.parse(JSON.stringify(this.dataSource))
|
||||
this.selectedRowKeys = []
|
||||
|
||||
Reference in New Issue
Block a user