This commit is contained in:
pushuo 2022-07-27 10:35:59 +08:00
parent 70fb76b4df
commit 85e9958503
2 changed files with 11 additions and 1 deletions

View File

@ -13,6 +13,7 @@
<tr> <tr>
<th>#</th> <th>#</th>
<th>名称</th> <th>名称</th>
<th>描述</th>
<th class="text-end">操作</th> <th class="text-end">操作</th>
</tr> </tr>
</thead> </thead>
@ -20,6 +21,7 @@
<tr v-for="tax, index in regions" :key="index"> <tr v-for="tax, index in regions" :key="index">
<td>@{{ tax.id }}</td> <td>@{{ tax.id }}</td>
<td>@{{ tax.name }}</td> <td>@{{ tax.name }}</td>
<td>@{{ tax.description }}</td>
<td class="text-end"> <td class="text-end">
<button class="btn btn-outline-secondary btn-sm" @click="checkedCreate('edit', index)">编辑</button> <button class="btn btn-outline-secondary btn-sm" @click="checkedCreate('edit', index)">编辑</button>
<button class="btn btn-outline-danger btn-sm ml-1" type="button" @click="deleteCustomer(tax.id, index)">删除</button> <button class="btn btn-outline-danger btn-sm ml-1" type="button" @click="deleteCustomer(tax.id, index)">删除</button>

View File

@ -13,6 +13,7 @@
<tr> <tr>
<th>#</th> <th>#</th>
<th>名称</th> <th>名称</th>
<th>描述</th>
<th class="text-end">操作</th> <th class="text-end">操作</th>
</tr> </tr>
</thead> </thead>
@ -20,6 +21,7 @@
<tr v-for="tax, index in tax_classes" :key="index"> <tr v-for="tax, index in tax_classes" :key="index">
<td>@{{ tax.id }}</td> <td>@{{ tax.id }}</td>
<td>@{{ tax.title }}</td> <td>@{{ tax.title }}</td>
<td>@{{ tax.description }}</td>
<td class="text-end"> <td class="text-end">
<button class="btn btn-outline-secondary btn-sm" @click="checkedCreate('edit', index)">编辑</button> <button class="btn btn-outline-secondary btn-sm" @click="checkedCreate('edit', index)">编辑</button>
<button class="btn btn-outline-danger btn-sm ml-1" type="button" @click="deleteCustomer(tax.id, index)">删除</button> <button class="btn btn-outline-danger btn-sm ml-1" type="button" @click="deleteCustomer(tax.id, index)">删除</button>
@ -125,6 +127,7 @@
checkedCreate(type, index) { checkedCreate(type, index) {
this.dialog.show = true this.dialog.show = true
this.dialog.type = type this.dialog.type = type
this.dialog.index = index
if (type == 'edit') { if (type == 'edit') {
let tax = this.tax_classes[index]; let tax = this.tax_classes[index];
@ -162,7 +165,12 @@
$http[type](url, this.dialog.form).then((res) => { $http[type](url, this.dialog.form).then((res) => {
this.$message.success(res.message); this.$message.success(res.message);
this.tax_classes.push(res.data) if (type == 'add') {
this.tax_classes.push(res.data)
} else {
this.tax_classes[this.dialog.index] = res.data
}
this.dialog.show = false this.dialog.show = false
}) })
}); });