117 lines
2.6 KiB
Vue
117 lines
2.6 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-plus"
|
|
v-auth="'tooling.create'"
|
|
@click="add"
|
|
>新增</el-button>
|
|
</div>
|
|
<div class="right-panel">
|
|
<el-input
|
|
v-model="query.search"
|
|
placeholder="工装名称/编号"
|
|
clearable
|
|
@keyup.enter="handleQuery"
|
|
></el-input>
|
|
<el-button
|
|
type="primary"
|
|
icon="el-icon-search"
|
|
@click="handleQuery"
|
|
></el-button>
|
|
</div>
|
|
</el-header>
|
|
<el-main class="nopadding">
|
|
<scTable
|
|
ref="table"
|
|
:apiObj="apiObj"
|
|
row-key="id"
|
|
stripe
|
|
:query="query"
|
|
>
|
|
<el-table-column type="index" width="50" />
|
|
<el-table-column label="工装名称" prop="name" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="工装编号" prop="code" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="备注" prop="remark" show-overflow-tooltip></el-table-column>
|
|
<el-table-column label="操作" fixed="right" align="left" width="100">
|
|
<template #default="scope">
|
|
<el-button
|
|
link
|
|
type="primary"
|
|
@click="table_edit(scope.row)"
|
|
v-auth="'tooling.update'"
|
|
>编辑</el-button>
|
|
<el-popconfirm
|
|
title="确定删除吗?"
|
|
@confirm="table_del(scope.row)"
|
|
v-auth="'tooling.delete'"
|
|
>
|
|
<template #reference>
|
|
<el-button link type="danger">删除</el-button>
|
|
</template>
|
|
</el-popconfirm>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
<save-dialog
|
|
v-if="dialog.save"
|
|
ref="saveDialog"
|
|
@success="handleSaveSuccess"
|
|
@closed="dialog.save = false"
|
|
></save-dialog>
|
|
</el-container>
|
|
</template>
|
|
|
|
<script>
|
|
import saveDialog from "./tooling_form.vue";
|
|
export default {
|
|
name: "工装管理",
|
|
components: {
|
|
saveDialog,
|
|
},
|
|
data() {
|
|
return {
|
|
apiObj: this.$API.mtm.tooling.list,
|
|
query: {},
|
|
dialog: {
|
|
save: false,
|
|
},
|
|
};
|
|
},
|
|
methods: {
|
|
add() {
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("add");
|
|
});
|
|
},
|
|
table_edit(row) {
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("edit").setData(row);
|
|
});
|
|
},
|
|
async table_del(row) {
|
|
this.$API.mtm.tooling.delete
|
|
.req(row.id)
|
|
.then(() => {
|
|
this.$message.success("删除成功");
|
|
this.$refs.table.refresh();
|
|
})
|
|
.catch((err) => {
|
|
return err;
|
|
});
|
|
},
|
|
handleSaveSuccess() {
|
|
this.$refs.table.refresh();
|
|
},
|
|
handleQuery() {
|
|
this.$refs.table.queryData(this.query);
|
|
},
|
|
},
|
|
};
|
|
</script>
|