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,12 +7,24 @@ ...@@ -7,12 +7,24 @@
<view class="daily-report-container"> <view class="daily-report-container">
<template v-for="(i,index) in list"> <template v-for="(i,index) in list">
<view <view
class="list-box" :class="['list-box',{ 'no-child': !i.children.length }]"
:key="index" :key="index"
> >
<view class="list-title">{{ i.label }}</view> <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>
</view>
<template v-if="i.children.length">
<Table <Table
:columns="i.children[index]" :columns="i.children[0]"
:data="i.children" :data="i.children"
titleKey="label" titleKey="label"
tableStyle="padding-right:32rpx" tableStyle="padding-right:32rpx"
...@@ -20,14 +32,15 @@ ...@@ -20,14 +32,15 @@
cornerText="序号" cornerText="序号"
LeftWidth="104rpx" LeftWidth="104rpx"
@rowClick="handleRowClick" @rowClick="handleRowClick"
:index="index" :tableIndex="index"
hasFooter hasFooter
@clickAdd="addItem(index)" @clickAdd="addItem(index)"
> >
<template v-slot:customCell="{col }"> <template v-slot:customCell="{row, colIndex}">
{{ col.value || '-' }} {{ row[colIndex].value || '-' }}
</template> </template>
</Table> </Table>
</template>
</view> </view>
</template> </template>
</view> </view>
...@@ -39,7 +52,11 @@ ...@@ -39,7 +52,11 @@
</template> </template>
<nothing v-else /> <nothing v-else />
</template> </template>
<EditForm ref="editForm" @onDel="delItem" /> <EditForm
ref="editForm"
@onDel="delItem"
@onConfirm="confirm"
/>
</view> </view>
</template> </template>
...@@ -69,37 +86,33 @@ export default { ...@@ -69,37 +86,33 @@ export default {
templateData: { templateData: {
handler (val) { handler (val) {
if (!this.list.length) this.list = utils.deepClone(val) if (!this.list.length) this.list = utils.deepClone(val)
this.loadComplete = true
}, },
immediate: true, immediate: true,
deep: true deep: true
} }
}, },
computed: {
title () {
let sceneName = {
0: '延保/权益',
1: '轻改'
}[this.sceneType]
return `洽谈明细 (${sceneName})`
}
},
mounted () { mounted () {
this.loadComplete = true
}, },
methods: { methods: {
handleRowClick (row, rowIndex, index) { 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) { delItem (c_index, index) {
this.list[index].children.splice(c_index, 1) this.list[index].children.splice(c_index, 1)
// this.list.splice(index, 1)
}, },
addItem (index) { addItem (index) {
let { templateData } = this let { templateData } = this
this.list[index].children.push(templateData[index].children[0]) this.list[index].children.push(templateData[index].children[0])
let data = this.list[index].children[this.list[index].children.length - 1], let data = this.list[index].children[this.list[index].children.length - 1],
c_index = this.list[index].children.length - 1 c_index = this.list[index].children.length - 1,
this.$refs.editForm.open(data, c_index, index) 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,8 +144,47 @@ export default { ...@@ -131,8 +144,47 @@ export default {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
line-height: 44rpx; 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 { .footer {
transform: translateY(48rpx); transform: translateY(48rpx);
......
...@@ -20,6 +20,19 @@ ...@@ -20,6 +20,19 @@
</view> </view>
</view> </view>
<view class="popup-content"> <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>
<view class="popup-footer flex"> <view class="popup-footer flex">
<view <view
...@@ -30,7 +43,7 @@ ...@@ -30,7 +43,7 @@
</view> </view>
<view <view
class="popup-btn popup-cancel" class="popup-btn popup-cancel"
@click="cancel" @click="close"
>{{ cancelText }}</view> >{{ cancelText }}</view>
<view <view
class="popup-btn popup-confirm" class="popup-btn popup-confirm"
...@@ -44,8 +57,11 @@ ...@@ -44,8 +57,11 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import Popup from '@/components/Popup.vue' import Popup from '@/components/Popup.vue'
import FormItem from './FormItem.vue'
import utils from '@/utils/utils'
export default { export default {
components: { Popup }, components: { Popup, FormItem },
name: 'EditForm', name: 'EditForm',
props: { props: {
cancelText: { cancelText: {
...@@ -61,32 +77,74 @@ export default { ...@@ -61,32 +77,74 @@ export default {
return { return {
data: {}, data: {},
c_index: 0, c_index: 0,
index: 0 index: 0,
parent: {}
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
open (data, c_index, index) { rules (item) {
this.data = data || {} 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.c_index = c_index || 0
this.index = index || 0 this.index = index || 0
this.parent = utils.deepClone(parent) || {}
this.$refs.popup.open() this.$refs.popup.open()
}, },
del () { del () {
this.$refs.popup.close()
this.$emit('onDel', this.c_index, this.index) this.$emit('onDel', this.c_index, this.index)
this.close()
}, },
cancel () { cancel () {
this.$emit('onCancel') this.$emit('onCancel')
}, },
close () { close () {
this.data = {}
this.c_index = 0
this.index = 0
this.parent = {}
this.$refs.popup.close() this.$refs.popup.close()
this.$emit('close')
}, },
confirm () { 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> </script>
...@@ -116,11 +174,22 @@ export default { ...@@ -116,11 +174,22 @@ export default {
} }
} }
.popup-content { .popup-content {
height: calc(100vh - 320rpx); height: calc(100vh - 272rpx);
overflow-y: auto; 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 { .popup-footer {
padding: 64rpx 0; padding: 16rpx 0 64rpx 0;
justify-content: center; justify-content: center;
gap: 0 32rpx; gap: 0 32rpx;
margin: 0 48rpx; 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 \ No newline at end of file
...@@ -255,6 +255,7 @@ export default { ...@@ -255,6 +255,7 @@ export default {
.data-cell { .data-cell {
background-color: #f9fafc; background-color: #f9fafc;
border-bottom: 1rpx solid #fff; border-bottom: 1rpx solid #fff;
word-break: break-all;
} }
// 最后一行去掉底部边框 // 最后一行去掉底部边框
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
</view> </view>
<view class="detail-right"> <view class="detail-right">
<component <component
:ref="``"
:is="componentName" :is="componentName"
@jump="jump" @jump="jump"
:transmission-of-data="transmissionOfData" :transmission-of-data="transmissionOfData"
...@@ -171,10 +172,10 @@ export default { ...@@ -171,10 +172,10 @@ export default {
{ SCENE_TYPE, CAR_BRAND_ID, BASE_SCENE_CODE } = this, { SCENE_TYPE, CAR_BRAND_ID, BASE_SCENE_CODE } = this,
data = await uni.$api.dailyTemplateApi.getDailyTemplate(type) data = await uni.$api.dailyTemplateApi.getDailyTemplate(type)
let templateData = Object.values(data) let templateData = Object.values(data)
.filter(item => { // .filter(item => {
// 场景类型过滤 // // 场景类型过滤
return item.sceneType.length ? item.sceneType.includes(SCENE_TYPE) : true // return item.sceneType.length ? item.sceneType.includes(SCENE_TYPE) : true
}) // })
.filter(item => { .filter(item => {
// 品牌过滤 // 品牌过滤
if (item.filterBrandId && item.filterBrandId.length) { 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!