原材料库优化问题点0808:前端优化代码
This commit is contained in:
@@ -4,28 +4,28 @@
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<el-dialog
|
||||
title="选择异常出库原因"
|
||||
:visible.sync="reasonDialogVisible"
|
||||
width="30%"
|
||||
:before-close="closeReasonDialog"
|
||||
>
|
||||
<el-form ref="reasonForm" :model="reasonForm" label-width="80px">
|
||||
<el-form-item label="原因" prop="reason">
|
||||
<el-select v-model="reasonForm.reason" placeholder="请选择异常出库原因">
|
||||
<el-option
|
||||
v-for="item in dict.reason"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeReasonDialog">取消</el-button>
|
||||
<el-button type="primary" @click="submitReason">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
title="选择异常出库原因"
|
||||
:visible.sync="reasonDialogVisible"
|
||||
width="30%"
|
||||
:before-close="closeReasonDialog"
|
||||
>
|
||||
<el-form ref="reasonForm" :model="reasonForm" label-width="80px">
|
||||
<el-form-item label="原因" prop="reason">
|
||||
<el-select v-model="reasonForm.reason" placeholder="请选择异常出库原因">
|
||||
<el-option
|
||||
v-for="item in dict.reason"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeReasonDialog">取消</el-button>
|
||||
<el-button type="primary" @click="submitReason">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
@@ -185,19 +185,19 @@
|
||||
>
|
||||
缓存区一键移库
|
||||
</el-button>
|
||||
<!-- Confirmation Dialog -->
|
||||
<!-- Confirmation Dialog -->
|
||||
</crudOperation>
|
||||
<el-dialog
|
||||
title="确认"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
>
|
||||
<span>您确定要移库吗?</span>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmMove">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
title="确认"
|
||||
:visible.sync="dialogVisible"
|
||||
width="30%"
|
||||
>
|
||||
<span>您确定要移库吗?</span>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmMove">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<!--表单组件-->
|
||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="540px">
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px" style="border: 1px solid #cfe0df;margin-top: 10px;padding-top: 10px;">
|
||||
@@ -366,7 +366,7 @@
|
||||
:permission="permission"
|
||||
/>
|
||||
<el-button
|
||||
v-if="showQtyButton(scope.row.vehicle_qty,scope.row.region_code)"
|
||||
v-if="showQtyButton(scope.row.vehicle_qty,scope.row.region_code)"
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-view"
|
||||
@@ -439,7 +439,7 @@ const defaultForm = {
|
||||
}
|
||||
export default {
|
||||
name: 'SchBasePoint',
|
||||
dicts: ['vehicle_type', 'TrueOrFalse','reason'],
|
||||
dicts: ['vehicle_type', 'TrueOrFalse', 'reason'],
|
||||
components: { PointDialog, ViewDialog, pagination, crudOperation, rrOperation, udOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
@@ -478,9 +478,9 @@ export default {
|
||||
region_code: [
|
||||
{ required: true, message: '区域类型不能为空', trigger: 'blur' }
|
||||
]
|
||||
},reasonDialogVisible: false,
|
||||
}, reasonDialogVisible: false,
|
||||
reasonForm: {
|
||||
reason: ""
|
||||
reason: ''
|
||||
},
|
||||
workShopList: [],
|
||||
regionList: [],
|
||||
@@ -489,7 +489,7 @@ export default {
|
||||
pointStatusDialogList: [],
|
||||
pointTypesDialogList: [],
|
||||
pointDialog: false,
|
||||
dialogVisible: false,
|
||||
dialogVisible: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@@ -559,8 +559,8 @@ export default {
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
showQtyButton(vehicle_qty,region_code) {
|
||||
if (vehicle_qty === 1 && (region_code === 'YL'|| region_code === 'YLHC')) {
|
||||
showQtyButton(vehicle_qty, region_code) {
|
||||
if (vehicle_qty === 1 && (region_code === 'YL' || region_code === 'YLHC')) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -587,52 +587,52 @@ export default {
|
||||
this.crud.query.point_type = null
|
||||
this.crud.query.point_status = null
|
||||
this.hand()
|
||||
},openReasonDialog(row) {
|
||||
}, openReasonDialog(row) {
|
||||
// 打开选择原因的对话框
|
||||
this.reasonDialogVisible = true;
|
||||
this.reasonDialogVisible = true
|
||||
// 这里可以将row存储到data中,以便在提交时使用
|
||||
this.selectedRow = row;
|
||||
},closeReasonDialog() {
|
||||
this.selectedRow = row
|
||||
}, closeReasonDialog() {
|
||||
// 关闭选择原因的对话框
|
||||
this.reasonDialogVisible = false;
|
||||
this.$refs["reasonForm"].resetFields();
|
||||
},submitReason() {
|
||||
this.reasonDialogVisible = false
|
||||
this.$refs['reasonForm'].resetFields()
|
||||
}, submitReason() {
|
||||
// 提交选择的原因到后端接口
|
||||
const data = {
|
||||
reason: this.reasonForm.reason,
|
||||
device_code: this.selectedRow.point_code
|
||||
};
|
||||
}
|
||||
// 调用后端接口提交数据
|
||||
// 这里假设使用axios库发送POST请求
|
||||
this.$axios
|
||||
.post("/api/schBasePoint/outbound", data)
|
||||
.post('/api/schBasePoint/outbound', data)
|
||||
.then(response => {
|
||||
// 处理后端返回的数据
|
||||
console.log("提交成功", response);
|
||||
this.$message.success("提交成功");
|
||||
this.closeReasonDialog();
|
||||
console.log('提交成功', response)
|
||||
this.$message.success('提交成功')
|
||||
this.closeReasonDialog()
|
||||
})
|
||||
.catch(error => {
|
||||
// 处理错误情况
|
||||
console.error("提交失败,废包材位有货", error);
|
||||
this.$message.error("提交失败,废包材位有货");
|
||||
});
|
||||
},showConfirmationDialog() {
|
||||
this.dialogVisible = true;
|
||||
console.error('提交失败,废包材位有货', error)
|
||||
this.$message.error('提交失败,废包材位有货')
|
||||
})
|
||||
}, showConfirmationDialog() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
confirmMove() {
|
||||
this.$axios.post('/api/schBaseTask/move', { })
|
||||
this.$axios.post('/api/schBaseTask/move', { })
|
||||
.then(response => {
|
||||
console.log(response.data);
|
||||
console.log(response.data)
|
||||
})
|
||||
.catch(error => {
|
||||
// Handle error response
|
||||
console.error(error);
|
||||
console.error(error)
|
||||
})
|
||||
.finally(() => {
|
||||
this.dialogVisible = false; // Close the dialog
|
||||
});
|
||||
},
|
||||
this.dialogVisible = false // Close the dialog
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user