|
|
@@ -1,13 +1,270 @@
|
|
|
+<!-- @desc:产成品入库 @auth:洪旭东 @time:2023-08-09 13:27 -->
|
|
|
<template>
|
|
|
-
|
|
|
+ <div class="main-div" ref="mainDiv">
|
|
|
+ <!--加载中-->
|
|
|
+ <loading :loading="loading" v-if="!modalVisible"></loading>
|
|
|
+ <DkPageButton :total="editKeys?editKeys.length:0"
|
|
|
+ :current="editIndex"
|
|
|
+ v-if="editKeys && editKeys.length > 1"
|
|
|
+ @pageChange="editPageChange"></DkPageButton>
|
|
|
+ <DkCollapse ref="collapse" @on-change="changeCollapse">
|
|
|
+ <DkPanel prop="essentialInformation">
|
|
|
+ <!-- 下拉区域 -->
|
|
|
+ <DkForm slot="content" ref="formInline" v-model="formData" :label-max-words="6" style="width: 95%">
|
|
|
+ <!--物料编码-->
|
|
|
+ <DkFormItem prop="packagingBarcode" :label="$t('appPackagingBarcode')">
|
|
|
+ <InputPop v-model="formData.packagingBarcode" @on-blur="changeValue" @on-enter="changeValue"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--订单单号-->
|
|
|
+ <DkFormItem required prop="orderNo" v-if="type === $config.formMode.add">
|
|
|
+ <InputPop ref="orderNo" v-model="formData.orderNo"/>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--仓库-->
|
|
|
+ <DkFormItem prop="whCodeName" v-if="type === $config.formMode.add">
|
|
|
+ <SelectMagnifier v-model="formData.whId" :type="$config.MagnifierType.warehouse" :multiple="false"
|
|
|
+ @ok="chooseWarehouse"></SelectMagnifier>
|
|
|
+ </DkFormItem>
|
|
|
+ <!--仓位-->
|
|
|
+ <DkFormItem prop="whPlaceName" v-if="type === $config.formMode.add">
|
|
|
+ <SelectMagnifier v-model="formData.placeId" :type="$config.MagnifierType.warehousePlace"
|
|
|
+ :disabled="!formData.whId" :other-condition="{whId: formData.whId}" :multiple="false"
|
|
|
+ @ok="chooseWhPlace"></SelectMagnifier>
|
|
|
+ </DkFormItem>
|
|
|
+ </DkForm>
|
|
|
+ </DkPanel>
|
|
|
+ <!--列表数据-->
|
|
|
+ <DkPanel prop="details">
|
|
|
+ <!--明细-->
|
|
|
+ <EditTable slot="content" ref="table"
|
|
|
+ :columns="detailColumns"
|
|
|
+ :height="tableHeight + 8"
|
|
|
+ :freeze="false"
|
|
|
+ :enabledRepeat="false"
|
|
|
+ @addRow="addList"
|
|
|
+ :add-flag="false"
|
|
|
+ :requiredColumn="['whCodeName', 'whPlaceName']"
|
|
|
+ ></EditTable>
|
|
|
+ </DkPanel>
|
|
|
+ </DkCollapse>
|
|
|
+ <!-- 下部分按钮区域-->
|
|
|
+ <DkSaveButton ref="saveButton" :loading="loading" @save="save" @close="close"></DkSaveButton>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import { formMixin } from '@/mixins/form'
|
|
|
export default {
|
|
|
- name: "form"
|
|
|
+ mixins: [formMixin],
|
|
|
+ data() {
|
|
|
+ let self = this
|
|
|
+ return {
|
|
|
+ loading: false,
|
|
|
+ tableHeight: 600,
|
|
|
+ checkId: null,//总单Id编辑用
|
|
|
+ // 画面表单数据
|
|
|
+ formData: {
|
|
|
+ packagingBarcode: null,//物料编码
|
|
|
+ orderId:null,//订单Id
|
|
|
+ whId: null,//仓库
|
|
|
+ placeId: null,//仓位
|
|
|
+ },
|
|
|
+ //明细
|
|
|
+ detailColumns: [
|
|
|
+ //物料型号编码
|
|
|
+ { field: 'pdtUniqueCode', title: self.$t('pdtBarcode'), type: 'disabled', width: 'auto', },
|
|
|
+ //产品型号
|
|
|
+ { field: 'modelCodeName', title: self.$t('pdtModel'), type: 'disabled', width: 'auto', },
|
|
|
+ //商标
|
|
|
+ { field: 'logoCodeName', title: self.$t('productLogo'), type: 'disabled', width: 'auto', },
|
|
|
+ //成型工号
|
|
|
+ { field: 'moldingUserCodeName', title: self.$t('moldingUser'), type: 'disabled', width: 'auto', },
|
|
|
+ //模具名称
|
|
|
+ { field: 'moldlineItemCode', title: self.$t('produceModelCode'), type: 'disabled', width: 'auto', },
|
|
|
+ //成型日期
|
|
|
+ { field: 'moldingDate', title: self.$t('moldingDate'), type: 'disabled', width: 'auto', },
|
|
|
+ //交坯日期
|
|
|
+ { field: 'renderMTime', title: self.$t('renderMTime'), type: 'disabled', width: 'auto', },
|
|
|
+ //板码
|
|
|
+ { field: 'carrierCode', title: self.$t('carrierCode'), type: 'disabled', width: 'auto', },
|
|
|
+ //仓库
|
|
|
+ {
|
|
|
+ field: 'whCodeName',
|
|
|
+ type: 'tableSelect',
|
|
|
+ selectField: 'whCodeName',
|
|
|
+ width: 'auto',
|
|
|
+ param: () => {
|
|
|
+ return {}
|
|
|
+ },
|
|
|
+ dataType: self.$config.tableSelectType.warehouse,
|
|
|
+ fieldUpdate: self.$updateColumns.productDeliveryWh,
|
|
|
+ },
|
|
|
+ //仓位
|
|
|
+ {
|
|
|
+ field: 'whPlaceName',
|
|
|
+ type: 'tableSelect',
|
|
|
+ selectField: 'placeName',
|
|
|
+ width: 'auto',
|
|
|
+ param: () => {
|
|
|
+ return {}
|
|
|
+ },
|
|
|
+ dataType: self.$config.tableSelectType.warehousePlace,
|
|
|
+ fieldUpdate: self.$updateColumns.productDeliveryPlace,
|
|
|
+ },
|
|
|
+ //备注
|
|
|
+ { field: 'remarks', type: 'text', width: 'auto', },
|
|
|
+ ],
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /**
|
|
|
+ * @desc : 新建明细
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-09 16:23
|
|
|
+ */
|
|
|
+ addList(rowIndex) {
|
|
|
+ if (this.$refs.table && this.$refs.table.tableData[rowIndex + 1]) {
|
|
|
+ this.$refs.table.tableData[rowIndex + 1].whId = this.formData.whId
|
|
|
+ this.$refs.table.tableData[rowIndex + 1].whCodeName = this.formData.whCodeName
|
|
|
+ this.$refs.table.tableData[rowIndex + 1].placeId = this.formData.placeId
|
|
|
+ this.$refs.table.tableData[rowIndex + 1].whPlaceName = this.formData.whPlaceName
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 设置传参
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-11 11:27
|
|
|
+ */
|
|
|
+ setParams() {
|
|
|
+ this.params = this.$refs.table.tableData.filter(f => f.pdtUniqueId).map(m => {return {
|
|
|
+ pdtUniqueId: m.pdtUniqueId,
|
|
|
+ opnType: this.type === this.$config.formMode.add ? 1:0,
|
|
|
+ whId: m.whId,
|
|
|
+ placeId: m.placeId,
|
|
|
+ carrierId: m.carrierId,
|
|
|
+ carrierBatch: m.carrierBatch,
|
|
|
+ carrierRangeId: m.carrierRangeId,
|
|
|
+ orderNo: this.formData.orderNo
|
|
|
+ }})
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 验证数据
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-11 11:25
|
|
|
+ */
|
|
|
+ validData() {
|
|
|
+ if (!this.$refs.table.tableData.filter(f => f.pdtUniqueId).length) {
|
|
|
+ this.$Message.warning(this.$t('W_012'))
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.type === this.$config.formMode.add &&
|
|
|
+ this.$refs.table.tableData.some(s => !s.whId || !s.placeId)) {
|
|
|
+ this.$Message.warning(this.$t('W_001', {'param': '明细中仓库或仓位'}))
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 保存数据
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-11 11:27
|
|
|
+ */
|
|
|
+ saveData() {
|
|
|
+ return this.type === this.$config.formMode.add ?
|
|
|
+ this.excute(this.$service.productDeliveryService, this.$service.productDeliveryService.insertBatch, this.params)
|
|
|
+ : this.excute(this.$service.productDeliveryService, this.$service.productDeliveryService.reverse, this.params)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 清空
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-11 11:28
|
|
|
+ */
|
|
|
+ clear() {
|
|
|
+ this.formData = {
|
|
|
+ packagingBarcode: null,//物料编码
|
|
|
+ orderId:null,//订单Id
|
|
|
+ whId: null,//仓库
|
|
|
+ placeId: null,//仓位
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 选择仓库
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-09 16:12
|
|
|
+ */
|
|
|
+ chooseWarehouse(val) {
|
|
|
+ if (val && val.length) {
|
|
|
+ let wh = val[0]
|
|
|
+ this.formData.whCodeName = wh.whCodeName
|
|
|
+ for (let it of this.$refs.table.tableData) {
|
|
|
+ if (!it.whId) {
|
|
|
+ it.whId = wh.whId
|
|
|
+ it.whCodeName = wh.whCodeName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$refs.table.$refs.xTable.reloadData(this.$refs.table.tableData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 选择仓位
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-09 16:12
|
|
|
+ */
|
|
|
+ chooseWhPlace(val) {
|
|
|
+ if (val && val.length) {
|
|
|
+ let whp = val[0]
|
|
|
+ this.formData.whPlaceName = whp.placeName
|
|
|
+ for (let it of this.$refs.table.tableData) {
|
|
|
+ if (!it.placeId) {
|
|
|
+ it.placeId = whp.placeId
|
|
|
+ it.whPlaceName = whp.placeName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$refs.table.$refs.xTable.reloadData(this.$refs.table.tableData)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @desc : 表格输入
|
|
|
+ * @author : 洪旭东
|
|
|
+ * @date : 2023-08-09 16:23
|
|
|
+ */
|
|
|
+ changeValue(){
|
|
|
+ let val = this.formData.packagingBarcode
|
|
|
+ if (!val) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.excute(this.$service.collectService, this.$service.collectService.selectByCodeOrCarrier, {barCode: val, carCode: val}).then(res=>{
|
|
|
+ if (res.code === this.$config.SUCCESS_CODE) {
|
|
|
+ //带出相同板车的产品
|
|
|
+ if (this.$refs.table.tableData[0] && !this.$refs.table.tableData[0].pdtUniqueId) {
|
|
|
+ this.$refs.table.tableData.splice(0, 1)
|
|
|
+ }
|
|
|
+ for (let it of res.data) {
|
|
|
+ it.pdtUniqueId = it.uniqueId
|
|
|
+ it.pdtUniqueCode = it.uniqueCode
|
|
|
+ it.whId = this.formData.whId
|
|
|
+ it.whCodeName = this.formData.whCodeName
|
|
|
+ it.placeId = this.formData.placeId
|
|
|
+ it.whPlaceName = this.formData.whPlaceName
|
|
|
+ if (!this.$refs.table.tableData.some(s => s.pdtUniqueId == it.uniqueId)) {
|
|
|
+ this.$refs.table.tableData.push(it)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // this.$refs.table.tableData[rowIndex].pdtUniqueCode = null
|
|
|
+ this.$Message.error(res.message)
|
|
|
+ }
|
|
|
+ this.formData.packagingBarcode = null
|
|
|
+ })
|
|
|
+ },
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.resizeTableFlag = true // 计算表格高度
|
|
|
+ if (this.type !== this.$config.formMode.add) {
|
|
|
+ this.detailColumns = this.detailColumns.filter(f => f.field !== 'whCodeName' && f.field !== 'whPlaceName')
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style scoped>
|
|
|
-
|
|
|
+<style lang="less" scoped>
|
|
|
</style>
|