|
@@ -86,9 +86,16 @@
|
|
|
align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <integer-input v-model="scope.row.number"></integer-input>
|
|
|
+ <el-input v-model="scope.row.number" :class="{ 'input-error': scope.row.number === '' }" @input="handleInput" :disabled="oData.tagApplyStateId !='0' && oData.tagApplyStateId != '1'"></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="单价(元)"
|
|
|
+ prop="unitPrice"
|
|
|
+ align="right"
|
|
|
+ min-width="70"
|
|
|
+ header-align="center"
|
|
|
+ ></el-table-column>
|
|
|
<el-table-column
|
|
|
label="费用(元)"
|
|
|
prop="amount"
|
|
@@ -186,13 +193,8 @@ export default {
|
|
|
cancelButtonClass: 'confirm-dialog-cancel-btn',
|
|
|
type: 'warning'
|
|
|
}).then(() => {
|
|
|
- for (let i = 0; i < this.oData.details.length; i++) {
|
|
|
- if (this.oData.details[i].id === data.id) {
|
|
|
- this.oData.details.splice(i, 1)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- this.list = this.oData.details
|
|
|
+ this.list = this.list.filter(item => item.id !== data.id)
|
|
|
+ this.oData.details = this.list
|
|
|
}).catch(() => {})
|
|
|
},
|
|
|
onCloseBtnClick () {
|
|
@@ -201,10 +203,21 @@ export default {
|
|
|
onOkBtnClick () {
|
|
|
this.$$request(this.api, this.oData).then(() => {
|
|
|
this.close()
|
|
|
+ this.$emit('saved')
|
|
|
}).catch(console.error).finally(() => {})
|
|
|
+ },
|
|
|
+ handleInput (value) {
|
|
|
+ let sanitizedValue = value.replace(/[^0-9]/g, '')
|
|
|
+ sanitizedValue = sanitizedValue.replace(/^0+/, '')
|
|
|
+ this.selectedData.number = sanitizedValue === '' ? '' : sanitizedValue
|
|
|
+ this.selectedData.amount = sanitizedValue === '' ? 0 : (sanitizedValue * this.selectedData.unitPrice).toFixed(2)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss"></style>
|
|
|
+<style lang="scss">
|
|
|
+.input-error .el-input__inner {
|
|
|
+ border-color: red;
|
|
|
+}
|
|
|
+</style>
|