[update] 修改bug80447
This commit is contained in:
@@ -25,7 +25,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"
|
||||
@@ -56,12 +56,12 @@
|
||||
<a @click="handleLook(record, index)" class="table-ope-btn">{{ $t('lookDetail') }}</a>
|
||||
</template>
|
||||
<template v-else-if="!disabled">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
|
||||
<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>
|
||||
</template>
|
||||
<template v-else-if="editAndLook">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
|
||||
<a @click="handleEdit(record)" class="table-ope-btn">{{ $t('edit') }}</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="handleLook(record, index)" class="table-ope-btn">{{ $t('lookDetail') }}</a>
|
||||
</template>
|
||||
@@ -307,7 +307,15 @@ export default {
|
||||
initData (data) {
|
||||
// 给表格赋值
|
||||
if (data && data.dataList) {
|
||||
this.dataSource = data.dataList
|
||||
this.dataSource = data.dataList.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
// 外层要获取数据
|
||||
@@ -354,9 +362,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)
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
@@ -409,7 +421,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)
|
||||
@@ -444,9 +464,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.contactEnterSendTaskModal.edit(record)
|
||||
},
|
||||
// 查看
|
||||
@@ -454,12 +473,12 @@ export default {
|
||||
this.$refs.contactEnterSendTaskModal.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)
|
||||
}
|
||||
})
|
||||
@@ -474,10 +493,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 = []
|
||||
}
|
||||
})
|
||||
|
||||
+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 = []
|
||||
|
||||
@@ -7,7 +7,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"
|
||||
@@ -144,7 +144,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.list
|
||||
this.dataSource = data.list.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
|
||||
@@ -30,7 +30,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"
|
||||
@@ -43,10 +43,10 @@
|
||||
</template>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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(index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -438,7 +438,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.list
|
||||
this.dataSource = data.list.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
const formInline = {}
|
||||
// 更改级别代号
|
||||
formInline.levelCode = data.levelCode
|
||||
@@ -532,32 +540,35 @@ export default {
|
||||
this.$refs.updateListModal.add(standardId)
|
||||
},
|
||||
// 修改单的编辑
|
||||
handleEdit (record, index) {
|
||||
handleEdit (record) {
|
||||
const standardId = this.$refs.baseInfoForm.formInline.standardId || ''
|
||||
this.$refs.updateListModal.title = this.$t('edit')
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.$refs.updateListModal.edit(standardId, record, dataIndex)
|
||||
this.$refs.updateListModal.edit(standardId, record, record.uid)
|
||||
},
|
||||
// 修改单的删除
|
||||
handleDelete (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)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 修改单新增编辑完成
|
||||
modalFormOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
modalFormOk (value, uid) {
|
||||
console.log(value, uid)
|
||||
if (uid || uid === 0) {
|
||||
// 有下标,说明是编辑
|
||||
this.dataSource.splice(index, 1, value)
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.dataSource.splice(dataIndex, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
this.dataSource.push(value)
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.dataSource.push({ uid: uidGenerator(), ...value })
|
||||
}
|
||||
},
|
||||
// 修改前按钮点击
|
||||
|
||||
@@ -597,7 +597,15 @@ export default {
|
||||
this.formInline.projectType === ProjectType.WORK_TERMINATE.value)) {
|
||||
// 是完成时间变更或工作终止的变更
|
||||
this.$nextTick(() => {
|
||||
this.$refs.changeBaseInfo.dataSource = JSON.parse(JSON.stringify(this.model.dataList))
|
||||
this.$refs.changeBaseInfo.dataSource = JSON.parse(JSON.stringify(this.model.dataList)).map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
})
|
||||
} else if (this.formInline.applicationCategory === ApplicationCategory.CHANGE.value &&
|
||||
(this.formInline.projectType === ProjectType.RESPONSIBLE_DEPT_CHANGE.value ||
|
||||
|
||||
+17
-14
@@ -17,7 +17,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"
|
||||
@@ -35,10 +35,10 @@
|
||||
</template>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -213,9 +213,13 @@ export default {
|
||||
changeBaseInfoDrawerOk (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)
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
@@ -225,19 +229,18 @@ export default {
|
||||
this.$refs.changeBaseInfoDrawer.title = this.$t('newlyAdded')
|
||||
},
|
||||
// 编辑
|
||||
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.changeBaseInfoDrawer.edit(record)
|
||||
this.$refs.changeBaseInfoDrawer.title = this.$t('edit')
|
||||
},
|
||||
// 删除
|
||||
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)
|
||||
}
|
||||
})
|
||||
@@ -252,10 +255,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 = []
|
||||
}
|
||||
})
|
||||
|
||||
@@ -17,7 +17,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"
|
||||
@@ -35,10 +35,10 @@
|
||||
</template>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -71,8 +71,8 @@ export default {
|
||||
/* 分页参数 */
|
||||
ipagination: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
|
||||
pageSize: 5,
|
||||
pageSizeOptions: ['5', '10', '30', '50', '100', '150', '200'],
|
||||
showTotal: (total, range) => {
|
||||
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
|
||||
},
|
||||
@@ -170,9 +170,13 @@ export default {
|
||||
jobEndBaseInfoDrawerOk (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)
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
@@ -182,19 +186,18 @@ export default {
|
||||
this.$refs.jobEndBaseInfoDrawer.title = this.$t('newlyAdded')
|
||||
},
|
||||
// 编辑
|
||||
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.jobEndBaseInfoDrawer.edit(record)
|
||||
this.$refs.jobEndBaseInfoDrawer.title = this.$t('edit')
|
||||
},
|
||||
// 删除
|
||||
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)
|
||||
}
|
||||
})
|
||||
@@ -209,10 +212,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 = []
|
||||
}
|
||||
})
|
||||
|
||||
+26
-15
@@ -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"
|
||||
@@ -37,10 +37,10 @@
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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(index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -125,7 +125,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.advices
|
||||
this.dataSource = data.advices.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
@@ -161,33 +169,36 @@ export default {
|
||||
this.$refs.commentModal.add(file)
|
||||
},
|
||||
// 征求意见的编辑
|
||||
handleEdit (record, index) {
|
||||
handleEdit (record) {
|
||||
// 不知道左侧要预览哪个文件
|
||||
const file = ''
|
||||
this.$refs.commentModal.title = this.$t('edit')
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.$refs.commentModal.edit(file, record, dataIndex)
|
||||
this.$refs.commentModal.edit(file, record, record.uid)
|
||||
},
|
||||
// 征求意见的删除
|
||||
handleDelete (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)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 征求意见新增编辑完成
|
||||
modalFormOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
modalFormOk (value, uid) {
|
||||
console.log(value, uid)
|
||||
if (uid || uid === 0) {
|
||||
// 有下标,说明是编辑
|
||||
this.dataSource.splice(index, 1, value)
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.dataSource.splice(dataIndex, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
this.dataSource.push(value)
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.dataSource.push({ uid: uidGenerator(), ...value })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-17
@@ -30,10 +30,10 @@
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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(index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.id)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -197,36 +197,33 @@ export default {
|
||||
this.ipagination = pagination
|
||||
},
|
||||
// 征求意见的编辑
|
||||
handleEdit (record, index) {
|
||||
handleEdit (record) {
|
||||
// 不知道左侧要预览哪个文件
|
||||
const file = ''
|
||||
this.$refs.commentModal.title = this.$t('edit')
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.$refs.commentModal.edit(file, record, dataIndex)
|
||||
this.$refs.commentModal.edit(file, record, record.id)
|
||||
},
|
||||
// 征求意见的删除
|
||||
handleDelete (index) {
|
||||
handleDelete (id) {
|
||||
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.id === id)
|
||||
this.dataSource.splice(dataIndex, 1)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 征求意见新增编辑完成
|
||||
modalFormOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
modalFormOk (value, id) {
|
||||
console.log(value, id)
|
||||
if (id || id === 0) {
|
||||
const dataIndex = this.dataSource.findIndex(item => item.id === id)
|
||||
// 有下标,说明是编辑
|
||||
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.$set(this.dataSource[dataIndex], 'clauseNum', value.clauseNum)
|
||||
this.$set(this.dataSource[dataIndex], 'clauseName', value.clauseName)
|
||||
this.$set(this.dataSource[dataIndex], 'editAdvice', value.editAdvice)
|
||||
// this.dataSource.splice(index, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
this.dataSource.push(value)
|
||||
}
|
||||
},
|
||||
// 选择用户得到用户名
|
||||
|
||||
+28
-17
@@ -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"
|
||||
@@ -37,10 +37,10 @@
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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(index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -132,7 +132,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.advices
|
||||
this.dataSource = data.advices.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
@@ -168,36 +176,39 @@ export default {
|
||||
this.$refs.commentModal.add(file)
|
||||
},
|
||||
// 征求意见的编辑
|
||||
handleEdit (record, index) {
|
||||
handleEdit (record) {
|
||||
// 不知道左侧要预览哪个文件
|
||||
const file = ''
|
||||
this.$refs.commentModal.title = this.$t('edit')
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.$refs.commentModal.edit(file, record, dataIndex)
|
||||
this.$refs.commentModal.edit(file, record, record.uid)
|
||||
},
|
||||
// 征求意见的删除
|
||||
handleDelete (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)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 征求意见新增编辑完成
|
||||
modalFormOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
modalFormOk (value, uid) {
|
||||
console.log(value, uid)
|
||||
if (uid || uid === 0) {
|
||||
// 有下标,说明是编辑
|
||||
this.$set(this.dataSource[index], 'clauseNum', value.clauseNum)
|
||||
this.$set(this.dataSource[index], 'clauseName', value.clauseName)
|
||||
this.$set(this.dataSource[index], 'editAdvice', value.editAdvice)
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.$set(this.dataSource[dataIndex], 'clauseNum', value.clauseNum)
|
||||
this.$set(this.dataSource[dataIndex], 'clauseName', value.clauseName)
|
||||
this.$set(this.dataSource[dataIndex], 'editAdvice', value.editAdvice)
|
||||
// this.dataSource.splice(index, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
this.dataSource.push(value)
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.dataSource.push({ uid: uidGenerator(), ...value })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-11
@@ -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"
|
||||
@@ -162,7 +162,11 @@ export default {
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.advices.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item,
|
||||
handleAdvice: item.handleAdvice ? item.handleAdvice : undefined
|
||||
}
|
||||
@@ -211,35 +215,38 @@ export default {
|
||||
this.$refs.commentModal.add(file)
|
||||
},
|
||||
// 征求意见的编辑
|
||||
handleEdit (record, index) {
|
||||
handleEdit (record) {
|
||||
// 不知道左侧要预览哪个文件
|
||||
const file = ''
|
||||
this.$refs.commentModal.title = this.$t('edit')
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.$refs.commentModal.edit(file, record, dataIndex)
|
||||
this.$refs.commentModal.edit(file, record, record.uid)
|
||||
},
|
||||
// 征求意见的删除
|
||||
handleDelete (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)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 征求意见新增编辑完成
|
||||
modalFormOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
modalFormOk (value, uid) {
|
||||
console.log(value, uid)
|
||||
if (uid || uid === 0) {
|
||||
// 有下标,说明是编辑
|
||||
this.dataSource.splice(index, 1, value)
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.dataSource.splice(dataIndex, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
const currentUser = Vue.ls.get(USER_INFO)
|
||||
const currentUserId = currentUser.realname + '(' + currentUser.username + ')'
|
||||
this.dataSource.push({ ...value, createUserId_dictText: currentUserId })
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.dataSource.push({ ...value, createUserId_dictText: currentUserId, uid: uidGenerator() })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+33
-17
@@ -6,7 +6,7 @@
|
||||
:can-drag="true"
|
||||
:scroll="{x: '100%'}"
|
||||
ref="table"
|
||||
:rowKey="(record, index) => { return (Number(this.draftIpagination.current) - 1) * Number(this.draftIpagination.pageSize) + index }"
|
||||
rowKey="uid"
|
||||
:columns="drafterColumns"
|
||||
:dataSource="drafterDataSource"
|
||||
:pagination="draftIpagination"
|
||||
@@ -137,7 +137,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"
|
||||
@@ -145,10 +145,10 @@
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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(index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -343,8 +343,21 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.drafterDataSource = data.otherDraftUserVOS
|
||||
this.dataSource = data.inspectContents || []
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.drafterDataSource = data.otherDraftUserVOS.map(item => {
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
this.dataSource = data.inspectContents && data.inspectContents.length > 0 ? data.inspectContents.map(item => {
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
}) : []
|
||||
this.formInline = Object.assign({}, data)
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
@@ -463,33 +476,36 @@ export default {
|
||||
this.$refs.checkContentModal.add(standardFile)
|
||||
},
|
||||
// 稽查内容的编辑
|
||||
handleEdit (record, index) {
|
||||
handleEdit (record) {
|
||||
// 编辑左侧的预览文件,还不知道要赋值哪个文件 ??
|
||||
const standardFile = ''
|
||||
this.$refs.checkContentModal.title = this.$t('edit')
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
this.$refs.checkContentModal.edit(standardFile, record, dataIndex)
|
||||
this.$refs.checkContentModal.edit(standardFile, record, record.uid)
|
||||
},
|
||||
// 稽查内容的删除
|
||||
handleDelete (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)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 稽查内容新增编辑完成
|
||||
checkContentOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
checkContentOk (value, uid) {
|
||||
console.log(value, uid)
|
||||
if (uid || uid === 0) {
|
||||
// 有下标,说明是编辑
|
||||
this.dataSource.splice(index, 1, value)
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === uid)
|
||||
this.dataSource.splice(dataIndex, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
this.dataSource.push(value)
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
this.dataSource.push({ uid: uidGenerator(), ...value })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+26
-16
@@ -32,7 +32,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"
|
||||
@@ -40,10 +40,10 @@
|
||||
@change="handleTableChange">
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
||||
<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.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
<a @click="handleDelete(record.uid)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
||||
</div>
|
||||
|
||||
</j-table>
|
||||
@@ -72,8 +72,8 @@ export default {
|
||||
/* 分页参数 */
|
||||
ipagination: {
|
||||
current: 1,
|
||||
pageSize: 10,
|
||||
pageSizeOptions: ['10', '30', '50', '100', '150', '200'],
|
||||
pageSize: 5,
|
||||
pageSizeOptions: ['5', '10', '30', '50', '100', '150', '200'],
|
||||
showTotal: (total, range) => {
|
||||
return range[0] + '-' + range[1] + ' ' + this.$t('total') + total + this.$t('strip')
|
||||
},
|
||||
@@ -127,7 +127,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值,在线编辑不知道要怎么赋值?
|
||||
this.dataSource = data.otherDraftUserVOS || []
|
||||
this.dataSource = data.otherDraftUserVOS && data.otherDraftUserVOS.length > 0 ? data.otherDraftUserVOS.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
}) : []
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
@@ -166,18 +174,17 @@ export default {
|
||||
this.$refs.addEditDrafterDrawer.add()
|
||||
},
|
||||
// 编辑
|
||||
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.addEditDrafterDrawer.edit(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)
|
||||
}
|
||||
})
|
||||
@@ -185,10 +192,13 @@ export default {
|
||||
// 新增或编辑完成
|
||||
modalFormOk (value) {
|
||||
if (this.modalType === 'add') {
|
||||
this.dataSource.push(value)
|
||||
} else if (this.modalType && this.modalType.split('-')[0] === 'edit') {
|
||||
console.log(Number(this.modalType.split('-')[1]), value)
|
||||
this.dataSource.splice(Number(this.modalType.split('-')[1]), 1, 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') {
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === this.modalType.split(',')[1])
|
||||
this.dataSource.splice(dataIndex, 1, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-9
@@ -6,7 +6,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"
|
||||
@@ -21,10 +21,10 @@
|
||||
<!--</template>-->
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
||||
<div slot="action" slot-scope="{record}" class="action-span-cell">
|
||||
<!-- 上传企标 只能上传分配给自己的上传企标,到期未上传跳过该起草人,操作列表显示- -->
|
||||
<a v-if="record.operateType !== '1'"
|
||||
@click="handleUploadStandard(record, index)"
|
||||
@click="handleUploadStandard(record)"
|
||||
class="table-ope-btn"
|
||||
:disabled="disabled"
|
||||
>
|
||||
@@ -112,7 +112,7 @@ export default {
|
||||
loading: false,
|
||||
userInfo: {}, // 当前登录人信息
|
||||
currentDate: '',
|
||||
uploadIndex: undefined // 正在上传企标的下标
|
||||
uploadUid: undefined // 正在上传企标的行uid
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@@ -123,7 +123,15 @@ export default {
|
||||
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
||||
initData (data) {
|
||||
// 给表格赋值
|
||||
this.dataSource = data.otherDraftUserVOS
|
||||
this.dataSource = data.otherDraftUserVOS.map(item => {
|
||||
const uidGenerator = () => {
|
||||
return '-' + parseInt(Math.random() * 10000 + 1, 10)
|
||||
}
|
||||
return {
|
||||
uid: uidGenerator(),
|
||||
...item
|
||||
}
|
||||
})
|
||||
// 给表单赋值
|
||||
this.$nextTick(() => {
|
||||
this.$refs.baseInfoForm.initData(data)
|
||||
@@ -165,10 +173,9 @@ export default {
|
||||
this.ipagination = pagination
|
||||
},
|
||||
// 上传企标
|
||||
handleUploadStandard (record, index) {
|
||||
const dataIndex = (Number(this.ipagination.current) - 1) * Number(this.ipagination.pageSize) + index
|
||||
handleUploadStandard (record) {
|
||||
this.$refs.uploadFile.open(record.fileId)
|
||||
this.uploadIndex = dataIndex
|
||||
this.uploadUid = record.uid
|
||||
},
|
||||
// 上传企标后的回调
|
||||
uploadFileChange (data) {
|
||||
@@ -179,7 +186,8 @@ export default {
|
||||
})
|
||||
}
|
||||
/** 赋值给对应行的企标 */
|
||||
this.dataSource[this.uploadIndex].fileId = attIdList.join(',')
|
||||
const dataIndex = this.dataSource.findIndex(item => item.uid === this.uploadUid)
|
||||
this.dataSource[dataIndex].fileId = attIdList.join(',')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user