8 changed files with 899 additions and 10 deletions
-
22src/api/factory/partAttribute.js
-
3src/api/warehouse/ifsInventoryInit.js
-
3src/api/warehouse/labelQuery.js
-
5src/views/main-navbar.vue
-
290src/views/modules/factory/partAttribute-add-or-update.vue
-
326src/views/modules/factory/partAttribute.vue
-
215src/views/modules/warehouse/ifsInventoryInit.vue
-
45src/views/modules/warehouse/labelQuery.vue
@ -0,0 +1,22 @@ |
|||||
|
import { createAPI } from "@/utils/httpRequest.js"; |
||||
|
|
||||
|
// 分页查询料件属性列表
|
||||
|
export const getPartAttributeList = data => createAPI('/factory/partAttribute/list', 'post', data) |
||||
|
|
||||
|
// 根据站点和料号查询料件属性详情
|
||||
|
export const getPartAttributeInfo = data => createAPI('/factory/partAttribute/info', 'get', data) |
||||
|
|
||||
|
// 新增料件属性
|
||||
|
export const savePartAttribute = data => createAPI('/factory/partAttribute/save', 'post', data) |
||||
|
|
||||
|
// 修改料件属性
|
||||
|
export const updatePartAttribute = data => createAPI('/factory/partAttribute/update', 'post', data) |
||||
|
|
||||
|
// 删除料件属性
|
||||
|
export const deletePartAttribute = data => createAPI('/factory/partAttribute/delete', 'post', data) |
||||
|
|
||||
|
// 批量删除料件属性
|
||||
|
export const batchDeletePartAttribute = data => createAPI('/factory/partAttribute/batchDelete', 'post', data) |
||||
|
|
||||
|
// 验证料件属性数据
|
||||
|
export const validatePartAttribute = data => createAPI('/factory/partAttribute/validate', 'post', data) |
||||
@ -0,0 +1,290 @@ |
|||||
|
<template> |
||||
|
<el-dialog |
||||
|
:title="!originalPartNo ? '新增料件属性' : '修改料件属性'" |
||||
|
:close-on-click-modal="false" |
||||
|
:visible.sync="visible" |
||||
|
width="500px"> |
||||
|
|
||||
|
<el-form |
||||
|
:model="dataForm" |
||||
|
:rules="dataRule" |
||||
|
ref="dataForm" |
||||
|
@keyup.enter.native="dataFormSubmit()" |
||||
|
label-width="120px"> |
||||
|
|
||||
|
<el-form-item label="工厂/站点" prop="site"> |
||||
|
<el-input v-model="dataForm.site" placeholder="工厂/站点" :disabled="true"></el-input> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="料号" prop="partNo"> |
||||
|
<el-input |
||||
|
v-model="dataForm.partNo" |
||||
|
placeholder="请输入料号" |
||||
|
:disabled="!!originalPartNo" |
||||
|
maxlength="100" |
||||
|
show-word-limit> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-row :gutter="20"> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否进立库" prop="isInWh"> |
||||
|
<el-radio-group v-model="dataForm.isInWh"> |
||||
|
<el-radio label="Y">是</el-radio> |
||||
|
<el-radio label="N">否</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="是否机械手臂拣选" prop="isRobotPick"> |
||||
|
<el-radio-group v-model="dataForm.isRobotPick"> |
||||
|
<el-radio label="Y">是</el-radio> |
||||
|
<el-radio label="N">否</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-form-item label="是否常用" prop="isCommonlyUsed"> |
||||
|
<el-radio-group v-model="dataForm.isCommonlyUsed"> |
||||
|
<el-radio label="Y">是</el-radio> |
||||
|
<el-radio label="N">否</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-form-item label="重量(kg)" prop="weight"> |
||||
|
<el-input |
||||
|
v-model="dataForm.weight" |
||||
|
placeholder="请输入重量" |
||||
|
:precision="3" |
||||
|
:min="0" |
||||
|
:max="999999" |
||||
|
style="width: 100%"> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<el-row :gutter="20"> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="长度(mm)" prop="length"> |
||||
|
<el-input |
||||
|
v-model="dataForm.length" |
||||
|
placeholder="请输入长度" |
||||
|
:precision="2" |
||||
|
:min="0" |
||||
|
:max="999999" |
||||
|
style="width: 100%"> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="宽度(mm)" prop="width"> |
||||
|
<el-input |
||||
|
v-model="dataForm.width" |
||||
|
placeholder="请输入宽度" |
||||
|
:precision="2" |
||||
|
:min="0" |
||||
|
:max="999999" |
||||
|
style="width: 100%"> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-row :gutter="20"> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="高度(mm)" prop="height"> |
||||
|
<el-input |
||||
|
v-model="dataForm.height" |
||||
|
placeholder="请输入高度" |
||||
|
:precision="2" |
||||
|
:min="0" |
||||
|
:max="999999" |
||||
|
style="width: 100%"> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="直径(mm)" prop="diameter"> |
||||
|
<el-input |
||||
|
v-model="dataForm.diameter" |
||||
|
placeholder="请输入直径" |
||||
|
:precision="2" |
||||
|
:min="0" |
||||
|
:max="999999" |
||||
|
style="width: 100%"> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
|
||||
|
</el-form> |
||||
|
|
||||
|
<span slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="visible = false">取消</el-button> |
||||
|
<el-button type="primary" @click="dataFormSubmit()" :loading="submitLoading">确定</el-button> |
||||
|
</span> |
||||
|
</el-dialog> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { getPartAttributeInfo, savePartAttribute, updatePartAttribute } from '@/api/factory/partAttribute' |
||||
|
|
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
visible: false, |
||||
|
submitLoading: false, |
||||
|
originalPartNo: '', // 用于记录原始料号,修改时不允许更改 |
||||
|
dataForm: { |
||||
|
site: '', |
||||
|
partNo: '', |
||||
|
isInWh: 'N', |
||||
|
isRobotPick: 'N', |
||||
|
isCommonlyUsed: 'N', |
||||
|
weight: null, |
||||
|
length: null, |
||||
|
width: null, |
||||
|
height: null, |
||||
|
diameter: null |
||||
|
}, |
||||
|
dataRule: { |
||||
|
site: [ |
||||
|
{ required: true, message: '工厂/站点不能为空', trigger: 'blur' }, |
||||
|
{ max: 50, message: '工厂/站点长度不能超过50个字符', trigger: 'blur' } |
||||
|
], |
||||
|
partNo: [ |
||||
|
{ required: true, message: '料号不能为空', trigger: 'blur' }, |
||||
|
{ max: 100, message: '料号长度不能超过100个字符', trigger: 'blur' } |
||||
|
], |
||||
|
isInWh: [ |
||||
|
{ required: true, message: '请选择是否进立库', trigger: 'change' } |
||||
|
], |
||||
|
isRobotPick: [ |
||||
|
{ required: true, message: '请选择是否机械手臂拣选', trigger: 'change' } |
||||
|
], |
||||
|
isCommonlyUsed: [ |
||||
|
{ required: true, message: '请选择是否常用', trigger: 'change' } |
||||
|
], |
||||
|
weight: [ |
||||
|
{ type: 'number', min: 0, message: '重量不能为负数', trigger: 'blur' } |
||||
|
], |
||||
|
length: [ |
||||
|
{ type: 'number', min: 0, message: '长度不能为负数', trigger: 'blur' } |
||||
|
], |
||||
|
width: [ |
||||
|
{ type: 'number', min: 0, message: '宽度不能为负数', trigger: 'blur' } |
||||
|
], |
||||
|
height: [ |
||||
|
{ type: 'number', min: 0, message: '高度不能为负数', trigger: 'blur' } |
||||
|
], |
||||
|
diameter: [ |
||||
|
{ type: 'number', min: 0, message: '直径不能为负数', trigger: 'blur' } |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
init(site, partNo) { |
||||
|
this.visible = true |
||||
|
this.originalPartNo = partNo || '' |
||||
|
|
||||
|
// 重置表单 |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs['dataForm'].resetFields() |
||||
|
|
||||
|
// 设置默认值 |
||||
|
this.dataForm.site = site || localStorage.getItem('site') || '' |
||||
|
this.dataForm.isInWh = 'N' |
||||
|
this.dataForm.isRobotPick = 'N' |
||||
|
this.dataForm.isCommonlyUsed = 'N' |
||||
|
|
||||
|
if (site && partNo) { |
||||
|
// 修改模式,获取详情 |
||||
|
this.getInfo(site, partNo) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
// 获取信息 |
||||
|
getInfo(site, partNo) { |
||||
|
getPartAttributeInfo({ site, partNo }).then(({ data }) => { |
||||
|
if (data && data.code === 0 && data.data) { |
||||
|
const info = data.data |
||||
|
this.dataForm.site = info.site |
||||
|
this.dataForm.partNo = info.partNo |
||||
|
this.dataForm.isInWh = info.isInWh || 'N' |
||||
|
this.dataForm.isRobotPick = info.isRobotPick || 'N' |
||||
|
this.dataForm.isCommonlyUsed = info.isCommonlyUsed || 'N' |
||||
|
this.dataForm.weight = info.weight |
||||
|
this.dataForm.length = info.length |
||||
|
this.dataForm.width = info.width |
||||
|
this.dataForm.height = info.height |
||||
|
this.dataForm.diameter = info.diameter |
||||
|
} else { |
||||
|
this.$message.error(data.msg || '获取料件属性信息失败') |
||||
|
} |
||||
|
}).catch(() => { |
||||
|
this.$message.error('获取料件属性信息失败') |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
// 表单提交 |
||||
|
dataFormSubmit() { |
||||
|
this.$refs['dataForm'].validate((valid) => { |
||||
|
if (valid) { |
||||
|
this.submitLoading = true |
||||
|
|
||||
|
const submitData = { ...this.dataForm } |
||||
|
|
||||
|
// 处理数值字段,null值不传递 |
||||
|
if (submitData.weight === null || submitData.weight === '') { |
||||
|
delete submitData.weight |
||||
|
} |
||||
|
if (submitData.length === null || submitData.length === '') { |
||||
|
delete submitData.length |
||||
|
} |
||||
|
if (submitData.width === null || submitData.width === '') { |
||||
|
delete submitData.width |
||||
|
} |
||||
|
if (submitData.height === null || submitData.height === '') { |
||||
|
delete submitData.height |
||||
|
} |
||||
|
if (submitData.diameter === null || submitData.diameter === '') { |
||||
|
delete submitData.diameter |
||||
|
} |
||||
|
|
||||
|
const apiCall = this.originalPartNo ? updatePartAttribute : savePartAttribute |
||||
|
|
||||
|
apiCall(submitData).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.$message.success(data.msg || (this.originalPartNo ? '修改成功' : '新增成功')) |
||||
|
this.visible = false |
||||
|
this.$emit('refreshDataList') |
||||
|
} else { |
||||
|
this.$message.error(data.msg || (this.originalPartNo ? '修改失败' : '新增失败')) |
||||
|
} |
||||
|
this.submitLoading = false |
||||
|
}).catch(() => { |
||||
|
this.$message.error(this.originalPartNo ? '修改失败' : '新增失败') |
||||
|
this.submitLoading = false |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.el-form-item { |
||||
|
margin-bottom: 20px; |
||||
|
} |
||||
|
|
||||
|
.dialog-footer { |
||||
|
text-align: right; |
||||
|
} |
||||
|
|
||||
|
.el-input-number { |
||||
|
width: 100%; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,326 @@ |
|||||
|
<template> |
||||
|
<div class="mod-config"> |
||||
|
<!-- 查询条件 --> |
||||
|
<el-form :inline="true" label-position="top" class="query-form"> |
||||
|
<el-form-item label="料号"> |
||||
|
<el-input |
||||
|
v-model="queryForm.partNo" |
||||
|
placeholder="请输入料号" |
||||
|
style="width: 160px;" |
||||
|
clearable> |
||||
|
</el-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="是否进立库"> |
||||
|
<el-select v-model="queryForm.isInWh" placeholder="请选择" style="width: 120px;" clearable> |
||||
|
<el-option label="全部" value=""></el-option> |
||||
|
<el-option label="是" value="Y"></el-option> |
||||
|
<el-option label="否" value="N"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="是否机械手臂拣选"> |
||||
|
<el-select v-model="queryForm.isRobotPick" placeholder="请选择" style="width: 160px;" clearable> |
||||
|
<el-option label="全部" value=""></el-option> |
||||
|
<el-option label="是" value="Y"></el-option> |
||||
|
<el-option label="否" value="N"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="是否常用"> |
||||
|
<el-select v-model="queryForm.isCommonlyUsed" placeholder="请选择" style="width: 120px;" clearable> |
||||
|
<el-option label="全部" value=""></el-option> |
||||
|
<el-option label="是" value="Y"></el-option> |
||||
|
<el-option label="否" value="N"></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item style="margin-top: 20px;"> |
||||
|
<el-button @click="getDataList()" type="primary" icon="el-icon-search">查询</el-button> |
||||
|
<el-button @click="resetQuery()" type="default" icon="el-icon-refresh">重置</el-button> |
||||
|
<el-button |
||||
|
|
||||
|
@click="addOrUpdateHandle()" |
||||
|
type="success" |
||||
|
icon="el-icon-plus"> |
||||
|
新增 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
|
||||
|
@click="deleteHandle()" |
||||
|
type="danger" |
||||
|
icon="el-icon-delete" |
||||
|
:disabled="dataListSelections.length <= 0"> |
||||
|
批量删除 |
||||
|
</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<!-- 数据表格 --> |
||||
|
<el-table |
||||
|
:data="dataList" |
||||
|
border |
||||
|
v-loading="dataListLoading" |
||||
|
@selection-change="selectionChangeHandle" |
||||
|
style="width: 100%; margin-bottom: 15px;" |
||||
|
:height="tableHeight"> |
||||
|
|
||||
|
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
||||
|
<el-table-column prop="site" label="工厂/站点" header-align="center" align="center" width="100"></el-table-column> |
||||
|
<el-table-column prop="partNo" label="料号" header-align="center" align="center" min-width="150" show-overflow-tooltip></el-table-column> |
||||
|
<el-table-column prop="isInWh" label="是否进立库" header-align="center" align="center" width="120"> |
||||
|
<template slot-scope="scope"> |
||||
|
|
||||
|
{{ scope.row.isInWh === 'Y' ? '是' : '否' }} |
||||
|
|
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="isRobotPick" label="是否机械手臂拣选" header-align="center" align="center" width="140"> |
||||
|
<template slot-scope="scope"> |
||||
|
|
||||
|
{{ scope.row.isRobotPick === 'Y' ? '是' : '否' }} |
||||
|
|
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="isCommonlyUsed" label="是否常用" header-align="center" align="center" width="100"> |
||||
|
<template slot-scope="scope"> |
||||
|
|
||||
|
{{ scope.row.isCommonlyUsed === 'Y' ? '是' : '否' }} |
||||
|
|
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="weight" label="重量(kg)" header-align="center" align="center" width="100"> |
||||
|
<template slot-scope="scope"> |
||||
|
{{ scope.row.weight || '-' }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="length" label="长度(mm)" header-align="center" align="center" width="100"> |
||||
|
<template slot-scope="scope"> |
||||
|
{{ scope.row.length || '-' }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="width" label="宽度(mm)" header-align="center" align="center" width="100"> |
||||
|
<template slot-scope="scope"> |
||||
|
{{ scope.row.width || '-' }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="height" label="高度(mm)" header-align="center" align="center" width="100"> |
||||
|
<template slot-scope="scope"> |
||||
|
{{ scope.row.height || '-' }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column prop="diameter" label="直径(mm)" header-align="center" align="center" width="100"> |
||||
|
<template slot-scope="scope"> |
||||
|
{{ scope.row.diameter || '-' }} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
<el-table-column label="操作" fixed="right" header-align="center" align="center" width="150"> |
||||
|
<template slot-scope="scope"> |
||||
|
<a |
||||
|
type="text" |
||||
|
size="small" |
||||
|
@click="addOrUpdateHandle(scope.row.site, scope.row.partNo)"> |
||||
|
修改 |
||||
|
</a> |
||||
|
<a |
||||
|
type="text" |
||||
|
size="small" |
||||
|
@click="deleteHandle(scope.row.site, scope.row.partNo)"> |
||||
|
删除 |
||||
|
</a> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<!-- 分页 --> |
||||
|
<el-pagination |
||||
|
@size-change="sizeChangeHandle" |
||||
|
@current-change="currentChangeHandle" |
||||
|
:current-page="pageIndex" |
||||
|
:page-sizes="[10, 20, 50, 100]" |
||||
|
:page-size="pageSize" |
||||
|
:total="totalPage" |
||||
|
layout="total, sizes, prev, pager, next, jumper"> |
||||
|
</el-pagination> |
||||
|
|
||||
|
<!-- 弹窗, 新增 / 修改 --> |
||||
|
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { getPartAttributeList, deletePartAttribute, batchDeletePartAttribute } from '@/api/factory/partAttribute' |
||||
|
import AddOrUpdate from './partAttribute-add-or-update' |
||||
|
|
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
queryForm: { |
||||
|
partNo: '', |
||||
|
isInWh: '', |
||||
|
isRobotPick: '', |
||||
|
isCommonlyUsed: '' |
||||
|
}, |
||||
|
dataList: [], |
||||
|
pageIndex: 1, |
||||
|
pageSize: 20, |
||||
|
totalPage: 0, |
||||
|
dataListLoading: false, |
||||
|
dataListSelections: [], |
||||
|
addOrUpdateVisible: false, |
||||
|
tableHeight: 500 |
||||
|
} |
||||
|
}, |
||||
|
components: { |
||||
|
AddOrUpdate |
||||
|
}, |
||||
|
activated() { |
||||
|
this.getDataList() |
||||
|
this.calculateTableHeight() |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.getDataList() |
||||
|
this.calculateTableHeight() |
||||
|
window.addEventListener('resize', this.calculateTableHeight) |
||||
|
}, |
||||
|
beforeDestroy() { |
||||
|
window.removeEventListener('resize', this.calculateTableHeight) |
||||
|
}, |
||||
|
methods: { |
||||
|
// 计算表格高度 |
||||
|
calculateTableHeight() { |
||||
|
this.$nextTick(() => { |
||||
|
const windowHeight = window.innerHeight |
||||
|
const otherHeight = 280 // 其他元素的高度 |
||||
|
this.tableHeight = windowHeight - otherHeight |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
// 获取数据列表 |
||||
|
getDataList() { |
||||
|
this.dataListLoading = true |
||||
|
const params = { |
||||
|
page: this.pageIndex, |
||||
|
size: this.pageSize, |
||||
|
site: localStorage.getItem('site'), |
||||
|
...this.queryForm |
||||
|
} |
||||
|
|
||||
|
getPartAttributeList(params).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.dataList = data.page.list || [] |
||||
|
this.totalPage = data.page.totalCount || 0 |
||||
|
} else { |
||||
|
this.dataList = [] |
||||
|
this.totalPage = 0 |
||||
|
this.$message.error(data.msg || '查询失败') |
||||
|
} |
||||
|
this.dataListLoading = false |
||||
|
}).catch(() => { |
||||
|
this.dataList = [] |
||||
|
this.totalPage = 0 |
||||
|
this.dataListLoading = false |
||||
|
this.$message.error('查询失败') |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
// 重置查询条件 |
||||
|
resetQuery() { |
||||
|
this.queryForm = { |
||||
|
partNo: '', |
||||
|
isInWh: '', |
||||
|
isRobotPick: '', |
||||
|
isCommonlyUsed: '' |
||||
|
} |
||||
|
this.pageIndex = 1 |
||||
|
this.getDataList() |
||||
|
}, |
||||
|
|
||||
|
// 每页数 |
||||
|
sizeChangeHandle(val) { |
||||
|
this.pageSize = val |
||||
|
this.pageIndex = 1 |
||||
|
this.getDataList() |
||||
|
}, |
||||
|
|
||||
|
// 当前页 |
||||
|
currentChangeHandle(val) { |
||||
|
this.pageIndex = val |
||||
|
this.getDataList() |
||||
|
}, |
||||
|
|
||||
|
// 多选 |
||||
|
selectionChangeHandle(val) { |
||||
|
this.dataListSelections = val |
||||
|
}, |
||||
|
|
||||
|
// 新增 / 修改 |
||||
|
addOrUpdateHandle(site, partNo) { |
||||
|
this.addOrUpdateVisible = true |
||||
|
this.$nextTick(() => { |
||||
|
this.$refs.addOrUpdate.init(site, partNo) |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
// 删除 |
||||
|
deleteHandle(site, partNo) { |
||||
|
if (site && partNo) { |
||||
|
// 单个删除 |
||||
|
this.$confirm(`确定要删除料号为"${partNo}"的料件属性吗?`, '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(() => { |
||||
|
deletePartAttribute({ site, partNo }).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.$message.success(data.msg || '删除成功') |
||||
|
this.getDataList() |
||||
|
} else { |
||||
|
this.$message.error(data.msg || '删除失败') |
||||
|
} |
||||
|
}).catch(() => { |
||||
|
this.$message.error('删除失败') |
||||
|
}) |
||||
|
}) |
||||
|
} else { |
||||
|
// 批量删除 |
||||
|
if (this.dataListSelections.length <= 0) { |
||||
|
this.$message.warning('请选择要删除的数据') |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
this.$confirm(`确定要删除选中的${this.dataListSelections.length}条料件属性吗?`, '提示', { |
||||
|
confirmButtonText: '确定', |
||||
|
cancelButtonText: '取消', |
||||
|
type: 'warning' |
||||
|
}).then(() => { |
||||
|
const deleteList = this.dataListSelections.map(item => ({ |
||||
|
site: item.site, |
||||
|
partNo: item.partNo |
||||
|
})) |
||||
|
|
||||
|
batchDeletePartAttribute(deleteList).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.$message.success(data.msg || '删除成功') |
||||
|
this.getDataList() |
||||
|
} else { |
||||
|
this.$message.error(data.msg || '删除失败') |
||||
|
} |
||||
|
}).catch(() => { |
||||
|
this.$message.error('删除失败') |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.query-form { |
||||
|
background: #f5f5f5; |
||||
|
padding: 15px; |
||||
|
border-radius: 4px; |
||||
|
margin-bottom: 15px; |
||||
|
} |
||||
|
|
||||
|
.query-form .el-form-item { |
||||
|
margin-bottom: 10px; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue