<template>
|
<j-modal
|
:title="title"
|
:width="1200"
|
:visible="visible"
|
centered
|
:confirmLoading="confirmLoading"
|
:okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
|
switchFullscreen
|
@ok="handleOk"
|
@cancel="handleCancel"
|
cancelText="关闭">
|
<a-spin :spinning="confirmLoading">
|
<a-form-model ref="form" :model="model" :rules="validatorRules" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
<a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 工具基础信息
|
</a-divider>
|
|
<a-row :gutter="24">
|
<a-col :span="6">
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="classifyNum" label="工具分类编码">
|
<a-input placeholder="请输入工具分类编码" v-model="model.classifyNum" :disabled="true" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="classifyName" label="工具分类名称">
|
<a-input placeholder="请输入工具分类名称" v-model="model.classifyName" :disabled="true" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="toolCode" label="工具编码">
|
<a-input :placeholder="disableSubmit?'':'请输入工具编码'" v-model="model.toolCode" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-col>
|
|
<a-col :span="6">
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="chineseName"
|
label="中文名称">
|
<a-input :placeholder="disableSubmit?'':'请输入中文名称'" v-model="model.chineseName" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="foreignLanguageName"
|
label="外文名称">
|
<a-input :placeholder="disableSubmit?'':'请输入外文名称'" v-model="model.foreignLanguageName" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="toolModel"
|
label="型号/图号">
|
<a-input :placeholder="disableSubmit?'':'请输入型号/图号'" v-model="model.toolModel" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-col>
|
|
<a-col :span="6">
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="standardLevel"
|
label="标注级别">
|
<a-input :placeholder="disableSubmit?'':'请输入标准级别'" v-model="model.standardLevel" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="standardCode" label="标准号">
|
<a-input :placeholder="disableSubmit?'':'请输入标准号'" v-model="model.standardCode" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item prop="signCode" label="序号">
|
<a-input :placeholder="disableSubmit?'':'请输入序号'" v-model="model.signCode" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-col>
|
|
<a-col :span="6">
|
<a-row>
|
<a-col :span="24">
|
<a-form-model-item label='' :labelCol='labelCol' :wrapperCol='wrapperCol'>
|
<j-image-upload text='上传工具图片' v-model='model.toolPicture'></j-image-upload>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-col>
|
</a-row>
|
<a-divider orientation="center" style="font-size: large;font-style: italic;color: #66aeed;"> 管理参数
|
</a-divider>
|
|
<a-row :gutter="24">
|
<a-col :span="8">
|
<a-form-model-item prop="applicationType"
|
label="工具类型">
|
<j-dict-select-tag dict-code="equipment_category" :placeholder="disableSubmit?'':'请选择工具类型'"
|
v-model="model.applicationType" :disabled="disableSubmit" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="provinceCity" label="仓库省份城市">
|
<a-input :placeholder="disableSubmit?'':'请输入仓库省份城市'" v-model="model.provinceCity" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="positionCode" label="库位号">
|
<a-input :placeholder="disableSubmit?'':'请输入库位号'" v-model="model.positionCode" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row :gutter="24">
|
<a-col :span="8">
|
<a-form-model-item prop="storageLocation" label="存储位置">
|
<a-input :placeholder="disableSubmit?'':'请输入存储位置'" v-model="model.storageLocation" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="lowerInventory" label="最低库存">
|
<a-input :placeholder="disableSubmit?'':'请输入最低库存'" v-model="model.lowerInventory" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="highestInventory" label="最高库存">
|
<a-input :placeholder="disableSubmit?'':'请输入最高库存'" v-model="model.highestInventory" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row :gutter="24">
|
<a-col :span="8">
|
<a-form-model-item prop="auxiliaryUnitFlag" label="是否有计量辅单位">
|
<a-radio-group v-model="model.auxiliaryUnitFlag" :placeholder="disableSubmit?'':'请选择是否有计量辅单位'" :disabled="disableSubmit">
|
<a-radio :value="'1'">是</a-radio>
|
<a-radio :value="'2'">否</a-radio>
|
</a-radio-group>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="mainUnit" label="计量主单位">
|
<a-input :placeholder="disableSubmit?'':'请输入计量主单位'" v-model="model.mainUnit" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="auxiliaryUnit" label="计量辅单位">
|
<a-input :placeholder="disableSubmit?'':'请输入计量辅单位'" v-model="model.auxiliaryUnit" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
|
<a-row :gutter="24">
|
<a-col :span="8">
|
<a-form-model-item prop="supplierId" label="厂家">
|
<a-input :placeholder="disableSubmit?'':'请输入厂家'" v-model="model.supplierId" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="8">
|
<a-form-model-item prop="price" label="单价">
|
<a-input :placeholder="disableSubmit?'':'请输入单价'" v-model="model.price" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
<a-row :gutter="24">
|
<a-col :span="24">
|
<a-form-model-item :labelCol="labelColLong" :wrapperCol="wrapperColLong" prop="remark" label="备注">
|
<a-textarea :placeholder="disableSubmit?'':'请输入备注'" v-model="model.remark" :disabled="disableSubmit"/>
|
</a-form-model-item>
|
</a-col>
|
</a-row>
|
</a-form-model>
|
</a-spin>
|
</j-modal>
|
</template>
|
|
<script>
|
import { getAction,postAction, httpAction } from '@/api/manage'
|
import { validateDuplicateValueInDelFlag } from '@/utils/util'
|
import JSelectProduction from '@comp/jeecgbiz/JSelectProduction.vue'
|
import { getSystemConfigValue } from '@api/api'
|
import { duplicateCheck } from '@/api/api'//重复校验
|
|
export default {
|
name: 'ParaHoleToolsModal',
|
components: { JSelectProduction },
|
data() {
|
return {
|
title: '操作',
|
visible: false,
|
//控制编辑
|
editable: false,
|
//详情控制
|
disableSubmit: false,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 9 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 14 }
|
},
|
labelColLong: {
|
xs: { span: 24 },
|
sm: { span: 2 }
|
},
|
wrapperColLong: {
|
xs: { span: 24 },
|
sm: { span: 22 }
|
},
|
confirmLoading: false,
|
validatorRules: {
|
toolCode: [
|
{ required: true, message: '请输入工具编码' },
|
{ validator: this.validateNum }
|
],
|
classifyNum: [
|
{ required: true, message: '请输入工具分类编码' }
|
],
|
classifyName: [
|
{ required: true, message: '请输入工具分类名称' }
|
],
|
toolModel: [
|
{ required: true, message: '请输入型号/图号' },
|
{ validator: this.validateModel }
|
],
|
chineseName: [
|
{ required: true, message: '请输入中文名称' }
|
]
|
},
|
url: {
|
add: '/tms/baseTools/add',
|
edit: '/tms/baseTools/edit',
|
},
|
}
|
},
|
created() {
|
},
|
methods: {
|
add(nodeSelected) {
|
this.editable = false;
|
//初始化默认值
|
this.model = {};
|
this.model.classifyId = nodeSelected.key
|
this.model.classifyNum = nodeSelected.entity.classifyId
|
this.model.classifyName = nodeSelected.entity.typeName
|
this.model.paraTypeFlag = nodeSelected.entity.paraTypeFlag
|
this.visible = true
|
},
|
edit(record) {
|
this.editable = true;
|
this.model = Object.assign({}, record)
|
this.visible = true
|
},
|
close() {
|
this.$emit('close')
|
this.visible = false
|
this.$refs.form.clearValidate()
|
},
|
handleOk() {
|
const that = this
|
// 触发表单验证
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = true
|
let formData = Object.assign(this.model)
|
let httpUrl = ''
|
let method = 'post'
|
if (!this.model.id) {
|
httpUrl += this.url.add
|
} else {
|
httpUrl += this.url.edit
|
}
|
httpAction(httpUrl, formData, 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()
|
})
|
}
|
})
|
},
|
handleCancel() {
|
this.close()
|
},
|
//验证工具编码是否重复
|
validateNum(rule, value, callback) {
|
var params = {
|
tableName: 'tms_base_tools',
|
fieldName: 'tool_code',
|
fieldVal: value,
|
dataId: this.model.id
|
};
|
duplicateCheck(params).then((res) => {
|
if (res.success) {
|
callback()
|
} else {
|
callback("工具编码已存在!")
|
}
|
})
|
},
|
//验证型号/图号是否重复
|
validateModel(rule, value, callback) {
|
var params = {
|
tableName: 'tms_base_tools',
|
fieldName: 'tool_model',
|
fieldVal: value,
|
dataId: this.model.id
|
};
|
duplicateCheck(params).then((res) => {
|
if (res.success) {
|
callback()
|
} else {
|
callback("型号/图号已存在!")
|
}
|
})
|
},
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
/deep/ .ant-modal-body {
|
padding: 0 24px;
|
}
|
|
/deep/ .ant-upload {
|
width: 185px;
|
height: 185px;
|
}
|
|
/deep/ .img {
|
display: flex;
|
justify-content: center;
|
|
.ant-upload-picture-card-wrapper {
|
width: auto;
|
}
|
}
|
|
/deep/ .ant-upload-list-picture-card-container {
|
width: 185px;
|
height: 185px;
|
}
|
|
/deep/ .ant-upload-list-item {
|
width: 185px;
|
height: 185px;
|
}
|
</style>
|