外协特殊过程表与任务单

dev-scheduling
姜雪 4 weeks ago
parent 47d096ad02
commit 6179ccc32b
  1. 45
      src/api/oem/inplan.js
  2. 159
      src/views/oem/proTask/components/inPlantProcessDetails.vue
  3. 252
      src/views/oem/proTask/components/inPlantProcessHandle.vue
  4. 142
      src/views/oem/proTask/inPlantProcessOem.vue

@ -0,0 +1,45 @@
import request from '@/axios';
export const pageList = (current, size, params) => {
return request({
url: '/blade-desk/mesOemTaskBill/page',
method: 'get',
params: {
...params,
current,
size,
},
});
};
//详情
export const detailItem = (params)=>{
return request({
url: '/blade-desk/dsTaskBill/listOemFillingDetail',
method: 'get',
params: params
});
}
//处理
export const handleOemTaskBillItem = params => {
return request({
url: '/blade-desk/mesOemTaskBill/handleOemTaskBill',
method: 'post',
data: params,
});
};
//删除
export const removeItem = ids => {
return request({
url: '/blade-desk/mesOemTaskBill/remove',
method: 'post',
params: {
ids,
},
});
};

@ -0,0 +1,159 @@
<template>
<el-dialog title="详情" append-to-body :modelValue="openShow" width="40%" @close="closeDialog">
<!-- <avue-form :option="option"></avue-form> -->
<avue-crud :option="option" :table-loading="loading" :data="data" ref="crud" @on-load="onLoad">
<template #menu-left> </template>
<template #menu-right> </template>
<template #menu> </template>
<template #heatTreat> </template>
</avue-crud>
<!-- <template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</template> -->
</el-dialog>
</template>
<script>
import { detailItem} from '@/api/oem/inplan';
// import { getDetail } from '@/api/processManagement/inPlantProcess';
export default {
props: {
showDialog: {
type: Boolean,
default: false,
},
rowData: {
type: Object,
default: () => ({}),
},
},
data() {
return {
openShow: false,
data: [],
loading: false,
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',
header: false,
menu: false,
column: [
{
label: '事项',
prop: 'matter',
search: false,
sortable: true,
span: 12,
},
{
label: '描述',
prop: 'process',
search: false,
sortable: true,
span: 12,
},
],
},
};
},
watch: {
showDialog(newVal) {
this.openShow = newVal;
}
},
mounted() {
this.openShow = this.showDialog;
},
methods: {
closeDialog() {
this.openShow = false;
this.$emit('closeDialog');
},
submit() {
this.$refs.form.validate(async valid => {
if (valid) {
let params = {
id: this.$route.query.id,
approvalStatus: '',
// status: this.option.column[0].value,
// reason: this.option.column[1].value,
};
// updateProcess(params).then((res) => {
// if (res.code == 200) {
// this.$message.success('');
// this.closeDialog();
// }
// });
}
});
},
onLoad() {
this.loading = true;
detailItem({ busId: this.rowData.id }).then(res => {
if (res.data && res.data.code === 200) {
this.data = res.data.data || [];
} else {
this.$message.error(res.data.msg || '获取数据失败');
this.data = [];
}
this.loading = false;
}).catch(error => {
console.error('获取详情数据失败:', error);
this.$message.error('获取数据失败');
this.data = [];
this.loading = false;
});
},
},
};
</script>
<style lang="scss" scoped>
::v-deep(.el-dialog .el-dialog__body) {
padding-bottom: 20px !important;
padding-left: 20px !important;
padding-right: 20px !important;
}
</style>

@ -0,0 +1,252 @@
<template>
<el-dialog title="处理" append-to-body :modelValue="openShow" width="70%" @close="closeDialog">
<!-- 单个 Form 包裹整个表格 -->
<el-form ref="tableForm" :model="form" :rules="formRules" label-width="0px">
<el-form-item label="备注:" label-width="60px">
<el-input v-model="form.fillMemo" type="textarea" :rows="3" style="width:50%" />
</el-form-item>
<div style="margin-bottom: 12px" >
<el-button type="primary" @click="addTable">插入一行</el-button>
<el-button type="danger" @click="delTable">删除选中行</el-button>
</div>
<!-- 全局错误提示 -->
<div v-if="formError" class="error-message" style="color: #f56c6c; margin-bottom: 10px">
{{ formError }}
</div>
<el-table :data="form.tableData" @select="selectChange" border>
<el-table-column type="selection" width="55"></el-table-column>
<!-- 作业中心绑定数组字段 -->
<el-table-column align="center" label="事项">
<template #header>
<span><i style="color: red">*</i>事项</span>
</template>
<template #default="scope">
<!-- prop 格式数组名[索引].字段名 -->
<el-form-item :prop="`tableData[${scope.$index}].matter`" :rules="formRules.matter">
<el-input
v-model="scope.row.matter"
placeholder="请输入"
style="width: 100%"
></el-input>
</el-form-item>
</template>
</el-table-column>
<!-- 描述 -->
<el-table-column align="center" label="描述">
<template #header>
<span><i style="color: red">*</i>描述</span>
</template>
<template #default="scope">
<el-form-item :prop="`tableData[${scope.$index}].process`" :rules="formRules.process">
<el-input
v-model="scope.row.process"
placeholder="请输入"
style="width: 100%"
></el-input>
</el-form-item>
</template>
</el-table-column>
</el-table>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</span>
</template>
</el-dialog>
</template>
<script>
import { handleOemTaskBillItem } from '@/api/oem/inplan';
// import { submitBatchData } from '@/api/processManagement/inPlantProcess.js'; //
export default {
props: {
showDialog: { type: Boolean, default: false },
moldAddMore: { type: Boolean, default: false },
tabPosition: { type: String, default: '' },
rowData: { type: Object, default: () => ({}) },
},
data() {
return {
openShow: false,
wcData: [],
formError: '', //
//
form: {
tableData: [], // Form
fillMemo: '', //
},
//
formRules: {
// 1
tableData: [
{
required: true,
message: '请至少添加一行数据',
trigger: 'submit',
type: 'array', //
},
{
validator: (rule, value, callback) => {
if (value.length === 0) {
callback(new Error('请至少添加一行数据'));
} else {
callback();
}
},
trigger: 'submit',
},
],
// wcId
matter: [{ required: true, message: '请输入', trigger: ['change', 'submit'] }],
// preserveContent
process: [{ required: true, message: '请输入', trigger: ['blur', 'submit'] }],
},
};
},
watch: {
showDialog(newVal) {
this.openShow = newVal;
if (newVal && this.moldAddMore && this.form.tableData.length === 0) {
this.addTable();
}
}
},
mounted() {
this.openShow = this.showDialog;
console.log(898989, this.showDialog);
// this.getWorkCenterList();
//
if (this.moldAddMore && this.form.tableData.length === 0) {
this.addTable();
}
},
methods: {
selectChange(list, row) {
row._select = !row._select;
},
// push tableData
addTable() {
this.form.tableData.push({
_select: false, //
matter: '',
process: '',
});
},
//
delTable() {
this.form.tableData = this.form.tableData.filter(row => !row._select);
},
closeDialog() {
this.openShow = false;
this.$emit('closeDialog', true);
//
this.form.tableData = [];
this.form.fillMemo = '';
this.formError = '';
this.$refs.tableForm?.resetFields();
},
//
submitForm() {
this.formError = '';
// Form
this.$refs.tableForm.validate(async (isValid, invalidFields) => {
if (!isValid) {
//
this.formError = '存在未完善的字段,请检查表格中的红色提示';
this.$nextTick(() => {
//
const firstError = document.querySelector('.el-form-item.is-error');
if (firstError) {
firstError.scrollIntoView({ behavior: 'smooth', block: 'center' });
}
});
return;
}
//
const submitData = this.form.tableData.map(row => {
const { _select, ...validData } = row; //
return validData;
});
//
try {
let query = {
fillingDetailList: submitData,
otbId: this.rowData.id,
deleteIds: [],
fillMemo: this.form.fillMemo || '',
};
handleOemTaskBillItem(query).then(res => {
this.$message.success('提交成功');
this.closeDialog();
this.$emit('submitSuccess', submitData);
});
//
// this.$message.success('');
// this.closeDialog();
// this.$emit('submitSuccess', submitData);
} catch (err) {
this.$message.error(err);
// console.error('', err);
}
});
},
},
};
</script>
<style lang="scss" scoped>
//
:deep(.el-table .el-form-item) {
margin-bottom: 0; //
}
//
:deep(.el-form-item__error) {
font-size: 12px;
white-space: nowrap;
z-index: 10;
background: #fff;
padding: 2px 4px;
border: 1px solid #f56c6c;
border-radius: 4px;
}
// textarea
.el-table__row {
height: 80px !important;
}
.el-table__cell {
vertical-align: middle !important;
}
.error-message {
font-size: 14px;
line-height: 1.5;
}
:deep(.el-table .el-table__cell) {
height: 50px !important;
padding: 0 !important;
line-height: 50px !important;
}
</style>

@ -22,15 +22,42 @@
</template>
<template #menu-right> </template>
<template #menu="scope">
<el-button type="primary" @click="handleImport">处理 </el-button>
<el-button type="text" @click="detailsView(scope.row)">详情 </el-button>
<el-button type="text" @click="handle(scope.row)" v-if="scope.row.tbStatus == 0"
>处理
</el-button>
</template>
</avue-crud>
<!-- 处理 -->
<inPlantProcessHandle
v-if="showHandle"
:showDialog="showHandle"
:moldAddMore="moldAddMore"
:rowData="rowData"
@closeDialog="cancel()"
></inPlantProcessHandle>
<!-- 详情 -->
<inPlantProcessDetails
v-if="showDetails"
:showDialog="showDetails"
:rowData="rowData"
@closeDialog="cancel()"
></inPlantProcessDetails>
</basic-container>
</template>
<script>
import { pageList, detailItem, handleOemTaskBillItem, removeItem } from '@/api/oem/inplan';
import inPlantProcessHandle from './components/inPlantProcessHandle.vue';
import inPlantProcessDetails from './components/inPlantProcessDetails.vue';
export default {
components: {
inPlantProcessHandle,
inPlantProcessDetails,
},
data() {
return {
loading: false,
selectionList: [],
option: {
height: 'auto',
@ -47,8 +74,9 @@ export default {
index: true,
selection: false,
viewBtn: false,
delBtn: true,
delBtn: false,
addBtn: false,
editBtn: false,
editBtnText: '修改',
addBtnIcon: ' ',
viewBtnIcon: ' ',
@ -56,16 +84,14 @@ export default {
editBtnIcon: ' ',
viewBtnText: '详情',
labelWidth: 120,
menuWidth: 180,
menuWidth: 120,
dialogWidth: 1040,
dialogClickModal: false,
searchEnter: true,
excelBtn: false,
excelBtn: true,
filterBtn: true,
searchShowBtn: false,
columnSort: true,
excelBtn: true,
columnSort: true,
showOverflowTooltip: true,
menuAlign: 'left',
gridBtn: false,
@ -74,6 +100,7 @@ export default {
searchSpan: 6,
searchMenuPosition: 'right',
align: 'center',
menu: true,
column: [
{
label: '外协厂商',
@ -121,7 +148,7 @@ export default {
},
{
label: '确认编号',
prop: 'condition',
prop: 'confirmCondition',
search: true,
sortable: true,
filter: true,
@ -151,8 +178,7 @@ export default {
},
{
label: '工艺员',
prop: 'proMan.userName',
bind: 'proMan.userName',
prop: 'proManName',
search: true,
sortable: true,
filter: true,
@ -169,7 +195,7 @@ export default {
},
{
label: '备注',
prop: 'memo',
prop: 'remarks',
search: false,
sortable: true,
filter: true,
@ -179,7 +205,7 @@ export default {
},
{
label: '状态',
prop: 'tbStatusTitle',
prop: 'tbStatusName',
search: false,
sortable: true,
filter: true,
@ -190,38 +216,112 @@ export default {
],
},
form: {},
data: [],
query: {},
page: {
pageSize: 10,
currentPage: 1,
total: 0,
},
rowData: {},
showHandle: false,
moldAddMore: true,
showDetails: false,
};
},
methods: {
handleDelete() {
if (this.selectionList.length === 0) {
this.$message.warning('请选择至少一条数据');
return;
}
//
detailsView(row) {
console.log(row, 'row');
this.showDetails = true;
this.rowData = row;
this.moldAddMore = false;
},
handle(row) {
this.rowData = row;
this.showHandle = true;
},
cancel() {
this.showHandle = false;
this.showDetails = false;
this.onLoad(this.page, this.query);
},
//
rowDel(row, index, done) {
console.log('【删除行】row:', row);
this.$confirm('确定将选择数据删除?', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(() => {});
}).then(() => {
return removeItem(String(row.id)).then(() => {
this.$message.success('删除成功');
this.onLoad(this.page);
done();
});
}).catch(error => {
console.error('删除失败:', error);
this.$message.error('删除失败,请稍后重试');
});
},
//
selectionChange(list) {
this.selectionList = list;
},
onLoad() {
onLoad(page, params = {}) {
this.loading = true;
this.data = [];
this.page.total = this.data.length;
this.loading = false;
pageList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
console.log('API返回数据:', res);
//
if (res.data && res.data.code === 200) {
const data = res.data.data;
this.page.total = data.total || 0;
this.data = data.records || [];
console.log('设置的数据:', { total: this.page.total, data: this.data });
} else {
this.$message.error(res.data.msg || '获取数据失败');
this.data = [];
}
this.loading = false;
}).catch(error => {
console.error('获取数据失败:', error);
this.$message.error('获取数据失败');
this.data = [];
this.loading = false;
});
setTimeout(() => {
this.selectionClear();
}, 500);
},
searchReset() {
this.query = {};
this.onLoad(this.page);
},
searchChange(params, done) {
this.query = params;
this.page.currentPage = 1;
this.onLoad(this.page, params);
done();
},
currentChange(currentPage) {
this.page.currentPage = currentPage;
this.onLoad(this.page, this.query);
},
sizeChange(pageSize) {
this.page.pageSize = pageSize;
this.onLoad(this.page, this.query);
},
refreshChange() {
this.onLoad(this.page, this.query);
},
selectionClear() {
this.selectionList = [];
this.$refs.crud.toggleSelection();
},
},
};
</script>

Loading…
Cancel
Save