|
@@ -57,7 +57,7 @@
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogFormVisible = false">取消</el-button>
|
|
|
- <el-button type="primary" @click="dialogStatus==='create' ? createData() : updateData()">确定</el-button>
|
|
|
+ <el-button type="primary" @click="updateData()">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogVisible" width="20%">
|
|
@@ -104,9 +104,8 @@ export default {
|
|
|
temp: {
|
|
|
id: 1,
|
|
|
organizeID: 1,
|
|
|
- classifyName: '针剂',
|
|
|
- telephone: '13888888888',
|
|
|
- sort: 60
|
|
|
+ classifyName: '',
|
|
|
+ telephone: ''
|
|
|
},
|
|
|
dialogFormVisible: false,
|
|
|
dialogStatus: '',
|
|
@@ -166,12 +165,12 @@ export default {
|
|
|
{
|
|
|
id: 3,
|
|
|
organizeID: 1,
|
|
|
- classifyName: '吴小研',
|
|
|
+ classifyName: '郑帅哥',
|
|
|
classifyNum: '2020010120201110',
|
|
|
watchName: '轻描淡写',
|
|
|
openID: 'o0dXI5ajSPa6PkOmjjq1aar93JW4',
|
|
|
code: '315654',
|
|
|
- telephone: 13888888888,
|
|
|
+ telephone: 13666666666,
|
|
|
createTime: '2020-01-01:20:30:56',
|
|
|
bindTime: '2020-01-01:20:30:56',
|
|
|
status: 2,
|
|
@@ -180,12 +179,12 @@ export default {
|
|
|
{
|
|
|
id: 3,
|
|
|
organizeID: 1,
|
|
|
- classifyName: '吴小研',
|
|
|
+ classifyName: '李帅哥',
|
|
|
classifyNum: '2020010120201110',
|
|
|
watchName: '轻描淡写',
|
|
|
openID: 'o0dXI5ajSPa6PkOmjjq1aar93JW4',
|
|
|
code: '315654',
|
|
|
- telephone: 13888888888,
|
|
|
+ telephone: 13979770618,
|
|
|
createTime: '2020-01-01:20:30:56',
|
|
|
bindTime: '2020-01-01:20:30:56',
|
|
|
status: 3,
|
|
@@ -197,7 +196,7 @@ export default {
|
|
|
},
|
|
|
handleEdit(row) {
|
|
|
this.temp = Object.assign({}, row)
|
|
|
- this.temp.timestamp = new Date(this.temp.timestamp)
|
|
|
+ console.log(this.temp)
|
|
|
this.dialogStatus = 'edit'
|
|
|
this.dialogFormVisible = true
|
|
|
this.$nextTick(() => {
|
|
@@ -278,38 +277,15 @@ export default {
|
|
|
this.$refs['dataForm'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
const tempData = Object.assign({}, this.temp)
|
|
|
- tempData.updateTime = +new Date(tempData.updateTime)
|
|
|
- updateCategory(tempData).then(() => {
|
|
|
- for (const v of this.list) {
|
|
|
- if (v.id === this.temp.id) {
|
|
|
- const index = this.list.indexOf(v)
|
|
|
- this.list.splice(index, 1, this.temp)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.$notify({
|
|
|
- title: 'Success',
|
|
|
- message: '更新成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.$notify({
|
|
|
+ title: 'Success',
|
|
|
+ message: '保存成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 2000
|
|
|
})
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- createData() {
|
|
|
- this.$refs['dataForm'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- createCategory(this.temp).then(() => {
|
|
|
- this.list.unshift(this.temp)
|
|
|
- this.dialogFormVisible = false
|
|
|
- this.$notify({
|
|
|
- title: 'Success',
|
|
|
- message: '添加分类成功',
|
|
|
- type: 'success',
|
|
|
- duration: 2000
|
|
|
- })
|
|
|
+ updateCategory(tempData).then(() => {
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
})
|