|
@@ -1,12 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<div class="ele-body">
|
|
<div class="ele-body">
|
|
|
<el-card shadow="never" v-loading="loading">
|
|
<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>
|
|
</materialPlan-search>
|
|
|
|
|
|
|
|
<el-tabs v-model="activeName" type="card">
|
|
<el-tabs v-model="activeName" type="card">
|
|
@@ -14,24 +9,12 @@
|
|
|
<el-tab-pane label="生产配料计划" name="second"></el-tab-pane>
|
|
<el-tab-pane label="生产配料计划" name="second"></el-tab-pane>
|
|
|
</el-tabs>
|
|
</el-tabs>
|
|
|
<!-- 数据表格 -->
|
|
<!-- 数据表格 -->
|
|
|
- <ele-pro-table
|
|
|
|
|
- ref="table"
|
|
|
|
|
- :key="activeName"
|
|
|
|
|
- :initLoad="false"
|
|
|
|
|
- :columns="columns"
|
|
|
|
|
- :datasource="datasource"
|
|
|
|
|
- :cache-key="`${activeName}materialPlanTable`"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <ele-pro-table ref="table" :key="activeName" :initLoad="false" :columns="columns" :datasource="datasource"
|
|
|
|
|
+ :cache-key="`${activeName}materialPlanTable`">
|
|
|
<template v-slot:toolbar>
|
|
<template v-slot:toolbar>
|
|
|
- <el-button type="primary" @click="handleEdit('add')"
|
|
|
|
|
- >创建计划</el-button
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-button type="primary" @click="handleEdit('add')">创建计划</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
- <template v-slot:code="{ row }">
|
|
|
|
|
-
|
|
|
|
|
- {{ row.code }}
|
|
|
|
|
|
|
|
|
|
- </template>
|
|
|
|
|
<template v-slot:status="{ row }">
|
|
<template v-slot:status="{ row }">
|
|
|
<span :class="{ 'ele-text-danger': row.status == 3 }">
|
|
<span :class="{ 'ele-text-danger': row.status == 3 }">
|
|
|
{{ statusFormatter(row.status) }}
|
|
{{ statusFormatter(row.status) }}
|
|
@@ -39,38 +22,12 @@
|
|
|
</template>
|
|
</template>
|
|
|
<!-- 操作列 -->
|
|
<!-- 操作列 -->
|
|
|
<template v-slot:action="{ row }">
|
|
<template v-slot:action="{ row }">
|
|
|
- <el-link
|
|
|
|
|
- type="primary"
|
|
|
|
|
- :underline="false"
|
|
|
|
|
- icon="el-icon-truck"
|
|
|
|
|
- v-if="row.status == 2"
|
|
|
|
|
- @click="handleOrderPublish(1, row)"
|
|
|
|
|
- >
|
|
|
|
|
- 发布工单
|
|
|
|
|
- </el-link>
|
|
|
|
|
- <el-link
|
|
|
|
|
- type="primary"
|
|
|
|
|
- v-if="row.status == 3"
|
|
|
|
|
- :underline="false"
|
|
|
|
|
- icon="el-icon-truck"
|
|
|
|
|
- @click="handleOrderPublish(2, row)"
|
|
|
|
|
- >
|
|
|
|
|
- 重新发布
|
|
|
|
|
- </el-link>
|
|
|
|
|
- <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>
|
|
|
- <el-link
|
|
|
|
|
- type="primary"
|
|
|
|
|
- @click="handleDel(row)"
|
|
|
|
|
- :underline="false"
|
|
|
|
|
- icon="el-icon-edit"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <el-link @click="handleDel(row)" type="danger" :underline="false" icon="el-icon-delete">
|
|
|
删除
|
|
删除
|
|
|
</el-link>
|
|
</el-link>
|
|
|
</template>
|
|
</template>
|
|
@@ -81,215 +38,144 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
- import materialPlanSearch from './components/materialPlan-search.vue';
|
|
|
|
|
- import planEditDialog from './components/plan-edit-dialog.vue';
|
|
|
|
|
- import { getList, del } from '@/api/materialPlan/index';
|
|
|
|
|
- export default {
|
|
|
|
|
- components: {
|
|
|
|
|
- planEditDialog,
|
|
|
|
|
- materialPlanSearch
|
|
|
|
|
- },
|
|
|
|
|
|
|
+import materialPlanSearch from './components/materialPlan-search.vue';
|
|
|
|
|
+import planEditDialog from './components/plan-edit-dialog.vue';
|
|
|
|
|
+import { getList, del } from '@/api/materialPlan/index';
|
|
|
|
|
+export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ planEditDialog,
|
|
|
|
|
+ materialPlanSearch
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ data() {
|
|
|
|
|
+ return {
|
|
|
|
|
+ activeName: 'first',
|
|
|
|
|
+
|
|
|
|
|
+ // 加载状态
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ pageType: 'add',
|
|
|
|
|
+ dialogTitle: '',
|
|
|
|
|
+ isBindPlan: false,
|
|
|
|
|
+ statusOpt: {
|
|
|
|
|
+ first: [
|
|
|
|
|
+ { label: '所有状态', value: '3,2' },
|
|
|
|
|
+ { label: '待发布', value: '2' },
|
|
|
|
|
+ { label: '发布失败', value: '3' }
|
|
|
|
|
+ ],
|
|
|
|
|
+ second: [
|
|
|
|
|
+ { label: '所有状态', value: '7,4,5,6' },
|
|
|
|
|
+ { label: '待生产', value: '4' },
|
|
|
|
|
+ { label: '生产中', value: '5' },
|
|
|
|
|
+ { label: '已完成', value: '6' },
|
|
|
|
|
+ { label: '已延期', value: '7' }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ },
|
|
|
|
|
+ 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',
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- data() {
|
|
|
|
|
- return {
|
|
|
|
|
- activeName: 'first',
|
|
|
|
|
|
|
|
|
|
- // 加载状态
|
|
|
|
|
- loading: false,
|
|
|
|
|
- pageType: 'add',
|
|
|
|
|
- dialogTitle: '',
|
|
|
|
|
- isBindPlan: false,
|
|
|
|
|
- statusOpt: {
|
|
|
|
|
- first: [
|
|
|
|
|
- { label: '所有状态', value: '3,2' },
|
|
|
|
|
- { label: '待发布', value: '2' },
|
|
|
|
|
- { label: '发布失败', value: '3' }
|
|
|
|
|
- ],
|
|
|
|
|
- second: [
|
|
|
|
|
- { label: '所有状态', value: '7,4,5,6' },
|
|
|
|
|
- { label: '待生产', value: '4' },
|
|
|
|
|
- { label: '生产中', value: '5' },
|
|
|
|
|
- { label: '已完成', value: '6' },
|
|
|
|
|
- { label: '已延期', value: '7' }
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ columnKey: 'status',
|
|
|
|
|
+ label: '状态',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ slot: 'status',
|
|
|
|
|
+ action: 'status'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'createUserName',
|
|
|
|
|
+ label: '创建人',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ prop: 'createTime',
|
|
|
|
|
+ label: '创建时间',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ columnKey: 'action',
|
|
|
|
|
+ label: '操作',
|
|
|
|
|
+ width: 250,
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ resizable: false,
|
|
|
|
|
+ fixed: 'right',
|
|
|
|
|
+ slot: 'action'
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
- },
|
|
|
|
|
- computed: {
|
|
|
|
|
- // 表格列配置
|
|
|
|
|
- columns() {
|
|
|
|
|
- return [
|
|
|
|
|
- {
|
|
|
|
|
- columnKey: 'index',
|
|
|
|
|
- label: '序号',
|
|
|
|
|
- type: 'index',
|
|
|
|
|
- width: 55,
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- fixed: 'left'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- slot: 'code',
|
|
|
|
|
- prop: 'code',
|
|
|
|
|
- action: 'code',
|
|
|
|
|
- label: '计划编号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- width: 200
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'materialCode',
|
|
|
|
|
- label: '编号',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- width: 150
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'materialName',
|
|
|
|
|
- label: '物料名称',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
|
|
- minWidth: 110
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'brandNo',
|
|
|
|
|
- label: '牌号',
|
|
|
|
|
- align: 'center'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'num',
|
|
|
|
|
- label:
|
|
|
|
|
- this.activeName === 'second'
|
|
|
|
|
- ? '计划生产重量(KG)'
|
|
|
|
|
- : '生产重量(KG)',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
|
|
- minWidth: 150
|
|
|
|
|
- },
|
|
|
|
|
- ...(this.activeName === 'second'
|
|
|
|
|
- ? [
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'producedWeight',
|
|
|
|
|
- label: '已生产重量(KG)',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
|
|
- minWidth: 150
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- : []),
|
|
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ statusFormatter(status) {
|
|
|
|
|
+ const obj = this.statusOpt[this.activeName].find(
|
|
|
|
|
+ (i) => i.value == status
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'deliveryTime',
|
|
|
|
|
- label: '要求交付日期',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
|
|
- minWidth: 110
|
|
|
|
|
- },
|
|
|
|
|
- ...(this.activeName === 'second'
|
|
|
|
|
- ? [
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'completeTime',
|
|
|
|
|
- label: '实际完成时间',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- showOverflowTooltip: true,
|
|
|
|
|
- minWidth: 110
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- : []),
|
|
|
|
|
- {
|
|
|
|
|
- columnKey: 'status',
|
|
|
|
|
- label: '状态',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- slot: 'status',
|
|
|
|
|
- action: 'status'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'createUserName',
|
|
|
|
|
- label: '创建人',
|
|
|
|
|
- align: 'center'
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'createTime',
|
|
|
|
|
- label: '创建时间',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- width: 160
|
|
|
|
|
- },
|
|
|
|
|
- ...(this.activeName === 'second'
|
|
|
|
|
- ? [
|
|
|
|
|
- {
|
|
|
|
|
- prop: 'releaseTime',
|
|
|
|
|
- label: '发布时间',
|
|
|
|
|
- align: 'center'
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- : []),
|
|
|
|
|
- ...(this.activeName === 'first'
|
|
|
|
|
- ? [
|
|
|
|
|
- {
|
|
|
|
|
- columnKey: 'action',
|
|
|
|
|
- label: '操作',
|
|
|
|
|
- width: 250,
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- resizable: false,
|
|
|
|
|
- fixed: 'right',
|
|
|
|
|
- slot: 'action'
|
|
|
|
|
- }
|
|
|
|
|
- ]
|
|
|
|
|
- : [])
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+ return obj && obj.label;
|
|
|
|
|
+ },
|
|
|
|
|
+ /* 表格数据源 */
|
|
|
|
|
+ datasource({ page, limit, where, order }) {
|
|
|
|
|
+ return getList({
|
|
|
|
|
+ pageNum: page,
|
|
|
|
|
+ size: limit,
|
|
|
|
|
+ ...where
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+ handleEdit(type, row) {
|
|
|
|
|
+ if (this.activeName == 'first') {
|
|
|
|
|
+ this.$refs.planEditDialogRef.open(type, row);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ handleDel({ id }) {
|
|
|
|
|
+ this.$confirm('确认删除当前数据!', '提示').then(async () => {
|
|
|
|
|
+ await del([id]);
|
|
|
|
|
+ this.$message.success('删除成功!');
|
|
|
|
|
+ this.reload();
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
- methods: {
|
|
|
|
|
- statusFormatter(status) {
|
|
|
|
|
- const obj = this.statusOpt[this.activeName].find(
|
|
|
|
|
- (i) => i.value == status
|
|
|
|
|
- );
|
|
|
|
|
|
|
|
|
|
- return obj && obj.label;
|
|
|
|
|
- },
|
|
|
|
|
- /* 表格数据源 */
|
|
|
|
|
- datasource({ page, limit, where, order }) {
|
|
|
|
|
- return getList({
|
|
|
|
|
- pageNum: page,
|
|
|
|
|
- size: limit,
|
|
|
|
|
- ...where
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- handleEdit(type, row) {
|
|
|
|
|
- if(this.activeName == 'first') {
|
|
|
|
|
- this.$refs.planEditDialogRef.open(type, row);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- },
|
|
|
|
|
- handleDel({ id }) {
|
|
|
|
|
- this.$confirm('确认删除当前数据!', '提示').then(async () => {
|
|
|
|
|
- await del([id]);
|
|
|
|
|
- this.$message.success('删除成功!');
|
|
|
|
|
- this.reload();
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- // 发布工单
|
|
|
|
|
- handleOrderPublish(type, row) {
|
|
|
|
|
- this.$router.push({
|
|
|
|
|
- path: '/materialPlan/workOrderPublish',
|
|
|
|
|
- query: {
|
|
|
|
|
- type,
|
|
|
|
|
- id: row.id
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- handleTabChange() {
|
|
|
|
|
- this.$refs.searchRef.reset();
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ handleTabChange() {
|
|
|
|
|
+ this.$refs.searchRef.reset();
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
- /* 刷新表格 */
|
|
|
|
|
- reload(where = {}) {
|
|
|
|
|
- where.statusList = this.statusOpt[this.activeName][0].value.split(',');
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- this.$refs.table.reload({ page: 1, where });
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ /* 刷新表格 */
|
|
|
|
|
+ reload(where = {}) {
|
|
|
|
|
+ where.statusList = this.statusOpt[this.activeName][0].value.split(',');
|
|
|
|
|
+ this.$nextTick(() => {
|
|
|
|
|
+ this.$refs.table.reload({ page: 1, where });
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
- };
|
|
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped></style>
|
|
<style lang="scss" scoped></style>
|