¶Ô±ÈÐÂÎļþ |
| | |
| | | <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> |