Files
2024-03-29 11:26:14 +08:00

267 lines
10 KiB
Vue

<template>
<el-drawer
title="新增标准/译文获取申请123"
:visible.sync="visible"
:direction="direction"
:append-to-body="true"
:wrapper-closable="false"
:before-close="handleClose"
size="40%"
>
<loading :loading="showLoading">加载中...</loading>
<el-form ref="addFormRef" :model="StandardApplyForEO" :rules="addFormRules" class="label-input-form">
<el-row>
<el-col :span="12">
<el-form-item label="申请单位" prop="applyForUnitName" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.applyForUnitName" readonly clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="申请人" prop="applyForUserName" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.applyForUserName" readonly clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="类型" prop="type" label-width="100px" class="add-form-item">
<el-select
v-model="StandardApplyForEO.type"
:placeholder="'请选择类型'"
clearable
>
<el-option
v-for="opt in typeList"
:key="opt.value"
:value="opt.value === undefined ? '' :opt.value"
:label="opt.label"
>
{{ opt.label }}
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标准类型" prop="standType" label-width="100px" class="add-form-item">
<el-select
v-model="StandardApplyForEO.standType"
:placeholder="'请选择标准类型'"
clearable
@change="selectStandType"
>
<el-option
v-for="opt in standTypeList"
:key="opt.value"
:value="opt.value === undefined ? '' :opt.value"
:label="opt.label"
>
{{ opt.label }}
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标准类别" prop="standLb" label-width="100px" class="add-form-item">
<el-select
v-model="StandardApplyForEO.standLb"
:placeholder="'请选择标准类别'"
clearable
>
<el-option
v-for="opt in standLbList"
:key="opt.value"
:value="opt.value === undefined ? '' :opt.value"
:label="opt.label"
>
{{ opt.label }}
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标准编号" prop="standNum" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.standNum" placeholder="请输入标准编号" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="标准年份" prop="standYear" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.standYear" placeholder="请输入标准年份" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="需求时间" prop="requiredTime" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.requiredTime" placeholder="请输入需求时间" clearable />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="标准名称" prop="standName" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.standName" placeholder="请输入标准名称" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="原语言" prop="sourceLanguage" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.sourceLanguage" placeholder="请输入原语言" clearable />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="目标语言" prop="targetLanguage" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.targetLanguage" placeholder="请输入目标语言" clearable />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="理由" prop="reason" label-width="100px" class="add-form-item">
<el-input v-model="StandardApplyForEO.reason" placeholder="请输入理由" type="textarea" onkeydown="return event.key !== 'Enter';" :autosize="{ minRows: 10,maxRows: 10}" clearable/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="drawer-footer">
<el-button type="primary" class="common-button-primary" icon="el-icon-check" :loading="isSubmit" @click="submit">提交</el-button>
<el-button class="common-button-default" icon="el-icon-close" @click="visible=false">取消</el-button>
</div>
</el-drawer>
</template>
<script>
export default {
name: 'AddModal',
data () {
return {
direction: 'rtl',
visible: false,
isSubmit: false,
showLoading: false,
id: '',
StandardApplyForEO: {},
typeList: [],
standTypeList: [],
standLbList: [],
addFormRules: {
applyForUnitName: [ { required: true, message: '申请单位不能为空', trigger: 'blur' } ],
applyForUserName: [ { required: true, message: '申请人不能为空', trigger: 'blur' } ],
type: [ { required: true, message: '类型不能为空', trigger: 'blur' } ],
standType: [ { required: true, message: '标准类型类型不能为空', trigger: 'blur' } ],
standLb: [ { required: true, message: '标准类型类别不能为空', trigger: 'blur' } ],
standYear: [ { max: 100, message: '标准年份不能超过100个字符' } ],
requiredTime: [ { max: 100, message: '需求时间不能超过100个字符' } ],
sourceLanguage: [ { max: 100, message: '原语言不能超过100个字符' } ],
targetLanguage: [ { max: 100, message: '目标语言不能超过100个字符' } ],
standNum: [ { required: true, message: '标准编号不能为空', trigger: 'blur' }, { max: 100, message: '标准编号不能超过100个字符' } ],
standName: [ { required: true, message: '标准名称不能为空', trigger: 'blur' }, { max: 500, message: '标准名称不能超过500个字符' } ],
reason: [ { required: true, message: '理由不能为空', trigger: 'blur' }, {max: 500, message: '理由不能超过500个字符', trigger: 'blur'} ],
},
url: {
addUrl: '/lawss/standardApplyFor/insert',
editUrl: '/lawss/standardApplyFor/edit'
}
}
},
methods: {
getDicTypeListCode () {
this.$http.get('/lawss/standardApplyFor/getStandTypeDropDownData', {}, {
_this: this
}, res => {
this.standTypeList = res.data
})
this.$http.get('sys/dictype/getDicTypeListCode', '', {
_this: this
}, res => {
this.typeList = res.data.BZJYWTYPE // 标准类别
})
},
handleClose () {
this.visible = false
},
addModel () {
this.id = ''
this.visible = true
this.StandardApplyForEO = {}
this.StandardApplyForEO.applyForUserId = this.$store.getters.userInfo.userId
this.StandardApplyForEO.applyForUserName = this.$store.getters.userInfo.userName
this.StandardApplyForEO.applyForUnitId = this.$store.getters.userInfo.upDeptId
this.StandardApplyForEO.applyForUnitName = this.$store.getters.userInfo.upDeptName
this.StandardApplyForEO = { ...this.StandardApplyForEO }
this.$nextTick(() => {
this.$refs.addFormRef.clearValidate()
this.getDicTypeListCode()
})
},
showModal (item) {
this.id = item.id
this.visible = true
this.showLoading = true
this.StandardApplyForEO = JSON.parse(JSON.stringify(item))
this.$nextTick(() => {
this.$refs.addFormRef.clearValidate()
this.getDicTypeListCode()
this.selectStandType(this.StandardApplyForEO.standType, 'callBack')
})
},
selectStandType (value,tag) {
if (value === '') {
this.standLbList = []
}
this.$http.get('/lawss/standardApplyFor/getStandLbDropDownData', { dicId: value }, {
_this: this
}, res => {
if (res.ok) {
this.$nextTick(() => {
this.standLbList = res.data
if (tag !== 'callBack') {
console.log(1111)
this.$set(this.StandardApplyForEO, 'standLb', null)
}
this.showLoading = false
})
return
}
this.standLbList = []
this.$set(this.StandardApplyForEO, 'standLb', null)
})
},
submit () {
this.$refs.addFormRef.validate((valid) => {
if (valid) {
this.isSubmit = true
const url = this.id ? this.url.editUrl : this.url.addUrl
if (this.id) {
delete this.StandardApplyForEO.updateTime
delete this.StandardApplyForEO.updateBy
}
this.$http.postData(url, this.StandardApplyForEO, { _this: this },
res => {
if (res.ok) {
this.$emit('updateList')
this.$message.success(res.data)
this.visible = false
}else{
this.$message.warning(res.message)
}
this.isSubmit = false
})
}
})
}
}
}
</script>
<style scoped>
.label-input-form {
padding: 0 19px;
}
.drawer-footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
width: 100%;
padding: 0 20px;
height: 70px;
line-height: 69px;
border-top: 1px solid #e8e8e8;
text-align: right;
background: #fff;
z-index: 999;
}
</style>