Commit b2c21aff by zhangquan

提交format价格

1 parent 94c1f9a6
...@@ -86,6 +86,7 @@ export default { ...@@ -86,6 +86,7 @@ export default {
let quill = this.$refs.myQuillEditor.quill; let quill = this.$refs.myQuillEditor.quill;
if(!quill.container.innerText || !this.operateList?.length) return if(!quill.container.innerText || !this.operateList?.length) return
let num = 0 let num = 0
const offsetArr = []
this.operateList.forEach(item => { this.operateList.forEach(item => {
console.log(item) console.log(item)
let subStr = item.key let subStr = item.key
...@@ -93,14 +94,19 @@ export default { ...@@ -93,14 +94,19 @@ export default {
do{ do{
offset = quill.getText().indexOf(subStr, offset); offset = quill.getText().indexOf(subStr, offset);
if(offset != -1){ if(offset != -1){
// console.log(quill.container.innerText,111) // console.log(quill.container.innerText)
// this.insertContent(item.name, subStr, offset) // 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 }, { retain: offset + num },
{ delete: subStr.length }, { delete: subStr.length },
{ insert: { label: {name: item.name, key: subStr} } } { insert: { label: {name: item.name, key: subStr} } }
]); ]);
num++ offsetArr.push(offset)
offset += item.name.length offset += item.name.length
} }
}while(offset != -1) }while(offset != -1)
...@@ -111,6 +117,8 @@ export default { ...@@ -111,6 +117,8 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.editor-ctnr{ .editor-ctnr{
width: 100%;
height: 100%;
.content-label{ .content-label{
width: 154px; width: 154px;
display: inline-block; display: inline-block;
...@@ -125,7 +133,11 @@ export default { ...@@ -125,7 +133,11 @@ export default {
.editor{ .editor{
display: inline-block; display: inline-block;
background-color: #fff; background-color: #fff;
width: 100%;
height: 100%;
.quill{ .quill{
width: 100%;
height: 100%;
background-color: #fff; background-color: #fff;
border-color: #E5E5E5; border-color: #E5E5E5;
/deep/ .ql-toolbar.ql-snow, /deep/ .ql-container.ql-snow{ /deep/ .ql-toolbar.ql-snow, /deep/ .ql-container.ql-snow{
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
<el-checkbox v-for="(item,index) in conditionList" :label="item.id" :key="index"> <el-checkbox v-for="(item,index) in conditionList" :label="item.id" :key="index">
<span class="sign">条件{{index+1}}</span> <span class="sign">条件{{index+1}}</span>
<span v-if="!item.newItem" class="condition">{{item.contractContent}}</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> <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="editCondition(item)"></i> <i v-if="!item.newItem && !disable" class="el-icon-edit-outline edit" @click.prevent="editConditionFn(item, 'conditionList')"></i>
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<div v-if="!disable" class="add-btn" @click="addCondition('conditionList')"> <div v-if="!disable" class="add-btn" @click="addCondition('conditionList')">
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
<el-checkbox v-for="(item,index) in responsibilityList" :label="item.id" :key="index"> <el-checkbox v-for="(item,index) in responsibilityList" :label="item.id" :key="index">
<span class="sign">责任{{index+1}}</span> <span class="sign">责任{{index+1}}</span>
<span v-if="!item.newItem" class="condition">{{item.contractContent}}</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> <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="editCondition(item)"></i> <i v-if="!item.newItem && !disable" class="el-icon-edit-outline edit" @click.prevent="editConditionFn(item, 'responsibilityList')"></i>
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
<div v-if="!disable" class="add-btn" @click="addCondition('responsibilityList')"> <div v-if="!disable" class="add-btn" @click="addCondition('responsibilityList')">
...@@ -257,6 +257,13 @@ export default { ...@@ -257,6 +257,13 @@ export default {
gradeList: [] gradeList: []
} }
}, },
directives: {
focus: {
inserted(el) {
el.querySelector('input').focus()
},
},
},
created() { created() {
const urlParam = this.$route.params const urlParam = this.$route.params
this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id)) this.routeInfo = JSON.parse(decodeURIComponent(urlParam.id))
...@@ -277,12 +284,12 @@ export default { ...@@ -277,12 +284,12 @@ export default {
}, },
methods: { methods: {
editCondition(row){ editConditionFn(row, key){
this.curEditCondition = { this.curEditCondition = {
id: row.id, id: row.id,
value: row.contractContent 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) this.$set(target, 'newItem', true)
}, },
addCondition(key){ addCondition(key){
...@@ -430,6 +437,12 @@ export default { ...@@ -430,6 +437,12 @@ export default {
this.getConfigList() this.getConfigList()
} }
}) })
},
clearData(){
this.curEditCondition = {
id: '',
value: ''
}
} }
} }
} }
......
...@@ -18,17 +18,22 @@ ...@@ -18,17 +18,22 @@
<td>标准</td> <td>标准</td>
<td>-</td> <td>-</td>
<template v-for="(item, index) in tableData.salePeriodData"> <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 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('.', '$#$')
<td :key="index"> <el-input :disabled="disable" v-model="item.standardSalesCost"></el-input></td> .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> </template>
</tr> </tr>
<tr v-for="(item, index) in tableData.gradeConfigList" :key="index"> <tr v-for="(item, index) in tableData.gradeConfigList" :key="index">
<td class="price"> <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> <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>
<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"> <template v-for="(ele, eIdx) in tableData.salePeriodData">
<td :key="eIdx">{{ Number((ele.standardShelfCost * item.priceCoefficient).toFixed(2))}}</td> <td :key="eIdx">{{ Number((ele.standardShelfCost * item.priceCoefficient).toFixed(2))}}</td>
<td :key="eIdx">{{ Number((ele.standardSalesCost * 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!