Commit a7a94797 by chenwq

对账单编辑-展示字段

1 parent 118a7afa
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
<el-select v-model="scope.row[subItem.extInfo.source || 'ORDER'][subItem.editObj.selectField]" style="width: 90px" :popper-append-to-body="false" slot="prepend" placeholder="请选择" @change="handleSelectInputChange(scope.$index, subItem)" :class="{ 'is-error': hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField) }"> <el-select v-model="scope.row[subItem.extInfo.source || 'ORDER'][subItem.editObj.selectField]" style="width: 90px" :popper-append-to-body="false" slot="prepend" placeholder="请选择" @change="handleSelectInputChange(scope.$index, subItem)" :class="{ 'is-error': hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField) }">
<el-option v-for="(k, kIdx) in subItem.editObj.optionList" :key="kIdx" :label="k[subItem.editObj.optionLabel]" :value="k[subItem.editObj.optionId]" /> <el-option v-for="(k, kIdx) in subItem.editObj.optionList" :key="kIdx" :label="k[subItem.editObj.optionLabel]" :value="k[subItem.editObj.optionId]" />
</el-select> </el-select>
<span v-if="subItem.editObj.suffixFn" slot="suffix">
<span class="inputSuffix">{{ subItem.editObj.suffixFn(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField, subItem.editObj.inputField) }}</span>
</span>
</el-input> </el-input>
<div v-if="hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField)" class="el-form-item__error"> <div v-if="hasError(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField)" class="el-form-item__error">
{{ getErrorMessage(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField) }} {{ getErrorMessage(scope.$index, subItem.extInfo.source || 'ORDER', subItem.editObj.selectField) }}
...@@ -101,6 +104,9 @@ ...@@ -101,6 +104,9 @@
<el-select v-model="batchForm[headObj.editObj.selectField]" style="width: 90px" :popper-append-to-body="false" slot="prepend" placeholder="请选择" :class="{ 'is-error': dialogErrors[headObj.editObj.selectField] }" @change="batchValidateForm"> <el-select v-model="batchForm[headObj.editObj.selectField]" style="width: 90px" :popper-append-to-body="false" slot="prepend" placeholder="请选择" :class="{ 'is-error': dialogErrors[headObj.editObj.selectField] }" @change="batchValidateForm">
<el-option v-for="(k, kIdx) in headObj.editObj.optionList" :key="kIdx" :label="k[headObj.editObj.optionLabel]" :value="k[headObj.editObj.optionId]" /> <el-option v-for="(k, kIdx) in headObj.editObj.optionList" :key="kIdx" :label="k[headObj.editObj.optionLabel]" :value="k[headObj.editObj.optionId]" />
</el-select> </el-select>
<span v-if="headObj.editObj.suffixFn" slot="suffix">
<span class="inputSuffix">{{ headObj.editObj.suffixFn('', headObj.extInfo.source || 'ORDER', headObj.editObj.selectField, headObj.editObj.inputField, true) }}</span>
</span>
</el-input> </el-input>
<div v-if="dialogErrors[headObj.editObj.inputField]" class="el-form-item__error">{{ dialogErrors[headObj.editObj.inputField] }}</div> <div v-if="dialogErrors[headObj.editObj.inputField]" class="el-form-item__error">{{ dialogErrors[headObj.editObj.inputField] }}</div>
<div v-if="dialogErrors[headObj.editObj.selectField]" class="el-form-item__error">{{ dialogErrors[headObj.editObj.selectField] }}</div> <div v-if="dialogErrors[headObj.editObj.selectField]" class="el-form-item__error">{{ dialogErrors[headObj.editObj.selectField] }}</div>
...@@ -380,6 +386,17 @@ export default { ...@@ -380,6 +386,17 @@ export default {
{ confId: 3, confValue: '按固定金额' } { confId: 3, confValue: '按固定金额' }
], ],
source: 'SUB_ORDER', source: 'SUB_ORDER',
suffixFn: (rowIndex, source, selectField, inputField, isBatch = false) => {
const suffixObj = {
1: '%',
2: '%',
3: '元'
}
var suffix = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
suffix = suffixObj[obj[selectField]] || ''
return suffix
},
rule: (value, rowIndex, source, headObj, isBatch = false) => { rule: (value, rowIndex, source, headObj, isBatch = false) => {
var errorTxt = '' var errorTxt = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source] const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
...@@ -420,7 +437,18 @@ export default { ...@@ -420,7 +437,18 @@ export default {
{ confId: 3, confValue: '按固定金额' } { confId: 3, confValue: '按固定金额' }
], ],
source: 'SUB_ORDER', source: 'SUB_ORDER',
rule: (value, rowIndex, source, field, isBatch = false) => { suffixFn: (rowIndex, source, selectField, inputField, isBatch = false) => {
const suffixObj = {
1: '%',
2: '%',
3: '元'
}
var suffix = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
suffix = suffixObj[obj[selectField]] || ''
return suffix
},
rule: (value, rowIndex, source, headObj, isBatch = false) => {
var errorTxt = '' var errorTxt = ''
const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source] const obj = isBatch ? this.batchForm : this.tableList[rowIndex][source]
const typeVal = obj[headObj.editObj.selectField] const typeVal = obj[headObj.editObj.selectField]
...@@ -509,41 +537,51 @@ export default { ...@@ -509,41 +537,51 @@ export default {
}], }],
trafficFeeCalculateTypeTxtList: [{ trafficFeeCalculateTypeTxtList: [{
confId: 1, confId: 1,
confLabel: '按毛利' confLabel: '按毛利',
suffix: '%'
}, },
{ {
confId: 2, confId: 2,
confLabel: '按收入' confLabel: '按收入',
suffix: '%'
}, },
{ {
confId: 3, confId: 3,
confLabel: '按固定金额' confLabel: '按固定金额',
suffix: '元'
}, { }, {
confId: 4, confId: 4,
confLabel: '按(产值-流量成本)比例' confLabel: '按(产值-流量成本)比例',
suffix: '%'
}, },
{ {
confId: 5, confId: 5,
confLabel: '按(产值-流量成本-其他费用不包含成本)比例' confLabel: '按(产值-流量成本-其他费用不包含成本)比例',
suffix: '%'
}, },
{ {
confId: 6, confId: 6,
confLabel: '按(产值-流量成本-其他费用包含成本)比例' confLabel: '按(产值-流量成本-其他费用包含成本)比例',
suffix: '%'
}, { }, {
confId: 7, confId: 7,
confLabel: '可扩展兜底' confLabel: '可扩展兜底',
suffix: ''
}, },
{ {
confId: 8, confId: 8,
confLabel: '按(收入-自定义其他费用)比例' confLabel: '按(收入-自定义其他费用)比例',
suffix: '%'
}, },
{ {
confId: 9, confId: 9,
confLabel: '按(收入-其他费用)比例' confLabel: '按(收入-其他费用)比例',
suffix: '%'
}, },
{ {
confId: 10, confId: 10,
confLabel: '按固定金额*购买数量' confLabel: '按固定金额*购买数量',
suffix: '元'
}] }]
}, },
defaultWidth: '180px' defaultWidth: '180px'
...@@ -644,9 +682,12 @@ export default { ...@@ -644,9 +682,12 @@ export default {
// 测算 // 测算
billCompute(rowIndex, source, field, isInput = false) { billCompute(rowIndex, source, field, isInput = false) {
if (field) { if (field) {
console.log(field, '校验-----')
this.validateField(rowIndex, source, field, isInput) this.validateField(rowIndex, source, field, isInput)
} }
this.billComputePage()
},
billComputePage() {
console.log(this.tableList, 'this.tableList---') console.log(this.tableList, 'this.tableList---')
this.loading = true this.loading = true
console.log(this.tableModifyList, 'this.tableModifyList----') console.log(this.tableModifyList, 'this.tableModifyList----')
...@@ -678,14 +719,16 @@ export default { ...@@ -678,14 +719,16 @@ export default {
const headObj = this.tmplFieldsList.find(i => i.fieldCode == field) const headObj = this.tmplFieldsList.find(i => i.fieldCode == field)
console.log(field, 'field----') console.log(field, 'field----')
var key = `${rowIndex}_${source}_${field}` var key = `${rowIndex}_${source}_${field}`
console.log(headObj, 'headObj---') console.log(headObj, 'headObj---00000000000')
if (headObj?.editType === 'selectInput') { if (headObj?.editType === 'selectInput') {
const obj = this.tableList[rowIndex][source] const obj = this.tableList[rowIndex][source]
if (!obj[headObj.editObj.selectField]) { const selectVal = obj[headObj.editObj.selectField]
const inputVal = obj[headObj.editObj.inputField]
if (selectVal === undefined || selectVal === null || selectVal === '') {
this.$set(this.validationErrors, `${rowIndex}_${source}_${headObj.editObj.selectField}`, '此项为必填项') this.$set(this.validationErrors, `${rowIndex}_${source}_${headObj.editObj.selectField}`, '此项为必填项')
return false return false
} }
if (!obj[headObj.editObj.inputField]) { if (inputVal === undefined || inputVal === null || inputVal === '') {
this.$set(this.validationErrors, `${rowIndex}_${source}_${headObj.editObj.inputField}`, '此项为必填项') this.$set(this.validationErrors, `${rowIndex}_${source}_${headObj.editObj.inputField}`, '此项为必填项')
return false return false
} }
...@@ -849,7 +892,7 @@ export default { ...@@ -849,7 +892,7 @@ export default {
inputType: 'number', inputType: 'number',
...this.editObj.selectInput.defaultConf[k.fieldCode] ...this.editObj.selectInput.defaultConf[k.fieldCode]
} }
k.width = '220px' k.width = '240px'
} }
} }
...@@ -915,8 +958,10 @@ export default { ...@@ -915,8 +958,10 @@ export default {
const source = m.source const source = m.source
const selectField = m.attr.split(',')[0] const selectField = m.attr.split(',')[0]
const inputField = m.attr.split(',')[1] const inputField = m.attr.split(',')[1]
const selectTxt = this.baseData[selectField + 'TxtList'].find(n => n[m.optionId] == item[m.source][selectField])?.[m.optionLabel] const selectObj = this.baseData[selectField + 'TxtList'].find(n => n[m.optionId] == item[m.source][selectField])
const selectTxt = selectObj?.[m.optionLabel]
item[m.source][selectField] = selectTxt || '' item[m.source][selectField] = selectTxt || ''
item[m.source][inputField] = item[m.source][inputField] + selectObj?.suffix
} else if (m.type == 'time') { } else if (m.type == 'time') {
item[m.source][m.attr] = item[m.source][m.attr] ? Util.dateFormate(item[m.source][m.attr], 'YYYY-MM-DD HH:mm:ss') : '-' item[m.source][m.attr] = item[m.source][m.attr] ? Util.dateFormate(item[m.source][m.attr], 'YYYY-MM-DD HH:mm:ss') : '-'
} }
...@@ -1173,6 +1218,12 @@ export default { ...@@ -1173,6 +1218,12 @@ export default {
} }
} }
} }
::v-deep .el-input__suffix .inputSuffix {
position: absolute;
left: -14px;
top: 8px;
// transition: all 0.3s;
}
.tb-header-cell { .tb-header-cell {
box-sizing: border-box; box-sizing: border-box;
text-align: center; text-align: center;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!