From e14ed882d12df3b48e59390eba364442cdff70bd Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 28 五月 2025 15:46:32 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/tms/requirement/modules/ToolsSharpeningModal.vue | 286 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 286 insertions(+), 0 deletions(-) diff --git a/src/views/tms/requirement/modules/ToolsSharpeningModal.vue b/src/views/tms/requirement/modules/ToolsSharpeningModal.vue new file mode 100644 index 0000000..9346322 --- /dev/null +++ b/src/views/tms/requirement/modules/ToolsSharpeningModal.vue @@ -0,0 +1,286 @@ +<template> + <j-modal + :title="title" + :width="1200" + :confirmLoading="confirmLoading" + switchFullscreen + centered + :visible="visible" + :mask-closable="false" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴"> + + <a-spin :spinning="spinning"> + <a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item prop="standardCode" label="宸ュ叿缂栧彿"> + <a-input-search v-model="model.toolId" placeholder="璇烽�夋嫨宸ュ叿缂栧彿" :disabled="disableSubmit" + @search="selectTools" enter-button + /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item prop="classify_id" label="宸ュ叿鍒嗙被缂栫爜"> + <a-input placeholder="璇疯緭鍏ュ伐鍏峰垎绫诲悕绉�" v-model="model.classifyId" readOnly :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item prop="paramaTableName" label="宸ュ叿鍙傛暟鏍囪瘑"> + <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" readOnly v-model="model.paramaTableName" readOnly + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="宸ュ叿绫诲瀷"> + <a-input placeholder="閫夋嫨璁惧鍚庤嚜鍔ㄥ甫鍑�" v-model="model.applicationType" readOnly + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item prop="responsiblePerson" label="璐d换浜�"> + <j-dict-select-tag type="list" v-model="model.responsiblePerson" dictCode="sys_user,realname,id" + placeholder="璇烽�夋嫨璐d换浜�" :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鍒冪(鏃堕棿" prop="sharpeningTime"> + <j-date placeholder="璇烽�夋嫨鍒冪(鏃堕棿" date-format="YYYY-MM-DD HH:mm:ss" v-model="model.sharpeningTime" + style="width: 100%" :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + </a-row> + + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item label="鍒冪(缁撴灉鍙婂缓璁�" prop="sharpeningResult"> + <a-textarea placeholder="閫夋嫨濉啓鍒冪(缁撴灉鍙婂缓璁�" v-model="model.sharpeningResult" + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鍨嬪彿/鍥惧彿"> + <a-input placeholder="閫夋嫨濉啓鍨嬪彿/鍥惧彿" v-model="model.toolModel" :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item label="浠撳簱鍩庡競" prop="inspectionDate"> + <a-input placeholder="閫夋嫨濉啓浠撳簱鐪佷唤鍩庡競" v-model="model.provinceCity" readOnly + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="搴撳尯/搴撳彿"> + <a-input placeholder="閫夋嫨濉啓搴撳尯/搴撳彿" v-model="model.warehouseId" readOnly :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item label="瀛樺偍浣嶇疆" prop="storageLocation"> + <a-input placeholder="閫夋嫨濉啓瀛樺偍浣嶇疆" v-model="model.positionCode" readOnly + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="璁¢噺涓诲崟浣�"> + <a-input placeholder="璇峰~鍐欒閲忎富鍗曚綅" v-model="model.mainUnit" readOnly :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + </a-row> + <a-row :gutter="24"> + <a-col :span="12"> + <a-form-model-item label="瀛樺偍浣嶇疆" prop="storageLocation"> + <a-input placeholder="閫夋嫨濉啓瀛樺偍浣嶇疆" v-model="model.positionCode" readOnly + :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="澶囨敞"> + <a-textarea v-model="model.remark" rows="3" placeholder="璇疯緭鍏ュ娉�" :disabled="disableSubmit" /> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </a-spin> + <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> + <tools-modal ref="toolListModel"></tools-modal> + + + </j-modal> +</template> + +<script> +import { getAction, postAction, requestPut } from '@/api/manage' +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import ToolsModal from '@views/tms/requirement/modules/ToolsModal.vue' + +export default { + name: 'ToolsSharpeningModal', + mixins: [JVxeTableModelMixin], + components: { + ToolsModal + }, + data() { + return { + title: '鎿嶄綔', + visible: false, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 15 } + }, + confirmLoading: false, + spinning: false, + disabled: false, + disableSubmit: false, + validatorRules: { + + sharpeningTime: [ + { required: true, message: '璇烽�夋嫨鍒冪(鏃ユ湡!' } + ], + responsiblePerson: [ + { required: true, message: '璇烽�夋嫨璐d换浜�!' } + ], + sharpeningResult: [ + { required: true, message: '璇疯緭鍏ュ垉纾ㄧ粨鏋滃強寤鸿!' } + ] + }, + url: { + add: '/tms/toolSharpening/add', + edit: '/tms/toolSharpening/edit', + queryDetailList: '/tms/toolSharpening/listToolSharpening' + } + } + }, + created() { + }, + mounted() { + this.$bus.$on('selectionRows', (data) => { + console.log('selectionRows', data) + if (data && data.length > 0) { + const item = data[0] + // 浣跨敤 $set 纭繚 model 鐨勫睘鎬ф槸鍝嶅簲寮忕殑 + this.$set(this.model, 'toolId', item.toolCode) + this.$set(this.model, 'toolCode', item.id) + this.$set(this.model, 'classifyId', item.classifyId) + this.$set(this.model, 'paramaTableName', item.paramaTableName_dictText) + this.$set(this.model, 'applicationType', item.applicationType_dictText) + this.$set(this.model, 'toolModel', item.toolModel) + this.$set(this.model, 'provinceCity', item.provinceCity) + this.$set(this.model, 'warehouseId', item.warehouseId) + this.$set(this.model, 'positionCode', item.positionCode) + this.$set(this.model, 'mainUnit', item.mainUnit) + } + }) + + }, + methods: { + + selectTools: function() { + this.$refs.toolListModel.showModals() + this.$refs.toolListModel.title = '閫夋嫨宸ュ叿淇℃伅' + this.$refs.toolListModel.disableSubmit = false + }, + + add() { + this.addShow = false + this.edit() + }, + + edit(record) { + console.log(record) + // this.model = Object.assign({}, record) + this.visible = true + getAction(this.url.queryDetailList, { + id: record.id, + pageNo: 1, + pageSize: 99999 + }).then((res) => { + if (res.success) { + const readOnlyData = res.result.records[0] || {} + this.model = Object.assign({}, this.model, { + paramaTableName: readOnlyData.paramaTableName_dictText, + applicationType: readOnlyData.applicationType_dictText, + provinceCity: readOnlyData.provinceCity, + warehouseId: readOnlyData.warehouseId, + positionCode: readOnlyData.positionCode, + mainUnit: readOnlyData.mainUnit, + toolModel: readOnlyData.toolModel + }) + + } else { + this.dataSource = null + } + }) + }, + handleOk() { + const that = this + that.confirmLoading = true + + // 鉁� 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + let formData = Object.assign(this.model) + + 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 + }) + } else { + that.$message.warning('璇峰~鍐欏繀濉瓧娈�') + that.confirmLoading = false + return false + } + }) + }, + + handleCancel() { + this.close() + }, + + close() { + this.$emit('close') + this.visible = false + this.$refs.form.clearValidate() + } + } +} +</script> + +<style lang="less" scoped> + +</style> \ No newline at end of file -- Gitblit v1.9.3