|
|
@@ -87,42 +87,11 @@
|
|
|
label="Action"
|
|
|
width="210"
|
|
|
>
|
|
|
- <template v-slot="{ row }">
|
|
|
- <el-row
|
|
|
- type="flex"
|
|
|
- justify="space-between"
|
|
|
- align="middle"
|
|
|
- :gutter="10"
|
|
|
- class="action"
|
|
|
- >
|
|
|
- <el-col
|
|
|
- v-if="isDriverOperation(row)"
|
|
|
- :span="11"
|
|
|
- >
|
|
|
- <el-button
|
|
|
- icon='el-icon-edit'
|
|
|
- class="editButton"
|
|
|
- type="text"
|
|
|
- @click="onClickEditButton(row)"
|
|
|
- >
|
|
|
- Edit
|
|
|
- </el-button>
|
|
|
- </el-col>
|
|
|
- <div v-else />
|
|
|
- <el-divider
|
|
|
- v-if="isDriverOperation(row)"
|
|
|
- direction="vertical"></el-divider>
|
|
|
- <el-col :span="11">
|
|
|
- <el-button
|
|
|
- class="deleteButton"
|
|
|
- icon="el-icon-delete"
|
|
|
- type="text"
|
|
|
- @click="onClickDeleteButton(row)"
|
|
|
- >
|
|
|
- Delete
|
|
|
- </el-button>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <TableAction
|
|
|
+ :showEdit="isDriverOperation(row)"
|
|
|
+ @edit="onClickEditButton(row)"
|
|
|
+ @delete="onClickDeleteButton(row)"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
@@ -139,12 +108,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import Pagination from '@/components/Pagination'
|
|
|
+import Pagination from '@/components/Pagination'
|
|
|
+import TableAction from '@/components/TableAction'
|
|
|
import { deleteDriver, fetchDriverPages } from '@/http/api/driver'
|
|
|
|
|
|
export default {
|
|
|
name: "FleetCompanyList",
|
|
|
- components: { Pagination },
|
|
|
+ components: { Pagination, TableAction },
|
|
|
data() {
|
|
|
return {
|
|
|
form: {
|
|
|
@@ -185,6 +155,15 @@ export default {
|
|
|
this.$router.push({ name: 'DriverDetail' })
|
|
|
},
|
|
|
async onClickDeleteButton(driver) {
|
|
|
+ this.$confirm('Are you sure you want to delete this driver?', 'Delete', {
|
|
|
+ confirmButtonText: 'OK',
|
|
|
+ cancelButtonText: 'Cancel',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(res => {
|
|
|
+ this.deleteUser(driver);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async deleteUser(driver) {
|
|
|
try {
|
|
|
const { success, msg } = await deleteDriver({
|
|
|
userPk: driver.userPk
|