Compare commits

...

4 Commits

3 changed files with 101 additions and 13 deletions

View File

@ -16,7 +16,7 @@ export function login(data) {
reject(res.msg || '登录失败') reject(res.msg || '登录失败')
} }
}).catch(error => { }).catch(error => {
reject(error) reject(error.response.data)
}) })
}) })
} }

View File

@ -81,22 +81,39 @@
<el-row :gutter="20" v-if="index % 2 === 0"> <el-row :gutter="20" v-if="index % 2 === 0">
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="item.specName"> <el-form-item :label="item.specName">
<el-input v-if="item.specType === '2233'" v-model="item.value" :placeholder="item.specHoldplace" /> <input v-if="item.specType === '2233'"
<el-select v-else-if="item.specType === '3344'" v-model="item.value" style="width:100%"> v-model="item.value"
<el-option v-for="val in item.values" :key="val.value" :label="val.valueName" :value="val.value" /> :placeholder="item.specHoldplace"
</el-select> class="custom-input" />
<select v-else-if="item.specType === '3344'"
v-model="item.value"
class="custom-select">
<option v-for="val in item.values"
:key="val.value"
:label="val.valueName"
:value="val.value">
{{ val.valueName }}
</option>
</select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-if="index < attrs.length - 1"> <el-col :span="12" v-if="index < attrs.length - 1">
<el-form-item :label="attrs[index + 1].specName"> <el-form-item :label="attrs[index + 1].specName">
<el-input v-if="attrs[index + 1].specType === '2233'" v-model="attrs[index + 1].value" <input v-if="attrs[index + 1].specType === '2233'"
:placeholder="attrs[index + 1].specHoldplace" /> v-model="attrs[index + 1].value"
<el-select v-else-if="attrs[index + 1].specType === '3344'" v-model="attrs[index + 1].value" :placeholder="attrs[index + 1].specHoldplace"
style="width:100%"> class="custom-input" />
<el-option v-for="val in attrs[index + 1].values" :key="val.value" :label="val.valueName" <select v-else-if="attrs[index + 1].specType === '3344'"
:value="val.value" /> v-model="attrs[index + 1].value"
</el-select> class="custom-select">
<option v-for="val in attrs[index + 1].values"
:key="val.value"
:label="val.valueName"
:value="val.value">
{{ val.valueName }}
</option>
</select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -196,6 +213,7 @@ export default {
if (this.form.ownerAttrDtos) { if (this.form.ownerAttrDtos) {
const attrDto = this.form.ownerAttrDtos.find(dto => dto.specCd === attr.specCd) const attrDto = this.form.ownerAttrDtos.find(dto => dto.specCd === attr.specCd)
attr.value = attrDto ? attrDto.value : '' attr.value = attrDto ? attrDto.value : ''
attr.attrId = attrDto ? attrDto.attrId : ''
} }
} }
} catch (error) { } catch (error) {
@ -235,6 +253,7 @@ export default {
const params = { const params = {
...this.form, ...this.form,
attrs: this.attrs.map(attr => ({ attrs: this.attrs.map(attr => ({
attrId: attr.attrId,
specCd: attr.specCd, specCd: attr.specCd,
value: attr.value value: attr.value
})) }))
@ -281,4 +300,73 @@ export default {
.mt-10 { .mt-10 {
margin-top: 10px; margin-top: 10px;
} }
/* 自定义输入框样式,模拟 el-input */
.custom-input {
width: 100%;
height: 32px;
line-height: 32px;
padding: 0 12px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
box-sizing: border-box;
}
.custom-input:focus {
outline: none;
border-color: #409eff;
}
.custom-input:hover {
border-color: #c0c4cc;
}
.custom-input::placeholder {
color: #c0c4cc;
}
/* 自定义选择框样式,模拟 el-select */
.custom-select {
width: 100%;
height: 32px;
line-height: 32px;
padding: 0 12px;
border: 1px solid #dcdfe6;
border-radius: 4px;
font-size: 14px;
color: #606266;
background-color: #fff;
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
box-sizing: border-box;
cursor: pointer;
appearance: none;
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
background-position: right 8px center;
background-repeat: no-repeat;
background-size: 16px;
padding-right: 32px;
}
.custom-select:focus {
outline: none;
border-color: #409eff;
}
.custom-select:hover {
border-color: #c0c4cc;
}
.custom-select option {
padding: 8px 12px;
background-color: #fff;
color: #606266;
}
.custom-select option:hover {
background-color: #f5f7fa;
}
</style> </style>