中航光电热表web
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

431 lines
11 KiB

<template>
<div>
<avue-crud
:option="option"
:table-loading="loading"
:data="data"
v-model="form"
v-model:page="page"
v-model:search="query"
ref="crud"
@row-del="rowDel"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@current-change="currentChange"
@size-change="sizeChange"
@refresh-change="refreshChange"
@on-load="onLoad"
>
<template #menu-left> </template>
<template #menu-right> </template>
<template #menu="{ row }"> </template>
<template #tiqiankaigong="scope">
<el-button type="text" @click="toDetail(scope.row,'提前开工')">{{ scope.row.tiqiankaigong }}</el-button>
</template>
<template #zhunshikaigong="scope">
<el-button type="text" @click="toDetail(scope.row,'准时开工')">{{ scope.row.zhunshikaigong }}</el-button>
</template>
<template #yanchikaigong="scope">
<el-button type="text" @click="toDetail(scope.row,'延迟开工')">{{ scope.row.yanchikaigong }}</el-button>
</template>
<template #tiqianwangong="scope">
<el-button type="text" @click="toDetail(scope.row,'提前完工')">{{ scope.row.tiqianwangong }}</el-button>
</template>
<template #zhunshiwangong="scope">
<el-button type="text" @click="toDetail(scope.row,'准时完工')">{{ scope.row.zhunshiwangong }}</el-button>
</template>
<template #yanchiwangong="scope">
<el-button type="text" @click="toDetail(scope.row,'延迟完工')">{{ scope.row.yanchiwangong }}</el-button>
</template>
</avue-crud>
</div>
</template>
<script>
// import {
// getListPersonAbility,
// removePersonAbility,
// addPersonAbility,
// updatePersonAbility,
// } from '@/api/productionSchedulingPlan/scheduling';
export default {
components: {},
data() {
return {
form: {},
selectionList: [],
query: {},
loading: true,
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
option: {
columnSort: true,
tip: false,
height: 'auto',
calcHeight: 32,
simplePage: false,
searchShow: true,
searchMenuSpan: 6,
searchIcon: true,
searchIndex: 3,
tree: false,
border: true,
index: true,
selection: false,
addBtn: false,
editBtn: false,
viewBtn: false,
delBtn: false,
editBtnText: '修改',
labelWidth: 120,
menuWidth: 80,
dialogWidth: 900,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
filterBtn: true,
searchShowBtn: false,
excelBtn: true,
showOverflowTooltip: true,
addBtnIcon: ' ',
viewBtnIcon: ' ',
delBtnIcon: ' ',
editBtnIcon: ' ',
gridBtn: false,
searchLabelPosition: 'left',
searchGutter: 24,
searchSpan: 6,
menuAlign: 'left',
gridBtn: false,
searchMenuPosition: 'right',
align: 'center',
menu: false,
header: false,
column: [
{
label: '作业中心',
prop: 'workCenterName',
search: false,
sortable: true,
span: 12,
},
{
label: '作业中心',
prop: 'workCenterId',
search: true,
hide: true,
sortable: true,
span: 12,
width: 120,
searchOrder: 19,
type: 'select',
filterable: true,
dicUrl: '/blade-scheduling/workCenter/findList',
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
props: {
label: 'wcName',
value: 'id',
},
change: val => {
this.onChangeData(val.item, 'workCenterId');
},
},
{
label: '工艺能力',
prop: 'craftName',
search: false,
sortable: true,
width: 150,
span: 12,
searchOrder: 17,
},
{
label: '工艺能力',
prop: 'craftId',
hide: true,
search: true,
sortable: true,
span: 12,
width: 120,
searchOrder: 17,
type: 'select',
filterable: true,
dicUrl: '/blade-scheduling/craftAbility/findList',
props: {
label: 'caName',
value: 'id',
},
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
change: val => {
this.onChangeData(val.item, 'craftId');
},
},
{
label: '工序',
prop: 'processName',
search: false,
sortable: true,
width: 150,
span: 12,
searchOrder: 16,
},
{
label: '工序',
prop: 'processId',
search: true,
sortable: true,
hide: true,
span: 12,
searchOrder: 16,
type: 'select',
filterable: true,
dicUrl: '/blade-scheduling/processSet/findList',
props: {
label: 'name',
value: 'id',
},
rules: [
{
required: true,
message: '请选择',
trigger: 'blur',
},
],
change: (val, row) => {
this.onChangeData(val.item, 'processId');
},
},
{
label: '车间订单数量',
prop: 'partName',
search: false,
sortable: true,
span: 12,
searchLabelWidth: 'auto',
},
{
label: '准时偏差(±分钟)',
prop: 'zhunshipiancha',
search: true,
sortable: true,
span: 12,
searchLabelWidth: 'auto',
hide: true,
type: 'number',
},
{
label: '提前开工',
prop: 'tiqiankaigong',
search: false,
sortable: true,
span: 12,
},
{
label: '准时开工',
prop: 'zhunshikaigong',
search: false,
sortable: true,
span: 12,
},
{
label: '延迟开工',
prop: 'yanchikaigong',
search: false,
sortable: true,
span: 12,
},
{
label: '提前完工',
prop: 'tiqianwangong',
search: false,
sortable: true,
span: 12,
},
{
label: '准时完工',
prop: 'zhunshiwangong',
search: false,
sortable: true,
span: 12,
},
{
label: '延迟完工',
prop: 'yanchiwangong',
search: false,
sortable: true,
span: 12,
},
{
label: '工序完成时间',
prop: 'cycledate',
search: true,
sortable: true,
hide: true,
span: 12,
type: 'date',
searchLabelWidth: 'auto',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
format: 'YYYY-MM-DD',
valueFormat: 'YYYY-MM-DD',
searchRange: true,
searchOrder: 20,
},
],
},
data: [],
};
},
mounted() {
// 设置默认时间范围为最近七天
const today = new Date();
const threeDaysAgo = new Date(today);
threeDaysAgo.setDate(today.getDate() - 7);
this.query.cycledate = [this.formatDate(threeDaysAgo), this.formatDate(today)];
},
methods: {
onChangeData() {},
toDetail(row,type){
this.$emit('toDetail',row,type,'工序')
},
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
rowSave(row, done, loading) {
// addPersonAbility(row).then(
// () => {
// this.onLoad(this.page);
// this.$message({
// type: 'success',
// message: '操作成功!',
// });
// done();
// },
// error => {
// window.console.log(error);
// loading();
// }
// );
},
rowUpdate(row, index, done, loading) {
// updatePersonAbility(row).then(
// () => {
// this.onLoad(this.page);
// this.$message({
// type: 'success',
// message: '操作成功!',
// });
// done();
// },
// error => {
// window.console.log(error);
// loading();
// }
// );
},
rowDel(row) {
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(() => {
// return removePersonAbility(row.id);
})
.then(() => {
this.onLoad(this.page);
this.$message({
type: 'success',
message: '操作成功!',
});
});
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
selectionChange(list) {
this.selectionList = list;
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
},
refreshChange() {
this.onLoad(this.page, this.query);
},
handleChange(file, fileList) {
// proxy.$Export.xlsx(file.raw).then((data) => {
// data.value = data.results;
// });
this.$message({
type: 'success',
message: '操作成功!',
});
},
onLoad(page, params = {}) {
this.loading = false;
if (!!params.cycledate) {
this.query.startTime = params.cycledate[0];
this.query.endTime = params.cycledate[1];
}
this.data = [
{
id: '1',
zhunshikaigong: '20%',
zhunshiwangong: '30%',
tiqianwangong: '40%',
tiqiankaigong: '50%',
yanchikaigong: '60%',
yanchiwangong: '80%',
},
];
// getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
// this.data = res.data.data.records;
// this.loading = false;
// this.page.total = res.data.data.total;
// this.selectionClear();
// });
},
},
};
</script>