检查页面优化
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
+<template>
|
||||
<div>
|
||||
<el-empty v-if="!orderId || orderId == ''" description="未选中订单" />
|
||||
|
||||
@@ -10,9 +10,16 @@
|
||||
<!-- <el-button type="primary" plain icon="el-icon-printer" size="mini" @click="handlePrint">打印</el-button> -->
|
||||
<el-button type="primary" plain icon="el-icon-refresh" size="mini" @click="getList">刷新</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5" v-if="editable">
|
||||
<el-button type="success" plain icon="el-icon-document" size="mini"
|
||||
@click="handleBatchWriteToContract" :disabled="selectedItems.length === 0">
|
||||
批量写入合同
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="orderItemList">
|
||||
<el-table v-loading="loading" :data="orderItemList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="产品类型" align="center" prop="productType" />
|
||||
<el-table-column label="成品宽度" align="center" prop="width" />
|
||||
<el-table-column label="成品厚度" align="center" prop="thickness" />
|
||||
@@ -63,7 +70,11 @@
|
||||
<el-input v-model="form.productType" placeholder="请输入产品类型" />
|
||||
</el-form-item>
|
||||
<el-form-item label="成品规格" prop="finishedProductSpec">
|
||||
<el-input v-model="form.finishedProductSpec" placeholder="请输入成品规格" />
|
||||
<el-select v-model="form.finishedProductSpec" placeholder="请选择或输入成品规格" style="width: 100%" allow-create filterable>
|
||||
<el-option label="SPCC" value="SPCC" />
|
||||
<el-option label="DCO1" value="DCO1" />
|
||||
<el-option label="DX51D+Z" value="DX51D+Z" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="成品宽度" prop="width">
|
||||
<el-input v-model="form.width" placeholder="请输入宽度" />
|
||||
@@ -172,6 +183,8 @@ export default {
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 选中的订单明细项(用于批量操作)
|
||||
selectedItems: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
@@ -296,13 +309,15 @@ export default {
|
||||
let content = parseProductContent(data.productContent);
|
||||
const product = convertOrderItemToProduct(row);
|
||||
content = addProduct(content, product);
|
||||
|
||||
|
||||
const jsonContent = stringifyProductContent(content);
|
||||
updateOrder({
|
||||
...this.orderContent,
|
||||
productContent: jsonContent
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess("写入成功,请刷新合同内容查看");
|
||||
this.$modal.msgSuccess("写入成功");
|
||||
// 自动刷新合同内容
|
||||
this.refreshContractContent();
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
@@ -310,6 +325,51 @@ export default {
|
||||
return;
|
||||
}
|
||||
},
|
||||
/** 批量写入合同 */
|
||||
async handleBatchWriteToContract() {
|
||||
if (this.selectedItems.length === 0) {
|
||||
this.$modal.msgWarning("请先选择要写入的订单明细");
|
||||
return;
|
||||
}
|
||||
|
||||
const { data } = await getOrder(this.orderId);
|
||||
try {
|
||||
let content = parseProductContent(data.productContent);
|
||||
|
||||
// 批量添加选中的产品
|
||||
this.selectedItems.forEach(row => {
|
||||
const product = convertOrderItemToProduct(row);
|
||||
content = addProduct(content, product);
|
||||
});
|
||||
|
||||
const jsonContent = stringifyProductContent(content);
|
||||
updateOrder({
|
||||
...this.orderContent,
|
||||
productContent: jsonContent
|
||||
}).then(response => {
|
||||
this.$modal.msgSuccess(`成功写入 ${this.selectedItems.length} 条产品信息`);
|
||||
// 自动刷新合同内容
|
||||
this.refreshContractContent();
|
||||
// 清空选中状态
|
||||
this.$refs.orderTable.clearSelection();
|
||||
this.selectedItems = [];
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
this.$modal.msgError("产品内容格式错误");
|
||||
return;
|
||||
}
|
||||
},
|
||||
/** 刷新合同内容(通知父组件刷新) */
|
||||
refreshContractContent() {
|
||||
// 通过事件通知父组件刷新合同内容
|
||||
this.$emit('refreshContract');
|
||||
|
||||
// 如果没有父组件监听,直接刷新页面
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
printOrder() {
|
||||
this.$refs["printer"].print();
|
||||
this.orderOpen = false;
|
||||
@@ -324,6 +384,7 @@ export default {
|
||||
this.ids = selection.map(item => item.itemId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
this.selectedItems = selection;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
|
||||
Reference in New Issue
Block a user