|
|
@@ -1,17 +1,34 @@
|
|
|
<template>
|
|
|
<div class="ele-body">
|
|
|
<el-card shadow="never" v-loading="loading">
|
|
|
- <materialPlan-search @search="reload" :statusOpt="statusOpt" :activeName="activeName" ref="searchRef">
|
|
|
+ <materialPlan-search
|
|
|
+ @search="reload"
|
|
|
+ :statusOpt="statusOpt"
|
|
|
+ :activeName="activeName"
|
|
|
+ ref="searchRef"
|
|
|
+ >
|
|
|
</materialPlan-search>
|
|
|
|
|
|
-
|
|
|
<!-- 数据表格 -->
|
|
|
- <ele-pro-table ref="table" :initLoad="false" :columns="columns" :datasource="datasource"
|
|
|
- cache-key="`materialPlanTable`">
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ :initLoad="false"
|
|
|
+ :columns="columns"
|
|
|
+ :datasource="datasource"
|
|
|
+ cache-key="`materialPlanTable`"
|
|
|
+ >
|
|
|
<template v-slot:toolbar>
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="handleEdit('add')">创建销售计划</el-button>
|
|
|
|
|
|
- <el-button type="primary" icon="el-icon-plus" @click="produceAdd('add')">创建生产计划</el-button>
|
|
|
+
|
|
|
+ <el-dropdown trigger="click" @command="handleClick">
|
|
|
+ <el-link type="primary" icon="el-icon-plus">创建采购计划</el-link>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item command="1">来源销售计划</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="2">来源生产计划</el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:status="{ row }">
|
|
|
@@ -21,22 +38,39 @@
|
|
|
</template>
|
|
|
|
|
|
<template v-slot:approvalStatus="{ row }">
|
|
|
- <el-link type="primary" :underline="false" @click="handleDetails(row)"> {{
|
|
|
- approvalStatusFormatter(row.approvalStatus) }} </el-link>
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="handleDetails(row)"
|
|
|
+ >
|
|
|
+ {{ approvalStatusFormatter(row.approvalStatus) }}
|
|
|
+ </el-link>
|
|
|
</template>
|
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="{ row }">
|
|
|
-
|
|
|
-
|
|
|
- <el-link type="primary" :underline="false" icon="el-icon-edit" @click="handleEdit('edit', row)">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleEdit('edit', row)"
|
|
|
+ >
|
|
|
修改计划
|
|
|
</el-link>
|
|
|
- <el-link @click="handleDel(row)" type="danger" :underline="false" icon="el-icon-delete">
|
|
|
+ <el-link
|
|
|
+ @click="handleDel(row)"
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ >
|
|
|
删除
|
|
|
</el-link>
|
|
|
|
|
|
- <el-link type="primary" :underline="false" @click="todo(row)"
|
|
|
- v-if="row.approvalStatus == 0 || row.approvalStatus == 3">
|
|
|
+ <el-link
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ @click="todo(row)"
|
|
|
+ v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
|
|
|
+ >
|
|
|
提交
|
|
|
</el-link>
|
|
|
</template>
|
|
|
@@ -44,202 +78,199 @@
|
|
|
</el-card>
|
|
|
<planEditDialog ref="planEditDialogRef" @success="reload" />
|
|
|
<producePlan ref="produceRef"></producePlan>
|
|
|
-
|
|
|
+
|
|
|
<detail ref="detailRef"></detail>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import materialPlanSearch from './components/materialPlan-search.vue';
|
|
|
-import planEditDialog from './components/plan-edit-dialog.vue';
|
|
|
-import producePlan from './components/producePlan.vue'
|
|
|
-
|
|
|
-import detail from './components/detail.vue'
|
|
|
-import { getList, del, submit } from '@/api/materialPlan/index';
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- planEditDialog,
|
|
|
-
|
|
|
- materialPlanSearch,
|
|
|
- detail,
|
|
|
- producePlan
|
|
|
- },
|
|
|
-
|
|
|
- data() {
|
|
|
- return {
|
|
|
- activeName: 'first',
|
|
|
-
|
|
|
- // 加载状态
|
|
|
- loading: false,
|
|
|
-
|
|
|
-
|
|
|
- statusOpt: {
|
|
|
- first: [
|
|
|
- { label: '所有状态', value: null },
|
|
|
- { label: '待排产', value: '1' },
|
|
|
- { label: '待发布', value: '2' },
|
|
|
- { label: '发布失败', value: '3' },
|
|
|
- { label: '已完成', value: '6' },
|
|
|
-
|
|
|
- ],
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- approvalStatusOpt: {
|
|
|
- first: [
|
|
|
-
|
|
|
- { label: '未提交', value: '0' },
|
|
|
- { label: '审核中', value: '1' },
|
|
|
- { label: '审核通过', value: '2' },
|
|
|
- { label: '审核未通过', value: '3' },
|
|
|
- ]
|
|
|
- }
|
|
|
- };
|
|
|
- },
|
|
|
- computed: {
|
|
|
- // 表格列配置
|
|
|
- columns() {
|
|
|
- return [
|
|
|
- {
|
|
|
- columnKey: 'index',
|
|
|
- label: '序号',
|
|
|
- type: 'index',
|
|
|
- width: 55,
|
|
|
- align: 'center',
|
|
|
- fixed: 'left'
|
|
|
- },
|
|
|
- {
|
|
|
- slot: 'name',
|
|
|
- prop: 'name',
|
|
|
- label: '计划名称',
|
|
|
- align: 'center',
|
|
|
-
|
|
|
- },
|
|
|
- {
|
|
|
- prop: 'code',
|
|
|
- label: '计划编号',
|
|
|
- align: 'center',
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- {
|
|
|
- columnKey: 'status',
|
|
|
- label: '状态',
|
|
|
- align: 'center',
|
|
|
- slot: 'status',
|
|
|
- action: 'status'
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- {
|
|
|
- prop: 'approvalStatus',
|
|
|
- label: '审批状态',
|
|
|
- align: 'center',
|
|
|
- slot: 'approvalStatus',
|
|
|
- action: 'approvalStatus'
|
|
|
- },
|
|
|
-
|
|
|
+ import materialPlanSearch from './components/materialPlan-search.vue';
|
|
|
+ import planEditDialog from './components/plan-edit-dialog.vue';
|
|
|
+ import producePlan from './components/producePlan.vue';
|
|
|
+
|
|
|
+ import detail from './components/detail.vue';
|
|
|
+ import { getList, del, submit } from '@/api/materialPlan/index';
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ planEditDialog,
|
|
|
+
|
|
|
+ materialPlanSearch,
|
|
|
+ detail,
|
|
|
+ producePlan
|
|
|
+ },
|
|
|
|
|
|
- {
|
|
|
- prop: 'createUserName',
|
|
|
- label: '创建人',
|
|
|
- align: 'center'
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeName: 'first',
|
|
|
+
|
|
|
+ // 加载状态
|
|
|
+ loading: false,
|
|
|
+
|
|
|
+ statusOpt: {
|
|
|
+ first: [
|
|
|
+ { label: '所有状态', value: null },
|
|
|
+ { label: '待排产', value: '1' },
|
|
|
+ { label: '待发布', value: '2' },
|
|
|
+ { label: '发布失败', value: '3' },
|
|
|
+ { label: '已完成', value: '6' }
|
|
|
+ ]
|
|
|
},
|
|
|
- {
|
|
|
- prop: 'createTime',
|
|
|
- label: '创建时间',
|
|
|
- align: 'center',
|
|
|
|
|
|
- },
|
|
|
- {
|
|
|
- columnKey: 'action',
|
|
|
- label: '操作',
|
|
|
- width: 250,
|
|
|
- align: 'center',
|
|
|
- resizable: false,
|
|
|
- fixed: 'right',
|
|
|
- slot: 'action'
|
|
|
+ approvalStatusOpt: {
|
|
|
+ first: [
|
|
|
+ { label: '未提交', value: '0' },
|
|
|
+ { label: '审核中', value: '1' },
|
|
|
+ { label: '审核通过', value: '2' },
|
|
|
+ { label: '审核未通过', value: '3' }
|
|
|
+ ]
|
|
|
}
|
|
|
- ];
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- statusFormatter(status) {
|
|
|
- const obj = this.statusOpt[this.activeName].find(
|
|
|
- (i) => i.value == status
|
|
|
- );
|
|
|
-
|
|
|
- return obj && obj.label;
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 表格列配置
|
|
|
+ columns() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ type: 'index',
|
|
|
+ width: 55,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ slot: 'name',
|
|
|
+ prop: 'name',
|
|
|
+ label: '计划名称',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'code',
|
|
|
+ label: '计划编号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ columnKey: 'status',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'status',
|
|
|
+ action: 'status'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'approvalStatus',
|
|
|
+ label: '审批状态',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'approvalStatus',
|
|
|
+ action: 'approvalStatus'
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ prop: 'createUserName',
|
|
|
+ label: '创建人',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'createTime',
|
|
|
+ label: '创建时间',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ columnKey: 'action',
|
|
|
+ label: '操作',
|
|
|
+ width: 250,
|
|
|
+ align: 'center',
|
|
|
+ resizable: false,
|
|
|
+ fixed: 'right',
|
|
|
+ slot: 'action'
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
},
|
|
|
+ methods: {
|
|
|
+ statusFormatter(status) {
|
|
|
+ const obj = this.statusOpt[this.activeName].find(
|
|
|
+ (i) => i.value == status
|
|
|
+ );
|
|
|
|
|
|
- approvalStatusFormatter(status) {
|
|
|
- const obj = this.approvalStatusOpt[this.activeName].find(
|
|
|
- (i) => i.value == status
|
|
|
- );
|
|
|
+ return obj && obj.label;
|
|
|
+ },
|
|
|
|
|
|
- return obj && obj.label;
|
|
|
- },
|
|
|
- /* 表格数据源 */
|
|
|
- datasource({ page, limit, where }) {
|
|
|
- where.type = 1
|
|
|
- return getList({
|
|
|
- pageNum: page,
|
|
|
- size: limit,
|
|
|
- ...where
|
|
|
- });
|
|
|
- },
|
|
|
- handleEdit(type, row) {
|
|
|
- this.$refs.planEditDialogRef.open(type, row);
|
|
|
- },
|
|
|
- handleDel({ id }) {
|
|
|
- this.$confirm('确认删除当前数据!', '提示').then(async () => {
|
|
|
- await del([id]);
|
|
|
- this.$message.success('删除成功!');
|
|
|
- this.reload();
|
|
|
- });
|
|
|
- },
|
|
|
+ approvalStatusFormatter(status) {
|
|
|
+ const obj = this.approvalStatusOpt[this.activeName].find(
|
|
|
+ (i) => i.value == status
|
|
|
+ );
|
|
|
|
|
|
- todo(row) {
|
|
|
- submit({ businessId: row.id }).then(res => {
|
|
|
- if (res) {
|
|
|
- this.$message.success('提交成功!');
|
|
|
+ return obj && obj.label;
|
|
|
+ },
|
|
|
+ /* 表格数据源 */
|
|
|
+ datasource({ page, limit, where }) {
|
|
|
+ where.type = 1;
|
|
|
+ return getList({
|
|
|
+ pageNum: page,
|
|
|
+ size: limit,
|
|
|
+ ...where
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleEdit(type, row) {
|
|
|
+ this.$refs.planEditDialogRef.open(type, row);
|
|
|
+ },
|
|
|
+ handleDel({ id }) {
|
|
|
+ this.$confirm('确认删除当前数据!', '提示').then(async () => {
|
|
|
+ await del([id]);
|
|
|
+ this.$message.success('删除成功!');
|
|
|
this.reload();
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ handleClick(tab) {
|
|
|
+ if(tab == 1) {
|
|
|
+ this.handleEdit('add')
|
|
|
+
|
|
|
}
|
|
|
- })
|
|
|
- },
|
|
|
+ else if(tab == 2){
|
|
|
+ this.produceAdd('add')
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- handleTabChange() {
|
|
|
- this.$refs.searchRef.reset();
|
|
|
- },
|
|
|
+ todo(row) {
|
|
|
+ submit({ businessId: row.id }).then((res) => {
|
|
|
+ if (res) {
|
|
|
+ this.$message.success('提交成功!');
|
|
|
+ this.reload();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- produceAdd(type, row) {
|
|
|
- this.$refs.produceRef.open(type, row);
|
|
|
- },
|
|
|
+ handleTabChange() {
|
|
|
+ this.$refs.searchRef.reset();
|
|
|
+ },
|
|
|
|
|
|
- /* 刷新表格 */
|
|
|
- reload(where = {}) {
|
|
|
- if(where.statusList) {
|
|
|
- console.log(where.statusList)
|
|
|
- where.statusList = where.statusList.split(',')
|
|
|
- }
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
- });
|
|
|
- },
|
|
|
+ produceAdd(type, row) {
|
|
|
+ this.$refs.produceRef.open(type, row);
|
|
|
+ },
|
|
|
|
|
|
- handleDetails(row) {
|
|
|
- if (row.status == 0) {
|
|
|
- this.$message.info('未提交没有审核流程')
|
|
|
- } else {
|
|
|
- this.$refs.detailRef.open(row.processInstanceId);
|
|
|
- }
|
|
|
+ /* 刷新表格 */
|
|
|
+ reload(where = {}) {
|
|
|
+ if (where.statusList) {
|
|
|
+ console.log(where.statusList);
|
|
|
+ where.statusList = where.statusList.split(',');
|
|
|
+ }
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
+ handleDetails(row) {
|
|
|
+ if (row.status == 0) {
|
|
|
+ this.$message.info('未提交没有审核流程');
|
|
|
+ } else {
|
|
|
+ this.$refs.detailRef.open(row.processInstanceId);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped></style>
|