factory_web/src/views/pum/planitem.vue

143 lines
4.4 KiB
Vue

<template>
<div style="padding: 8px">
<div>
<el-card style="width: 100%" header="基本信息" shadow="hover">
<el-descriptions>
<el-descriptions-item label="计划名称">{{ orderObj.name }}</el-descriptions-item>
<el-descriptions-item label="计划编号">{{ orderObj.number }}</el-descriptions-item>
<el-descriptions-item label="计划状态">{{ orderObj.state }}</el-descriptions-item>
</el-descriptions>
</el-card>
</div>
<div style="height:8px"></div>
<div>
<el-card style="width: 100%" header="计划明细" shadow="hover">
<div>
<el-button type="primary" icon="el-icon-plus" v-auth="'pu_planitem.create'" @click="add">新增</el-button>
</div>
<scTable ref="table" :apiObj="apiObj" row-key="id" stripe :params="query" hidePagination>
<el-table-column type="index" width="50" />
<el-table-column label="所属物料" prop="material" show-overflow-tooltip>
<template #default="scope">
<span v-if="scope.row.material_"> {{ scope.row.material_.name }}</span>
</template>
</el-table-column>
<el-table-column label="所属数量" prop="need_count">
</el-table-column>
<el-table-column label="需求日期" prop="need_date" show-overflow-tooltip>
</el-table-column>
<el-table-column label="部门" prop="belong_dept_name">
</el-table-column>
<el-table-column label="关联采购订单" prop="pu_order">
</el-table-column>
<el-table-column label="创建人" prop="create_by_name">
</el-table-column>
<el-table-column label="备注" prop="note" show-overflow-tooltip>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="100px">
<template #default="scope">
<el-link type="primary" @click="table_edit(scope.row)" v-auth="'pu_planitem.update'">
编辑
</el-link>
<el-divider direction="vertical"></el-divider>
<el-link type="danger" @click="table_del(scope.row)" v-auth="'pu_planitem.delete'">
删除
</el-link>
</template>
</el-table-column>
</scTable>
</el-card>
</div>
</div>
<save-dialog v-if="dialog.save" ref="saveDialog" :puPlan="puPlan" @success="handleSaveSuccess"
@closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from "./planitem_form.vue";
export default {
name: "rparty",
components: {
saveDialog,
},
data() {
return {
dialog: {
save: false,
},
puPlan: '',
orderObj: {},
apiObj: null,
query: {
page: 1,
page_size: 20
},
};
},
mounted() {
this.puPlan = this.$route.query.pu_plan;
this.query.pu_plan = this.$route.query.pu_plan;
this.apiObj= this.$API.pum.planitem.list;
this.$refs.table.refresh();
this.getOrder();
},
methods: {
getOrder() {
this.$API.pum.plan.item.req(this.puPlan).then((res) => {
debugger;
console.log(res);
this.orderObj = res;
})
},
//添加
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);
});
},
//查看
table_show(row) {
this.dialog.save = true;
this.$nextTick(() => {
this.$refs.saveDialog.open("show").setData(row);
});
},
//删除
table_del(row) {
this.$confirm(`确定删除该计划详情吗?`, "提示", {
type: "warning",
}).then(() => {
this.$API.pum.planitem.delete.req(row.id).then((res) => {
this.$message.success("删除成功");
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>