|
@@ -198,8 +198,8 @@
|
|
|
:row-selection="rowSelection">
|
|
|
<span slot="action" slot-scope="record">
|
|
|
<template>
|
|
|
- <!-- <a @click="handleEdit(record)">修改</a>
|
|
|
- <a-divider type="vertical" />-->
|
|
|
+ <a @click="handleEdit(record)">修改</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
<a-popconfirm title="是否要删除该条数据?" @confirm="handleDelOne(record.id)">
|
|
|
<a>删除</a>
|
|
|
</a-popconfirm>
|
|
@@ -244,7 +244,7 @@ export default {
|
|
|
columns: [
|
|
|
{
|
|
|
title: '序号',
|
|
|
- width: 120,
|
|
|
+ width: 180,
|
|
|
dataIndex: 'id'
|
|
|
},
|
|
|
{
|
|
@@ -389,11 +389,26 @@ export default {
|
|
|
this.confirmLoading = false
|
|
|
return
|
|
|
}
|
|
|
- values.id = this.index++
|
|
|
- values.param4 = this.BaseTool.Date.formatter(values.param4, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
|
|
|
- this.data.push(values)
|
|
|
- this.$message.info('更新成功')
|
|
|
- this.confirmLoading = false
|
|
|
+ if (values.id == null) {
|
|
|
+ var str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
|
+ var result = ''
|
|
|
+ var length = 16
|
|
|
+ for (var i = length; i > 0; --i) { result += str[Math.floor(Math.random() * str.length)] }
|
|
|
+ values.id = result
|
|
|
+ values.param4 = this.BaseTool.Date.formatter(values.param4, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN)
|
|
|
+ this.data.push(values)
|
|
|
+ this.$message.info('更新成功')
|
|
|
+ this.confirmLoading = false
|
|
|
+ } else {
|
|
|
+ const data = [...this.data]
|
|
|
+ this.data = data.filter(item => values.id !== item.id)
|
|
|
+ var str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
|
+ var result = ''
|
|
|
+ var length = 16
|
|
|
+ for (var i = length; i > 0; --i) { result += str[Math.floor(Math.random() * str.length)] }
|
|
|
+ values.id = result
|
|
|
+ this.data.push(values)
|
|
|
+ }
|
|
|
localStorage.setItem('test', JSON.stringify(this.data))
|
|
|
this.form.resetFields()
|
|
|
})
|