| | |
| | | @cancel="handleCancel" |
| | | > |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form :form="form"> |
| | | <a-form-model ref="form" :model="model" :rules="validatorRules"> |
| | | <a-row style="width: 100%"> |
| | | <a-col :span="24 / 2"> |
| | | <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="入库类型"> |
| | | <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="工具分类编号"> |
| | | <a-input v-model="model.classifyNum" placeholder="请输入工具分类编码" :disabled="true"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24 / 2"> |
| | | <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="工具分类名称"> |
| | | <a-input v-model="model.typeName" placeholder="请输入工具分类名称" :disabled="true"></a-input> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row style="width: 100%"> |
| | | <a-col :span="24 / 2"> |
| | | <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="入库类型" prop="inStorehouseType"> |
| | | <j-dict-select-tag |
| | | :disabled="disableSubmit" |
| | | type="list" |
| | | v-decorator="['inStorehouseType', validatorRules.inStorehouseType]" |
| | | v-model="model.inStorehouseType" |
| | | :triggerChange="true" |
| | | dictCode="in_storehouse_type" |
| | | placeholder="请选择入库类型" |
| | | @change="handleTypeChange" |
| | | /> |
| | | </a-form-item> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | <a-col :span="24 / 2"> |
| | | <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="入库时间"> |
| | | <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="入库时间" prop="inboundTime"> |
| | | <a-date-picker |
| | | @change="onChange" |
| | | :disabled="disableSubmit" |
| | | style="width: 100%" |
| | | v-decorator="['inboundTime', validatorRules.inboundTime]" |
| | | v-model="model.inboundTime" |
| | | /> |
| | | </a-form-item> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | <a-row style="width: 100%"> |
| | | |
| | | <a-row style="width: 100%"> |
| | | <a-col :span="24 / 2"> |
| | | <a-form-item label="入库数量" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-input placeholder="请输入入库数量" :disabled="disableSubmit" v-decorator="['in_number', validatorRules.applicationReason]" /> |
| | | </a-form-item> |
| | | <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="库位号" prop="locationCodeId"> |
| | | <a-select |
| | | :triggerChange="true" |
| | | :options="locationCodeOptions" |
| | | v-model="model.locationCodeId" |
| | | /> |
| | | </a-form-model-item> |
| | | </a-col> |
| | | </a-row> |
| | | |
| | | </a-form> |
| | | </a-form-model> |
| | | </a-spin> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectReturnList()" v-show="returnShow && !disableSubmit">选择借用出库单</a-button> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectReturnList()" v-show="returnShow && !disableSubmit">选择借出工具</a-button> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectTooling()" v-show="toolingShow && !disableSubmit">选择工具</a-button> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectSharpenList()" v-show="sharpenShow && !disableSubmit">选择刃磨出库单</a-button> |
| | | <a-button type="primary" :style="{ marginBottom: '8px' }" @click="selectSharpenList()" v-show="sharpenShow && !disableSubmit">选择刃磨工具</a-button> |
| | | <a-table |
| | | ref="table" |
| | | bordered |
| | |
| | | <div :key="col.dataIndex"> |
| | | <a-input-number |
| | | v-if="col.dataIndex == 'inStorageQuantity'" |
| | | :disabled="quantityDisable" |
| | | :disabled="record.accuracyClass == '1'" |
| | | :value="text" |
| | | @change="(e) => handleChange(e, record.key, col, index)" |
| | | @change="(e) => handleChange(e, record, col, index)" |
| | | :min="1" |
| | | /> |
| | | </div> |
| | |
| | | <template slot="footer" v-if="disableSubmit == true"> |
| | | <a-button :style="{ marginRight: '8px' }" @click="handleCancel">关闭</a-button> |
| | | </template> |
| | | <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk"></j-select-tooling-modal> |
| | | <j-select-return-list-modal ref="returnModalForm" @ok="modalFormOk"></j-select-return-list-modal> |
| | | <j-select-sharpen-list-modal ref="sharpenModalForm" @ok="modalFormOk"></j-select-sharpen-list-modal> |
| | | <j-select-tooling-modal ref="toolingModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-tooling-modal> |
| | | <j-select-return-list-modal ref="returnModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-return-list-modal> |
| | | <j-select-sharpen-list-modal ref="sharpenModalForm" @ok="modalFormOk" :classifyId="classifyId"></j-select-sharpen-list-modal> |
| | | |
| | | <div id="printArea" style="display: block;"> |
| | | <div v-for="(item, index) in qrList" :key="index" class="qrcode-item"> |
| | | <img :src="item.base64" alt="QR Code"> |
| | | <p>{{ item.content }}</p> |
| | | </div> |
| | | </div> |
| | | </a-modal> |
| | | |
| | | </template> |
| | | |
| | | <script> |
| | |
| | | import { filterObj } from '@/utils/util' |
| | | import JSelectReturnListModal from '.././inboundOrder/JSelectReturnListModal' |
| | | import JSelectSharpenListModal from '.././inboundOrder/JSelectSharpenListModal' |
| | | import printJS from 'print-js'; |
| | | |
| | | export default { |
| | | name: 'InboundOrderModel', |
| | | name: 'InboundModel', |
| | | components: { |
| | | JSelectToolingModal, |
| | | JMultiSelectTag, |
| | |
| | | showSizeChanger: true, |
| | | total: 0 |
| | | }, |
| | | form: this.$form.createForm(this), |
| | | isDisabled: false, |
| | | selectedRowKeys: {}, |
| | | state: { |
| | |
| | | maintenanceState: false, |
| | | checkState: false, |
| | | }, |
| | | inboundDate: '', |
| | | applicationDate: '', |
| | | supplierShow: false, |
| | | disableSubmit: false, |
| | | numDisable:false, |
| | | quantityDisable:false, |
| | | onlyCodeDisable:true, |
| | | returnShow:false, |
| | | toolingShow:false, |
| | | sharpenShow:false, |
| | | addDisable:false, |
| | | toolinngOptions:[], |
| | | title: '操作', |
| | | visible: false, |
| | | model: {}, |
| | |
| | | }, |
| | | confirmLoading: false, |
| | | loading: false, |
| | | form: this.$form.createForm(this), |
| | | dataSource: [], |
| | | toolingTreeData:[], |
| | | warehouseOptions:[], |
| | | locationOptions:[], |
| | | allToolingList:[], |
| | | param: {}, |
| | | barcodeCurrentType: false, |
| | | inboundOrderId:'', |
| | | validatorRules: { |
| | | type: { |
| | | rules: [ |
| | | inStorehouseType: [ |
| | | { |
| | | required: true, |
| | | message: '请选择入库类型!', |
| | | }, |
| | | ], |
| | | }, |
| | | inboundDate: { |
| | | rules: [ |
| | | inboundTime:[ |
| | | { |
| | | required: true, |
| | | message: '请选择申请入库日期!', |
| | | }, |
| | | ], |
| | | }, |
| | | applicant: { |
| | | rules: [ |
| | | locationCodeId:[ |
| | | { |
| | | required: true, |
| | | message: '请选择申请人!', |
| | | message: '请选择库位号!', |
| | | }, |
| | | ], |
| | | }, |
| | | ] |
| | | }, |
| | | url: { |
| | | add: '/tms/inboundOrder/add', |
| | | edit: '/tms/inboundOrder/edit', |
| | | queryByUserName: '/sys/user/queryByUserName', |
| | | addInStorage: '/tms/inboundOrder/addInStorage', |
| | | toolingList:'/tms/baseTools/list', |
| | | queryAccountList:'/tooling/storage/queryAccountList', |
| | | querySharpenList:'/sharpen/sharpenDetail/querySharpenList', |
| | | queryReturnList:'/returnInventory/queryReturnList', |
| | | querySharpenList:'/tms/toolLedgerDetail/list', |
| | | queryReturnList:'/tms/toolLedgerDetail/list', |
| | | detailList:'/tms/inboundDetail/list', |
| | | }, |
| | | toolingOptions:[], |
| | | columns: [ |
| | | { |
| | | title: '#', |
| | |
| | | dataIndex: 'toolModel' |
| | | }, |
| | | { |
| | | title: '唯一编码', |
| | | align: 'center', |
| | | dataIndex: 'onlyCode', |
| | | width: 150, |
| | | }, |
| | | { |
| | | title: '入库数量', |
| | | align: 'center', |
| | | dataIndex: 'inStorageQuantity', |
| | |
| | | scopedSlots: { customRender: 'action' }, |
| | | }, |
| | | ], |
| | | classifyId:'', |
| | | locationCodeOptions:[], |
| | | qrList: [] |
| | | } |
| | | }, |
| | | created() {}, |
| | | created() { |
| | | //备份model原始值 |
| | | this.modelDefault = JSON.parse(JSON.stringify(this.model)); |
| | | ajaxGetDictItems("tms_goods_shelves,location_code,id", null).then((res) => { |
| | | if (res.success) { |
| | | this.locationCodeOptions = res.result |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | modalFormOk() { |
| | | }, |
| | |
| | | this.param.pageSize = this.ipagination.pageSize |
| | | return filterObj(this.param) |
| | | }, |
| | | add() { |
| | | this.edit({}) |
| | | add (nodeSelected) { |
| | | this.qrList = [] |
| | | this.classifyId = nodeSelected.key |
| | | this.model.classifyNum = nodeSelected.entity.classifyId |
| | | this.model.typeName = nodeSelected.entity.typeName |
| | | this.dataSource = [] |
| | | this.visible = true; |
| | | }, |
| | | edit(record) { |
| | | let that = this |
| | | this.form.resetFields() |
| | | this.model = Object.assign({}, record) |
| | | this.visible = true |
| | | this.isDisabled = false |
| | | this.disableSubmit = false |
| | | if (record.id) { |
| | | if(record.inStorehouseType == "1"){ |
| | | this.toolingShow = true |
| | | }else if(record.inStorehouseType == "2"){ |
| | | this.returnShow = true |
| | | }else if(record.inStorehouseType == "5"){ |
| | | this.sharpenShow = true |
| | | } |
| | | this.inboundOrderId = record.id |
| | | this.detailList(this.inboundOrderId) |
| | | } |
| | | this.initOptions() |
| | | this.$nextTick(() => { |
| | | this.form.setFieldsValue( |
| | | pick(this.model, 'inboundNum', 'inStorehouseType', 'inboundTime', 'applicationReason', 'handler','approvalDate','reviewer','approvalOpinion','remark') |
| | | ) |
| | | }) |
| | | }, |
| | | handleChange(value, key, column, index) { |
| | | handleChange(value, record, column, index) { |
| | | //let t = (this.ipaginationm.current - 1) * this.ipaginationm.pageSize + index |
| | | let key = record.key |
| | | const temp = [...this.dataSource] |
| | | const target = temp.filter(item => key === item.key)[index]; |
| | | if (target) { |
| | | target[column.dataIndex] = value |
| | | this.dataSource = temp |
| | | |
| | | if(column.dataIndex === 'inStorageQuantity'){ |
| | | if(target['quantity']<value){ |
| | | this.$message.error('入库数量不能大于出库数量!') |
| | | this.isDisabled = true |
| | | }else{ |
| | | this.isDisabled = false |
| | | } |
| | | } |
| | | this.dataSource = temp |
| | | } |
| | | }, |
| | | close() { |
| | | this.$emit('close') |
| | | this.dataSource = [] |
| | | this.model = {}, |
| | | this.visible = false |
| | | this.supplierShow = false, |
| | | this.disableSubmit = false, |
| | | this.numDisable = false, |
| | | this.quantityDisable = false, |
| | | this.onlyCodeDisable = true, |
| | | this.returnShow = false, |
| | | this.toolingShow = false, |
| | | this.sharpenShow = false, |
| | | this.addDisable = false |
| | | this.sharpenShow = false |
| | | }, |
| | | handleTableChange(pagination, filters, sorter) { |
| | | this.ipagination = pagination |
| | |
| | | }, |
| | | handleOk() { |
| | | const that = this |
| | | if(this.dataSource.length == 0){ |
| | | that.$message.error("请先选择需要入库的工具!") |
| | | return |
| | | } |
| | | // 触发表单验证 |
| | | this.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | this.$refs.form.validate(valid => { |
| | | if (valid) { |
| | | that.confirmLoading = true |
| | | let formData = Object.assign(this.model, values) |
| | | formData.detailData = this.dataSource |
| | | let http = '' |
| | | if(this.model.id){ |
| | | http = this.url.edit |
| | | }else{ |
| | | http = this.url.add |
| | | } |
| | | postAction(http, formData) |
| | | this.model.detailData = this.dataSource |
| | | this.model.classifyId = this.classifyId |
| | | postAction(this.url.addInStorage, this.model) |
| | | .then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | if(this.model.inStorehouseType === '1'){ |
| | | this.qrList = res.result.map((content, i) => ({ |
| | | content:res.result[i].content, |
| | | base64: res.result[i].image |
| | | })); |
| | | this.handleBacthPrint(); |
| | | }else{ |
| | | that.$message.success("保存成功") |
| | | } |
| | | that.$emit('ok', new Date()) |
| | | } else { |
| | | that.$message.warning(res.message) |
| | |
| | | selectTooling: function () { |
| | | let ids = [] |
| | | for (let i = 0; i < this.dataSource.length; i++) { |
| | | ids.push(this.dataSource[i].toolCodeId) |
| | | ids.push(this.dataSource[i].id) |
| | | } |
| | | this.$refs.toolingModalForm.showModal(ids) |
| | | this.$refs.toolingModalForm.title = '选择工具' |
| | |
| | | this.dataSource.splice(index, 1) |
| | | }, |
| | | onChange() {}, |
| | | //控制扫码或手选 |
| | | selectCurrentUserType(e) { |
| | | if (e == '0') { |
| | | this.barcodeCurrentType = true |
| | | } else { |
| | | this.barcodeCurrentType = false |
| | | } |
| | | }, |
| | | //手选人员值 |
| | | selectCurrentUserChange(e) { |
| | | console.log('当前手选', e) |
| | | // this.form.setFieldsValue({ |
| | | // // userName: e, |
| | | // userNameId: e, |
| | | // }) |
| | | }, |
| | | //入库类型 |
| | | handleTypeChange(value) { |
| | | this.dataSource = [] |
| | | if(value == 1){ |
| | | this.toolingShow = true |
| | | this.quantityDisable = false |
| | | this.addDisable = true |
| | | this.numDisable = false |
| | | }else{ |
| | | this.toolingShow = false |
| | | } |
| | | if(value == 2){ |
| | | this.numDisable = true |
| | | this.addDisable = false |
| | | this.returnShow = true |
| | | this.quantityDisable = true |
| | | }else{ |
| | | this.returnShow = false |
| | | } |
| | | if (value == 5) { |
| | | this.numDisable = true |
| | | this.addDisable = false |
| | | this.sharpenShow = true |
| | | this.quantityDisable = true |
| | | } else { |
| | | this.sharpenShow = false |
| | | } |
| | | |
| | | }, |
| | | //添加工具按钮 |
| | | addTooling() { |
| | | const temp = [...this.dataSource]; |
| | | temp.push({ indexId: temp.length + 1 }); |
| | | this.dataSource = temp; |
| | | }, |
| | | detailList(inboundOrderId) { |
| | | this.param.inboundOrderId = inboundOrderId |
| | |
| | | } |
| | | }) |
| | | }, |
| | | initOptions() { |
| | | |
| | | ajaxGetDictItems("mes_base_warehouse,name,id,del_flag!='1' order by num asc", null).then((res) => { |
| | | if (res.success) { |
| | | if (res.result) { |
| | | for (let i = 0; i < res.result.length; i++) { |
| | | res.result[i].label = res.result[i].title; |
| | | } |
| | | } |
| | | this.warehouseOptions = res.result; |
| | | } |
| | | }) |
| | | ajaxGetDictItems("mes_base_storage_area,name,id,del_flag!='1'", null).then((res) => { |
| | | if (res.success) { |
| | | if (res.result) { |
| | | for (let i = 0; i < res.result.length; i++) { |
| | | res.result[i].label = res.result[i].title; |
| | | } |
| | | } |
| | | this.locationOptions = res.result; |
| | | } |
| | | }) |
| | | ajaxGetDictItems("mes_base_tooling,num,id,del_flag!='1'", null).then((res) => { |
| | | if (res.success) { |
| | | if (res.result) { |
| | | for (let i = 0; i < res.result.length; i++) { |
| | | res.result[i].label = res.result[i].title; |
| | | res.result[i].toolingName = res.result[i].name |
| | | } |
| | | } |
| | | this.toolingOptions = res.result; |
| | | } |
| | | }) |
| | | }, |
| | | filterOption(input, option) { |
| | | return ( |
| | | option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| | | ); |
| | | }, |
| | | |
| | | // 执行打印 |
| | | handleBacthPrint() { |
| | | this.$nextTick(() => { |
| | | printJS({ |
| | | printable: 'printArea', |
| | | type: 'html', |
| | | style: ` |
| | | .qrcode-item { |
| | | page-break-inside: avoid; |
| | | margin: 10px; |
| | | text-align: center; |
| | | } |
| | | img { width: 100px; height: 100px; } |
| | | `, |
| | | scanStyles: false |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | watch: {}, |
| | | mounted() { |
| | |
| | | //getCurrSelected 事件 接收组件传递的参数 |
| | | for (let i = 0; i < data.length; i++) { |
| | | this.dataSource.push({ |
| | | toolCodeId:data[i].id, |
| | | toolingId: data[i].toolingId || data[i].id, |
| | | id: data[i].id, |
| | | toolCodeId: data[i].toolCodeId, |
| | | toolCode: data[i].toolCode, |
| | | chineseName: data[i].chineseName, |
| | | toolModel: data[i].toolModel, |
| | | applicationType: data[i].applicationTypeName, |
| | | unitName: data[i].unitName || data[i].unitId_dictText, |
| | | onlyCode:data[i].onlyCode, |
| | | noAccountQuantity:data[i].noAccountQuantity, |
| | | inStorageQuantity:data[i].storageQuantity |
| | | inStorageQuantity:data[i].storageQuantity || data[i].quantity || 1, |
| | | quantity:data[i].quantity, |
| | | accuracyClass:data[i].accuracyClass |
| | | }) |
| | | } |
| | | //this.ipaginationm.total = this.dataSource.length |