Commit b2c21aff by zhangquan

提交format价格

1 parent 94c1f9a6
......@@ -86,6 +86,7 @@ export default {
let quill = this.$refs.myQuillEditor.quill;
if(!quill.container.innerText || !this.operateList?.length) return
let num = 0
const offsetArr = []
this.operateList.forEach(item => {
console.log(item)
let subStr = item.key
......@@ -93,14 +94,19 @@ export default {
do{
offset = quill.getText().indexOf(subStr, offset);
if(offset != -1){
// console.log(quill.container.innerText,111)
// console.log(quill.container.innerText)
// this.insertContent(item.name, subStr, offset)
quill.updateContents([
num = offsetArr.filter((item)=>{
return item < offset
}).length
/*** 为什么加num? 我也不知道,大概是插入一个自定义节点的话,就要加1,
所以在offset为100要插入节点时,就要判断(位置100)前面插入了多少自定义节点 ***/
quill.updateContents([ //相当于replace内容
{ retain: offset + num },
{ delete: subStr.length },
{ insert: { label: {name: item.name, key: subStr} } }
]);
num++
offsetArr.push(offset)
offset += item.name.length
}
}while(offset != -1)
......@@ -111,6 +117,8 @@ export default {
</script>
<style lang="scss" scoped>
.editor-ctnr{
width: 100%;
height: 100%;
.content-label{
width: 154px;
display: inline-block;
......@@ -125,7 +133,11 @@ export default {
.editor{
display: inline-block;
background-color: #fff;
width: 100%;
height: 100%;
.quill{
width: 100%;
height: 100%;
background-color: #fff;
border-color: #E5E5E5;
/deep/ .ql-toolbar.ql-snow, /deep/ .ql-container.ql-snow{
......
......@@ -26,8 +26,8 @@
<el-checkbox v-for="(item,index) in conditionList" :label="item.id" :key="index">
<span class="sign">条件{{index+1}}</span>
<span v-if="!item.newItem" class="condition">{{item.contractContent}}</span>
<el-input v-else type="text" v-model="curEditCondition.value" @blur.stop="createConfig(0)"></el-input>
<i v-if="!item.newItem && !disable" class="el-icon-edit-outline edit" @click.prevent="editCondition(item)"></i>
<el-input v-focus v-else type="text" v-model="curEditCondition.value" @blur.stop="createConfig(0)"></el-input>
<i v-if="!item.newItem && !disable" class="el-icon-edit-outline edit" @click.prevent="editConditionFn(item, 'conditionList')"></i>
</el-checkbox>
</el-checkbox-group>
<div v-if="!disable" class="add-btn" @click="addCondition('conditionList')">
......@@ -43,8 +43,8 @@
<el-checkbox v-for="(item,index) in responsibilityList" :label="item.id" :key="index">
<span class="sign">责任{{index+1}}</span>
<span v-if="!item.newItem" class="condition">{{item.contractContent}}</span>
<el-input v-else type="text" v-model="curEditCondition.value" @blur.stop="createConfig(1)"></el-input>
<i v-if="!item.newItem && !disable" class="el-icon-edit-outline edit" @click.prevent="editCondition(item)"></i>
<el-input v-focus v-else type="text" v-model="curEditCondition.value" @blur.stop="createConfig(1)"></el-input>
<i v-if="!item.newItem && !disable" class="el-icon-edit-outline edit" @click.prevent="editConditionFn(item, 'responsibilityList')"></i>
</el-checkbox>
</el-checkbox-group>
<div v-if="!disable" class="add-btn" @click="addCondition('responsibilityList')">
......@@ -257,6 +257,13 @@ export default {
gradeList: []
}
},
directives: {
focus: {
inserted(el) {
el.querySelector('input').focus()
},
},
},
created() {
const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
......@@ -277,12 +284,12 @@ export default {
},
methods: {
editCondition(row){
editConditionFn(row, key){
this.curEditCondition = {
id: row.id,
value: row.contractContent
}
const target = this.conditionList.find(item => item.id==row.id)
const target = this[key].find(item => item.id==row.id)
this.$set(target, 'newItem', true)
},
addCondition(key){
......@@ -430,6 +437,12 @@ export default {
this.getConfigList()
}
})
},
clearData(){
this.curEditCondition = {
id: '',
value: ''
}
}
}
}
......
......@@ -18,17 +18,22 @@
<td>标准</td>
<td>-</td>
<template v-for="(item, index) in tableData.salePeriodData">
<td :key="index"><el-input :disabled="disable" v-model="item.standardShelfCost"></el-input></td>
<td :key="index"> <el-input :disabled="disable" v-model="item.standardSalesCost"></el-input></td>
<td :key="index"><el-input onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disable" v-model="item.standardShelfCost"></el-input></td>
<td :key="index"> <el-input onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disable" v-model="item.standardSalesCost"></el-input></td>
</template>
</tr>
<tr v-for="(item, index) in tableData.gradeConfigList" :key="index">
<td class="price">
<el-input :disabled="disable" v-model="item.minPrice"></el-input>
<el-input onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disable" v-model="item.minPrice"></el-input>
<span class="sign">-</span>
<el-input :disabled="disable" v-model="item.maxPrice"></el-input>
<el-input onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disable" v-model="item.maxPrice"></el-input>
</td>
<td><el-input :disabled="disable" v-model="item.priceCoefficient"></el-input></td>
<td><el-input onkeyup="value = value ? value.replace(/^0\d/g, '0').replace(/[^\d.]/g, '').replace(/^\./g, '').replace(/^\d{6}\d+(\.\d+)?/g, value.substr(0,6)).replace(/\.{2,}/g, '').replace('.', '$#$')
.replace(/\./g, '').replace('$#$', '.').replace(/^(-)*(\d+)\.(\d\d).*$/, '$1$2.$3') : value" :disabled="disable" v-model="item.priceCoefficient"></el-input></td>
<template v-for="(ele, eIdx) in tableData.salePeriodData">
<td :key="eIdx">{{ Number((ele.standardShelfCost * item.priceCoefficient).toFixed(2))}}</td>
<td :key="eIdx">{{ Number((ele.standardSalesCost * item.priceCoefficient).toFixed(2))}}</td>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!