parent
0e56ce0516
commit
5e98f0f915
@ -0,0 +1,159 @@ |
||||
<script setup> |
||||
import { reactive } from 'vue' |
||||
import { iprogressList, iprogressAdd, iprogressUpdate, iprogressDelete, iprogressGetById, iproductionplanList } from './api' |
||||
import { baseModelOptions, baseFilterOptions } from './options' |
||||
const currentTime = new Date(); |
||||
const year = currentTime.getFullYear(); |
||||
const month = String(currentTime.getMonth() + 1).padStart(2, '0'); |
||||
const day = String(currentTime.getDate()).padStart(2, '0'); |
||||
const formattedTime = `${year}-${month}-${day}`; |
||||
const { proxy } = getCurrentInstance(); |
||||
const table = ref() |
||||
const state = reactive({ |
||||
baseModelOptions: baseModelOptions(), |
||||
baseFilterOptions: baseFilterOptions(), |
||||
title: "进度跟踪管理", |
||||
baseModelName: '进度跟踪信息', |
||||
addBtnName: '新增进度跟踪', |
||||
editBtnName: '', |
||||
delBtnName: '', |
||||
primaryKey: 'id', |
||||
getTableFn: iprogressList, |
||||
addFn: iprogressAdd, |
||||
editFn: iprogressUpdate, |
||||
deleteFn: iprogressDelete, |
||||
detailFn: iprogressGetById, |
||||
rowKey: 'id', |
||||
showEditBtn: false, |
||||
showDeleteBtn: false, |
||||
columnCount: 1, |
||||
// rowControl: { |
||||
// showEditBtn: false, |
||||
// showDelBtn: false |
||||
// }, |
||||
permission: {//菜单管理中添加权限 |
||||
add: 'progressTracking:page:list', |
||||
edit: 'progressTracking:page:list', |
||||
delete: 'progressTracking:page:list', |
||||
detail: 'progressTracking:page:list', |
||||
}, |
||||
hideselection: true, |
||||
pageInfo: { total: 0, base: { limit: 8, current: 1 } }, |
||||
baseQuery: { processDate: formattedTime }, |
||||
beforeSubmit: function (params) { |
||||
let child = proxy.getNameById(state.planList, params.planId, 'id') |
||||
if (!params.parentId) params.parentId = 0 |
||||
params.planName = child.planName |
||||
return params |
||||
}, |
||||
planList: [], |
||||
handleAdd: function (params) { |
||||
getPlanList().then(() => { |
||||
table.value.handleAdd() |
||||
}) |
||||
}, |
||||
beforeEdit: function (params) { |
||||
if (params.parentId == 0) params.parentId = ' ' |
||||
return new Promise((resolve) => { |
||||
getPlanList().then(() => { |
||||
resolve(params) |
||||
}) |
||||
}) |
||||
}, |
||||
}) |
||||
onMounted(() => { |
||||
getPlanList() |
||||
}) |
||||
function getPlanList(params) { |
||||
return new Promise(async (resolve) => { |
||||
await iproductionplanList({ pageNo: 1, pageSize: 9999 }).then((res) => { |
||||
if (res.code == 200) { |
||||
state.planList = res.data.list |
||||
state.baseModelOptions = proxy.$util.setOptions({ |
||||
attrName: 'data',//树形 |
||||
data: state.baseModelOptions, //待赋值数据源 |
||||
key: "planId", //配置项的key |
||||
res: res, //返回结果 |
||||
path: res.data.list, |
||||
relation: { key: 'value', name: 'label', resKey: 'id', resName: 'planName' }, |
||||
everClear: true, |
||||
hasChildren: true, |
||||
}); |
||||
state.baseFilterOptions = proxy.$util.setOptions({ |
||||
attrName: 'data',//树形 |
||||
data: state.baseFilterOptions, //待赋值数据源 |
||||
key: "planId", //配置项的key |
||||
res: res, //返回结果 |
||||
path: res.data.list, |
||||
relation: { key: 'value', name: 'label', resKey: 'id', resName: 'planName' }, |
||||
everClear: true, |
||||
hasChildren: true, |
||||
}); |
||||
} |
||||
}) |
||||
await iprogressList({ 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" /> |
||||
<el-table-column label="日期" align="center" prop="processDate" /> |
||||
<el-table-column label="当日完成进度 " align="center" prop="dayProgress"> |
||||
<template #default="scope"> |
||||
<el-progress :stroke-width="6" :percentage="Number(scope.row.dayProgress)" /> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column label="累计完成进度" align="center" prop="accumulativeProgress"> |
||||
<template #default="scope"> |
||||
<el-progress :stroke-width="6" :percentage="Number(scope.row.accumulativeProgress)" /> |
||||
</template> |
||||
</el-table-column> |
||||
<!-- <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="['progressTracking:page:add']" type="text" icon="Plus" |
||||
@click="handAdd(scope.row)"> |
||||
新增 |
||||
</el-button> |
||||
<el-button v-hasPermi="['progressTracking:page:edit']" type="text" icon="EditPen" |
||||
@click="baseScope.handleEdit(scope.$index, scope.row)"> |
||||
修改 |
||||
</el-button> |
||||
<el-button v-hasPermi="['progressTracking: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> |
Loading…
Reference in new issue