Commit b0e93481 authored by xioln's avatar xioln

班组新增人员、库房新增库位、移库库位选择修改

parent bb5c0856
/**
* @Description: 新增库位
* @author xioln
* @date 2023-09-15
* @FilePath: applications/dee-mes/src/privateComponents/components/AddExtDxProductWorkUnit/index.vue
*/
<template>
<div class="add-extDxProductWorkUnit">
<dee-as-com ref="addtWorkUnit" :form="form" :lay-config="{ typeName: 'ExtDxProductWorkUnit', layKey: 'addExtDxProductWorkUnit' }" />
<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: 'AddExtDxProductWorkUnit', // name写在组件的最前方,自定义组件为必填
componentName: '新增库位',
components: {},
props: {
basicData: {
type: Object,
default: () => { }
}
},
data() {
return {
form: {}
}
},
computed: {},
created() {
// 初始化数据
},
mounted() {
this.$nextTick(() => {
if (this.basicData.hasOwnProperty('createTime')) {
this.form = this.basicData
}
})
},
methods: {
submitEvent() {
const currentDate = new Date()
const addForm = this.$refs.addtWorkUnit.$refs.asCom.form
// 格式化为 "YYYY-MM-DD HH:MM:SS" 格式
const formattedDate = `${currentDate.getFullYear()}-${(currentDate.getMonth() + 1).toString().padStart(2, '0')}-${currentDate.getDate().toString().padStart(2, '0')} ${currentDate.getHours().toString().padStart(2, '0')}:${currentDate.getMinutes().toString().padStart(2, '0')}:${currentDate.getSeconds().toString().padStart(2, '0')}`
const form = {
creator: {
userName: localStorage.getItem('user')
},
createTime: formattedDate,
extcode: addForm.extcode,
isValid: addForm.isValid
}
this.$emit('submitEvent', { formData: form })
},
cancelEvent() {
this.$emit('cancel')
}
}
}
</script>
<style lang='scss'>
.add-extDxProductWorkUnit {
.foot-btn-box {
display: flex;
margin-top: 10px;
justify-content: center;
align-content: center;
}
}
</style>
......@@ -37,12 +37,74 @@ export default {
// 初始化数据
},
methods: {
submitEvent() {
const form = this.$refs.addUser.$children[0].$children[0].form
const formData = [{
...form
}]
this.$emit('submitEvent', { formData: formData })
async submitEvent() {
// 新增班组添加人员
const form = this.$refs.addUser.$refs.asCom.form
// 新增班组班组人员表格
const tableData = this.$parent.$parent.$parent.$parent.form
const tableDataList = []
let users = []
if (form.hasOwnProperty('dxUserInfo') && form.dxUserInfo) {
const params = {
'searchItems': {
'items': [
{
'fieldName': 'id',
'operator': 'IN',
'value': form.dxUserInfo
}
],
'operator': 'AND'
}
}
await this.$api.searchApi('DxUserInfo', params).then(res => {
if (res.items.content.length) {
users = res.items.content
}
})
// 展开人员岗位信息
if (users) {
// 列表是否有数据
if (tableData.hasOwnProperty('extProcessSkillUsers') && tableData.extProcessSkillUsers) {
const arr = tableData.extProcessSkillUsers.filter(item => form.dxUserInfo.includes(item.dxUserInfoId))
if (arr.length !== 0) {
const names = arr.map(item => item.dxUserInfo.userName)
return this.$utils.showMessageWarning('人员已存在:' + names.join(','))
}
}
// 使用 Promise.all 来等待所有请求完成
await Promise.all(users.map(async(user, i) => {
const params = {
'openProps': [{ 'name': 'source' }],
'searchItems': {
'items': [{ 'fieldName': 'targetId', 'operator': 'EQ', 'value': user.id }],
'operator': 'AND'
}
}
try {
const post = await this.$api.searchApi('DxPostMemberLink', params)
if (post.items.content.length) {
const postList = post.items.content[0]
tableDataList.push({
dxPost: postList.source,
dxUserInfo: user,
dxUserInfoId: user.id,
isSkillLeader: form.isSkillLeader,
postValidity: form.postValidity,
remark: form.remark,
sealNo: form.sealNo
})
}
// 判断是否是最后一个用户
if (i === users.length - 1) {
this.$emit('submitEvent', { formData: tableDataList })
}
} catch (error) {
console.error('Error fetching data for user:', user.id, error)
}
}))
}
}
},
cancelEvent() {
this.$emit('cancel')
......
......@@ -101,6 +101,8 @@ export default {
const _val = _get(this.form, this.itemObj.linkageAttr)
if (_val !== this.linkageValue) {
this.linkageValue = _val
this.selVal = null
this.options = []
}
}
}
......
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