You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
193 lines
5.0 KiB
193 lines
5.0 KiB
<template>
|
|
<div>
|
|
|
|
<div class="tab-header webtop">
|
|
<!-- 标题 -->
|
|
<div>计量单位信息</div>
|
|
<!-- start 添加修改按钮 -->
|
|
<div>
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button>
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
|
|
</div>
|
|
<!-- end 添加修改按钮 -->
|
|
<!-- end 详情按钮 -->
|
|
</div>
|
|
|
|
<div class="listconadd">
|
|
|
|
|
|
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
|
|
|
|
<el-row class="first_row">
|
|
<el-col :span="8">
|
|
|
|
<div class="span-sty"><span class="must">*</span> 计量单位名称</div>
|
|
<el-form-item prop="unitName">
|
|
<el-input v-model="formobj.unitName" placeholder="" class="addinputw addinputInfo" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
|
|
<el-col :span="16">
|
|
<div class="span-sty">备注</div>
|
|
<el-form-item>
|
|
<el-input v-model="formobj.remarks" placeholder="" class="addinputw addinputInfo" clearable />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<!-- <el-card class="box-card">
|
|
<div class="item">
|
|
<span class="item_text"><span class="must">*</span> 计量单位名称:</span>
|
|
<el-input v-model="formobj.unitName" placeholder="" class="item_input" clearable />
|
|
</div>
|
|
<div class="item">
|
|
<span class="item_text">计量单位备注:</span>
|
|
<el-input v-model="formobj.remarks" placeholder="" class="item_input" clearable />
|
|
</div>
|
|
</el-card> -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import req from '@/api/goods/unit.js'
|
|
export default {
|
|
components: {},
|
|
data() {
|
|
return {
|
|
submitdisabled: false,
|
|
formobj: {
|
|
sid: '',
|
|
unitName: '',
|
|
remarks: '',
|
|
orgPath: window.sessionStorage.getItem('orgSidPath'),
|
|
useOrgSid: window.sessionStorage.getItem('defaultDeptSid'),
|
|
userSid: window.sessionStorage.getItem('userSid'),
|
|
createOrgSid: window.sessionStorage.getItem('orgSid'),
|
|
},
|
|
rules: {
|
|
unitName: [{
|
|
required: true,
|
|
message: '计量单位名称不能为空',
|
|
trigger: 'blur'
|
|
}],
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
// this.initData()
|
|
},
|
|
methods: {
|
|
|
|
saveOrUpdate() {
|
|
console.log('>>>>>>>>>saveOrUpdate', this.formobj)
|
|
|
|
// if (this.formobj.unitName == '') {
|
|
// this.$message({
|
|
// showClose: true,
|
|
// type: 'warning',
|
|
// message: "计量单位名称不能为空"
|
|
// })
|
|
// return
|
|
// }
|
|
this.$refs['form_obj'].validate((valid) => {
|
|
if (valid) {
|
|
this.submitdisabled = true
|
|
req.saveUnits(this.formobj)
|
|
.then(resp => {
|
|
if (resp.success) {
|
|
this.$message({
|
|
showClose: true,
|
|
type: 'success',
|
|
message: resp.msg
|
|
})
|
|
this.handleReturn('true')
|
|
} else {
|
|
// 根据resp.code进行异常情况处理
|
|
this.submitdisabled = false
|
|
}
|
|
})
|
|
.catch(() => {
|
|
this.submitdisabled = false
|
|
})
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
handleReturn(isreload) {
|
|
if (isreload === 'true') this.$emit('reloadlist')
|
|
this.formobj = {
|
|
sid: '',
|
|
unitName: '',
|
|
remarks: '',
|
|
orgPath: window.sessionStorage.getItem('orgSidPath'),
|
|
useOrgSid: window.sessionStorage.getItem('defaultDeptSid'),
|
|
userSid: window.sessionStorage.getItem('userSid'),
|
|
createOrgSid: window.sessionStorage.getItem('orgSid'),
|
|
}
|
|
this.submitdisabled = false
|
|
this.$emit('doback')
|
|
},
|
|
showAdd() {
|
|
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
|
|
},
|
|
showEdit(row) {
|
|
this.$nextTick(() => {
|
|
this.$refs['form_obj'].clearValidate()
|
|
})
|
|
|
|
req.initUnits(row.sid)
|
|
.then(resp => {
|
|
if (resp.success) {
|
|
this.formobj = resp.data
|
|
}
|
|
})
|
|
.catch(e => {
|
|
this.formobj = row
|
|
})
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
<style scoped>
|
|
/deep/ .el-form-item__error {
|
|
margin-left: 120px !important;
|
|
}
|
|
|
|
.must {
|
|
color: #f00;
|
|
}
|
|
|
|
.span-sty {
|
|
width: 130px !important;
|
|
}
|
|
|
|
.addinputInfo {
|
|
margin-left: 120px !important;
|
|
}
|
|
|
|
.formaddcopy02 .el-row .el-col /deep/ .el-form-item .addinputw {
|
|
margin-left: 120px !important;
|
|
width: calc(100% - 115px);
|
|
}
|
|
|
|
.first_row {
|
|
border-top: 1px solid #E0E3EB;
|
|
}
|
|
|
|
.titleOne {
|
|
padding: 7px;
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
</style>
|
|
|