From 5e31103125cb1ff33be29ec400c9c8d007448462 Mon Sep 17 00:00:00 2001 From: zhangherong <571457620@qq.com> Date: 星期二, 27 五月 2025 14:50:22 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/tms/stocktakingBound/modules/ToolsStocktakingBoundModal.vue | 515 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 515 insertions(+), 0 deletions(-) diff --git a/src/views/tms/stocktakingBound/modules/ToolsStocktakingBoundModal.vue b/src/views/tms/stocktakingBound/modules/ToolsStocktakingBoundModal.vue new file mode 100644 index 0000000..d0d4230 --- /dev/null +++ b/src/views/tms/stocktakingBound/modules/ToolsStocktakingBoundModal.vue @@ -0,0 +1,515 @@ +<template> + <a-modal :title="title" :width="1500" :height="1500" :visible="visible" :maskClosable="false" @ok="handleOk" + cancelText="鍏抽棴" + @cancel="handleCancel" :confirmLoading="confirmLoading"> + + <a-spin :spinning="confirmLoading"> + <a-form :form="form"> + <a-row> + <a-col :span="12"> + <a-form-model-item label="鐩樼偣鍗曞彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderCode"> + <a-input :disabled="true" v-model="model.orderCode" placeholder="绯荤粺鑷姩鐢熸垚"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鐩樼偣绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="approvalStatus"> + <j-dict-select-tag dictCode="stocktakingType" placeholder="璇烽�夋嫨鐩樼偣绫诲瀷" v-model="model.stocktakingType" + :disabled="disableSubmit"></j-dict-select-tag> + </a-form-model-item> + </a-col> + + + <a-col :span="12"> + <a-form-model-item label="鐩樼偣鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stocktakingName"> + <a-input v-model="model.stocktakingName" placeholder="璇疯緭鍏ョ洏鐐瑰悕绉�"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="瀹℃牳浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reviewer"> + <j-select-user-by-dep :disabled="disableSubmit" v-model="model.reviewer" :store="'username'" + :text="'realname'" :multi="false" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鐩樼偣鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryTime"> + <j-date placeholder="璇烽�夋嫨鐩樼偣鏃堕棿" date-format="YYYY-MM-DD HH:mm:ss" v-model="model.inventoryTime" + style="width: 100%" /> + </a-form-model-item> + </a-col> + + <a-col :span="12"> + <a-form-model-item v-show="addShow" label="缁忔墜浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="handler"> + <j-dict-select-tag dictCode="sys_user,realname,id" placeholder="璇烽�夋嫨缁忔墜浜�" v-model="model.handler" + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + + <a-col :span="12"> + <a-form-model-item v-show="addShow" label="瀹℃牳鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="approvalStatus"> + <j-dict-select-tag dictCode="approval_status" placeholder="璇烽�夋嫨瀹℃牳鐘舵��" v-model="model.approvalStatus" + :disabled="true"></j-dict-select-tag> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item v-show="addShow" label="瀹℃牳鎰忚" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="approvalOpinion"> + <a-input v-model="model.approvalOpinion" placeholder="璇疯緭鍏ュ鏍告剰瑙�" type="textarea" + :disabled="model.approvalStatus==1"></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item v-show="addShow" label="瀹℃牳鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryTime"> + <j-date placeholder="璇烽�夋嫨瀹℃牳鏃堕棿" date-format="YYYY-MM-DD HH:mm:ss" v-model="model.approvalDate" + style="width: 100%" /> + </a-form-model-item> + </a-col> + + <a-col :span="12"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-input v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" type="textarea"></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form> + </a-spin> + <a-button type="primary" :style="{ marginRight: '8px', marginBottom: '8px' }" :loading="confirmLoading" + :disabled="disableSubmit" @click="selectTools()">宸ュ叿鏄庣粏 + </a-button> + <a-table ref="table" bordered size="middle" rowKey="id" :columns="columns" :dataSource="dataSource" + :scroll="{x:true}"> + <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index"> + <a-input-number :disabled="disableSubmit" :value="text" v-if="col.dataIndex == 'practicalQuantity'" :min="0" + :max="99999" + @change="(e) => handleChange(e, record.key, col, index)" style="width: 100%;" /> + <a-input-number :value="text" v-if="col.dataIndex == 'differenceValue'" :min="0" :max="99999" + :disabled="true" @change="(e) => handleChange(e, record.key, col, index)" + style="width: 100%;" /> + <j-dict-select-tag :value="text" v-if="col.dataIndex == 'surplusDeficit'" + dictCode="surplusDeficit" + :disabled="true" + style="width: 100%;" + @change="(e) => handleChange(e, record.key, col, index)" /> + <!-- <j-dict-select-tag :value="text" v-if="col.dataIndex == 'classifyId'"--> + <!-- dictCode="tms_tools_classify,type_name,id"--> + <!-- style="width: 100%;"--> + <!-- :disabled="true"--> + <!-- @change="(e) => handleChange(e, record.key, col, index)" />--> + <j-date + :value="text" + v-if="col.dataIndex == 'stocktakingDate'" + placeholder="閫夋嫨鐩樺簱鏃堕棿" + @change="(e) => handleChange(e, record.key, col, index)" + style="width: 100%;" + /> + + <a-textarea + v-if="col.dataIndex == 'remark'" + :disabled="disableSubmit" + style="margin: -5px 0" + :value="text" + @change="(e) => handleChange(e.target.value, record.key, col, index)" + /> + + </template> + + <span slot="action" slot-scope="text, record, index"> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(text, record, index)"> + <a :disabled="disableSubmit">鍒犻櫎</a> + </a-popconfirm> + </span> + </a-table> + <template slot="footer"> + <a-button :style="{ marginRight: '8px' }" @click="handleCancel()"> + 鍏抽棴 + </a-button> + + <a-button @click="handleOk()" :disabled="disableSubmit" type="primary" :loading="confirmLoading">纭畾</a-button> + </template> + <tool-selector-modal ref="toolsModalForm"></tool-selector-modal> + </a-modal> + +</template> + +<script> +import { getAction, postAction, requestPut } from '@/api/manage' +import JMultiSelectTag from '@/components/dict/JMultiSelectTag' +import Tooltip from 'ant-design-vue/es/tooltip' +import ToolSelectorModal from '@views/tms/stocktakingBound/modules/ToolSelectorModal.vue' + +export default { + name: 'ToolsStocktakingBoundModal', + components: { + ToolSelectorModal, + JMultiSelectTag, + Tooltip + }, + data() { + + return { + addShow: true, + model: {}, + formDisabled: false, + pagination: { + current: 1, + pageSize: 10, + total: 0 + }, + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + }, + width: 50 + }, + { + title: '鍒�鍏风紪鍙�', + dataIndex: 'toolCode', + align: 'center', + width: 150 + }, + + { + title: '宸ュ叿绫诲瀷', + dataIndex: 'applicationType', + align: 'center', + width: 150 + }, + { + title: '璐﹂潰搴撳瓨', + width: 150, + dataIndex: 'bookQuantity', + align: 'center' + + }, + { + title: '鍙敤鏁伴噺', + width: 150, + dataIndex: 'availableQuantity', + align: 'center' + + }, + { + title: '瀹炵洏鏁伴噺', + dataIndex: 'practicalQuantity', + align: 'center', + width: 150, + scopedSlots: { customRender: 'practicalQuantity' } + }, + { + title: '宸紓鍊�', + dataIndex: 'differenceValue', + align: 'center', + width: 150, + scopedSlots: { customRender: 'differenceValue' } + }, + + { + title: '鐩樹簭鐩樼泩', + width: 150, + dataIndex: 'surplusDeficit', + align: 'center', + scopedSlots: { customRender: 'surplusDeficit' } + }, + + { + title: '鐩樺簱鏃堕棿', + width: 150, + dataIndex: 'stocktakingDate', + align: 'center', + scopedSlots: { customRender: 'stocktakingDate' } + }, + { + title: '澶囨敞', + width: 150, + dataIndex: 'remark', + align: 'center', + scopedSlots: { customRender: 'remark' } + }, + { + title: '涓枃鍚嶇О', + dataIndex: 'chineseName', + width: 150, + align: 'center' + }, + + { + title: '鍨嬪彿/鍥惧彿', + dataIndex: 'toolModel', + width: 150, + align: 'center' + }, + + { + title: '鍒�鍏锋潗鏂�', + width: 150, + dataIndex: 'toolMaterial', + align: 'center' + }, + { + title: '闆朵欢鏉愭枡', + width: 150, + dataIndex: 'partMaterial', + align: 'center' + }, + { + title: '鍘傚', + width: 150, + dataIndex: 'supplierId', + align: 'center' + + }, + { + title: '瀛樺偍浣嶇疆', + width: 150, + dataIndex: 'goodsShelvesId', + align: 'center' + + }, + + + { + title: '鎿嶄綔', + width: 150, + dataIndex: 'action', + scopedSlots: { customRender: 'action' }, + align: 'center' + } + ], + title: '鎿嶄綔', + visible: false, + disableSubmit: false, + codeDisable: true, + + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 18 } + }, + confirmLoading: false, + form: this.$form.createForm(this), + validatorRules: { + orderCode: [ + { required: true, message: '璇疯緭鍏ョ洏鐐瑰崟鍙�!' } + ], + handler: [ + { required: true, message: '璇疯緭鍏ョ粡鎵嬩汉!' } + ], + stocktakingName: [ + { required: true, message: '璇疯緭鍏ョ洏鐐瑰悕绉�!' } + ], + approvalStatus: [ + { required: true, message: '璇疯緭鍏ュ鏍哥姸鎬�!' } + ], + inventoryTime: [ + { required: true, message: '璇疯緭鍏ョ洏鐐规椂闂�!' } + ] + }, + url: { + add: '/tms/toolsStocktakingBound/add', + edit: '/tms/toolsStocktakingBound/edit', + queryDetailList: '/tms/toolsStocktakingBound/listToolsStocktakingBoundControllerDetailsByMainId' + + }, + dataSource: [] + } + }, + + mounted() { + this.$bus.$on('selectionRows', (data) => { + for (let i = 0; i < data.length; i++) { + this.dataSource.push({ + toolId: data[i].id, + toolCode: data[i].toolCode, + classifyId: data[i].classifyId, + applicationType: data[i].applicationType_dictText, + chineseName: data[i].chineseName, + toolModel: data[i].toolModel, + material: data[i].material, + toolMaterial: data[i].toolMaterial, + partMaterial: data[i].partMaterial, + bookQuantity: data[i].totalCount, + supplierId: data[i].supplierId, + goodsShelvesId: data[i].positionCode + }) + } + }) + }, + + methods: { + selectTools: function() { + let ids = [] + for (let i = 0; i < this.dataSource.length; i++) { + ids.push(this.dataSource[i].partId) + } + this.$refs.toolsModalForm.showModals(ids) + this.$refs.toolsModalForm.title = '閫夋嫨宸ュ叿淇℃伅' + this.$refs.toolsModalForm.disableSubmit = false + }, + add() { + this.addShow = false + this.edit() + }, + + edit(record) { + console.log(record) + console.log(this.auditFlag) + this.form.resetFields() + this.model = Object.assign({}, record) + this.visible = true + getAction(this.url.queryDetailList, { + stocktakingBoundId: record.id, + pageNo: 1, + pageSize: 99999 + }).then((res) => { + if (res.success) { + console.log(res.result.records) + this.dataSource = res.result.records + } else { + this.dataSource = null + } + }) + }, + + + + close() { + this.$emit('close') + this.visible = false + }, + + handleCancel() { + this.model = {} + this.dataSource = [] + this.close() + }, + + handleOk() { + const that = this + let data = that.dataSource + for (let i = 0; i < data.length; i++) { + if (data[i].practicalQuantity == undefined || data[i].practicalQuantity == null || data[i].practicalQuantity == '') { + that.$message.warning('璇疯緭鍏ョ' + (i + 1) + '琛岀殑瀹炵洏鏁伴噺鏁版嵁锛�') + return false + } + } + this.form.validateFields((err, values) => { + if (!err) { + that.confirmLoading = true + let formData = Object.assign(this.model, values) + if (that.dataSource.length === 0) { + that.$message.warning('璇烽�夋嫨宸ュ叿锛�') + that.confirmLoading = false + return + } + formData.toolsStocktakingBoundDetailList = that.dataSource + // formData.status = '0'; + let obj + if (!this.model.id) { + obj = postAction(this.url.add, formData) + } else { + obj = requestPut(this.url.edit, formData, { id: this.model.id }) + } + obj.then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + that.close() + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = false + }) + } + }) + }, + + handleDelete(text, record, index) { + this.dataSource.splice(index, 1) + }, + + handleChange(value, key, column, index) { + let that = this + const temp = [...that.dataSource] + const target = temp.filter(item => key === item.key)[index] + if (target) { + // if (column.dataIndex == 'practicalQuantity') { + // target[column.dataIndex] = value + // } + if (column.dataIndex === 'practicalQuantity') { + target[column.dataIndex] = value + + // 璁$畻宸紓鍊� + target.differenceValue = value - target.availableQuantity + + // 鏍规嵁宸紓鍊煎垽鏂洏浜忕洏鐩� + if (target.differenceValue > 0) { + target.surplusDeficit = 1 + } else if (target.differenceValue < 0) { + target.surplusDeficit = 2 + } else { + target.surplusDeficit = 0 + } + } + if (column.dataIndex == 'differenceValue') { + target[column.dataIndex] = value + } + if (column.dataIndex == 'classifyId') { + target[column.dataIndex] = value + } + if (column.dataIndex == 'surplusDeficit') { + target[column.dataIndex] = value // 鍋囪 value 鏄瓧绗︿覆鏍煎紡鐨勬棩鏈� + } + if (column.dataIndex == 'stocktakingDate') { + target[column.dataIndex] = value // 鍋囪 value 鏄瓧绗︿覆鏍煎紡鐨勬棩鏈� + } + if (column.dataIndex === 'remark') { + // 娉ㄦ剰杩欓噷浣跨敤鐨勬槸 e.target.value + target[column.dataIndex] = value + } + + that.dataSource = temp + } + } + } + +} +</script> + +<style lang="less" scoped> +.frozenRowClass { + color: #c9c9c9; +} + +.fontweight { + font-weight: bold; +} + +.ant-btn { + padding: 0 10px; + margin-left: 3px; +} + +.ant-form-item-control { + line-height: 0px; +} + +/** 涓昏〃鍗曡闂磋窛 */ +.ant-form .ant-form-item { + margin-bottom: 10px; +} + +/** Tab椤甸潰琛岄棿璺� */ +.ant-tabs-content .ant-form-item { + margin-bottom: 0px; +} +</style> \ No newline at end of file -- Gitblit v1.9.3