基础资料优化处理

main
GaoF 2024-08-09 21:55:48 +08:00
parent 6740a79d17
commit af997e65b1
5 changed files with 289 additions and 44 deletions

View File

@ -0,0 +1,32 @@
import { baseRequest } from '@/utils/request'
const request = (url, ...arg) => baseRequest(`/produce/tag/` + url, ...arg)
/**
* 生产标签Api接口管理器
*
* @author Luck
* @date 2024/08/07 22:07
**/
export default {
// 获取生产标签分页
produceTagPage(data) {
return request('page', data, 'get')
},
// 获取生产标签 列表
produceTagList(data) {
return request('list', data, 'get')
},
// 提交生产标签表单 edit为true时为编辑默认为新增
produceTagSubmitForm(data, edit = false) {
return request(edit ? 'edit' : 'add', data)
},
// 删除生产标签
produceTagDelete(data) {
return request('delete', data)
},
// 获取生产标签详情
produceTagDetail(data) {
return request('detail', data, 'get')
}
}

View File

@ -86,8 +86,8 @@
<template v-if="column.dataIndex === 'name'"> <template v-if="column.dataIndex === 'name'">
<a-input :disabled="route.query.type === 'SEARCH'" v-model:value="record.name" /> <a-input :disabled="route.query.type === 'SEARCH'" v-model:value="record.name" />
</template> </template>
<template v-if="column.dataIndex === 'rate'"> <template v-if="column.dataIndex === 'unitRate'">
<a-input disabled v-model:value="record.rate" /> <a-input disabled v-model:value="record.unitRate" />
</template> </template>
</template> </template>
</a-table> </a-table>
@ -138,7 +138,7 @@
<a-tab-pane key="7" tab="操作信息" v-if="route.query.type !== 'ADD'"> <a-tab-pane key="7" tab="操作信息" v-if="route.query.type !== 'ADD'">
<OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation> <OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation>
</a-tab-pane> </a-tab-pane>
<template #rightExtra v-if="activeKey === '3'"> <template #rightExtra v-if="activeKey === '4'">
<a-button @click="handleCompute"></a-button> <a-button @click="handleCompute"></a-button>
</template> </template>
</a-tabs> </a-tabs>
@ -196,7 +196,6 @@
unitOptions = unitList unitOptions = unitList
dataSource.value = packageData dataSource.value = packageData
console.log(dataSource.value, 'dataSource.value')
} }
}) })
@ -234,7 +233,7 @@
materialCategoryList && materialCategoryList &&
baseFormItems.forEach((item) => { baseFormItems.forEach((item) => {
if (item.name === 'categoryId') { if (item.name === 'categoryId') {
item.attrs.options = materialCategoryList item.attrs.treeData = materialCategoryList
} }
}) })
@ -275,13 +274,20 @@
}) })
unitOptions = res unitOptions = res
formData.packageProportion = null
const resFilter = res.filter((item) => item.isBase === 'YES') const resFilter = res.filter((item) => item.isBase === 'YES')
if (resFilter.length > 0) formData.baseUnitId = resFilter[0].id if (resFilter.length > 0) formData.baseUnitId = resFilter[0].id
dataSource.value.forEach((item) => {
item.unitId = null
item.productQty = null
item.unitRate = null
})
// //
dataSource.value[0].unitId = resFilter[0].id dataSource.value[0].unitId = resFilter[0].id
dataSource.value[0].productQty = null dataSource.value[0].productQty = null
dataSource.value[0].rate = resFilter[0].rate dataSource.value[0].unitRate = resFilter[0].rate
}) })
} }
@ -430,12 +436,12 @@
{ {
label: '物料类型:', label: '物料类型:',
name: 'categoryId', name: 'categoryId',
type: 'a-select', type: 'a-tree-select',
span: 6, span: 6,
rules: [required('请选择物料类型')], rules: [required('请选择物料类型')],
attrs: { attrs: {
placeholder: '请选择物料类型', placeholder: '请选择物料类型',
options: tool.dictList('OFFICIAL_ACCOUNT_TYPE'), treeData: [],
fieldNames: { fieldNames: {
label: 'name', label: 'name',
value: 'id' value: 'id'
@ -447,7 +453,6 @@
name: 'brandId', name: 'brandId',
type: 'a-select', type: 'a-select',
span: 6, span: 6,
rules: [required('请选择品牌')],
attrs: { attrs: {
placeholder: '请选择品牌', placeholder: '请选择品牌',
options: [], options: [],
@ -731,7 +736,7 @@
}, },
{ {
title: '换算率', title: '换算率',
dataIndex: 'rate', dataIndex: 'unitRate',
editable: true, editable: true,
align: 'center', align: 'center',
width: 200 width: 200
@ -745,9 +750,8 @@
} }
] ]
const [api, contextHolder] = notification.useNotification()
const onChangeUnit = (value, options, record) => { const onChangeUnit = (value, options, record) => {
record.rate = options.rate record.unitRate = options.rate
} }
const handleCompute = () => { const handleCompute = () => {
@ -770,7 +774,7 @@
// //
for (let i = 0; i < enabledStateFilter.length - 1; i++) { for (let i = 0; i < enabledStateFilter.length - 1; i++) {
// //
if (enabledStateFilter[i].rate > enabledStateFilter[i + 1].rate) { if (enabledStateFilter[i].unitRate > enabledStateFilter[i + 1].unitRate) {
// //
return notification.error({ return notification.error({
message: `包装比例转换提示`, message: `包装比例转换提示`,
@ -783,7 +787,7 @@
let packageProportionCount = [] let packageProportionCount = []
enabledStateFilter.forEach((item) => { enabledStateFilter.forEach((item) => {
packageProportionCount.push(item.productQty * item.rate) packageProportionCount.push(item.productQty * item.unitRate)
}) })
formData.packageProportion = calculateRatios(packageProportionCount).join(':') formData.packageProportion = calculateRatios(packageProportionCount).join(':')

View File

@ -0,0 +1,145 @@
<template>
<xn-form-container title="新增员工" :width="700" :visible="visible" :destroy-on-close="true" @close="onClose">
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="姓名:" name="employeeName">
<a-input v-model:value="formData.employeeName" placeholder="请输入姓名" allow-clear disabled />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="手机号码:" name="employeePhone">
<a-input v-model:value="formData.employeePhone" placeholder="请输入手机号码" allow-clear disabled />
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否合适:" name="isFit">
<a-select
:disabled="pageType === 'SEARCH'"
v-model:value="formData.isFit"
placeholder="请选择是否合适"
:options="tool.dictList('FIT_STATE')"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="支付方式:" name="payMode">
<a-select
style="width: 100%"
placeholder="请选择支付方式"
v-model:value="formData.payMode"
:options="tool.dictList('MANUAL_TASK_PAY_MODE')"
allowClear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="生产数量:" name="amount">
<a-input-number
style="width: 100%"
v-model:value="formData.amount"
:min="0.01"
@change="amountChange()"
:precision="2"
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="金额:" name="money">
<a-input-number style="width: 100%" disabled v-model:value="formData.money" :precision="2" />
</a-form-item>
</a-col>
</a-row>
</a-form>
<template #footer>
<a-button style="margin-right: 8px" @click="onClose"></a-button>
<a-button v-if="pageType !== 'SEARCH'" type="primary" @click="onSubmit" :loading="submitLoading"></a-button>
</template>
</xn-form-container>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { required } from '@/utils/formRules'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
import employeeApi from '@/api/base/employee/employeeApi'
import tool from '@/utils/tool'
import manualTaskDetailApi from '@/api/base/manual-task/manualTaskDetailApi'
//
const visible = ref(false)
const emit = defineEmits({ successful: null })
const formRef = ref()
const formData = ref({
manualTaskId: '',
employeeId: '',
employeeName: '',
employeePhone: '',
employeeNumber: '',
isFit: '',
payMode: '',
amount: '',
money: ''
})
let materialProducePrice = 0
const submitLoading = ref(false)
let pageType = ref('ADD')
//
const onOpen = (record) => {
visible.value = true
formData.value.manualTaskId = record.manualTaskId
formData.value.employeeId = record.id
formData.value.employeeGender = record.gender
formData.value.employeeName = record.name
formData.value.employeePhone = record.phone
formData.value.employeeNumber = record.number
formData.value.isFit = record.isFit
materialProducePrice = record.materialProducePrice
}
//
const onClose = () => {
formRef.value.resetFields()
visible.value = false
formRef.value = {}
}
// refresh
const formRules = {
name: [required('请输入姓名')],
isFit: [required('请选择是否合适')],
amount: [required('请输入生产数量')],
payMode: [required('请选择支付方式')],
money: [required('请输入金额')]
}
//
const onSubmit = () => {
formRef.value.validate().then(() => {
submitLoading.value = true
const formDataParam = cloneDeep(formData.value)
manualTaskDetailApi
.manualTaskDetailSubmitForm(formDataParam, formDataParam.id)
.then((res) => {
emit('successful', formData.value)
onClose()
})
.finally(() => {
submitLoading.value = false
})
})
}
//
const amountChange = () => {
formData.value.money = formData.value.amount * materialProducePrice
}
let treeData = ref([])
//
defineExpose({
onOpen
})
</script>

View File

@ -43,38 +43,44 @@
</template> </template>
<template v-if="column.dataIndex === 'isFit'"> <template v-if="column.dataIndex === 'isFit'">
<a-select <a-select
:disabled="route.query.type === 'SEARCH'" v-if="route.query.type === 'ADD'"
style="width: 100%" style="width: 100%"
placeholder="请选择是否合适" placeholder="请选择是否合适"
v-model:value="record.isFit" v-model:value="record.isFit"
:options="tool.dictList('FIT_STATE')" :options="tool.dictList('FIT_STATE')"
allowClear allowClear
/> />
<span v-else>{{ $TOOL.dictTypeData('FIT_STATE', record.isFit) }}</span>
</template> </template>
<template v-if="column.dataIndex === 'payMode'"> <template v-if="column.dataIndex === 'payMode'">
<a-select <a-select
:disabled="route.query.type === 'SEARCH'" v-if="route.query.type === 'ADD'"
style="width: 100%" style="width: 100%"
placeholder="请选择支付方式" placeholder="请选择支付方式"
v-model:value="record.payMode" v-model:value="record.payMode"
:options="tool.dictList('MANUAL_TASK_PAY_MODE')" :options="tool.dictList('MANUAL_TASK_PAY_MODE')"
allowClear allowClear
:disabled="route.query.type !== 'ADD'"
/> />
<span v-else>{{ $TOOL.dictTypeData('MANUAL_TASK_PAY_MODE', record.payMode) }}</span>
</template> </template>
<template v-if="column.dataIndex === 'amount'"> <template v-if="column.dataIndex === 'amount'">
<a-input-number <a-input-number
v-if="route.query.type === 'ADD'"
v-model:value="record.amount" v-model:value="record.amount"
:min="0.01" :min="0.01"
@change="amountChange($event, record)" @change="amountChange($event, record)"
:precision="2" :precision="2"
:disabled="route.query.type === 'SEARCH'" :disabled="route.query.type !== 'ADD'"
/> />
<span v-else>{{ record.amount.toFixed(2) }}</span>
</template> </template>
<template v-if="column.dataIndex === 'money'"> <template v-if="column.dataIndex === 'money'">
<a-input-number disabled v-model:value="record.money" :precision="2" /> <a-input-number v-if="route.query.type === 'ADD'" disabled v-model:value="record.money" :precision="2" />
<span v-else>{{ record.money.toFixed(2) }}</span>
</template> </template>
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<a-button type="link" @click="handleDelete(record)"></a-button> <a-button type="link" @click="handleDelete(record)"></a-button>
@ -104,15 +110,19 @@
:user-page-api="selectorApiFunction.userPageApi" :user-page-api="selectorApiFunction.userPageApi"
:checkedUserListApi="selectorApiFunction.userListByIdListApi" :checkedUserListApi="selectorApiFunction.userListByIdListApi"
@onBack="userSelectorOnBack" @onBack="userSelectorOnBack"
:radioModel="route.query.type === 'EDIT'"
></employee-selector-plus> ></employee-selector-plus>
<personnel-form ref="personnelFormRef" @successful="successful"></personnel-form> <personnel-form ref="personnelFormRef" @successful="successful"></personnel-form>
<add-personnel-item ref="addPersonnelItemRef" @successful="addSuccessful"></add-personnel-item>
</template> </template>
<script setup name="personnelReportDetail"> <script setup name="personnelReportDetail">
import employeeApi from '@/api/base/employee/employeeApi' import employeeApi from '@/api/base/employee/employeeApi'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi' import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
import manualTaskApi from '@/api/base/manual-task/manualTaskApi' import manualTaskApi from '@/api/base/manual-task/manualTaskApi'
import manualTaskDetailApi from '@/api/base/manual-task/manualTaskDetailApi'
import MaterielSelectorPlus from '@/components/Selector/materielSelectorPlus.vue' import MaterielSelectorPlus from '@/components/Selector/materielSelectorPlus.vue'
import LineSelectorPlus from '@/components/Selector/lineSelectorPlus.vue' import LineSelectorPlus from '@/components/Selector/lineSelectorPlus.vue'
@ -124,7 +134,7 @@
import { required } from '@/utils/formRules' import { required } from '@/utils/formRules'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { message } from 'ant-design-vue' import { message } from 'ant-design-vue'
import manualTaskDetailApi from "@/api/base/manual-task/manualTaskDetailApi"; import AddPersonnelItem from '@/views/productionBusiness/employee/personnelReport/detail/addPersonnelItem.vue'
const route = useRoute() const route = useRoute()
@ -167,7 +177,16 @@
type: 'a-input', type: 'a-input',
attrs: { attrs: {
disabled: true, disabled: true,
placeholder: '请输入基本单位', placeholder: '请输入基本单位'
}
},
{
label: '生产价格:',
name: 'materialProducePrice',
type: 'a-input',
attrs: {
disabled: true,
placeholder: '请输入生产价格'
} }
}, },
{ {
@ -195,6 +214,7 @@
] ]
const formRef1 = ref(null) const formRef1 = ref(null)
const addPersonnelItemRef = ref(null)
const formRules = { const formRules = {
materialName: [required('请输入物料')], materialName: [required('请输入物料')],
productionLineName: [required('请输入生产线')] productionLineName: [required('请输入生产线')]
@ -233,7 +253,7 @@
formData.baseUnitId = res.baseUnitId // id formData.baseUnitId = res.baseUnitId // id
// //
materielMoney = res.producePrice formData.materialProducePrice = res.materialProducePrice
manualTaskDetailApi manualTaskDetailApi
.manualTaskDetailPage({ .manualTaskDetailPage({
@ -258,7 +278,6 @@
// //
let unitList = ref([]) let unitList = ref([])
let materielMoney = 0
// //
const materielBackOk = (event) => { const materielBackOk = (event) => {
formData.materialName = event.materielSelectedRows[0].name // formData.materialName = event.materielSelectedRows[0].name //
@ -269,7 +288,7 @@
formData.baseUnitId = event.materielSelectedRows[0].baseUnitId // id formData.baseUnitId = event.materielSelectedRows[0].baseUnitId // id
// //
materielMoney = event.materielSelectedRows[0].producePrice formData.materialProducePrice = event.materielSelectedRows[0].producePrice
} }
/** /**
@ -291,7 +310,7 @@
* */ * */
const userSelectorPlusProRef = ref(null) const userSelectorPlusProRef = ref(null)
const handleOpenUser = () => { const handleOpenUser = () => {
if (materielMoney === 0) return message.error('请选择物料当前生产价格为0') if (formData.materialProducePrice === null) return message.error('请选择物料当前生产价格为0')
userSelectorPlusProRef.value.showUserPlusModal() userSelectorPlusProRef.value.showUserPlusModal()
} }
// API // API
@ -316,6 +335,17 @@
// //
const userSelectorOnBack = (data) => { const userSelectorOnBack = (data) => {
if (data.length > 0) { if (data.length > 0) {
if (route.query.type === 'EDIT') {
const exists = dataSource.value.find((item) => item.employeeId === data[0].id)
if (exists) return message.warning(`员工 ${data[0].name} 已经存在,未重复添加。`)
return addPersonnelItemRef.value.onOpen({
...data[0],
manualTaskId: route.query.id,
materialProducePrice: formData.materialProducePrice
})
}
data.forEach((i) => { data.forEach((i) => {
// employeeId // employeeId
const exists = dataSource.value.find((item) => item.employeeId === i.id) const exists = dataSource.value.find((item) => item.employeeId === i.id)
@ -326,6 +356,8 @@
employeeName: i.name, employeeName: i.name,
employeeIdNumber: i.idNumber, employeeIdNumber: i.idNumber,
employeeNumber: i.number, employeeNumber: i.number,
employeePhone: i.phone,
employeeGender: i.gender,
isFit: i.isFit, isFit: i.isFit,
payMode: null, payMode: null,
amount: null, amount: null,
@ -364,7 +396,7 @@
}, },
{ {
title: '员工性别', title: '员工性别',
dataIndex: 'employeeSex', dataIndex: 'employeeGender',
editable: true, editable: true,
align: 'center', align: 'center',
width: 200 width: 200
@ -417,10 +449,12 @@
// //
const handleDelete = (record) => { const handleDelete = (record) => {
if (route.query.type === 'EDIT') { if (route.query.type === 'EDIT') {
manualTaskDetailApi.manualTaskDetailDelete({ manualTaskDetailApi
.manualTaskDetailDelete({
manualTaskId: route.query.id, manualTaskId: route.query.id,
detailIdParamList: [{ id: record.id }] detailIdParamList: [{ id: record.id }]
}).then(res => { })
.then((res) => {
console.log(res) console.log(res)
}) })
} }
@ -430,7 +464,7 @@
// //
const amountChange = (event, record) => { const amountChange = (event, record) => {
record.money = event * materielMoney record.money = event * formData.materialProducePrice
} }
/** /**
@ -438,17 +472,17 @@
* */ * */
const personnelFormRef = ref(null) const personnelFormRef = ref(null)
const handleOpenAddUser = () => { const handleOpenAddUser = () => {
if (materielMoney === 0) return message.error('请选择物料当前生产价格为0') if (formData.materialProducePrice === 0) return message.error('请选择物料当前生产价格为0')
personnelFormRef.value.onOpen() personnelFormRef.value.onOpen()
} }
const successful = (data) => { const successful = (data) => {
if (route.query.type === 'EDIT') { if (route.query.type === 'EDIT') {
// manualTaskDetailApi.manualTaskDetailSubmitForm({ addPersonnelItemRef.value.onOpen({
// manualTaskId: route.query.id, ...data,
// detailIdParamList: [{id: record.id}] manualTaskId: route.query.id,
// }).then(res => { materialProducePrice: formData.materialProducePrice
// console.log(res) })
// }) return
} }
dataSource.value.push({ dataSource.value.push({
@ -456,12 +490,30 @@
employeeName: data.name, employeeName: data.name,
employeeIdNumber: data.idNumber, employeeIdNumber: data.idNumber,
employeeNumber: data.number, employeeNumber: data.number,
employeePhone: data.phone,
employeeGender: data.employeeGender,
isFit: data.isFit, isFit: data.isFit,
payMode: null, payMode: null,
amount: null, amount: null,
money: null money: null
}) })
} }
//
const addSuccessful = (data) => {
dataSource.value.push({
employeeId: data.employeeId,
employeeName: data.employeeName,
employeeIdNumber: data.employeeIdNumber,
employeeNumber: data.employeeNumber,
employeePhone: data.employeePhone,
employeeGender: data.employeeGender,
isFit: data.isFit,
payMode: data.payMode,
amount: data.amount,
money: data.money
})
}
</script> </script>
<style scoped></style> <style scoped></style>

View File

@ -2,6 +2,11 @@
<a-card :bordered="false"> <a-card :bordered="false">
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form"> <a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="6">
<a-form-item label="标签" name="number">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
</a-form-item>
</a-col>
<a-col :span="6"> <a-col :span="6">
<a-form-item label="编码" name="number"> <a-form-item label="编码" name="number">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" /> <a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
@ -100,9 +105,15 @@
v-if="hasPerm('customerEdit')" v-if="hasPerm('customerEdit')"
> >
<FormOutlined /> <FormOutlined />
<!-- 编辑-->
</a> </a>
</a-tooltip> </a-tooltip>
<!-- <a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('customerDelete')">
<DeleteOutlined />
&lt;!&ndash; 删除&ndash;&gt;
</a-button>
</a-popconfirm>-->
<a-divider type="vertical"></a-divider> <a-divider type="vertical"></a-divider>
<a-tooltip title="添加标签"> <a-tooltip title="添加标签">
@ -195,7 +206,8 @@
deleteBatchRecords, deleteBatchRecords,
options, options,
searchFormRef, searchFormRef,
navigateTo navigateTo,
deleteRecord
} = useTableManagement( } = useTableManagement(
{ {
page: manualTaskApi.manualTaskPage, page: manualTaskApi.manualTaskPage,