Commit 2d7d28d9 authored by xioln's avatar xioln

物料对照

parent c96ae281
/**
* @Description: 班组定义新增人员
* @author xioln
* @date 2023-08-29
* @FilePath: applications/dee-mes/src/privateComponents/components/AddExtProcessSkillUser/index.vue
*/
<template>
<div class="add-extProcessSkillUser">
<dee-as-com ref="addUser" :lay-config="{ typeName: 'ExtProcessSkillUser', layKey: 'teamUserCreate' }" />
<div slot="footer" class="foot-btn-box">
<el-button type="primary" @click="submitEvent">确认</el-button>
<el-button @click="cancelEvent">取消</el-button>
</div>
</div>
</template>
<script>
export default {
name: 'AddExtProcessSkillUser', // name写在组件的最前方,自定义组件为必填
componentName: '班组定义新增人员',
components: {},
props: {
basicData: {
type: Object,
default: () => { }
},
form: {
type: Object,
default: () => { }
}
},
data() {
return {
}
},
computed: {},
created() {
// 初始化数据
},
methods: {
submitEvent() {
const form = this.$refs.addUser.$children[0].$children[0].form
const formData = [{
...form
}]
this.$emit('submitEvent', { formData: formData })
},
cancelEvent() {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss'>
.add-extProcessSkillUser {
.foot-btn-box {
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style>
......@@ -63,7 +63,6 @@ export default {
this.selection = val
},
submitEvent() {
console.log('this.basicData', this.basicData)
const selection = this.selection.filter(r => {
if (!this.basicData.inStorageRequestItems) {
return true
......
/**
* @Description: 新增物料对照表
* @author xioln
* @date 2023-08-30
* @FilePath: applications/dee-mes/src/privateComponents/components/MaterialReferenceLinkTable/components/addForm.vue
*/
<template>
<div class="add-form">
<div class="container">
<dee-form ref="sourceForm" class="source-form" :form="sourceForm" :form-data="sourceFormData" />
<div class="separator" /> <!-- 分隔符 -->
<dee-form ref="targetForm" class="target-form" :form="targetForm" :form-data="targetFormData" />
</div>
<div slot="footer" class="foot-btn-box">
<el-button type="primary" @click="submitEvent">确认</el-button>
<el-button @click="cancelEvent">取消</el-button>
</div>
</div>
</template>
<script>
import { post } from '@/utils/http'
export default {
components: {},
data() {
return {
sourceForm: {},
sourceFormData: [
{
split: 2,
title: '物料A',
data: [
{
title: '物料编码',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
remote: true,
filterable: true,
'remote-method': this.resetMaterialA,
options: []
},
handler: {
change: (v) => this.sourceChangeMaterial(v)
}
},
{
key: 'resName',
title: '物料名称',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'modelNo',
title: '型号/件号',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'techSpec',
title: '技术条件',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'spec',
title: '规格',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'supplyStatus',
title: '供应状态',
component: {
name: 'el-input',
disabled: true
}
}
]
}
],
targetForm: {},
targetFormData: [
{
split: 2,
title: '物料B',
data: [
{
title: '物料编码',
key: 'resCode',
component: {
clearable: true,
name: 'el-select',
placeholder: '请输入物料关键词',
remote: true,
filterable: true,
'remote-method': this.resetMaterialB,
options: []
},
handler: {
change: (v) => this.targetChangeMaterial(v)
}
},
{
key: 'resName',
title: '物料名称',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'modelNo',
title: '型号/件号',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'techSpec',
title: '技术条件',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'spec',
title: '规格',
component: {
name: 'el-input',
disabled: true
}
},
{
key: 'supplyStatus',
title: '供应状态',
component: {
name: 'el-input',
disabled: true
}
}
]
}
],
optionsA: [],
optionsB: []
}
},
computed: {},
watch: {
},
created() {
// 初始化数据
},
methods: {
editData(form) {
this.sourceForm = form.source
this.targetForm = form.target
},
// 设置物料A类型下拉
resetMaterialA(query) {
if (query && query.length > 1) {
post(
`/ExtDxProcessMaterial/search`,
{
'pageFrom': 1,
'pageSize': 99,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'resCode',
'operator': 'LIKE',
'value': query
}
],
'operator': 'OR'
}
],
'items': []
},
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
},
'post'
)
.then((res) => {
this.optionsA = res.items.content
this.sourceFormData[0].data[0].component.options = res.items.content.map(
(item) => {
return {
label: item.resCode,
value: item.resCode
}
}
)
})
.catch((err) => {
console.log(err)
})
}
},
resetMaterialB(query) {
if (query && query.length > 1) {
post(
`/ExtDxProcessMaterial/search`,
{
'pageFrom': 1,
'pageSize': 99,
'searchItems': {
'children': [
{
'items': [
{
'fieldName': 'resCode',
'operator': 'LIKE',
'value': query
}
],
'operator': 'OR'
}
],
'items': []
},
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
},
'post'
)
.then((res) => {
this.optionsB = res.items.content
this.targetFormData[0].data[0].component.options = res.items.content.map(
(item) => {
return {
label: item.resCode,
value: item.resCode
}
}
)
})
.catch((err) => {
console.log(err)
})
}
},
// 切换物料下拉
sourceChangeMaterial(v) {
// 带出物料相关默认值
const SELECT_MATERIAL = this.optionsA.find((item) => item.resCode === v)
if (SELECT_MATERIAL) {
this.sourceForm.modelNo = SELECT_MATERIAL.modelNo || ''
this.sourceForm.techSpec = SELECT_MATERIAL.techSpec || ''
this.sourceForm.spec = SELECT_MATERIAL.spec || ''
this.sourceForm.supplyStatus = SELECT_MATERIAL.supplyStatus || ''
this.sourceForm.resName = SELECT_MATERIAL.resName || ''
}
},
// 切换物料下拉
targetChangeMaterial(v) {
// 带出物料相关默认值
const SELECT_MATERIAL = this.optionsB.find((item) => item.resCode === v)
if (SELECT_MATERIAL) {
this.targetForm.modelNo = SELECT_MATERIAL.modelNo || ''
this.targetForm.techSpec = SELECT_MATERIAL.techSpec || ''
this.targetForm.spec = SELECT_MATERIAL.spec || ''
this.targetForm.supplyStatus = SELECT_MATERIAL.supplyStatus || ''
this.targetForm.resName = SELECT_MATERIAL.resName || ''
}
},
submitEvent() {
const form = {
operator: 'ADD',
source: this.sourceForm,
target: this.targetForm
}
if (this.basicData) {
form.id = this.basicData.id
form.operator = 'MODIFY'
}
this.$api.recursion('MaterialReferenceLink', form).then(res => {
this.cancelEvent()
this.$utils.showMessageSuccess('保存成功')
})
},
cancelEvent() {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss'>
.add-form {
.container {
display: flex;
/* 使用 Flex 布局 */
/* 添加容器边框 */
height: 500px;
/* 添加内边距 */
.source-form .target-form {
padding-right: 20px;
}
.separator {
width: 1px;
/* 分隔符宽度 */
background-color: #e4e1e1;
/* 分隔符颜色 */
height: 100%;
/* 撑满容器高度 */
}
}
.foot-btn-box {
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style>
/**
* @Description: 物料对照表
* @author xioln
* @date 2023-08-30
* @FilePath: applications/dee-mes/src/privateComponents/components/MaterialReferenceLinkTable/index.vue
*/
<template>
<div class="materialReferenceLink-table">
<dee-form
:form="searchForm"
:form-data="searchFormData"
:form-buttons="formButtons"
:form-btn-position="'center'"
@on-submit="initData(searchForm)"
/>
<dee-table
:columns="tableColumns"
:data="tableData"
:index-row="{ title: '序号', width: '60', align: 'center', fixed: true }"
selection-row
:pagination="pagination"
@pagination-size-change="changePageSize"
@pagination-current-change="changePageNum"
@selection-change="selectionChange"
>
<dee-tools slot="header" :tools="tools" mode="normal" :collapse="false" />
</dee-table>
<dee-dialog width="70%" title="新增" :visible.sync="addDialogVisible" @on-cancel="addCancel">
<add-form ref="addForm" @cancel="addCancel" />
</dee-dialog>
</div>
</template>
<script>
import AddForm from './components/addForm'
export default {
name: 'MaterialReferenceLinkTable', // name写在组件的最前方,自定义组件为必填
componentName: '物料对照表',
components: { AddForm },
data() {
return {
addDialogVisible: false,
tableColumns: [
{ title: '操作', key: 'operate', align: 'center', hideTip: true, component: {
show: true,
name: 'EditTableRow',
props: {
btns: [
{
operation: '编辑',
handleClick: (row, index) => {
this.addDialogVisible = true
this.$nextTick(() => {
this.$refs.addForm.editData(row)
})
},
icon: '/icons/c-edit.png',
showFun: (row) => {
return !row.isEdit
}
}
]
}
}, width: 100 },
{
title: '物料A', children: [
{ title: '物料编码', key: 'source.resCode', align: 'center' },
{ title: '物料名称', key: 'source.resName', align: 'center' },
{ title: '牌号/型号/件号', width: '120', key: 'source.modelNo', align: 'center' },
{ title: '技术条件', key: 'source.techSpec', align: 'center' },
{ title: '规格', key: 'source.spec', align: 'center' },
{ title: '供应状态', key: 'source.supplyStatus', align: 'center' },
{ title: '物料', key: 'source.resType2.typeName', align: 'center' }
]
},
{
title: '物料B', children: [
{ title: '物料编码', key: 'target.resCode', align: 'center' },
{ title: '物料名称', key: 'target.resName', align: 'center' },
{ title: '牌号/型号/件号', width: '120', key: 'target.modelNo', align: 'center' },
{ title: '技术条件', key: 'target.techSpec', align: 'center' },
{ title: '规格', key: 'target.spec', align: 'center' },
{ title: '供应状态', key: 'target.supplyStatus', align: 'center' },
{ title: '物料', key: 'target.resType2.typeName', align: 'center' }
]
}],
tableData: [],
tools: [
{
name: '新增',
icon: '/icons/c-add.png',
handler: {
click: () => {
this.addDialogVisible = true
}
}
},
{
name: '删除',
icon: '/icons/c-delete.png',
handler: {
click: () => {
console.log('this.selectionRow', this.selectionRow)
const delData = this.selectionRow.map(item => item.id).join(',')
this.$utils.showConfirm(
'你是否确定删除选中的数据吗?',
'提示',
'warning',
'确定',
'取消',
() => {
this.$api.batchDelete('MaterialReferenceLink', delData).then(res => {
this.$utils.showMessageSuccess('删除成功')
this.initData(this.searchForm)
})
}
)
}
}
}
],
pagination: {
currentPage: 1,
pageSize: 10,
total: 0,
pageSizes: [10, 20, 50]
},
selectionRow: [],
formButtons: [
{
'text': '查询',
'type': 'submit',
'component': {
'type': 'primary'
}
}
],
searchForm: {
rescodeA: '',
rescodeB: ''
},
searchFormData: [{
split: 3,
data: [
{
key: 'rescodeA',
title: '物料A编码',
component: {
name: 'el-input'
}
},
{
key: 'rescodeB',
title: '物料B编码',
component: {
name: 'el-input'
}
}
]
}]
}
},
computed: {},
created() {
// 初始化数据
this.initData()
},
methods: {
initData(searchForm) {
// 初始化数据
const params = {
'pageFrom': this.pagination.currentPage,
'pageSize': this.pagination.pageSize,
'searchItems': {
'children': [],
'items': []
}
}
if (searchForm && searchForm.rescodeA) {
params.searchItems.children = [
{
'items': [
{
'fieldName': 'source.resCode',
'operator': 'LIKE',
'value': searchForm.rescodeA
}
],
'operator': 'OR'
}
]
}
if (searchForm && searchForm.rescodeB) {
params.searchItems.children = [
{
'items': [
{
'fieldName': 'target.resCode',
'operator': 'LIKE',
'value': searchForm.rescodeB
}
],
'operator': 'OR'
}
]
}
params.openProps = [{ name: 'target' }, { name: 'source' }]
this.$api.searchApi('MaterialReferenceLink', params).then(res => {
if (res.items && res.items.content) {
this.tableData = res.items.content
this.pagination.total = res.items.totalElements
}
})
},
selectionChange(v) {
this.selectionRow = v
},
changePageSize(pageSize) {
this.pagination.pageSize = pageSize
this.pagination.currentPage = 1
this.initData()
},
changePageNum(pageNum) {
this.pagination.currentPage = pageNum
this.initData()
},
addCancel(pageNum) {
this.addDialogVisible = false
}
}
}
</script>
<style lang='scss'>
.materialReferenceLink-table {}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment