Commit 3d802c98 by 李伟康

refactor(dailyReport): 重构日报组件数据处理逻辑

- 优化 Entrance.vue 组件代码格式和入口列表配置
- 更新日报提交逻辑,统一使用 requestJson 替代 fieldDataList 和 subformDataList
- 重构 subform.js 文件,完善动态表单处理逻辑和字段值序列化
- 添加新的驻店日报入口并调整现有入口的场景类型配置
- 优化组件样式布局和事件处理机制
1 parent becb0109
...@@ -3,12 +3,7 @@ ...@@ -3,12 +3,7 @@
<template v-if="entranceList.length"> <template v-if="entranceList.length">
<view class="entrance-container"> <view class="entrance-container">
<view :class="['entrance-list', `entrance-list-${type}`]"> <view :class="['entrance-list', `entrance-list-${type}`]">
<view <view class="entrance-item" v-for="(item, index) in entranceList" :key="index" @click="handleClick(item)">
class="entrance-item"
v-for="(item, index) in entranceList"
:key="index"
@click="handleClick(item)"
>
<view :class="['sprite-icon', `icon-${item.icon}`]"></view> <view :class="['sprite-icon', `icon-${item.icon}`]"></view>
<view class="entrance-name">{{ item.label }}</view> <view class="entrance-name">{{ item.label }}</view>
</view> </view>
...@@ -17,10 +12,7 @@ ...@@ -17,10 +12,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="developing flex"> <view class="developing flex">
<image <image class="developing-icon" src="../assets/images/common/developing.webp" />
class="developing-icon"
src="../assets/images/common/developing.webp"
/>
功能开发中 功能开发中
</view> </view>
</template> </template>
...@@ -37,7 +29,7 @@ export default { ...@@ -37,7 +29,7 @@ export default {
default: 0 default: 0
} }
}, },
data () { data() {
return { return {
// 工资申诉入口是否允许显示 // 工资申诉入口是否允许显示
wageAppealAllowed: false, wageAppealAllowed: false,
...@@ -46,7 +38,7 @@ export default { ...@@ -46,7 +38,7 @@ export default {
entranceList: [] entranceList: []
} }
}, },
created () { created() {
// 组件创建时请求工资申诉入口权限 // 组件创建时请求工资申诉入口权限
this.fetchWageAppealEntrance() this.fetchWageAppealEntrance()
this.getEntranceList() this.getEntranceList()
...@@ -56,7 +48,7 @@ export default { ...@@ -56,7 +48,7 @@ export default {
}, },
methods: { methods: {
// 请求工资申诉入口权限,并设置显示开关 // 请求工资申诉入口权限,并设置显示开关
async fetchWageAppealEntrance () { async fetchWageAppealEntrance() {
try { try {
this.loadingEntrance = true this.loadingEntrance = true
const userInfo = uni.$storage.get('userInfo') || {} const userInfo = uni.$storage.get('userInfo') || {}
...@@ -84,14 +76,14 @@ export default { ...@@ -84,14 +76,14 @@ export default {
this.loadingEntrance = false this.loadingEntrance = false
} }
}, },
handleClick (item) { handleClick(item) {
// 这里可以根据实际需求进行跳转或功能处理 // 这里可以根据实际需求进行跳转或功能处理
this.$emit('entranceClick', item) this.$emit('entranceClick', item)
}, },
isNewVersionNeed (merchantId) { isNewVersionNeed(merchantId) {
return uni.$api.dailyTemplateApi.isNewVersionNeed({ merchantId }) return uni.$api.dailyTemplateApi.isNewVersionNeed({ merchantId })
}, },
async getEntranceList () { async getEntranceList() {
let entranceList = [ let entranceList = [
{ {
icon: 'daily-report', icon: 'daily-report',
...@@ -169,6 +161,14 @@ export default { ...@@ -169,6 +161,14 @@ export default {
noInterception: true noInterception: true
}, },
{ {
icon: 'daily-report',
label: '驻店日报-新',
name: 'staffDailyReport',
page: '/pages/common/dailyNewspaper/index',
eventCode: 'staff_daily_report_page',
noInterception: true
},
{
icon: 'store-daily-report', icon: 'store-daily-report',
label: '门店日报', label: '门店日报',
name: 'storeDailyReport', name: 'storeDailyReport',
...@@ -190,11 +190,8 @@ export default { ...@@ -190,11 +190,8 @@ export default {
{ sceneType, shopMerchantId } = userInfo, { sceneType, shopMerchantId } = userInfo,
newReport = await this.isNewVersionNeed(shopMerchantId) newReport = await this.isNewVersionNeed(shopMerchantId)
if (newReport && sceneType != 7) { if (newReport && sceneType != 7) {
entranceList[0].name = 'staffDailyReport'
entranceList[0].page = '/pages/common/dailyNewspaper/index'
entranceList[0].eventCode = 'staff_daily_report_page'
entranceList.map(e => { entranceList.map(e => {
if (['storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1] if (['staffDailyReport', 'storeDailyReport', 'NegotiationDetail'].includes(e.name)) e.sceneType = [0, 1]
}) })
} }
// 先根据场景过滤 // 先根据场景过滤
...@@ -225,9 +222,11 @@ export default { ...@@ -225,9 +222,11 @@ export default {
display: grid; display: grid;
row-gap: toRpx(30); row-gap: toRpx(30);
column-gap: toRpx(68); column-gap: toRpx(68);
&.entrance-list-0 { &.entrance-list-0 {
grid-template-columns: repeat(5, 1fr); grid-template-columns: repeat(5, 1fr);
} }
&.entrance-list-1 { &.entrance-list-1 {
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
} }
...@@ -241,15 +240,18 @@ export default { ...@@ -241,15 +240,18 @@ export default {
justify-content: center; justify-content: center;
font-size: toRpx(28); font-size: toRpx(28);
color: #333; color: #333;
.entrance-name { .entrance-name {
margin-top: toRpx(8); margin-top: toRpx(8);
} }
} }
.developing { .developing {
height: 100%; height: 100%;
flex-direction: column; flex-direction: column;
color: #999999; color: #999999;
font-size: toRpx(20); font-size: toRpx(20);
&-icon { &-icon {
width: toRpx(344); width: toRpx(344);
height: toRpx(208); height: toRpx(208);
......
...@@ -6,12 +6,10 @@ ...@@ -6,12 +6,10 @@
<template v-if="loadComplete"> <template v-if="loadComplete">
<template v-if="list.length"> <template v-if="list.length">
<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-item',{'block':['group','divider','textarea'].includes(i.type)},{'list-box':i.type == 'group'}]" :class="['list-item', { 'block': ['group', 'divider', 'textarea'].includes(i.type) }, { 'list-box': i.type == 'group' }]"
:key="index" :key="index" v-if="itemShow(i)">
v-if="itemShow(i)"
>
<template v-if="i.type != 'group'"> <template v-if="i.type != 'group'">
<template v-if="i.type == 'divider'"> <template v-if="i.type == 'divider'">
<view class="divider flex"> <view class="divider flex">
...@@ -19,13 +17,8 @@ ...@@ -19,13 +17,8 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<FormItem <FormItem :formItem="i" :rules="i.rules" @onSelect="onSelect($event, index)"
:formItem="i" @onInput="onInput($event, index)" :disabled="itemDisabled(i)" />
:rules="i.rules"
@onSelect="onSelect($event, index)"
@onInput="onInput($event, index)"
:disabled="itemDisabled(i)"
/>
</template> </template>
</template> </template>
<template v-else> <template v-else>
...@@ -33,16 +26,10 @@ ...@@ -33,16 +26,10 @@
{{ i.label }} {{ i.label }}
</view> </view>
<template v-if="i.children.length"> <template v-if="i.children.length">
<template v-for="(c,c_index) in i.children"> <template v-for="(c, c_index) in i.children">
<FormItem <FormItem class="form-item" :formItem="c" :key="c_index" :rules="i.childrenRules[c.key]"
class="form-item" @onSelect="onSelect($event, index, c_index)" @onInput="onInput($event, index, c_index)"
:formItem="c" :disabled="itemDisabled(c)" />
:key="c_index"
:rules="i.childrenRules[c.key]"
@onSelect="onSelect($event,index, c_index)"
@onInput="onInput($event, index, c_index)"
:disabled="itemDisabled(c)"
/>
</template> </template>
</template> </template>
</template> </template>
...@@ -51,20 +38,13 @@ ...@@ -51,20 +38,13 @@
</view> </view>
<view class="footer"> <view class="footer">
<Footer> <Footer>
<view <view class="btn" @click="$emit('submitReport', list)">保存</view>
class="btn"
@click="$emit('submitReport',list)"
>保存</view>
</Footer> </Footer>
</view> </view>
</template> </template>
<nothing v-else /> <nothing v-else />
</template> </template>
<EditForm <EditForm ref="editForm" @onDel="delItem" @onConfirm="confirm" />
ref="editForm"
@onDel="delItem"
@onConfirm="confirm"
/>
</view> </view>
</template> </template>
...@@ -84,7 +64,7 @@ export default { ...@@ -84,7 +64,7 @@ export default {
default: () => [] default: () => []
} }
}, },
data () { data() {
return { return {
loadComplete: false, loadComplete: false,
list: [] list: []
...@@ -92,7 +72,7 @@ export default { ...@@ -92,7 +72,7 @@ export default {
}, },
watch: { watch: {
templateData: { templateData: {
handler (val) { handler(val) {
this.loadComplete = false this.loadComplete = false
this.list = utils.deepClone(val) this.list = utils.deepClone(val)
setTimeout(() => { setTimeout(() => {
...@@ -103,10 +83,10 @@ export default { ...@@ -103,10 +83,10 @@ export default {
deep: true deep: true
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
itemShow (i) { itemShow(i) {
if (i.rules) { if (i.rules) {
let { keys, result } = i.rules, let { keys, result } = i.rules,
{ list } = this { list } = this
...@@ -121,6 +101,14 @@ export default { ...@@ -121,6 +101,14 @@ export default {
}) })
let show = func(...value) let show = func(...value)
i.show = show i.show = show
if (!i.show) {
if (i.type == 'group') i.children.map(c => {
if (c.value != null) c.value = null
})
else {
if (i.value) i.value = null
}
}
return show return show
} else { } else {
i.show = true i.show = true
...@@ -131,14 +119,14 @@ export default { ...@@ -131,14 +119,14 @@ export default {
return true return true
} }
}, },
handleRowClick (row, rowIndex, index) { handleRowClick(row, rowIndex, index) {
let parent = this.list[index] let parent = this.list[index]
this.$refs.editForm.open(row, rowIndex, index, parent) 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)
}, },
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],
...@@ -146,18 +134,18 @@ export default { ...@@ -146,18 +134,18 @@ export default {
parent = this.list[index] parent = this.list[index]
this.$refs.editForm.open(data, c_index, index, parent) this.$refs.editForm.open(data, c_index, index, parent)
}, },
confirm (data, c_index, index) { confirm(data, c_index, index) {
this.$set(this.list[index].children, c_index, utils.deepClone(data)) this.$set(this.list[index].children, c_index, utils.deepClone(data))
}, },
onInput (val, index, c_index = -1) { onInput(val, index, c_index = -1) {
if (c_index == -1) this.$set(this.list[index], 'value', val) if (c_index == -1) this.$set(this.list[index], 'value', val)
else this.$set(this.list[index].children[c_index], 'value', val) else this.$set(this.list[index].children[c_index], 'value', val)
}, },
onSelect (val, index, c_index = -1) { onSelect(val, index, c_index = -1) {
if (c_index == -1) this.$set(this.list[index], 'value', val) if (c_index == -1) this.$set(this.list[index], 'value', val)
else this.$set(this.list[index].children[c_index], 'value', val) else this.$set(this.list[index].children[c_index], 'value', val)
}, },
itemDisabled (i) { itemDisabled(i) {
let disabled = i.disabled let disabled = i.disabled
if (i.disabledFun) { if (i.disabledFun) {
let { keys, result } = i.disabledFun, let { keys, result } = i.disabledFun,
...@@ -182,6 +170,7 @@ export default { ...@@ -182,6 +170,7 @@ export default {
.daily-report { .daily-report {
height: 100%; height: 100%;
position: relative; position: relative;
&-container { &-container {
height: calc(100% - #{toRpx(256)}); height: calc(100% - #{toRpx(256)});
padding: 0 48rpx; padding: 0 48rpx;
...@@ -191,23 +180,28 @@ export default { ...@@ -191,23 +180,28 @@ export default {
flex-wrap: wrap; flex-wrap: wrap;
gap: 24rpx 32rpx; gap: 24rpx 32rpx;
align-content: start; align-content: start;
.list-item, .list-item,
.form-item { .form-item {
width: calc((100% - 32rpx) / 2); width: calc((100% - 32rpx) / 2);
} }
.block { .block {
width: 100%; width: 100%;
} }
.divider { .divider {
color: #999999; color: #999999;
font-size: 24rpx; font-size: 24rpx;
line-height: 32rpx; line-height: 32rpx;
position: relative; position: relative;
justify-content: center; justify-content: center;
.text { .text {
position: relative; position: relative;
padding: 0 24rpx; padding: 0 24rpx;
} }
&::before, &::before,
&:after { &:after {
content: ''; content: '';
...@@ -218,19 +212,23 @@ export default { ...@@ -218,19 +212,23 @@ export default {
width: calc(50% - #{toRpx(72)}); width: calc(50% - #{toRpx(72)});
height: 0; height: 0;
} }
&::before { &::before {
left: 0; left: 0;
} }
&::after { &::after {
right: 0; right: 0;
} }
} }
.list-box { .list-box {
width: 100%; width: 100%;
border-radius: 32rpx; border-radius: 32rpx;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
gap: 24rpx 32rpx; gap: 24rpx 32rpx;
.list-title { .list-title {
color: #333333; color: #333333;
width: 100%; width: 100%;
...@@ -240,10 +238,12 @@ export default { ...@@ -240,10 +238,12 @@ export default {
padding: 8rpx 32rpx 0 0; padding: 8rpx 32rpx 0 0;
} }
} }
.no-child { .no-child {
padding-bottom: 0; padding-bottom: 0;
} }
} }
&-box { &-box {
position: absolute; position: absolute;
width: calc(100% - #{toRpx(96)}); width: calc(100% - #{toRpx(96)});
...@@ -255,6 +255,7 @@ export default { ...@@ -255,6 +255,7 @@ export default {
transform: translateX(-50%); transform: translateX(-50%);
padding: 0 0 32rpx 32rpx; padding: 0 0 32rpx 32rpx;
overflow-x: auto; overflow-x: auto;
.list-title { .list-title {
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
...@@ -266,6 +267,7 @@ export default { ...@@ -266,6 +267,7 @@ export default {
background: #fff; background: #fff;
} }
} }
.footer { .footer {
height: 136rpx; height: 136rpx;
......
<template> <template>
<view class="order-list"> <view class="order-list">
<template v-for="(i, index) in listData"> <template v-for="(i, index) in listData">
<view <view :key="index" @click="choose(i)" :class="['item flex', { active: checkActive(i) }]">
:key="index"
@click="choose(i)"
:class="['item flex', { active: checkActive(i) }]"
>
<view class="sprite-icon icon-tag-checked"></view> <view class="sprite-icon icon-tag-checked"></view>
{{ i.orderCode }} {{ i.orderCode }}
</view> </view>
...@@ -19,57 +15,55 @@ export default { ...@@ -19,57 +15,55 @@ export default {
mixins: [popupmixin], mixins: [popupmixin],
name: 'OrderList', name: 'OrderList',
inject: ['userInfo'], inject: ['userInfo'],
data () { data() {
return { return {
} }
}, },
computed: { computed: {
idKey () { idKey() {
let { params: { idKey }, sceneType } = this let { params: { idKey }, sceneType } = this
return Array.isArray(idKey) ? idKey[sceneType] : idKey return Array.isArray(idKey) ? idKey[sceneType] : idKey
} }
}, },
mounted () { mounted() {
}, },
methods: { methods: {
async getList (searchValue, search) { async getList(searchValue, search) {
const { userInfo, params, data, reqParams } = this, const { userInfo, params, data, reqParams } = this,
{ cacheData } = params { cacheData } = params
this.currentId = '' this.currentId = ''
// if (!search && cacheData && cacheData.length) { // if (!search && cacheData && cacheData.length) {
// this.initData(cacheData) // this.initData(cacheData)
// return // return
// } // }
this.componentLoading(params) this.componentLoading(params)
console.log(data)
const { shopMerchantId, uuid } = userInfo, const { shopMerchantId, uuid } = userInfo,
apiParams = { apiParams = {
merchantId: shopMerchantId, merchantId:shopMerchantId,
sellerUserId: uuid, sellerUserId: uuid,
...reqParams ...reqParams
} }
const res = await uni.$api.dailyTemplateApi.getGoodsOrderList(apiParams) const res = await uni.$api.dailyTemplateApi.getGoodsOrderList(apiParams)
this.updateParams(params, res || []) this.updateParams(params, res || [])
}, },
initData (list) { initData(list) {
console.log(list) const { data: { value } } = this
const { data, data: { key } } = this if (value) {
if (data[key]) { this.currentId = value
this.currentId = data[key]
let item = list.find(i => i.orderCode == this.currentId) let item = list.find(i => i.orderCode == this.currentId)
this.$emit('choose', item) this.$emit('choose', item)
} }
this.list = list this.list = list
this.$emit('onComplete') this.$emit('onComplete')
}, },
choose (i) { choose(i) {
this.currentId = i.orderCode this.currentId = i.orderCode
this.$emit('choose', i) this.$emit('choose', i)
}, },
checkActive (i) { checkActive(i) {
let { currentId, data: { key }, data } = this let { currentId, data: { value } } = this
return currentId ? i.orderCode == currentId : i.orderCode == data[key] return currentId ? i.orderCode == currentId : i.orderCode == value
} }
} }
} }
...@@ -81,6 +75,7 @@ export default { ...@@ -81,6 +75,7 @@ export default {
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
gap: toRpx(32); gap: toRpx(32);
margin: 0 toRpx(48); margin: 0 toRpx(48);
.item { .item {
justify-content: center; justify-content: center;
height: toRpx(72); height: toRpx(72);
...@@ -90,6 +85,7 @@ export default { ...@@ -90,6 +85,7 @@ export default {
position: relative; position: relative;
color: #333333; color: #333333;
font-size: toRpx(32); font-size: toRpx(32);
.sprite-icon { .sprite-icon {
display: none; display: none;
position: absolute; position: absolute;
...@@ -97,10 +93,12 @@ export default { ...@@ -97,10 +93,12 @@ export default {
right: 0; right: 0;
} }
} }
.active { .active {
border-color: #2c66f7; border-color: #2c66f7;
background: #ecf1ff; background: #ecf1ff;
color: #2c66f7; color: #2c66f7;
.sprite-icon { .sprite-icon {
display: block; display: block;
} }
......
<template> <template>
<view class="form-popup"> <view class="form-popup">
<uni-popup <uni-popup ref="popup" type="right" :is-mask-click="false" animation>
ref="popup"
type="right"
:is-mask-click="false"
animation
>
<view class="box"> <view class="box">
<view class="popup-title flex"> <view class="popup-title flex">
第{{ c_index + 1 }}行 第{{ c_index + 1 }}行
<view <view class="popup-close flex" @click="close">
class="popup-close flex" <uni-icons type="closeempty" size="16"></uni-icons>
@click="close"
>
<uni-icons
type="closeempty"
size="16"
></uni-icons>
</view> </view>
</view> </view>
<view class="popup-content"> <view class="popup-content">
<view class="form-box"> <view class="form-box">
<template v-for="(item,ind) in data"> <template v-for="(item, ind) in data">
<FormItem <FormItem class="form-item" :key="ind" :formItem="item" :rules="rules(item)" v-if="itemShow(item)"
class="form-item" @onSelect="onSelect($event, ind)" @onInput="onInput($event, ind)"
:key="ind" @openSelect="openSelect(...arguments, ind)" @onScanSuccess="onScanSuccess($event, ind)" />
:formItem="item"
:rules="rules(item)"
v-if="itemShow(item)"
@onSelect="onSelect($event, ind)"
@onInput="onInput($event, ind)"
@openSelect="openSelect(...arguments, ind)"
@onScanSuccess="onScanSuccess($event, ind)"
/>
</template> </template>
</view> </view>
</view> </view>
<view class="popup-footer flex"> <view class="popup-footer flex">
<view <view class="del flex" @click="del">
class="del flex"
@click="del"
>
<view class="sprite-icon icon-blue-delete"></view> <view class="sprite-icon icon-blue-delete"></view>
</view> </view>
<view <view class="popup-btn popup-cancel" @click="close">{{ cancelText }}</view>
class="popup-btn popup-cancel" <view class="popup-btn popup-confirm" @click="confirm">{{ confirmText }}</view>
@click="close"
>{{ cancelText }}</view>
<view
class="popup-btn popup-confirm"
@click="confirm"
>{{ confirmText }}</view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
<DailyPopup <DailyPopup ref="dailyPopup" @onConfirm="onPopupConfirm" :startDate="startDate" :endDate="endDate" />
ref="dailyPopup"
@onConfirm="onPopupConfirm"
:startDate="startDate"
:endDate="endDate"
/>
</view> </view>
</template> </template>
...@@ -83,7 +50,7 @@ export default { ...@@ -83,7 +50,7 @@ export default {
default: '确定' default: '确定'
} }
}, },
data () { data() {
return { return {
carBrandData: [], carBrandData: [],
data: {}, data: {},
...@@ -94,7 +61,7 @@ export default { ...@@ -94,7 +61,7 @@ export default {
} }
}, },
computed: { computed: {
startDate () { startDate() {
let childrenRules = this.parent.childrenRules, let childrenRules = this.parent.childrenRules,
item = this.currentItem item = this.currentItem
if (childrenRules && item.key) { if (childrenRules && item.key) {
...@@ -102,7 +69,7 @@ export default { ...@@ -102,7 +69,7 @@ export default {
return rules?.minDate ? dayjs(eval(rules.minDate)).format('YYYY-MM-DD') : '2020-01-01' return rules?.minDate ? dayjs(eval(rules.minDate)).format('YYYY-MM-DD') : '2020-01-01'
} }
}, },
endDate () { endDate() {
let childrenRules = this.parent.childrenRules, let childrenRules = this.parent.childrenRules,
item = this.currentItem item = this.currentItem
if (childrenRules && item.key) { if (childrenRules && item.key) {
...@@ -111,10 +78,10 @@ export default { ...@@ -111,10 +78,10 @@ export default {
} }
}, },
}, },
mounted () { mounted() {
}, },
methods: { methods: {
rules (item) { rules(item) {
let rules = this.parent.childrenRules let rules = this.parent.childrenRules
if (rules) { if (rules) {
return rules[item.key] || null return rules[item.key] || null
...@@ -127,32 +94,32 @@ export default { ...@@ -127,32 +94,32 @@ export default {
* @param index 父级index * @param index 父级index
* @param parent 父级数据 * @param parent 父级数据
*/ */
open (data, c_index, index, parent) { open(data, c_index, index, parent) {
this.data = utils.deepClone(data) || {} 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.parent = utils.deepClone(parent) || {}
this.$refs.popup.open() this.$refs.popup.open()
}, },
del () { del() {
this.$emit('onDel', this.c_index, this.index) this.$emit('onDel', this.c_index, this.index)
this.close() this.close()
}, },
cancel () { cancel() {
this.$emit('onCancel') this.$emit('onCancel')
}, },
close () { close() {
this.data = {} this.data = {}
this.c_index = 0 this.c_index = 0
this.index = 0 this.index = 0
this.parent = {} this.parent = {}
this.$refs.popup.close() this.$refs.popup.close()
}, },
confirm () { confirm() {
this.$emit('onConfirm', utils.deepClone(this.data), this.c_index, this.index) this.$emit('onConfirm', utils.deepClone(this.data), this.c_index, this.index)
this.close() this.close()
}, },
itemShow (item) { itemShow(item) {
let { parent } = this, let { parent } = this,
childrenShowRules = parent.childrenShowRules || null childrenShowRules = parent.childrenShowRules || null
if (childrenShowRules) { if (childrenShowRules) {
...@@ -169,6 +136,7 @@ export default { ...@@ -169,6 +136,7 @@ export default {
}) })
let show = func(...value) let show = func(...value)
item.show = show item.show = show
if (!item.show && item.value) item.value = null
return show return show
} else { } else {
item.show = true item.show = true
...@@ -179,25 +147,29 @@ export default { ...@@ -179,25 +147,29 @@ export default {
return true return true
} }
}, },
onInput (val, index) { onInput(val, index) {
this.$set(this.data[index], 'value', val) this.$set(this.data[index], 'value', val)
}, },
onSelect (val, index) { onSelect(val, index) {
this.$set(this.data[index], 'value', val) this.$set(this.data[index], 'value', val)
}, },
openSelect (item, type, index) { openSelect(item, type, index) {
let list = this.data || [] let list = this.data || []
this.currentItem = item this.currentItem = item
this.$refs.dailyPopup.open(item, type, index, list) this.$refs.dailyPopup.open(item, type, index, list)
}, },
onScanSuccess (val, index) { onScanSuccess(val, index) {
this.$set(this.data[index], 'value', val) this.$set(this.data[index], 'value', val)
}, },
onPopupConfirm ({ onPopupConfirm({
chooseContent, chooseContent,
popupType, popupType,
itemIndex itemIndex
}) { }) {
/** 根据 popupType 处理数据
* 5: 日期时间选择
* 6: 日历
*/
if (popupType == 6 || popupType == 5) { if (popupType == 6 || popupType == 5) {
this.$set(this.data[itemIndex], 'value', chooseContent) this.$set(this.data[itemIndex], 'value', chooseContent)
} else if (popupType == 3) { } else if (popupType == 3) {
...@@ -213,6 +185,7 @@ export default { ...@@ -213,6 +185,7 @@ export default {
keys.map((key, index) => { keys.map((key, index) => {
let ind = this.data.findIndex(i => i.key == key), let ind = this.data.findIndex(i => i.key == key),
val = chooseContent[resultKeys[index]] val = chooseContent[resultKeys[index]]
console.log(chooseContent[resultKeys[index]])
this.$set(this.data[ind], 'value', val != null ? val : '-') this.$set(this.data[ind], 'value', val != null ? val : '-')
}) })
} }
...@@ -221,6 +194,13 @@ export default { ...@@ -221,6 +194,13 @@ export default {
this.$set(this.data[itemIndex], 'value', chooseContent.staffName) this.$set(this.data[itemIndex], 'value', chooseContent.staffName)
this.$set(this.data[itemIndex], this.data[itemIndex].key, chooseContent.uuid) this.$set(this.data[itemIndex], this.data[itemIndex].key, chooseContent.uuid)
} }
let clearkeys = this.data[itemIndex].clearkeys
if (clearkeys) {
clearkeys.map(key => {
let ind = this.data.findIndex(i => i.key == key)
this.$set(this.data[ind], 'value', null)
})
}
} }
...@@ -234,6 +214,7 @@ export default { ...@@ -234,6 +214,7 @@ export default {
height: 100vh; height: 100vh;
border-radius: 32rpx 0 0 32rpx; border-radius: 32rpx 0 0 32rpx;
background-color: #fff; background-color: #fff;
.popup-title { .popup-title {
height: 112rpx; height: 112rpx;
position: relative; position: relative;
...@@ -242,6 +223,7 @@ export default { ...@@ -242,6 +223,7 @@ export default {
font-size: 36rpx; font-size: 36rpx;
font-weight: 500; font-weight: 500;
line-height: 48rpx; line-height: 48rpx;
.popup-close { .popup-close {
position: absolute; position: absolute;
height: 100%; height: 100%;
...@@ -252,34 +234,41 @@ export default { ...@@ -252,34 +234,41 @@ export default {
color: #1a1a1a; color: #1a1a1a;
} }
} }
.popup-content { .popup-content {
height: calc(100vh - 272rpx); height: calc(100vh - 272rpx);
overflow-y: auto; overflow-y: auto;
box-sizing: border-box; box-sizing: border-box;
padding: 16rpx 0; padding: 16rpx 0;
.form-box { .form-box {
margin: 0 48rpx; margin: 0 48rpx;
padding: 32rpx; padding: 32rpx;
border-radius: 24rpx; border-radius: 24rpx;
background: #94c2ff33; background: #94c2ff33;
.form-item { .form-item {
margin-bottom: 16rpx; margin-bottom: 16rpx;
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
} }
} }
} }
.popup-footer { .popup-footer {
padding: 16rpx 0 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;
.del { .del {
border-radius: 64rpx; border-radius: 64rpx;
background: #2c66f71a; background: #2c66f71a;
padding: 20rpx 32rpx; padding: 20rpx 32rpx;
} }
.popup-btn { .popup-btn {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -292,6 +281,7 @@ export default { ...@@ -292,6 +281,7 @@ export default {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
} }
.popup-confirm { .popup-confirm {
color: #fff; color: #fff;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%); background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
</view> </view>
<view :class="['item-content flex', { 'disabled': disabled }]"> <view :class="['item-content flex', { 'disabled': disabled }]">
<template v-if="item.disabled || disabled"> <template v-if="item.disabled || disabled">
<view :class="['select flex']">{{ item.value }} <view :class="['select flex']">
<text class="text-hide">{{ item.value }}</text>
</view> </view>
</template> </template>
<template v-else> <template v-else>
......
...@@ -47,7 +47,7 @@ export default { ...@@ -47,7 +47,7 @@ export default {
let { reportParams } = this, let { reportParams } = this,
list = utils.deepClone(res) list = utils.deepClone(res)
let jsonContent = JSON.stringify(list) let jsonContent = JSON.stringify(list)
let { fieldDataList, subformDataList } = buildAppNormalizedListsFromJsonContent(jsonContent) let requestJson = buildAppNormalizedListsFromJsonContent(jsonContent)
list.map(e => { list.map(e => {
let childrenValue = [] let childrenValue = []
if (e.children && e.children.length) e.children.map((c, cIndex) => { if (e.children && e.children.length) e.children.map((c, cIndex) => {
...@@ -71,8 +71,7 @@ export default { ...@@ -71,8 +71,7 @@ export default {
if (e.type == 'subform') delete e.children if (e.type == 'subform') delete e.children
}) })
reportParams.jsonContent = JSON.stringify(list) reportParams.jsonContent = JSON.stringify(list)
reportParams.fieldDataList = fieldDataList reportParams.requestJson = JSON.stringify(requestJson)
reportParams.subformDataList = subformDataList
console.log(reportParams) console.log(reportParams)
const data = await uni.$api.dailyTemplateApi.saveDraft(reportParams) const data = await uni.$api.dailyTemplateApi.saveDraft(reportParams)
uni.hideLoading() uni.hideLoading()
...@@ -122,7 +121,7 @@ export default { ...@@ -122,7 +121,7 @@ export default {
list = utils.deepClone(res) list = utils.deepClone(res)
console.log('提交日报', list) console.log('提交日报', list)
let jsonContent = JSON.stringify(list) let jsonContent = JSON.stringify(list)
let { fieldDataList, subformDataList } = buildAppNormalizedListsFromJsonContent(jsonContent) let requestJson = buildAppNormalizedListsFromJsonContent(jsonContent)
list.map(e => { list.map(e => {
let childrenValue = [] let childrenValue = []
if (e.children && e.children.length) e.children.map((c, cIndex) => { if (e.children && e.children.length) e.children.map((c, cIndex) => {
...@@ -172,8 +171,7 @@ export default { ...@@ -172,8 +171,7 @@ export default {
}) })
console.log('提交日报', list) console.log('提交日报', list)
reportParams.jsonContent = JSON.stringify(list) reportParams.jsonContent = JSON.stringify(list)
reportParams.fieldDataList = fieldDataList reportParams.requestJson = JSON.stringify(requestJson)
reportParams.subformDataList = subformDataList
console.log(reportParams) console.log(reportParams)
uni.hideLoading() uni.hideLoading()
this.$emit('submitReport', reportParams) this.$emit('submitReport', reportParams)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!