|
|
|
<script setup>
|
|
|
|
import { nextTick, onMounted, reactive } from 'vue'
|
|
|
|
import { iproductionplanList, iproductionplanAdd, iproductionplanUpdate, iproductionplanDelete, iproductionplanGetById } from './api'
|
|
|
|
import { baseModelOptions, baseFilterOptions } from './options'
|
|
|
|
|
|
|
|
const { proxy } = getCurrentInstance();
|
|
|
|
const table = ref()
|
|
|
|
const state = reactive({
|
|
|
|
baseModelOptions: baseModelOptions(),
|
|
|
|
baseFilterOptions: baseFilterOptions(),
|
|
|
|
title: "生产计划管理",
|
|
|
|
baseModelName: '生产计划信息',
|
|
|
|
editBtnName: '',
|
|
|
|
delBtnName: '',
|
|
|
|
primaryKey: 'id',
|
|
|
|
getTableFn: iproductionplanList,
|
|
|
|
addFn: iproductionplanAdd,
|
|
|
|
editFn: iproductionplanUpdate,
|
|
|
|
deleteFn: iproductionplanDelete,
|
|
|
|
detailFn: iproductionplanGetById,
|
|
|
|
showEditBtn: false,
|
|
|
|
showDeleteBtn: false,
|
|
|
|
columnCount: 1,
|
|
|
|
addBtnName: "新增计划",
|
|
|
|
// rowControl: {
|
|
|
|
// showEditBtn: false,
|
|
|
|
// showDelBtn: false
|
|
|
|
// },
|
|
|
|
permission: {//菜单管理中添加权限
|
|
|
|
add: 'productionPlan:page:list',
|
|
|
|
edit: 'productionPlan:page:list',
|
|
|
|
delete: 'productionPlan:page:list',
|
|
|
|
detail: 'productionPlan:page:list',
|
|
|
|
},
|
|
|
|
hideselection: true,
|
|
|
|
rowKey: 'id',
|
|
|
|
pageInfo: { total: 0, base: { limit: 8, current: 1 } },
|
|
|
|
beforeEdit: function (params) {
|
|
|
|
if (params.parentId == 0) params.parentId = ' '
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
getPlanList().then(() => {
|
|
|
|
resolve(params)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeSubmit: function (params) {
|
|
|
|
if (!params.parentId) params.parentId = 0
|
|
|
|
return params
|
|
|
|
},
|
|
|
|
handleAdd: function (params) {
|
|
|
|
getPlanList().then(() => {
|
|
|
|
table.value.handleAdd()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
|
|
|
onMounted(() => {
|
|
|
|
|
|
|
|
})
|
|
|
|
function getPlanList(params) {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
iproductionplanList({ pageNo: 1, pageSize: 9999 }).then((res) => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
state.baseModelOptions = proxy.$util.setOptions({
|
|
|
|
attrName: 'data',//树形
|
|
|
|
data: state.baseModelOptions, //待赋值数据源
|
|
|
|
key: "parentId", //配置项的key
|
|
|
|
res: res, //返回结果
|
|
|
|
path: res.data.list,
|
|
|
|
relation: { key: 'value', name: 'label', resKey: 'id', resName: 'planName' },
|
|
|
|
everClear: true,
|
|
|
|
hasChildren: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
resolve(params)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
function handAdd(item) {
|
|
|
|
state.handleAdd()
|
|
|
|
nextTick(() => {
|
|
|
|
table.value.modelRef.setValueByKey('parentId', item.id)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="app-container">
|
|
|
|
<BaseTablePage :tableOptions="state" ref="table">
|
|
|
|
<template v-slot:column>
|
|
|
|
<el-table-column label="计划名称" align="center" prop="planName" width="150" />
|
|
|
|
<el-table-column label="项目阶段" align="center" prop="projectStage" />
|
|
|
|
<el-table-column label="计划描述" align="center" prop="description" />
|
|
|
|
<el-table-column label="计划开始时间" align="center" prop="startTime" />
|
|
|
|
<el-table-column label="计划结束时间" align="center" prop="endTime" />
|
|
|
|
<el-table-column label="总工期(天)" align="center" prop="duration" />
|
|
|
|
<el-table-column label="关键节点时间" align="center" prop="keystageTime" />
|
|
|
|
<el-table-column label="计划负责人" align="center" prop="principal" />
|
|
|
|
<el-table-column label="创建人" align="center" prop="creator" />
|
|
|
|
<el-table-column label="创建时间" align="center" prop="createTime" />
|
|
|
|
</template>
|
|
|
|
<template #control="baseScope">
|
|
|
|
<el-table-column label="操作" align="center" width="200" fixed="right">
|
|
|
|
<template #default="scope">
|
|
|
|
<el-button v-if="scope.row.parentId==0" v-hasPermi="['productionPlan:page:add']" type="text" icon="Plus" @click="handAdd(scope.row)">
|
|
|
|
新增
|
|
|
|
</el-button>
|
|
|
|
<el-button v-hasPermi="['productionPlan:page:edit']" type="text" icon="EditPen"
|
|
|
|
@click="baseScope.handleEdit(scope.$index, scope.row)">
|
|
|
|
修改
|
|
|
|
</el-button>
|
|
|
|
<el-button v-hasPermi="['productionPlan:page:remove']" type="text" icon="Delete"
|
|
|
|
@click="baseScope.deleteTableData(scope.$index, scope.row)">删除</el-button>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</template>
|
|
|
|
</BaseTablePage>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style scoped></style>
|