|
@@ -183,6 +183,36 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
|
|
+ <template v-slot:blank_business_trip="scope">
|
|
|
|
|
+ <div style="width: 100%;">
|
|
|
|
|
+ <view v-for="(item, index) in scope.model.blank_business_trip" :key="index" class="seal-card">
|
|
|
|
|
+ <div class="seal-card-header">
|
|
|
|
|
+ <span class="seal-card-index">{{ index + 1 }}.</span>
|
|
|
|
|
+ <span class="seal-card-type">{{ item.transportation || '未知交通' }} {{ item.departureCity || '?' }}→{{ item.destinationCity || '?' }}</span>
|
|
|
|
|
+ <div class="seal-card-actions">
|
|
|
|
|
+ <van-button size="mini" type="primary" plain @click="openTripEditDialog(scope, 'edit', index)">编辑</van-button>
|
|
|
|
|
+ <van-button size="mini" type="danger" plain @click="delNewRow('blank_business_trip', index);calcTripTotal(scope)">删除</van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-card-body">
|
|
|
|
|
+ <div class="seal-card-row">
|
|
|
|
|
+ <span class="seal-card-label">往返</span>
|
|
|
|
|
+ <span class="seal-card-value">{{ item.isRoundTrip || '未填写' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-card-row">
|
|
|
|
|
+ <span class="seal-card-label">时间</span>
|
|
|
|
|
+ <span class="seal-card-value">{{ item.startTime || '-' }} ~ {{ item.endTime || '-' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-card-row">
|
|
|
|
|
+ <span class="seal-card-label">时长</span>
|
|
|
|
|
+ <span class="seal-card-value">{{ item.duration || '-' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <van-button type="primary" size="small" block @click="openTripEditDialog(scope, 'add', scope.model.blank_business_trip?scope.model.blank_business_trip.length:0)" style="margin-bottom:10px">+ 添加行程</van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+
|
|
|
</fm-generate-vant-form>
|
|
</fm-generate-vant-form>
|
|
|
|
|
|
|
|
<!-- 印章选择弹窗(根层级,避免被 form overflow 裁剪) -->
|
|
<!-- 印章选择弹窗(根层级,避免被 form overflow 裁剪) -->
|
|
@@ -295,6 +325,45 @@
|
|
|
</div>
|
|
</div>
|
|
|
</van-popup>
|
|
</van-popup>
|
|
|
|
|
|
|
|
|
|
+ <!-- 行程编辑弹窗 -->
|
|
|
|
|
+ <van-popup v-model:show="tripEditVisible" position="bottom" :style="{ height: '70%' }" round>
|
|
|
|
|
+ <div style="padding:16px">
|
|
|
|
|
+ <h4 style="text-align:center;margin-bottom:12px">{{ tripEditTitle }}</h4>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">交通工具</span>
|
|
|
|
|
+ <input class="seal-form-input" v-model="tripEditForm.transportation" placeholder="飞机/高铁/汽车" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">单程往返</span>
|
|
|
|
|
+ <input class="seal-form-input" v-model="tripEditForm.isRoundTrip" placeholder="单程/往返" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">出发城市</span>
|
|
|
|
|
+ <input class="seal-form-input" v-model="tripEditForm.departureCity" placeholder="请输入" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">目的城市</span>
|
|
|
|
|
+ <input class="seal-form-input" v-model="tripEditForm.destinationCity" placeholder="请输入" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">开始时间</span>
|
|
|
|
|
+ <input class="seal-form-input" type="datetime-local" v-model="tripEditForm.startTime" @change="calcTripDuration" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">结束时间</span>
|
|
|
|
|
+ <input class="seal-form-input" type="datetime-local" v-model="tripEditForm.endTime" @change="calcTripDuration" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="seal-form-row">
|
|
|
|
|
+ <span class="seal-form-label">时长</span>
|
|
|
|
|
+ <span class="seal-form-val">{{ tripEditForm.duration || '自动计算' }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div style="display:flex;justify-content:space-between;padding:20px 0">
|
|
|
|
|
+ <van-button style="width:48%" @click="tripEditVisible = false">取消</van-button>
|
|
|
|
|
+ <van-button style="width:48%" type="primary" @click="onTripEditSave">保存</van-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </van-popup>
|
|
|
|
|
+
|
|
|
<div>
|
|
<div>
|
|
|
|
|
|
|
|
<div v-if='isEdit'
|
|
<div v-if='isEdit'
|
|
@@ -477,6 +546,13 @@
|
|
|
appEditMode: 'add',
|
|
appEditMode: 'add',
|
|
|
appEditScope: null,
|
|
appEditScope: null,
|
|
|
appEditIndex: null,
|
|
appEditIndex: null,
|
|
|
|
|
+ // 行程出差
|
|
|
|
|
+ tripEditVisible: false,
|
|
|
|
|
+ tripEditTitle: '添加行程',
|
|
|
|
|
+ tripEditForm: { transportation: '', isRoundTrip: '', departureCity: '', destinationCity: '', startTime: '', endTime: '', duration: '' },
|
|
|
|
|
+ tripEditMode: 'add',
|
|
|
|
|
+ tripEditScope: null,
|
|
|
|
|
+ tripEditIndex: null,
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -729,6 +805,67 @@
|
|
|
this.appEditForm.productName = sel
|
|
this.appEditForm.productName = sel
|
|
|
this.appPopVisible = false
|
|
this.appPopVisible = false
|
|
|
},
|
|
},
|
|
|
|
|
+ // ===== 行程出差 =====
|
|
|
|
|
+ openTripEditDialog(scope, mode, index) {
|
|
|
|
|
+ this.tripEditScope = scope
|
|
|
|
|
+ this.tripEditIndex = index
|
|
|
|
|
+ this.tripEditMode = mode
|
|
|
|
|
+ if (mode === 'edit' && scope.model.blank_business_trip[index]) {
|
|
|
|
|
+ var r = scope.model.blank_business_trip[index]
|
|
|
|
|
+ this.tripEditForm = {
|
|
|
|
|
+ transportation: r.transportation||'', isRoundTrip: r.isRoundTrip||'',
|
|
|
|
|
+ departureCity: r.departureCity||'', destinationCity: r.destinationCity||'',
|
|
|
|
|
+ startTime: r.startTime||'', endTime: r.endTime||'', duration: r.duration||''
|
|
|
|
|
+ }
|
|
|
|
|
+ this.tripEditTitle = '编辑行程'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.tripEditForm = { transportation: '', isRoundTrip: '', departureCity: '', destinationCity: '', startTime: '', endTime: '', duration: '' }
|
|
|
|
|
+ this.tripEditTitle = '添加行程'
|
|
|
|
|
+ }
|
|
|
|
|
+ this.tripEditVisible = true
|
|
|
|
|
+ },
|
|
|
|
|
+ calcTripDuration() {
|
|
|
|
|
+ var s = this.tripEditForm.startTime, e = this.tripEditForm.endTime
|
|
|
|
|
+ if (!s || !e) { this.tripEditForm.duration = ''; return }
|
|
|
|
|
+ var ds = new Date(s).getTime(), de = new Date(e).getTime()
|
|
|
|
|
+ if (isNaN(ds) || isNaN(de) || de <= ds) { this.tripEditForm.duration = ''; return }
|
|
|
|
|
+ var diff = Math.floor((de - ds) / 1000)
|
|
|
|
|
+ var d = Math.floor(diff / 86400), h = Math.floor((diff % 86400) / 3600), m = Math.floor((diff % 3600) / 60), sec = diff % 60
|
|
|
|
|
+ var parts = []
|
|
|
|
|
+ if (d) parts.push(d + '天'); if (h) parts.push(h + '时'); if (m) parts.push(m + '分'); if (sec || !parts.length) parts.push(sec + '秒')
|
|
|
|
|
+ this.tripEditForm.duration = parts.join('')
|
|
|
|
|
+ },
|
|
|
|
|
+ async onTripEditSave() {
|
|
|
|
|
+ var scope = this.tripEditScope
|
|
|
|
|
+ var idx = this.tripEditIndex
|
|
|
|
|
+ var key = 'blank_business_trip'
|
|
|
|
|
+ var data = await this.$refs.generateForm.getData(false);
|
|
|
|
|
+ if (!data[key]) data[key] = []
|
|
|
|
|
+ if (this.tripEditMode === 'edit') {
|
|
|
|
|
+ data[key][idx] = JSON.parse(JSON.stringify(this.tripEditForm))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ data[key].push(JSON.parse(JSON.stringify(this.tripEditForm)))
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$refs.generateForm.setData({ [key]: data[key] })
|
|
|
|
|
+ this.tripEditVisible = false
|
|
|
|
|
+ this.calcTripTotal(scope)
|
|
|
|
|
+ },
|
|
|
|
|
+ calcTripTotal(scope) {
|
|
|
|
|
+ var list = scope.model.blank_business_trip || []
|
|
|
|
|
+ var totalSec = 0
|
|
|
|
|
+ list.forEach(function(it) {
|
|
|
|
|
+ var d = it.duration
|
|
|
|
|
+ if (!d) return
|
|
|
|
|
+ var match = { days: d.match(/(\d+)天/), hours: d.match(/(\d+)时/), minutes: d.match(/(\d+)分/), seconds: d.match(/(\d+)秒/) }
|
|
|
|
|
+ totalSec += (parseInt(match.days&&match.days[1])||0)*86400 + (parseInt(match.hours&&match.hours[1])||0)*3600 + (parseInt(match.minutes&&match.minutes[1])||0)*60 + (parseInt(match.seconds&&match.seconds[1])||0)
|
|
|
|
|
+ })
|
|
|
|
|
+ if (totalSec > 0) {
|
|
|
|
|
+ var dy = Math.floor(totalSec/86400), hr = Math.floor((totalSec%86400)/3600), mn = Math.floor((totalSec%3600)/60), sc = totalSec%60
|
|
|
|
|
+ var parts = []
|
|
|
|
|
+ if (dy) parts.push(dy+'天'); if (hr) parts.push(hr+'时'); if (mn) parts.push(mn+'分'); if (sc||!parts.length) parts.push(sc+'秒')
|
|
|
|
|
+ this.$refs.generateForm.setData({ input_if1cav3p: parts.join('') })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
async handleUploadLocal (model, rowIndex) {
|
|
async handleUploadLocal (model, rowIndex) {
|
|
|
console.log('上传本地文件按钮被点击,字段模型:', model, '行索引:', rowIndex)
|
|
console.log('上传本地文件按钮被点击,字段模型:', model, '行索引:', rowIndex)
|
|
|
let data = await this.$refs.generateForm.getData(false);
|
|
let data = await this.$refs.generateForm.getData(false);
|