140 lines
4.3 KiB
Vue
140 lines
4.3 KiB
Vue
<template>
|
|
<el-container>
|
|
<el-header>
|
|
<div class="left-panel">
|
|
<el-button type="primary" icon="el-icon-plus" @click="add" v-auth="'pu_plan.create'">新增</el-button>
|
|
</div>
|
|
<div class="right-panel">
|
|
<el-input v-model="query.search" placeholder="计划编号" clearable style="margin-right: 5px;"></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 :params="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="number">
|
|
</el-table-column>
|
|
<el-table-column label="状态" prop="state">
|
|
<template #default="scope">
|
|
<span><el-tag :type="stateOption[scope.row.state].color">{{ stateOption[scope.row.state].label
|
|
}}</el-tag></span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="提交时间" prop="submit_time" show-overflow-tooltip>
|
|
</el-table-column>
|
|
<el-table-column label="操作" fixed="right" align="center" width="200">
|
|
<template #default="scope">
|
|
<el-button link type="primary" @click="table_detail(scope.row)">详情
|
|
</el-button>
|
|
<el-button link type="primary" @click="table_edit(scope.row)" v-auth="'pu_plan.update'"
|
|
v-if="scope.row.state == 10">编辑
|
|
</el-button>
|
|
<el-button link type="primary" @click="table_submit(scope.row)" v-auth="'pu_plan.submit'"
|
|
v-if="scope.row.state == 10">提交
|
|
</el-button>
|
|
<el-button link type="danger" @click="table_del(scope.row)" v-auth="'pu_plan.delete'"
|
|
v-if="scope.row.state == 10">删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</scTable>
|
|
</el-main>
|
|
</el-container>
|
|
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess"
|
|
@closed="dialog.save = false"></save-dialog>
|
|
</template>
|
|
<script>
|
|
import saveDialog from "./plan_form.vue";
|
|
export default {
|
|
name: "rparty",
|
|
components: {
|
|
saveDialog,
|
|
},
|
|
data() {
|
|
return {
|
|
dialog: {
|
|
save: false,
|
|
},
|
|
apiObj: this.$API.pum.plan.list,
|
|
query: {
|
|
page: 1,
|
|
page_size: 20,
|
|
type: 10
|
|
},
|
|
selection: [],
|
|
stateOption: {
|
|
10: { "label": "创建中", "color": "" },
|
|
20: { "label": "已提交", "color": "" },
|
|
30: { "label": "下单中", "color": "" },
|
|
40: { "label": "下单完成", "color": "" },
|
|
40: { "label": "已完成", "color": "success" },
|
|
},
|
|
};
|
|
},
|
|
methods: {
|
|
//添加
|
|
add() {
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("add");
|
|
});
|
|
},
|
|
//查看
|
|
table_detail(row) {
|
|
this.$nextTick(() => {
|
|
this.$router.push({
|
|
name: "planitem",
|
|
query: { pu_plan: row.id }
|
|
|
|
});
|
|
});
|
|
},
|
|
//编辑
|
|
table_edit(row) {
|
|
this.dialog.save = true;
|
|
this.$nextTick(() => {
|
|
this.$refs.saveDialog.open("edit").setData(row);
|
|
});
|
|
},
|
|
//查看
|
|
table_submit(row) {
|
|
console.log(row.id)
|
|
this.$API.pum.plan.submit.req(row.id).then((res) => {
|
|
this.$refs.table.refresh();
|
|
debugger;
|
|
this.$message.success("提交成功");
|
|
});
|
|
},
|
|
//删除
|
|
table_del(row) {
|
|
this.$confirm(`确定删除该计划吗?`, "提示", {
|
|
type: "warning",
|
|
}).then(() => {
|
|
this.$API.pum.plan.delete.req(row.id).then((res) => {
|
|
this.$message.success("删除成功");
|
|
this.$refs.table.refresh();
|
|
return res;
|
|
}).catch((err) => {
|
|
return err;
|
|
});
|
|
}).catch(() => { });
|
|
},
|
|
//本地更新数据
|
|
handleSaveSuccess(data, mode) {
|
|
if (mode == "add") {
|
|
this.$refs.table.refresh();
|
|
} else if (mode == "edit") {
|
|
this.$refs.table.refresh();
|
|
}
|
|
},
|
|
handleQuery() {
|
|
this.$refs.table.queryData(this.query)
|
|
},
|
|
resetQuery() {
|
|
this.query = {};
|
|
},
|
|
},
|
|
};
|
|
</script> |