|
|
|
@ -1,21 +1,33 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div style="display: flex;"> |
|
|
|
<div> |
|
|
|
<el-input v-model="tpName" :placeholder="$t('form.xztp')" readonly |
|
|
|
@click.native="showSelectBalance" style="width: 100px;"/> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-input v-model="tpz" :placeholder="$t('form.placeholderInput')" maxlength="20" @change="tpzChange"> |
|
|
|
<template slot="append">{{ dw }} |
|
|
|
<el-select v-model="type" :placeholder="$t('form.placeholderSelect')" @change="typeChange"> |
|
|
|
<el-option :label="$t('page.business.resource.resource.common.tj')" :value="1"></el-option> |
|
|
|
<el-option :label="$t('page.business.resource.resource.common.zl')" :value="3"></el-option> |
|
|
|
</el-select> |
|
|
|
<template v-if="type == 1"> |
|
|
|
<el-input v-model="srz" :placeholder="$t('form.placeholderInput')" maxlength="20" @change="inputChange"> |
|
|
|
<template slot="append">{{ dw||'' }} |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" @click="getBalanceValue">{{ $t('form.hqz') }}</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<template v-if="type == 3"> |
|
|
|
<div> |
|
|
|
<el-input v-model="tpName" :placeholder="$t('form.xztp')" readonly @click.native="showSelectBalance" |
|
|
|
style="width: 100px;" /> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-input v-model="tpz" :placeholder="$t('form.placeholderInput')" maxlength="20" @change="tpzChange"> |
|
|
|
<template slot="append">{{ tpdw||'' }} |
|
|
|
</template> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
<div> |
|
|
|
<el-button type="primary" @click="getBalanceValue">{{ $t('form.hqz') }}</el-button> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
</div> |
|
|
|
<SelectInstrumentDialog ref="selectInstrumentDialog" @change="selectInstrumentChange"/> |
|
|
|
<SelectInstrumentDialog ref="selectInstrumentDialog" @change="selectInstrumentChange" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -24,7 +36,7 @@ import SelectInstrumentDialog from '@/views/business/comps/select/SelectInstrume |
|
|
|
import { getBalance } from "@/utils/tpph"; |
|
|
|
export default { |
|
|
|
name: "SelectBalanceValue", |
|
|
|
components: {SelectInstrumentDialog}, |
|
|
|
components: { SelectInstrumentDialog }, |
|
|
|
props: { |
|
|
|
value: { |
|
|
|
type: [Number, String], |
|
|
|
@ -45,10 +57,12 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
type: '', |
|
|
|
srz: '', |
|
|
|
tpName: '', |
|
|
|
tpz: '', |
|
|
|
|
|
|
|
yq:{} |
|
|
|
tpdw: '', |
|
|
|
yq: {} |
|
|
|
}; |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
@ -57,30 +71,40 @@ export default { |
|
|
|
showSelectBalance() { |
|
|
|
this.$refs.selectInstrumentDialog.show() |
|
|
|
}, |
|
|
|
selectInstrumentChange(val,row){ |
|
|
|
this.tpName=row.mc |
|
|
|
selectInstrumentChange(val, row) { |
|
|
|
this.tpName = row.mc |
|
|
|
this.yq = row |
|
|
|
}, |
|
|
|
async getBalanceValue() { |
|
|
|
if(!this.yq || !this.yq.bh){ |
|
|
|
if (!this.yq || !this.yq.bh) { |
|
|
|
this.$message.error('请选择仪器') |
|
|
|
return |
|
|
|
} |
|
|
|
this.tpz = '' |
|
|
|
let x = await getBalance({yq:this.yq,dw:null}) |
|
|
|
if(x && x.success){ |
|
|
|
debugger |
|
|
|
let x = await getBalance({ yq: this.yq, dw: null }) |
|
|
|
if (x && x.success) { |
|
|
|
this.tpz = x.value |
|
|
|
this.dw = x.unit |
|
|
|
}else{ |
|
|
|
this.tpdw = x.unit |
|
|
|
} else { |
|
|
|
this.$message.error(x.message || '获取值失败') |
|
|
|
} |
|
|
|
this.tpzChange() |
|
|
|
}, |
|
|
|
tpzChange() { |
|
|
|
this.$emit('change', this.tpz) |
|
|
|
this.$emit('change', { tpz: this.tpz, dw: this.tpdw }) |
|
|
|
this.$emit('input', this.tpz) |
|
|
|
}, |
|
|
|
inputChange() { |
|
|
|
this.$emit('change', { tpz: this.srz, dw: this.dw }) |
|
|
|
this.$emit('input', this.srz) |
|
|
|
}, |
|
|
|
typeChange(){ |
|
|
|
this.$emit('change', { tpz: null, dw: null }) |
|
|
|
this.$emit('input', null) |
|
|
|
this.srz=null |
|
|
|
this.tpz=null |
|
|
|
this.tpdw=null |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
</script> |