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/lossBound/modules/LossboundModal.vue | 434 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 434 insertions(+), 0 deletions(-) diff --git a/src/views/tms/lossBound/modules/LossboundModal.vue b/src/views/tms/lossBound/modules/LossboundModal.vue new file mode 100644 index 0000000..2017454 --- /dev/null +++ b/src/views/tms/lossBound/modules/LossboundModal.vue @@ -0,0 +1,434 @@ +<template> + <j-modal + :title="title" + :width="width" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + <a-spin :spinning="confirmLoading"> + <a-form-model ref="form" :model="model" :rules="validatorRules"> + <a-row> + <a-col :span="12"> + <a-form-model-item label="鎶ユ崯鍗曞崟鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="orderCode"> + <j-input v-model="model.orderCode" placeholder="绯荤粺鑷姩鐢熸垚" :disabled="true"></j-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鎶ユ崯浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="losser"> + <j-dict-select-tag :disabled="disableSubmit" + v-model="model.losser" dictCode="sys_user,realname,id" + placeholder="璇烽�夋嫨" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item label="鎶ユ崯鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lossTime"> + + <j-date placeholder="璇烽�夋嫨鎶ユ崯鏃堕棿" :disabled="disableSubmit" date-format="YYYY-MM-DD HH:mm:ss" v-model="model.lossTime" + style="width: 100%" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="瀹℃牳浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="reviewer"> + <!-- <j-dict-select-tag :disabled="disableSubmit"--> + <!-- v-model="model.reviewer" dictCode="sys_user,realname,id"--> + <!-- placeholder="璇烽�夋嫨" />--> + <j-select-user-by-dep :disabled="disableSubmit" v-model="model.reviewer" :store="'username'" + :text="'realname'" :multi="false" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + + <a-col :span="12"> + <a-form-model-item v-if="addShow" label="缁忔墜浜�" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="handler"> + + <j-dict-select-tag :disabled="disableSubmit" + v-model="model.handler" dictCode="sys_user,realname,id" + placeholder="璇烽�夋嫨" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item v-if="addShow" label="瀹℃牳鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="orderStatus"> + <j-dict-select-tag type="list" v-model="model.orderStatus" dictCode="out_bill_status" + placeholder="璇烽�夋嫨瀹℃牳鐘舵��" disabled /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item v-if="addShow" label="瀹℃牳鏃堕棿" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="approvalDate"> + + <j-date placeholder="璇烽�夋嫨瀹℃牳鏃堕棿" :disabled="disableSubmit" date-format="YYYY-MM-DD HH:mm:ss" v-model="model.approvalDate" + style="width: 100%" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item v-if="addShow" label="瀹℃牳鎰忚" :labelCol="labelCol" :wrapperCol="wrapperCol" + prop="approvalOpinion"> + <a-input v-model="model.approvalOpinion" placeholder="璇疯緭鍏ュ鏍告剰瑙�" disabled></a-input> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-textarea :disabled="disableSubmit" v-model="model.remark" rows="4" placeholder="璇疯緭鍏ュ娉�" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row> + <a-col :span="12"> + <a-form-model-item label="鎶ユ崯鍘熷洜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lossReason"> + <a-textarea :disabled="disableSubmit" v-model="model.lossReason" rows="4" placeholder="璇疯緭鍏ュ娉�" /> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + + <a-button type="primary" :style="{ marginBottom: '8px' }" :disabled="disableSubmit" @click="selectTools"> + 閫夋嫨宸ュ叿 + </a-button> + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :scroll="{x:true}" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="null" + @change="handleTableChange"> + + <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 == 'lossNumber'" :min="0" + :max="99999" + @change="(e) => handleChange(e, record.key, col, index)" style="width: 100%;" /> + <a-textarea + v-if="col.dataIndex == 'lossReason'" + :disabled="disableSubmit" + style="margin: -5px 0" + :value="text" + @change="(e) => handleChange(e.target.value, record.key, col, index)" + /> + + </template> + <span slot="action" v-if="disableSubmit === false" slot-scope="text, record, index"> + <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record, index)"> + <a>鍒犻櫎</a> + </a-popconfirm> + </span> + </a-table> + <template slot="footer" v-if="disableSubmit === false"> + <a-button :style="{ marginRight: '8px' }" @click="handleCancel">鍏抽棴</a-button> + <a-button @click="handleOk" :disabled="isDisabled" type="primary">纭畾</a-button> + </template> + + <j-select-lossbound-tool-modal ref="selectLossBoundToolModal"></j-select-lossbound-tool-modal> + </j-modal> + +</template> + +<script> + +import { httpAction } from '@/api/manage' +import LossboundDetailList from '../LossboundDetailList.vue' +import JSelectLossboundToolModal from './JSelectLossboundToolModal.vue' +import { getAction } from '../../../../api/manage' + +export default { + name: 'LossboundModal', + components: { + LossboundDetailList, + JSelectLossboundToolModal + }, + data() { + return { + title: '', + width: 1200, + visible: false, + disableSubmit: false, + isDisabled: false, + addShow: true, + selectBorrowTool: false, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + //琛ㄦ牸鍙傛暟 + ipagination: { + current: 1, + pageSize: 10, + total: 0 + }, + dataSource: [], + loading: false, + // 琛ㄥご + 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: 'lossReason', + align: 'center', + scopedSlots: { customRender: 'lossReason' } + }, + + { + title: '鎶ユ崯鏁伴噺', + dataIndex: 'lossNumber', + align: 'center', + width: 150, + scopedSlots: { customRender: 'lossNumber' } + }, + { + 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: 'remark', + align: 'center' + }, + { + title: '鎿嶄綔', + width: 150, + dataIndex: 'action', + scopedSlots: { customRender: 'action' }, + align: 'center' + } + ], + confirmLoading: false, + validatorRules: { + lossReason: [ + { required: true, message: '璇疯緭鍏ユ姤鎹熷師鍥�' } + ], + lossTime: [ + { required: true, message: '璇疯緭鍏ユ姤鎹熸椂闂�!' } + ], + losser: [ + { required: true, message: '璇疯緭鍏ユ姤鎹熶汉!' } + ], + + }, + url: { + list: '/tms/toolsLossBound/listlossboundDetailByMainId', + add: '/tms/toolsLossBound/addTotal', + edit: '/tms/toolsLossBound/editTotal' + } + + } + }, + created() { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)) + }, + 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, + supplierId: data[i].supplierId, + goodsShelvesId: data[i].positionCode, + toolMaterial: data[i].toolMaterial, + partMaterial: data[i].partMaterial + + }) + } + this.ipagination.total = this.dataSource.length + }) + }, + methods: { + + handleDelete(record, index) { + this.dataSource.splice(index, 1) + }, + handleChange(value, key, column, index) { + console.log(value, key, column, index) + 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 === 'lossNumber') { + + target[column.dataIndex] = value + } + if (column.dataIndex === 'lossReason') { + target[column.dataIndex] = value + } + this.dataSource = temp + } + }, + + selectTools: function() { + let ids = [] + for (let i = 0; i < this.dataSource.length; i++) { + ids.push(this.dataSource[i].id) + } + this.$refs.selectLossBoundToolModal.showModal(ids) + this.$refs.selectLossBoundToolModal.title = '閫夋嫨宸ュ叿淇℃伅' + this.$refs.selectLossBoundToolModal.disableSubmit = false + }, + add() { + this.addShow = false + this.edit({}) // 浼犲叆绌哄璞′綔涓洪粯璁ゅ�� + this.dataSource = [] + }, + edit(record) { + console.log(record) + if (record && record.id) { + this.model = Object.assign({}, record) + this.visible = true + getAction(this.url.list, { + lossBoundId: 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 + } + }) + } else { + this.model = {} // 濡傛灉鏄柊澧炴ā寮忥紝鍒欏垵濮嬪寲 model + this.visible = true + this.dataSource = [] // 娓呯┖鏁版嵁婧� + } + }, + + + close() { + this.$emit('close') + this.addShow = true + this.selectBorrowTool = false + this.visible = false + this.$refs.form.clearValidate() + }, + handleTableChange(pagination, filters, sorter) { + this.ipagination = pagination + }, + handleOk() { + const that = this + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + this.model.toolsLossBoundDetailList = this.dataSource + that.confirmLoading = true + let httpurl = '' + let method = '' + if (!this.model.id) { + httpurl += this.url.add + method = 'post' + } else { + httpurl += this.url.edit + method = 'put' + } + httpAction(httpurl, this.model, method).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = false + that.close() + }) + } else { + return false + } + }) + }, + handleCancel() { + this.close() + } + + } +} +</script> \ No newline at end of file -- Gitblit v1.9.3