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