Commit b1941237 by 李伟康

fix(css): 修复精灵图图标定位问题

- 调整 appeal-record 图标的背景位置坐标
- 修正 clone 和 collapse-all 图标的背景位置
- 更新 customer-add 图标的背景位置坐标
- 修复 customer-list 图标的背景位置
- 调整 dress-code 图标的背景位置坐标
- 修正 equityClose 图标的背景位置
- 更新 feedbackIcon 图标的背景位置坐标
- 修复 green-arrow 图标的背景位置
- 调整 lssl-icon 图标的背景位置坐标
- 修正 normal 图标的背景位置
- 更新 rule 图标的背景位置坐标
- 修复 study-tips 图标的背景位置
- 调整 task-pass 图标的背景位置坐标
- 修正 two-arrow 和 up-arrow 图标的背景位置
- 添加新的 date-time 图标样式定义
- 在日报页面组件中添加 ref 属性
- 注释掉场景类型过滤逻辑
- 重构谈判详情编辑页面的列表渲染结构
1 parent 51ac79b7

3.21 MB | W: | H:

3.21 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -7,27 +7,40 @@
<view class="daily-report-container">
<template v-for="(i,index) in list">
<view
class="list-box"
:class="['list-box',{ 'no-child': !i.children.length }]"
:key="index"
>
<view class="list-title">{{ i.label }}</view>
<Table
:columns="i.children[index]"
:data="i.children"
titleKey="label"
tableStyle="padding-right:32rpx"
customTable
cornerText="序号"
LeftWidth="104rpx"
@rowClick="handleRowClick"
:index="index"
hasFooter
@clickAdd="addItem(index)"
>
<template v-slot:customCell="{col }">
{{ col.value || '-' }}
<view class="list-title flex">
{{ i.label }}
<template v-if="!i.children.length">
<view
class="add flex"
@click="addItem(index)"
>
<view class="add-icon"></view>
新增
</view>
</template>
</Table>
</view>
<template v-if="i.children.length">
<Table
:columns="i.children[0]"
:data="i.children"
titleKey="label"
tableStyle="padding-right:32rpx"
customTable
cornerText="序号"
LeftWidth="104rpx"
@rowClick="handleRowClick"
:tableIndex="index"
hasFooter
@clickAdd="addItem(index)"
>
<template v-slot:customCell="{row, colIndex}">
{{ row[colIndex].value || '-' }}
</template>
</Table>
</template>
</view>
</template>
</view>
......@@ -39,7 +52,11 @@
</template>
<nothing v-else />
</template>
<EditForm ref="editForm" @onDel="delItem" />
<EditForm
ref="editForm"
@onDel="delItem"
@onConfirm="confirm"
/>
</view>
</template>
......@@ -69,37 +86,33 @@ export default {
templateData: {
handler (val) {
if (!this.list.length) this.list = utils.deepClone(val)
this.loadComplete = true
},
immediate: true,
deep: true
}
},
computed: {
title () {
let sceneName = {
0: '延保/权益',
1: '轻改'
}[this.sceneType]
return `洽谈明细 (${sceneName})`
}
},
mounted () {
this.loadComplete = true
},
methods: {
handleRowClick (row, rowIndex, index) {
this.$refs.editForm.open(row, rowIndex, index)
let parent = this.list[index]
this.$refs.editForm.open(row, rowIndex, index, parent)
},
delItem (c_index, index) {
this.list[index].children.splice(c_index, 1)
// this.list.splice(index, 1)
},
addItem (index) {
let { templateData } = this
this.list[index].children.push(templateData[index].children[0])
let data = this.list[index].children[this.list[index].children.length - 1],
c_index = this.list[index].children.length - 1
this.$refs.editForm.open(data, c_index, index)
c_index = this.list[index].children.length - 1,
parent = this.list[index]
this.$refs.editForm.open(data, c_index, index, parent)
},
confirm (data, c_index, index) {
console.log(data)
this.$set(this.list[index].children, c_index, utils.deepClone(data))
}
}
}
......@@ -131,9 +144,48 @@ export default {
font-size: 32rpx;
font-weight: 600;
line-height: 44rpx;
padding: 32rpx 0 24rpx;
padding: 32rpx 32rpx 24rpx 0;
.add {
margin-left: auto;
height: 64rpx;
padding: 20rpx 32rpx;
justify-content: center;
align-items: center;
border-radius: 32rpx;
background: #2c66f71a;
font-size: 30rpx;
font-weight: 500;
color: #2c66f7;
&-icon {
position: relative;
width: 28rpx;
height: 28rpx;
margin-right: 10rpx;
&::before,
&::after {
position: absolute;
content: '';
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #4673ff;
border-radius: 4rpx;
}
&::before {
width: 4rpx;
height: 28rpx;
}
&::after {
width: 28rpx;
height: 4rpx;
}
}
}
}
}
.no-child {
padding-bottom: 0;
}
.footer {
transform: translateY(48rpx);
height: 136rpx;
......
......@@ -20,6 +20,19 @@
</view>
</view>
<view class="popup-content">
<view class="form-box">
<template v-for="(item,ind) in data">
<FormItem
class="form-item"
:key="ind"
:formItem="item"
:rules="rules(item)"
v-if="itemShow(item)"
@onSelect="onSelect($event, ind)"
@onInput="onInput($event, ind)"
/>
</template>
</view>
</view>
<view class="popup-footer flex">
<view
......@@ -30,7 +43,7 @@
</view>
<view
class="popup-btn popup-cancel"
@click="cancel"
@click="close"
>{{ cancelText }}</view>
<view
class="popup-btn popup-confirm"
......@@ -44,8 +57,11 @@
<script type='text/ecmascript-6'>
import Popup from '@/components/Popup.vue'
import FormItem from './FormItem.vue'
import utils from '@/utils/utils'
export default {
components: { Popup },
components: { Popup, FormItem },
name: 'EditForm',
props: {
cancelText: {
......@@ -61,32 +77,74 @@ export default {
return {
data: {},
c_index: 0,
index: 0
index: 0,
parent: {}
}
},
mounted () {
},
methods: {
open (data, c_index, index) {
this.data = data || {}
rules (item) {
let rules = this.parent.childrenRules
if (rules) {
return rules[item.key] || null
} else return null
},
open (data, c_index, index, parent) {
console.log(c_index, index)
this.data = utils.deepClone(data) || {}
this.c_index = c_index || 0
this.index = index || 0
this.parent = utils.deepClone(parent) || {}
this.$refs.popup.open()
},
del () {
this.$refs.popup.close()
this.$emit('onDel', this.c_index, this.index)
this.close()
},
cancel () {
this.$emit('onCancel')
},
close () {
this.data = {}
this.c_index = 0
this.index = 0
this.parent = {}
this.$refs.popup.close()
this.$emit('close')
},
confirm () {
this.$emit('onConfirm', this.data, this.c_index, this.index)
this.$emit('onConfirm', utils.deepClone(this.data), this.c_index, this.index)
this.close()
},
itemShow (item) {
let { parent } = this,
childrenShowRules = parent.childrenShowRules || null
if (childrenShowRules) {
if (Object.keys(childrenShowRules).includes(item.key)) {
let { keys, result } = childrenShowRules[item.key],
{ data } = this,
params = keys.map((i, index) => `val${index + 1}`),
func = new Function(...params, result),
value = []
keys.map(key => {
let item = data.find(i => i.key == key)
if (item) value.push(item.value || null)
})
return func(...value)
} else {
return true
}
} else {
return true
}
},
onInput (val, index) {
this.$set(this.data[index], 'value', val)
},
onSelect (val, index) {
console.log(val)
this.$set(this.data[index], 'value', val)
}
}
}
</script>
......@@ -116,11 +174,22 @@ export default {
}
}
.popup-content {
height: calc(100vh - 320rpx);
height: calc(100vh - 272rpx);
overflow-y: auto;
box-sizing: border-box;
padding: 16rpx 0;
.form-box {
margin: 0 48rpx;
padding: 32rpx;
border-radius: 24rpx;
background: #94c2ff33;
.form-item {
margin-bottom: 16rpx;
}
}
}
.popup-footer {
padding: 64rpx 0;
padding: 16rpx 0 64rpx 0;
justify-content: center;
gap: 0 32rpx;
margin: 0 48rpx;
......
<template>
<view :class="['item flex',{ 'textarea-item': formItem.type == 'textarea' }]">
<view class="item-label flex">
{{ item.label }}
<text
class="required"
v-if="item.required"
>*</text>
</view>
<view class="item-content flex">
<template v-if="item.disabled">
<view :class="['select flex']">{{ item.value }}
</view>
</template>
<template v-else>
<template v-if="item.type == 'input'">
<input
:placeholder="item.placeholder || '请输入'"
:value="item.value"
class="input"
:maxlength="rules.maxLength || -1"
placeholder-class="placeholderStyle"
@input="input"
/></template>
<template v-else-if="item.type == 'phoneInput'">
<input
:placeholder="item.placeholder || '请输入'"
:value="item.value"
class="input"
:maxlength="11"
placeholder-class="placeholderStyle"
type="tel"
/>
</template>
<template v-else-if="item.type == 'textarea'">
<textarea
:placeholder="textareaPlaceholder"
:value="item.value"
class="textarea"
:maxlength="rules.maxLength || -1"
placeholder-class="placeholderStyle"
@input="input"
/>
</template>
<template v-else-if="item.type == 'select'">
<template v-if="item.optionsKey">
<view
:class="['select flex', { 'placeholderStyle': !item.value }]"
@click="select"
>{{ item.value || item.placeholder || '请选择' }}
<view class="sprite-icon icon-icon-select"></view>
</view>
</template>
<template v-else>
<picker
class="picker"
mode="selector"
@change="select"
:range="item.options"
range-key="label"
>
<view
:class="['select flex', { 'placeholderStyle': !item.value }]"
@click="select"
>{{ item.value || item.placeholder || '请选择' }}
<view class="sprite-icon icon-icon-select"></view>
</view>
</picker>
</template>
</template>
<template v-else-if="item.type == 'datetime'">
<view
:class="['select flex', { 'placeholderStyle': !item.value }]"
@click="$refs.calendar.open()"
>{{ item.value || item.placeholder || '请选择' }}
<view class="sprite-icon icon-date-time"></view>
</view>
<uni-calendar
ref="calendar"
:insert="false"
:clearDate="false"
:startDate="startDate"
:endDate="endDate"
@confirm="confirmCalendar"
hideMask
showBottomBtn
/>
</template>
<template v-else-if="item.type == 'radio'">
<radio-group
class="radio-group"
@change="$emit('onSelect',$event.detail.value)"
>
<radio
class="radio"
v-for="(i, r_index) in item.options"
:key="r_index"
:value="i.value"
:checked="i.value == item.value"
>{{ i.value }}</radio>
</radio-group>
</template>
<template v-else-if="item.type == 'numberInput'">
<input
:placeholder="item.placeholder || '请输入'"
:value="item.value"
class="input"
:maxlength="rules.maxLength || 11"
placeholder-class="placeholderStyle"
:type="rules.integer ? 'numeric' : 'decimal'"
@input="numberInput"
/>
</template>
</template>
<template v-if="item.prefixComponent">
<view :class="[`sprite-icon icon-${item.prefixComponent}Icon`]"></view>
</template>
<template v-if="item.unit">
<view class="unit">{{ item.unit }}</view>
</template>
</view>
</view>
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs';
import utils from '@/utils/utils'
export default {
name: 'FormItem',
props: {
formItem: {
type: Object,
default: () => { }
},
rules: {
type: Object,
default: () => ({})
},
},
watch: {
formItem: {
handler (newVal) {
if (!this.item) this.item = newVal
},
deep: true,
immediate: true
}
},
computed: {
textareaPlaceholder () {
let { rules } = this
return rules.maxLength ? `请输入(${rules.maxLength}字以内)` : '请输入'
},
startDate () {
let { rules } = this
return rules.minDate ? dayjs(eval(rules.minDate)).format('YYYY-MM-DD') : '2020-01-01'
},
endDate () {
let { rules } = this
return rules.maxDate ? dayjs(eval(rules.maxDate)).format('YYYY-MM-DD') : '2099-12-31'
},
},
data () {
return {
item: null,
}
},
mounted () {
},
methods: {
confirmCalendar ({ fulldate }) {
this.$emit('onSelect', fulldate)
},
input (e) {
this.$emit('onInput', e.detail.value)
},
select (e) {
let { item } = this
if (item.optionsKey) {
} else {
this.$emit('onSelect', item.options[e.detail.value].value)
}
},
numberInput (e) {
let { rules } = this,
val = e.detail.value,
precision = rules.precision || 2,
min = rules.min || 0,
max = rules.max || 9999999999
if (rules.integer) {
// 只保留数字
let filtered = (val || '').replace(/\D/g, '');
// 去除前导零(但保留单独的0)
if (filtered.length > 1) {
filtered = filtered.replace(/^0+/, '');
}
// 转换为数字进行范围检查
const numValue = parseInt(filtered, 10);
// 如果超出最大值,限制为最大值
if (!isNaN(numValue) && numValue > max) {
filtered = String(max);
}
e.detail.value = filtered
this.$set(this.item, 'value', filtered)
this.$emit('onInput', filtered)
}
if (rules.decimal) {
// 只保留数字和小数点
let filtered = (val || '').replace(/[^\d.]/g, '');
// 确保只有一个小数点
const parts = filtered.split('.');
if (parts.length > 2) {
filtered = parts[0] + '.' + parts.slice(1).join('');
}
// 重新分割,确保处理正确
const newParts = filtered.split('.');
// 去除整数部分的前导零(但保留单独的0或小数点前的0)
if (newParts[0].length > 1) {
newParts[0] = newParts[0].replace(/^0+/, '');
}
// 限制小数位数
if (newParts.length === 2 && newParts[1].length > precision) {
newParts[1] = newParts[1].substring(0, precision);
}
// 重新组合
filtered = newParts.join('.');
// 转换为数字进行范围检查
const numValue = parseFloat(filtered);
// 如果超出最大值,限制为最大值
if (!isNaN(numValue)) {
if (numValue < min) {
filtered = String(min);
} else if (numValue > max) {
filtered = String(max);
}
}
this.$set(this.item, 'value', filtered)
this.$emit('onInput', filtered)
}
}
}
}
</script>
<style scoped lang='scss'>
.item {
width: 100%;
height: 96rpx;
padding: 0 32rpx;
border-radius: 16rpx;
background: #fff;
&-label {
color: #333333;
font-size: 28rpx;
font-weight: 400;
line-height: 40rpx;
.required {
color: #f24724;
}
}
&-content {
flex: 1;
.input,
.radio-group {
text-align: right;
.radio {
margin-left: 28rpx;
::v-deep .uni-radio-input {
width: 28rpx;
height: 28rpx;
&:before {
font-size: 20rpx;
}
}
}
}
.sprite-icon {
margin-left: 8rpx;
}
}
.input,
.textarea,
.select,
.picker,
.radio-group {
width: 100%;
font-size: 28rpx;
&::placeholder {
color: #999999;
}
}
.select {
width: 100%;
justify-content: flex-end;
}
.placeholderStyle {
color: #999999;
}
}
.textarea-item {
height: 312rpx;
flex-direction: column;
padding-bottom: 40rpx;
box-sizing: border-box;
.item-label,
.item-content,
.textarea {
width: 100%;
}
.textarea {
height: 100%;
}
.item-label {
height: 80rpx;
}
.item-content {
height: 192rpx;
border-radius: 16rpx;
border: 2rpx solid #eff0f2;
background: #f4f5f7;
padding: 24rpx;
box-sizing: border-box;
}
}
</style>
\ No newline at end of file
......@@ -255,6 +255,7 @@ export default {
.data-cell {
background-color: #f9fafc;
border-bottom: 1rpx solid #fff;
word-break: break-all;
}
// 最后一行去掉底部边框
......
......@@ -43,6 +43,7 @@
</view>
<view class="detail-right">
<component
:ref="``"
:is="componentName"
@jump="jump"
:transmission-of-data="transmissionOfData"
......@@ -171,10 +172,10 @@ export default {
{ SCENE_TYPE, CAR_BRAND_ID, BASE_SCENE_CODE } = this,
data = await uni.$api.dailyTemplateApi.getDailyTemplate(type)
let templateData = Object.values(data)
.filter(item => {
// 场景类型过滤
return item.sceneType.length ? item.sceneType.includes(SCENE_TYPE) : true
})
// .filter(item => {
// // 场景类型过滤
// return item.sceneType.length ? item.sceneType.includes(SCENE_TYPE) : true
// })
.filter(item => {
// 品牌过滤
if (item.filterBrandId && item.filterBrandId.length) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!