初始代码
This commit is contained in:
303
pages/apply/catalog/index.vue
Normal file
303
pages/apply/catalog/index.vue
Normal file
@@ -0,0 +1,303 @@
|
||||
<template>
|
||||
<view class="catalog-v">
|
||||
<uni-nav-bar class="nav" :fixed="true" :statusBar="true" :border="false" height="44" right-icon="bars"
|
||||
@clickRight="clickRight" left-icon="left" @clickLeft="back">
|
||||
<!-- 左边插槽 -->
|
||||
<block #default>
|
||||
<view class="" @click="close"
|
||||
style="position: absolute;top: 0;left: 40px;bottom: 0;text-align: center;line-height: 82rpx;height: 100%;width: 40rpx;">
|
||||
<u-icon name="close"></u-icon>
|
||||
</view>
|
||||
<view class="nav-left">
|
||||
<view class="nav-left-text">{{ config.fullName }}</view>
|
||||
</view>
|
||||
</block>
|
||||
</uni-nav-bar>
|
||||
<view class="search-box_sticky" :style="{'top':topSearch+'rpx'}">
|
||||
<view class="search-box">
|
||||
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
|
||||
:show-action="false" @change="search" bg-color="#f0f2f6" shape="square">
|
||||
</u-search>
|
||||
</view>
|
||||
</view>
|
||||
<view class="workFlow-list">
|
||||
<view class="part" v-if="childrenData.length">
|
||||
<view class="u-flex u-flex-wrap">
|
||||
<view class="item u-flex-col u-col-center" v-for="(child, ii) in childrenData" :key="ii"
|
||||
@click="handelClick(child)">
|
||||
<text class="u-font-40 item-icon" :class="child.icon"
|
||||
:style="{ background: child.iconBackground || '#008cff' }" />
|
||||
<text class="u-font-24 u-line-1 item-text">{{child.fullName}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<NoData v-else></NoData>
|
||||
</view>
|
||||
<treeCollapse :show="showApply" v-if="showApply" :treeData="menuList" @change="handelClick"></treeCollapse>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import NoData from '@/components/noData'
|
||||
import treeCollapse from '@/components/treeCollapse'
|
||||
import resources from "@/libs/resources.js";
|
||||
export default {
|
||||
components: {
|
||||
NoData,
|
||||
treeCollapse
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showApply: false,
|
||||
topSearch: 80,
|
||||
passwordShow: false,
|
||||
keyword: "",
|
||||
statusBarHeight: "",
|
||||
userInfo: {
|
||||
systemIds: [],
|
||||
}, //CurrentUser接口中的userInfo数据
|
||||
modelId: "",
|
||||
config: {},
|
||||
fullName: "",
|
||||
childrenData: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
baseURL() {
|
||||
return this.define.baseURL;
|
||||
},
|
||||
token() {
|
||||
return uni.getStorageSync('token')
|
||||
},
|
||||
report() {
|
||||
return this.define.report;
|
||||
},
|
||||
menuList() {
|
||||
let list = uni.getStorageSync('menuList').filter(o => o.enCode !== 'workFlow')
|
||||
return list
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.config = JSON.parse(this.yunzhupaas.base64.decode(e.config)) || {};
|
||||
if (Array.isArray(this.config.children) && this.config.children.length) this.childrenData = JSON.parse(JSON
|
||||
.stringify(this.config.children))
|
||||
this.keyword = ""
|
||||
this.handleData(this.childrenData)
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.config.fullName
|
||||
})
|
||||
this.getStatusBarHeight();
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/apply',
|
||||
});
|
||||
},
|
||||
back() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
})
|
||||
},
|
||||
clickRight() {
|
||||
this.handleData(this.menuList)
|
||||
this.$nextTick(() => {
|
||||
this.showApply = !this.showApply
|
||||
})
|
||||
},
|
||||
handleData(childrenData) {
|
||||
const loop = (list, parent) => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let propertyJson = JSON.parse(list[i].propertyJson)
|
||||
this.$set(list[i], 'moduleId', propertyJson.moduleId)
|
||||
if (list[i].children && Array.isArray(list[i].children)) {
|
||||
loop(list[i].children, list[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
loop(childrenData)
|
||||
},
|
||||
getStatusBarHeight() {
|
||||
let that = this
|
||||
wx.getSystemInfo({
|
||||
success(res) {
|
||||
that.statusBarHeight = res.statusBarHeight;
|
||||
},
|
||||
});
|
||||
// #ifdef APP-PLUS
|
||||
uni.getSystemInfo({
|
||||
success(res) {
|
||||
that.statusBarHeight = res.statusBarHeight;
|
||||
let topSearch = 75 + that.statusBarHeight * 2
|
||||
that.topSearch = topSearch
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
search() {
|
||||
this.searchTimer && clearTimeout(this.searchTimer);
|
||||
this.searchTimer = setTimeout(() => {
|
||||
if (!this.keyword) return this.childrenData = JSON.parse(JSON.stringify(this.config.children))
|
||||
const regex = new RegExp(this.keyword, 'i');
|
||||
this.childrenData = this.childrenData.filter(item => regex.test(item.fullName))
|
||||
}, 300);
|
||||
},
|
||||
handelClick(item) {
|
||||
this.showApply = false
|
||||
this.modelId = item.moduleId
|
||||
if (item.type == 1) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/apply/catalog/index?config=" +
|
||||
this.yunzhupaas.base64.encode(JSON.stringify(item)),
|
||||
fail: (err) => {
|
||||
this.$u.toast("暂无此页面");
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (item.type == 2) {
|
||||
uni.navigateTo({
|
||||
url: item.urlAddress +
|
||||
"?menuId=" +
|
||||
item.id +
|
||||
"&fullName=" +
|
||||
item.fullName,
|
||||
fail: (err) => {
|
||||
this.$u.toast("暂无此页面");
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (item.type == 3 || item.type == 9) {
|
||||
if (!this.modelId) {
|
||||
this.$u.toast("暂无此页面");
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: "/pages/apply/dynamicModel/index?config=" +
|
||||
this.yunzhupaas.base64.encode(JSON.stringify(item)),
|
||||
fail: (err) => {
|
||||
this.$u.toast("暂无此页面");
|
||||
},
|
||||
});
|
||||
}
|
||||
if (item.type == 7 || item.type == 5) {
|
||||
let url =
|
||||
encodeURIComponent(item.urlAddress) + "&fullName=" + item.fullName;
|
||||
if (item.type == 5) {
|
||||
url = encodeURIComponent(
|
||||
`${this.report}/preview.html?id=${item.moduleId}&token=${this.token}&page=1&from=menu`
|
||||
);
|
||||
}
|
||||
if (!item.urlAddress && item.type == 7) {
|
||||
this.$u.toast("暂无此页面");
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: "/pages/apply/externalLink/index?url=" +
|
||||
url +
|
||||
"&fullName=" +
|
||||
item.fullName +
|
||||
"&type=" +
|
||||
item.type,
|
||||
fail: (err) => {
|
||||
this.$u.toast("暂无此页面");
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (item.type == 8) {
|
||||
if (!item.urlAddress) {
|
||||
this.$u.toast("暂无此页面");
|
||||
return;
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: "/pages/portal/scanPortal/index?id=" + item.moduleId + "&portalType=1&fullName=" +
|
||||
item.fullName,
|
||||
fail: (err) => {
|
||||
this.$u.toast("暂无此页面");
|
||||
},
|
||||
});
|
||||
return
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.catalog-v {
|
||||
.search-box_sticky {
|
||||
margin-bottom: 20rpx;
|
||||
|
||||
.search-box {
|
||||
padding: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.nav {
|
||||
z-index: 99999;
|
||||
|
||||
:deep(.uni-navbar__content) {
|
||||
z-index: 99999;
|
||||
}
|
||||
|
||||
:deep(.uni-navbar__header-container) {
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-left {
|
||||
max-width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.nav-left-text {
|
||||
font-weight: 700;
|
||||
font-size: 29rpx;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
|
||||
.select-box,
|
||||
.u-drawer {
|
||||
max-height: 600rpx;
|
||||
|
||||
:deep(.u-drawer-content) {
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.currentItem {
|
||||
color: #2979ff;
|
||||
}
|
||||
}
|
||||
|
||||
.search-box {
|
||||
overflow-y: overlay;
|
||||
height: 112rpx;
|
||||
width: 100%;
|
||||
padding: 20rpx 20rpx;
|
||||
z-index: 10000;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.workFlow-list {
|
||||
.part {
|
||||
.item {
|
||||
margin-bottom: 0;
|
||||
padding: 1rem 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
241
pages/apply/customBtn/index.vue
Normal file
241
pages/apply/customBtn/index.vue
Normal file
@@ -0,0 +1,241 @@
|
||||
<template>
|
||||
<view class="yunzhupaas-wrap yunzhupaas-wrap-form">
|
||||
<YunzhupaasParser :formConf="formConf" ref="dynamicForm" v-if="!loading" @submit="sumbitForm" :key="key" />
|
||||
<view class="buttom-actions">
|
||||
<u-button class="buttom-btn" @click.stop="cancel">取消</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="submit" :loading="btnLoading">
|
||||
{{config.confirmButtonText||'确定'}}
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getConfigData,
|
||||
getModelInfo,
|
||||
createModel
|
||||
} from '@/api/apply/visualDev'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/common'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
config: {},
|
||||
id: "",
|
||||
modelId: "",
|
||||
formConf: {},
|
||||
dataForm: {},
|
||||
key: +new Date(),
|
||||
loading: false,
|
||||
btnLoading: false,
|
||||
isPreview: true,
|
||||
formData: {},
|
||||
isAdd: false,
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.userInfo = uni.getStorageSync('userInfo') || {}
|
||||
this.loading = true
|
||||
let data = e.data ? JSON.parse(decodeURIComponent(e.data)) : {}
|
||||
this.config = data.config
|
||||
this.id = data.id
|
||||
this.modelId = data.modelId
|
||||
this.isPreview = data.isPreview
|
||||
if (this.id != null && this.id != undefined && this.id != '') {
|
||||
this.isAdd = false
|
||||
} else {
|
||||
this.isAdd = true
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.config.popupTitle
|
||||
})
|
||||
if (this.config.modelId) this.getConfigData(data.row)
|
||||
},
|
||||
methods: {
|
||||
getConfigData(row) {
|
||||
getConfigData(this.config.modelId).then(res => {
|
||||
if (res.code !== 200 || !res.data) {
|
||||
uni.showToast({
|
||||
title: res.msg || '请求出错,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.formConf = JSON.parse(res.data.formData)
|
||||
const setDataFun = (formData) => {
|
||||
if (this.config.formOptions.length) {
|
||||
for (let k in formData) {
|
||||
for (let i = 0; i < this.config.formOptions.length; i++) {
|
||||
const e = this.config.formOptions[i]
|
||||
if (e.currentField == '@formId') this.formData[e.field] = formData.id;
|
||||
if (e.currentField == k) this.formData[e.field] = formData[k]
|
||||
}
|
||||
}
|
||||
}
|
||||
this.fillFormData(this.formConf, this.formData)
|
||||
this.key = +new Date()
|
||||
this.loading = false
|
||||
}
|
||||
if (this.id) {
|
||||
getModelInfo(this.modelId, this.id).then(res => {
|
||||
let dataForm = res.data
|
||||
if (!dataForm.data) return
|
||||
const formData = JSON.parse(dataForm.data)
|
||||
this.formData = {}
|
||||
setDataFun({
|
||||
...formData,
|
||||
id: this.id
|
||||
})
|
||||
})
|
||||
} else {
|
||||
const formData = row
|
||||
setDataFun(formData)
|
||||
}
|
||||
}).catch(() => {})
|
||||
},
|
||||
fillFormData(form, data) {
|
||||
const loop = list => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let item = list[i]
|
||||
let vModel = item.__vModel__
|
||||
let config = item.__config__
|
||||
if (vModel) {
|
||||
let val = data.hasOwnProperty(vModel) ? data[vModel] : config.defaultValue
|
||||
if (!config.isSubTable) config.defaultValue = val
|
||||
if (config.defaultCurrent) {
|
||||
if (config.yunzhupaasKey === 'datePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
let format = this.yunzhupaas.handelFormat(item.format)
|
||||
let dateStr = this.yunzhupaas.toDate(new Date().getTime(), format)
|
||||
let time = format === 'yyyy' ? '-01-01 00:00:00' : format === 'yyyy-MM' ?
|
||||
'-01 00:00:00' : format === 'yyyy-MM-dd' ?
|
||||
' 00:00:00' : ''
|
||||
val = new Date(dateStr + time).getTime()
|
||||
config.defaultValue = val
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'timePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
config.defaultValue = this.yunzhupaas.toDate(new Date(), item.format)
|
||||
}
|
||||
}
|
||||
const organizeIdList = this.userInfo.organizeIdList
|
||||
if (config.yunzhupaasKey === 'organizeSelect' && Array.isArray(organizeIdList) &&
|
||||
organizeIdList.length) {
|
||||
config.defaultValue = item.multiple ? [organizeIdList] : organizeIdList
|
||||
}
|
||||
const departmentId = this.userInfo.departmentId
|
||||
if (config.yunzhupaasKey === 'depSelect' && departmentId) {
|
||||
config.defaultValue = item.multiple ? [departmentId] : departmentId;
|
||||
}
|
||||
const positionIds = this.userInfo.positionIds
|
||||
if (config.yunzhupaasKey === 'posSelect' && Array.isArray(positionIds) && positionIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? positionIds.map(o => o.id) : positionIds[
|
||||
0].id
|
||||
}
|
||||
const roleIds = this.userInfo.roleIds
|
||||
if (config.yunzhupaasKey === 'roleSelect' && Array.isArray(roleIds) && roleIds.length) {
|
||||
config.defaultValue = item.multiple ? roleIds : roleIds[0];
|
||||
}
|
||||
const groupIds = this.userInfo.groupIds
|
||||
if (config.yunzhupaasKey === 'groupSelect' && Array.isArray(groupIds) && groupIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? groupIds : groupIds[0];
|
||||
}
|
||||
const userId = this.userInfo.userId
|
||||
if (config.yunzhupaasKey === 'userSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId] : userId;
|
||||
}
|
||||
if (config.yunzhupaasKey === 'usersSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId + '--user'] : userId + '--user';
|
||||
}
|
||||
if (config.yunzhupaasKey === 'sign' && this.userInfo.signImg) {
|
||||
config.defaultValue = this.userInfo.signImg
|
||||
}
|
||||
}
|
||||
let noShow = !item.__config__.noShow ? false : item.__config__.noShow
|
||||
let isVisibility = false
|
||||
if (!item.__config__.visibility || (Array.isArray(item.__config__.visibility) && item
|
||||
.__config__.visibility.includes('app'))) isVisibility = true
|
||||
this.$set(item.__config__, 'isVisibility', isVisibility)
|
||||
this.$set(item.__config__, 'noShow', noShow)
|
||||
} else {
|
||||
let noShow = false,
|
||||
isVisibility = false
|
||||
if (!item.__config__.visibility || (Array.isArray(item.__config__.visibility) && item
|
||||
.__config__.visibility.includes('app'))) isVisibility = true
|
||||
this.$set(item.__config__, 'isVisibility', isVisibility)
|
||||
this.$set(item.__config__, 'noShow', noShow)
|
||||
}
|
||||
if (item.__config__ && item.__config__.children && Array
|
||||
.isArray(item.__config__.children)) {
|
||||
loop(item.__config__.children)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
loop(form.fields)
|
||||
},
|
||||
cancel() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
sumbitForm(data, callback) {
|
||||
if (!data) return
|
||||
this.btnLoading = true
|
||||
const successFun = (res, callback) => {
|
||||
if (callback && typeof callback === "function") callback()
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
this.btnLoading = false
|
||||
if (this.config.isRefresh) uni.$emit('refresh')
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.config.customBtn) {
|
||||
const query = {
|
||||
paramList: this.yunzhupaas.getParamList(this.config.templateJson, {
|
||||
...data,
|
||||
id: this.id
|
||||
}) || []
|
||||
};
|
||||
getDataInterfaceRes(this.config.interfaceId, query).then(res => {
|
||||
successFun(res, callback)
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
})
|
||||
} else {
|
||||
this.dataForm.data = JSON.stringify(data)
|
||||
createModel(this.config.modelId, this.dataForm).then(res => {
|
||||
successFun(res, callback)
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
if (this.isPreview) {
|
||||
uni.showToast({
|
||||
title: '功能预览不支持数据保存',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$refs.dynamicForm && this.$refs.dynamicForm.submitForm()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
</style>
|
||||
72
pages/apply/dynamicModel/bulkOperationMixin.js
Normal file
72
pages/apply/dynamicModel/bulkOperationMixin.js
Normal file
@@ -0,0 +1,72 @@
|
||||
import {
|
||||
deteleModel
|
||||
} from '@/api/apply/visualDev'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
slide: '',
|
||||
slide2: '',
|
||||
checkedAll: false,
|
||||
ids: [],
|
||||
showTop: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
/* 批量删除 */
|
||||
batchDelete() {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '删除后数据无法恢复',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
const uniqueIds = new Set();
|
||||
this.selectItems.forEach(item => {
|
||||
uniqueIds.add(item.id);
|
||||
});
|
||||
const ids = [...uniqueIds];
|
||||
let data = {
|
||||
flowId: this.config.flowId,
|
||||
ids
|
||||
};
|
||||
deteleModel(data, this.modelId).then(res => {
|
||||
this.selectItems = [];
|
||||
this.$u.toast(res.msg)
|
||||
this.mescroll.resetUpScroll()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
openBatchOperate() {
|
||||
this.showTop = !this.showTop
|
||||
if (this.showTop) {
|
||||
this.slide = 'slide-up'
|
||||
this.slide2 = 'slide-up2'
|
||||
}
|
||||
},
|
||||
checkAll() {
|
||||
this.checkedAll = !this.checkedAll
|
||||
this.list = this.list.map(o => ({
|
||||
...o,
|
||||
checked: false
|
||||
}))
|
||||
if (this.checkedAll) {
|
||||
this.list = this.list.map(o => ({
|
||||
...o,
|
||||
checked: true
|
||||
}))
|
||||
}
|
||||
},
|
||||
cancel() {
|
||||
this.list = this.list.map(o => ({
|
||||
...o,
|
||||
checked: false
|
||||
}))
|
||||
this.showTop = false
|
||||
this.checkedAll = false
|
||||
this.$nextTick(() => {
|
||||
this.$refs.list.handleCheckAll()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
594
pages/apply/dynamicModel/components/detail/Item.vue
Normal file
594
pages/apply/dynamicModel/components/detail/Item.vue
Normal file
@@ -0,0 +1,594 @@
|
||||
<template>
|
||||
<view :class="{'item-card':config.yunzhupaasKey==='card'}"
|
||||
v-if="!config.noShow && (!config.visibility || (Array.isArray(config.visibility) && config.visibility.includes('app')))">
|
||||
<template v-if="config.layout==='colFormItem'">
|
||||
<YunzhupaasText v-if="config.yunzhupaasKey=='text'" :content="item.content" :textStyle="item.textStyle" />
|
||||
<YunzhupaasDivider v-else-if="config.yunzhupaasKey==='divider'" :content="item.content" />
|
||||
<YunzhupaasGroupTitle v-else-if="config.yunzhupaasKey=='groupTitle'" :content="item.content"
|
||||
:content-position="item.contentPosition" :helpMessage="item.helpMessage" @groupIcon="clickIcon(item)" />
|
||||
<u-form-item v-else-if="config.yunzhupaasKey==='popupSelect' || config.yunzhupaasKey==='relationForm'"
|
||||
:label="realLabel" :prop="item.__vModel__" class="popup-select" :label-width="labelWidth"
|
||||
:left-icon="leftIcon" :left-icon-style="{'color':'#a8aaaf'}" @clickIcon="clickIcon(item)">
|
||||
<view class="detail-text-box" v-if="config.yunzhupaasKey==='popupSelect'">
|
||||
<view class="yunzhupaas-detail-text">
|
||||
{{formData[item.__vModel__]}}
|
||||
</view>
|
||||
<DisplayList v-if="Object.keys(extraObj).length" :extraObj="extraObj"
|
||||
:extraOptions="item.extraOptions">
|
||||
</DisplayList>
|
||||
</view>
|
||||
<view class="detail-text-box" @click.native="toDetail(item)" v-if="config.yunzhupaasKey==='relationForm'">
|
||||
<view class="yunzhupaas-detail-text" style="color:rgb(41, 121, 255)">
|
||||
{{formData[item.__vModel__]}}
|
||||
</view>
|
||||
<DisplayList v-if="Object.keys(extraObj).length" :extraObj="extraObj"
|
||||
:extraOptions="item.extraOptions">
|
||||
</DisplayList>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<u-form-item v-else :label="realLabel" :prop="item.__vModel__" :label-width="labelWidth"
|
||||
:left-icon="leftIcon" :left-icon-style="{'color':'#a8aaaf'}" @clickIcon="clickIcon(item)">
|
||||
<!-- #ifndef APP-HARMONY -->
|
||||
<YunzhupaasUploadFile v-if="config.yunzhupaasKey=='uploadFile'" v-model="config.defaultValue" detailed />
|
||||
<!-- #endif -->
|
||||
<view class="preview-image-box" v-if="config.yunzhupaasKey==='uploadImg'">
|
||||
<image v-for="(cItem,ci) in item.__config__.defaultValue" :key="ci" class="u-preview-image"
|
||||
:src="define.baseURL+cItem.url" mode="aspectFill"
|
||||
@tap.stop="doPreviewImage(define.baseURL+cItem.url, item.__config__.defaultValue)"></image>
|
||||
</view>
|
||||
<YunzhupaasColorPicker v-else-if="config.yunzhupaasKey==='colorPicker'" v-model="config.defaultValue"
|
||||
:colorFormat="item.colorFormat" disabled />
|
||||
<YunzhupaasRate v-else-if="config.yunzhupaasKey==='rate'" v-model="config.defaultValue" :max="item.count"
|
||||
:allowHalf="item.allowHalf" disabled />
|
||||
<YunzhupaasEditor v-else-if="config.yunzhupaasKey==='editor'" v-model="config.defaultValue" detailed />
|
||||
<YunzhupaasBarcode v-else-if="config.yunzhupaasKey=='barcode'" :staticText="item.staticText" :width="item.width"
|
||||
:height="item.height" :format="item.format" :dataType="item.dataType" :lineColor="item.lineColor"
|
||||
:background="item.background" :relationField="item.relationField+'_id'" :formData="formData" />
|
||||
<YunzhupaasQrcode v-else-if="config.yunzhupaasKey=='qrcode'" :staticText="item.staticText" :width="item.width"
|
||||
:dataType="item.dataType" :colorDark="item.colorDark" :colorLight="item.colorLight"
|
||||
:relationField="item.relationField+'_id'" :formData="formData" />
|
||||
<YunzhupaasInputNumber v-else-if="config.yunzhupaasKey=='inputNumber'" v-model="config.defaultValue"
|
||||
:step='item.step' :max='item.max||999999999999999' :min='item.min||-999999999999999'
|
||||
:disabled="item.disabled" :placeholder="item.placeholder" :isAmountChinese="item.isAmountChinese"
|
||||
:thousands="item.thousands" :addonAfter="item.addonAfter" :addonBefore="item.addonBefore"
|
||||
:controls="item.controls" :precision="item.precision" detailed />
|
||||
<YunzhupaasCalculate v-else-if="config.yunzhupaasKey==='calculate'&&item.isStorage==0" :expression='item.expression'
|
||||
:vModel='item.__vModel__' :config='config' :formData='formData' v-model="config.defaultValue"
|
||||
:precision="item.precision" :isAmountChinese="item.isAmountChinese" :thousands="item.thousands"
|
||||
:roundType="item.roundType" />
|
||||
<!--start labelwidth=0-->
|
||||
<YunzhupaasLink v-else-if="config.yunzhupaasKey=='link'" :content="item.content" :href="item.href"
|
||||
:target='item.target' :textStyle="item.textStyle" />
|
||||
<YunzhupaasAlert v-else-if="config.yunzhupaasKey=='alert'" :type="item.type" :title="item.title"
|
||||
:tagIcon='item.tagIcon' :showIcon="item.showIcon" :closable="item.closable"
|
||||
:description="item.description" :closeText="item.closeText" />
|
||||
<YunzhupaasButton v-else-if="config.yunzhupaasKey=='button'" :buttonText="item.buttonText" :align="item.align"
|
||||
:type="item.type" :disabled="item.disabled" />
|
||||
<YunzhupaasSlider v-else-if="config.yunzhupaasKey=='slider'" v-model="config.defaultValue" :step="item.step"
|
||||
:min="item.min||0" :max="item.max||100" disabled />
|
||||
<YunzhupaasSign v-else-if="config.yunzhupaasKey=='sign'" v-model="config.defaultValue" detailed />
|
||||
<YunzhupaasSignature v-else-if="config.yunzhupaasKey=='signature'" v-model="config.defaultValue" detailed />
|
||||
<YunzhupaasLocation v-else-if="config.yunzhupaasKey=='location'" v-model="config.defaultValue"
|
||||
:enableLocationScope="item.enableLocationScope" detailed />
|
||||
<!--end labelwidth=0-->
|
||||
<template v-else>
|
||||
<view class="yunzhupaas-detail-text" v-if="config.yunzhupaasKey==='calculate'">
|
||||
<view>{{ toThousands(config.defaultValue, item) }}</view>
|
||||
<view v-if="item.isAmountChinese" style="color: #999;">
|
||||
{{yunzhupaas.getAmountChinese(getValue(item))}}
|
||||
</view>
|
||||
</view>
|
||||
<YunzhupaasInput v-else-if="config.yunzhupaasKey=='input'" v-model="config.defaultValue" detailed
|
||||
:useMask="item.useMask" :maskConfig="item.maskConfig" :addonBefore="item.addonBefore"
|
||||
:addonAfter="item.addonAfter" />
|
||||
<view class="yunzhupaas-detail-text" v-else>{{ getValue(item) }}</view>
|
||||
</template>
|
||||
</u-form-item>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="yunzhupaas-card" v-if="config.yunzhupaasKey==='card'||config.yunzhupaasKey==='row'">
|
||||
<view class="yunzhupaas-card-cap u-line-1 u-flex" v-if="item.header" @click="clickIcon(item)">
|
||||
{{item.header}}
|
||||
<u-icon :name="config.tipLabel? 'question-circle-fill':''" class="u-m-l-10" color="#a0acb7" />
|
||||
</view>
|
||||
<Item v-for="(child, index) in config.children" :key="config.renderKey+index" :itemData="child"
|
||||
:formConf="formConf" :formData="formData" @toDetail="toDetail" @clickIcon='clickIcon' />
|
||||
</view>
|
||||
<template v-if="config.yunzhupaasKey==='table'">
|
||||
<view class="yunzhupaas-table">
|
||||
<view class="yunzhupaas-table-title u-line-1" @click="clickIcon(item)">
|
||||
{{config.label}}
|
||||
<u-icon v-if="config.tipLabel" :name="'question-circle-fill'" class="u-m-l-10"
|
||||
color="#a0acb7" />
|
||||
</view>
|
||||
<view v-for="(column,columnIndex) in config.defaultValue" :key="columnIndex">
|
||||
<view class="yunzhupaas-table-item-title">
|
||||
<view class="yunzhupaas-table-item-title-num">({{columnIndex+1}})</view>
|
||||
</view>
|
||||
<view class="form-item-box" v-for="(childItem,cIndex) in config.children" :key="cIndex">
|
||||
<u-form-item :label="childItem.__config__.showLabel?childItem.__config__.label:''"
|
||||
:label-width="childItem.__config__.labelWidth ? childItem.__config__.labelWidth * 1.5 : undefined"
|
||||
@clickIcon="clickIcon(childItem)"
|
||||
:left-icon='childItem.__config__.tipLabel &&childItem.__config__.showLabel&& childItem.__config__.label? "question-circle-fill":""'
|
||||
:left-icon-style="{'color':'#a0acb7'}"
|
||||
v-if="!childItem.__config__.noShow&&(!childItem.__config__.visibility|| (Array.isArray(childItem.__config__.visibility) && childItem.__config__.visibility.includes('app')))">
|
||||
<template
|
||||
v-if="['relationFormAttr','popupAttr'].includes(childItem.__config__.yunzhupaasKey)">
|
||||
<view class="yunzhupaas-detail-text" v-if="!childItem.__vModel__">
|
||||
{{ column[childItem.relationField.split('_yunzhupaasTable_')[0]+'_'+childItem.showField] }}
|
||||
</view>
|
||||
<view class="yunzhupaas-detail-text" v-else>
|
||||
{{column[childItem.__vModel__]}}
|
||||
</view>
|
||||
</template>
|
||||
<view v-else-if="childItem.__config__.yunzhupaasKey==='relationForm'" class="yunzhupaas-detail-text"
|
||||
style="color:rgb(41, 121, 255)"
|
||||
@click.native="toTableDetail(childItem,column[childItem.__vModel__+'_id'])">
|
||||
{{column[childItem.__vModel__]}}
|
||||
</view>
|
||||
<YunzhupaasSign v-else-if="childItem.__config__.yunzhupaasKey=='sign'"
|
||||
v-model="column[childItem.__vModel__]" detailed />
|
||||
<YunzhupaasSignature v-else-if="childItem.__config__.yunzhupaasKey=='signature'"
|
||||
v-model="column[childItem.__vModel__]" detailed />
|
||||
<YunzhupaasLocation v-else-if="childItem.__config__.yunzhupaasKey=='location'"
|
||||
v-model="column[childItem.__vModel__]"
|
||||
:enableLocationScope="item.enableLocationScope" detailed />
|
||||
<!-- #ifndef APP-HARMONY -->
|
||||
<YunzhupaasUploadFile v-else-if="childItem.__config__.yunzhupaasKey==='uploadFile'"
|
||||
v-model="column[childItem.__vModel__]" detailed />
|
||||
<!-- #endif -->
|
||||
<YunzhupaasUploadImg v-else-if="childItem.__config__.yunzhupaasKey==='uploadImg'"
|
||||
v-model="column[childItem.__vModel__]" detailed />
|
||||
<YunzhupaasInputNumber v-else-if="childItem.__config__.yunzhupaasKey=='inputNumber'"
|
||||
v-model="column[childItem.__vModel__]" :step='childItem.step' :max='childItem.max'
|
||||
:min='childItem.min' :disabled="childItem.disabled"
|
||||
:placeholder="childItem.placeholder" :isAmountChinese="childItem.isAmountChinese"
|
||||
:thousands="childItem.thousands" :addonAfter="childItem.addonAfter"
|
||||
:addonBefore="childItem.addonBefore" :controls="childItem.controls"
|
||||
:precision="childItem.precision" detailed />
|
||||
<YunzhupaasCalculate
|
||||
v-else-if="childItem.__config__.yunzhupaasKey==='calculate'&&childItem.isStorage==0"
|
||||
:expression='childItem.expression' :vModel='childItem.__vModel__'
|
||||
:config='childItem.__config__' :formData='formData' :roundType="childItem.roundType"
|
||||
v-model="column[childItem.__vModel__]" :precision="childItem.precision"
|
||||
:isAmountChinese="childItem.isAmountChinese" :thousands="childItem.thousands" />
|
||||
<YunzhupaasRate v-else-if="childItem.__config__.yunzhupaasKey==='rate'" :max="childItem.count"
|
||||
v-model="column[childItem.__vModel__]" :allowHalf="childItem.allowHalf" disabled />
|
||||
<YunzhupaasSlider v-else-if="childItem.__config__.yunzhupaasKey=='slider'"
|
||||
v-model="column[childItem.__vModel__]" :step="childItem.step"
|
||||
:min="childItem.min||0" :max="childItem.max||100" disabled />
|
||||
<template v-else>
|
||||
<view class="yunzhupaas-detail-text" v-if="childItem.__config__.yunzhupaasKey==='calculate'">
|
||||
<view>{{toThousands(column[childItem.__vModel__],childItem)}}</view>
|
||||
<view v-if="childItem.isAmountChinese" style="color: #999;">
|
||||
{{yunzhupaas.getAmountChinese(column[childItem.__vModel__])}}
|
||||
</view>
|
||||
</view>
|
||||
<YunzhupaasInput v-else-if="childItem.__config__.yunzhupaasKey=='input'"
|
||||
v-model="column[childItem.__vModel__]" detailed :useMask="childItem.useMask"
|
||||
:maskConfig="childItem.maskConfig" :addonBefore="childItem.addonBefore"
|
||||
:addonAfter="childItem.addonAfter" />
|
||||
<view class="yunzhupaas-detail-text" v-else>{{column[childItem.__vModel__]}}</view>
|
||||
</template>
|
||||
</u-form-item>
|
||||
</view>
|
||||
</view>
|
||||
<view class="yunzhupaas-table-item" v-if="item.showSummary && summaryField.length">
|
||||
<view class="yunzhupaas-table-item-title u-flex u-row-between">
|
||||
<text class="yunzhupaas-table-item-title-num">{{item.__config__.label}}合计</text>
|
||||
</view>
|
||||
<view class=" u-p-l-20 u-p-r-20 form-item-box">
|
||||
<u-form-item v-for="(item,index) in summaryField" :label="item.__config__.label"
|
||||
:key="item.__vModel__">
|
||||
<u-input input-align='right' v-model="item.value" disabled />
|
||||
</u-form-item>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<view v-else-if="config.yunzhupaasKey==='steps'" style="background-color: #fff;padding:15px 0">
|
||||
<view class="step-container">
|
||||
<u-steps :list="config.children" name="title" :mode="item.simple ? 'dot' :'number'"
|
||||
@change="onStepChange($event,item)" :current="stepCurrent">
|
||||
</u-steps>
|
||||
</view>
|
||||
<view v-for="(itemSub,i) in config.children" :key='i'>
|
||||
<view v-if="i === stepCurrent">
|
||||
<Item v-for="(childItem, childIndex) in itemSub.__config__.children" :key="childIndex"
|
||||
:itemData="childItem" :formConf="formConf" :formData="formData" @toDetail="toDetail"
|
||||
@clickIcon='clickIcon' />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="yunzhupaas-tab" v-if="config.yunzhupaasKey==='tab'">
|
||||
<u-tabs is-scroll :list="config.children" name="title" v-model="tabCurrent" @change="onTabChange" />
|
||||
<view v-for="(pane,i) in config.children" :key='i'>
|
||||
<view v-show="i == tabCurrent">
|
||||
<Item v-for="(childItem, childIndex) in pane.__config__.children" :key="childIndex"
|
||||
:itemData="childItem" :formConf="formConf" :formData="formData" @toDetail="toDetail"
|
||||
@clickIcon='clickIcon' />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="config.yunzhupaasKey==='collapse'">
|
||||
<u-collapse :head-style="{'padding-left':'20rpx'}" :accordion="item.accordion" ref="collapseRef">
|
||||
<u-collapse-item :title="pane.title" v-for="(pane, i) in config.children" :key="i"
|
||||
:open="config.active.indexOf(pane.name)>-1">
|
||||
<Item v-for="(child, j) in pane.__config__.children" :key="child.__config__.renderKey"
|
||||
:itemData="child" :formConf="formConf" :formData="formData" @toDetail="toDetail"
|
||||
@clickIcon='clickIcon' />
|
||||
</u-collapse-item>
|
||||
</u-collapse>
|
||||
</template>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getRelationFormDetail,
|
||||
getDataInterfaceDataInfoByIds
|
||||
} from '@/api/common.js'
|
||||
// #ifdef MP
|
||||
import Item from './Item.vue' //兼容小程序
|
||||
// #endif
|
||||
import DisplayList from '@/components/displayList'
|
||||
const specialList = ['link', 'editor', 'button', 'alert']
|
||||
export default {
|
||||
name: 'Item',
|
||||
components: {
|
||||
// #ifdef MP
|
||||
Item,
|
||||
// #endif
|
||||
DisplayList
|
||||
},
|
||||
props: {
|
||||
itemData: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
formConf: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
formData: {
|
||||
type: Object,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
item() {
|
||||
const item = uni.$u.deepClone(this.itemData)
|
||||
this.initI18n(item)
|
||||
return item
|
||||
},
|
||||
config() {
|
||||
return this.item.__config__
|
||||
},
|
||||
labelWidth() {
|
||||
if (specialList.indexOf(this.config.yunzhupaasKey) > -1) return 0
|
||||
return this.config.labelWidth ? this.config.labelWidth * 1.5 : undefined
|
||||
},
|
||||
label() {
|
||||
return this.config.showLabel && specialList.indexOf(this.config.yunzhupaasKey) < 0 ? this.config.label : ''
|
||||
},
|
||||
realLabel() {
|
||||
return this.label ? (this.label + (this.formConf.labelSuffix || '')) : ''
|
||||
},
|
||||
leftIcon() {
|
||||
return this.config.tipLabel && this.label && this.config.showLabel ? "question-circle-fill" : ""
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tabCurrent: 0,
|
||||
tableData: [],
|
||||
summaryField: [],
|
||||
stepCurrent: 0,
|
||||
extraObj: {}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.handleSummary()
|
||||
this.handleTab()
|
||||
},
|
||||
mounted() {
|
||||
if (this.config.yunzhupaasKey === 'collapse') {
|
||||
this.$refs.collapseRef && this.$refs.collapseRef.init()
|
||||
}
|
||||
uni.$on('initCollapse', () => {
|
||||
this.$refs.collapseRef && this.$refs.collapseRef.init()
|
||||
})
|
||||
this.getDataChange()
|
||||
this.getDataInterfaceDataInfoByIds()
|
||||
},
|
||||
methods: {
|
||||
onStepChange(index, item) {
|
||||
if (this.stepCurrent === index) return
|
||||
item.__config__.active = index
|
||||
this.stepCurrent = index
|
||||
this.$nextTick(() => {
|
||||
uni.$emit('updateCode')
|
||||
uni.$emit('initCollapse')
|
||||
})
|
||||
},
|
||||
initI18n(item) {
|
||||
const config = item.__config__
|
||||
if (item.placeholderI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.placeholder = this.$t(item.placeholderI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.placeholder = this.$t(item.placeholderI18nCode, item.placeholder);
|
||||
//#endif
|
||||
}
|
||||
if (item.__config__.label && item.__config__.labelI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.__config__.label = this.$t(item.__config__.labelI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.__config__.label = this.$t(item.__config__.labelI18nCode, item.__config__.label);
|
||||
//#endif
|
||||
}
|
||||
if (item.__config__.tipLabel && item.__config__.tipLabelI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.__config__.tipLabel = this.$t(item.__config__.tipLabelI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.__config__.tipLabel = this.$t(item.__config__.tipLabelI18nCode, item.__config__.tipLabel);
|
||||
//#endif
|
||||
}
|
||||
if (['groupTitle', 'divider', 'link', 'text'].includes(config.yunzhupaasKey)) {
|
||||
if (item.contentI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.content = this.$t(item.contentI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.content = this.$t(item.contentI18nCode, item.content);
|
||||
//#endif
|
||||
}
|
||||
if (item.helpMessageI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.helpMessage = this.$t(item.helpMessageI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.helpMessage = this.$t(item.helpMessageI18nCode, item.helpMessage);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'button') {
|
||||
if (item.buttonTextI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.buttonText = this.$t(item.buttonTextI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.buttonText = this.$t(item.buttonTextI18nCode.item.buttonText);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'alert') {
|
||||
if (item.titleI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.title = this.$t(item.titleI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.title = this.$t(item.titleI18nCode, item.title);
|
||||
//#endif
|
||||
}
|
||||
if (item.descriptionI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.description = this.$t(item.descriptionI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.description = this.$t(item.descriptionI18nCode, item.description);
|
||||
//#endif
|
||||
}
|
||||
if (item.closeTextI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.closeText = this.$t(item.closeTextI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.closeText = this.$t(item.closeTextI18nCode, item.closeText);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'card') {
|
||||
if (item.headerI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.header = this.$t(item.headerI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.header = this.$t(item.headerI18nCode, item.header);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
if (['tab', 'collapse', 'steps'].includes(config.yunzhupaasKey)) {
|
||||
if (config.children && config.children.length) {
|
||||
for (let i = 0; i < config.children.length; i++) {
|
||||
if (config.children[i].titleI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
config.children[i].title =
|
||||
this.$t(config.children[i].titleI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
config.children[i].title =
|
||||
this.$t(config.children[i].titleI18nCode, config.children[i].title);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.headerI18nCode) {
|
||||
//#ifdef MP-WEIXIN
|
||||
item.header = this.$t(item.headerI18nCode);
|
||||
//#endif
|
||||
//#ifndef MP-WEIXIN
|
||||
item.header = this.$t(item.headerI18nCode, item.header);
|
||||
//#endif
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'table') {
|
||||
if (config.children && config.children.length) {
|
||||
for (let i = 0; i < config.children.length; i++) {
|
||||
this.initI18n(config.children[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleTab() {
|
||||
if (this.config.yunzhupaasKey === 'steps') return this.stepCurrent = this.config.active
|
||||
if (this.config.yunzhupaasKey !== 'tab') return
|
||||
for (var i = 0; i < this.config.children.length; i++) {
|
||||
if (this.config.active == this.config.children[i].name) {
|
||||
this.tabCurrent = i
|
||||
break
|
||||
}
|
||||
}
|
||||
},
|
||||
getDataChange() {
|
||||
if (this.config.yunzhupaasKey === 'relationForm' && this.config.defaultValue) {
|
||||
let query = {
|
||||
id: this.formData[this.item.__vModel__ + '_id'],
|
||||
};
|
||||
if (this.item.propsValue) query = {
|
||||
...query,
|
||||
propsValue: this.item.propsValue
|
||||
};
|
||||
getRelationFormDetail(this.item.modelId, query).then(res => {
|
||||
if ((!res.data || !res.data.data) || res.data.data === "undefined") return
|
||||
let data = JSON.parse(res.data?.data)
|
||||
this.extraObj = data
|
||||
})
|
||||
}
|
||||
},
|
||||
getDataInterfaceDataInfoByIds() {
|
||||
if (this.config.yunzhupaasKey === 'popupSelect' && this.config.defaultValue) {
|
||||
let query = {
|
||||
ids: [this.config.defaultValue],
|
||||
interfaceId: this.item.interfaceId,
|
||||
propsValue: this.item.propsValue,
|
||||
relationField: this.item.relationField,
|
||||
paramList: this.getParamList()
|
||||
}
|
||||
getDataInterfaceDataInfoByIds(this.item.interfaceId, query).then(res => {
|
||||
const data = res.data && res.data.length ? res.data[0] : {};
|
||||
this.extraObj = data
|
||||
})
|
||||
}
|
||||
},
|
||||
getParamList() {
|
||||
let templateJson = this.item.templateJson
|
||||
if (!this.formData) return templateJson
|
||||
for (let i = 0; i < templateJson.length; i++) {
|
||||
if (templateJson[i].relationField && templateJson[i].sourceType == 1) {
|
||||
if (templateJson[i].relationField.includes('-')) {
|
||||
let tableVModel = templateJson[i].relationField.split('-')[0]
|
||||
let childVModel = templateJson[i].relationField.split('-')[1]
|
||||
templateJson[i].defaultValue = this.formData[tableVModel] && this.formData[tableVModel][this
|
||||
.rowIndex
|
||||
] && this.formData[tableVModel][this.rowIndex][childVModel] || ''
|
||||
} else {
|
||||
templateJson[i].defaultValue = this.formData[templateJson[i].relationField] || ''
|
||||
}
|
||||
}
|
||||
}
|
||||
return templateJson
|
||||
},
|
||||
handleSummary() {
|
||||
if (this.item.__config__.yunzhupaasKey !== 'table') return
|
||||
const val = this.item.__config__.defaultValue
|
||||
let summaryField = this.item.summaryField || []
|
||||
this.summaryField = []
|
||||
this.tableData = this.item.__config__.children || []
|
||||
for (let i = 0; i < summaryField.length; i++) {
|
||||
for (let o = 0; o < this.tableData.length; o++) {
|
||||
const item = this.tableData[o]
|
||||
if (this.tableData[o].__vModel__ === summaryField[i] && !item.__config__.noShow) {
|
||||
this.summaryField.push({
|
||||
value: '',
|
||||
...item
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$nextTick(() => this.getTableSummaries(val, this.item))
|
||||
},
|
||||
toThousands(val, column) {
|
||||
if (val) {
|
||||
let valList = val.toString().split('.')
|
||||
let num = Number(valList[0])
|
||||
let newVal = column.thousands ? num.toLocaleString() : num
|
||||
return valList[1] ? newVal + '.' + valList[1] : newVal
|
||||
} else {
|
||||
return val
|
||||
}
|
||||
},
|
||||
getTableSummaries(newVal, config) {
|
||||
for (let i = 0; i < this.summaryField.length; i++) {
|
||||
let val = 0
|
||||
for (let j = 0; j < newVal.length; j++) {
|
||||
if (newVal[j][this.summaryField[i].__vModel__]) {
|
||||
let data = isNaN(newVal[j][this.summaryField[i].__vModel__]) ? 0 :
|
||||
Number(newVal[j][this.summaryField[i].__vModel__])
|
||||
val += data
|
||||
}
|
||||
}
|
||||
let realVal = val && !Number.isInteger(val) ? Number(val).toFixed(2) : val;
|
||||
if (this.summaryField[i].thousands) realVal = Number(realVal).toLocaleString('zh')
|
||||
this.summaryField[i].value = realVal
|
||||
}
|
||||
},
|
||||
clickIcon(e) {
|
||||
this.$emit('clickIcon', e)
|
||||
},
|
||||
onTabChange(index) {
|
||||
if (this.tabCurrent === index) return
|
||||
this.tabCurrent = index;
|
||||
this.$emit('tab-change', this.item, index)
|
||||
this.$nextTick(() => {
|
||||
uni.$emit('initCollapse')
|
||||
uni.$emit('updateCode')
|
||||
})
|
||||
},
|
||||
doPreviewImage(current, imageList) {
|
||||
const images = imageList.map(item => this.define.baseURL + item.url);
|
||||
uni.previewImage({
|
||||
urls: images,
|
||||
current: current,
|
||||
success: () => {},
|
||||
fail: () => {
|
||||
uni.showToast({
|
||||
title: '预览图片失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
toDetail(item) {
|
||||
const data = {
|
||||
...item,
|
||||
...(item.__config__.yunzhupaasKey === 'relationForm' ? {
|
||||
sourceRelationForm: true,
|
||||
propsValue: item.propsValue
|
||||
} : {})
|
||||
};
|
||||
this.$emit('toDetail', data)
|
||||
},
|
||||
toTableDetail(item, value) {
|
||||
item.__config__.defaultValue = value
|
||||
this.$emit('toDetail', item)
|
||||
},
|
||||
getValue(item) {
|
||||
if (Array.isArray(item.__config__.defaultValue)) {
|
||||
if (['timeRange', 'dateRange'].includes(item.__config__.yunzhupaasKey)) {
|
||||
return item.__config__.defaultValue.join('')
|
||||
}
|
||||
return item.__config__.defaultValue.join()
|
||||
}
|
||||
return item.__config__.defaultValue
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.detail-text-box {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
68
pages/apply/dynamicModel/components/detail/Parser.vue
Normal file
68
pages/apply/dynamicModel/components/detail/Parser.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<u-form class="yunzhupaas-wrap-form" :model="formData" ref="dataForm"
|
||||
:label-position="formConf.labelPosition==='top'?'top':'left'"
|
||||
:label-align="formConf.labelPosition==='right'?'right':'left'"
|
||||
:label-width="formConf.labelWidth?formConf.labelWidth*1.5:150" :class='formConf.className'>
|
||||
<template v-for="(item, index) in formConf.fields" :key="item.__config__.renderKey">
|
||||
<Item :itemData="item" :formConf="formConf" :class="item.__config__.className" :formData="formData"
|
||||
:ref="item.__vModel__?item.__vModel__: undefined" @toDetail="toDetail" @clickIcon='clickIcon' />
|
||||
</template>
|
||||
<u-modal v-model="show" :content="content" width='70%' border-radius="16" :content-style="contentStyle"
|
||||
:titleStyle="titleStyle" :confirm-style="confirmStyle" :title="title" :confirm-text="$t('common.okText')">
|
||||
</u-modal>
|
||||
</u-form>
|
||||
</template>
|
||||
<script>
|
||||
import Item from './Item'
|
||||
export default {
|
||||
components: {
|
||||
Item
|
||||
},
|
||||
props: {
|
||||
formConf: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
formData: {
|
||||
type: Object,
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
content: '',
|
||||
contentStyle: {
|
||||
fontSize: '28rpx',
|
||||
padding: '20rpx',
|
||||
lineHeight: '44rpx',
|
||||
textAlign: 'left'
|
||||
},
|
||||
titleStyle: {
|
||||
padding: '20rpx'
|
||||
},
|
||||
confirmStyle: {
|
||||
height: '80rpx',
|
||||
lineHeight: '80rpx',
|
||||
},
|
||||
title: this.$t('common.tipTitle'),
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickIcon(e) {
|
||||
if (!e.__config__.tipLabel && !e.helpMessage) return
|
||||
this.content = e.helpMessage || e.__config__.tipLabel
|
||||
this.title = e.__config__.label
|
||||
if (e.__config__.yunzhupaasKey === 'card') this.title = e.header
|
||||
if (e.__config__.yunzhupaasKey === 'groupTitle') this.title = e.content
|
||||
this.show = true
|
||||
},
|
||||
toDetail(item) {
|
||||
this.$emit('toDetail', item)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
195
pages/apply/dynamicModel/components/form/index.vue
Normal file
195
pages/apply/dynamicModel/components/form/index.vue
Normal file
@@ -0,0 +1,195 @@
|
||||
<template>
|
||||
<view class="yunzhupaas-wrap yunzhupaas-wrap-form">
|
||||
<YunzhupaasParser v-if="!loading" ref="dynamicForm" :formConf="formConf" :key="key" @submit="sumbitForm" />
|
||||
<view class="buttom-actions" v-if="origin !='scan'">
|
||||
<u-button class="buttom-btn" @click.stop="resetForm">{{$t('common.resetText')}}</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="submit" :loading="btnLoading">
|
||||
{{getOkText}}
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
createModel,
|
||||
getModelInfo
|
||||
} from '@/api/apply/visualDev'
|
||||
export default {
|
||||
props: ['config', 'modelId', 'isPreview', 'origin', 'id'],
|
||||
data() {
|
||||
return {
|
||||
dataForm: {
|
||||
data: ''
|
||||
},
|
||||
formConf: {},
|
||||
key: +new Date(),
|
||||
btnLoading: false,
|
||||
loading: true,
|
||||
isAdd: false,
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getOkText() {
|
||||
const text = this.formConf.confirmButtonTextI18nCode ?
|
||||
this.$t(this.formConf.confirmButtonTextI18nCode, this.formConf.confirmButtonText) :
|
||||
this.formConf.confirmButtonText;
|
||||
return text || this.$t('common.okText');
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.userInfo = uni.getStorageSync('userInfo') || {}
|
||||
this.formConf = JSON.parse(this.config.formData)
|
||||
this.loading = true
|
||||
this.initData()
|
||||
},
|
||||
initData() {
|
||||
this.$nextTick(() => {
|
||||
if (this.origin === 'scan') {
|
||||
let extra = {
|
||||
modelId: this.modelId,
|
||||
id: this.id,
|
||||
type: 2
|
||||
}
|
||||
uni.setStorageSync('dynamicModelExtra', extra)
|
||||
getModelInfo(this.modelId, this.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
if (!this.dataForm.data) return
|
||||
this.formData = JSON.parse(this.dataForm.data)
|
||||
this.fillFormData(this.formConf, this.formData)
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.formData = {}
|
||||
this.loading = false
|
||||
this.isAdd = true
|
||||
this.fillFormData(this.formConf, this.formData)
|
||||
}
|
||||
this.key = +new Date()
|
||||
})
|
||||
},
|
||||
fillFormData(form, data) {
|
||||
const loop = list => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let item = list[i]
|
||||
let vModel = item.__vModel__
|
||||
let config = item.__config__
|
||||
if (vModel) {
|
||||
let val = data.hasOwnProperty(vModel) ? data[vModel] : config.defaultValue
|
||||
if (!config.isSubTable) config.defaultValue = val
|
||||
if (this.isAdd || config.isSubTable) { //新增时候,默认当前
|
||||
if (config.defaultCurrent) {
|
||||
if (config.yunzhupaasKey === 'datePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
let format = this.yunzhupaas.handelFormat(item.format)
|
||||
let dateStr = this.yunzhupaas.toDate(new Date().getTime(), format)
|
||||
let time = format === 'yyyy' ? '-01-01 00:00:00' : format === 'yyyy-MM' ?
|
||||
'-01 00:00:00' : format === 'yyyy-MM-dd' ?
|
||||
' 00:00:00' : ''
|
||||
val = new Date(dateStr + time).getTime()
|
||||
config.defaultValue = val
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'timePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
config.defaultValue = this.yunzhupaas.toDate(new Date(), item.format)
|
||||
}
|
||||
}
|
||||
const organizeIdList = this.userInfo.organizeIdList
|
||||
if (config.yunzhupaasKey === 'organizeSelect' && Array.isArray(organizeIdList) &&
|
||||
organizeIdList.length) {
|
||||
config.defaultValue = item.multiple ? [organizeIdList] : organizeIdList
|
||||
}
|
||||
const departmentId = this.userInfo.departmentId
|
||||
if (config.yunzhupaasKey === 'depSelect' && departmentId) {
|
||||
config.defaultValue = item.multiple ? [departmentId] : departmentId;
|
||||
}
|
||||
const positionIds = this.userInfo.positionIds
|
||||
if (config.yunzhupaasKey === 'posSelect' && Array.isArray(positionIds) && positionIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? positionIds.map(o => o.id) : positionIds[
|
||||
0].id
|
||||
}
|
||||
const roleIds = this.userInfo.roleIds
|
||||
if (config.yunzhupaasKey === 'roleSelect' && Array.isArray(roleIds) && roleIds.length) {
|
||||
config.defaultValue = item.multiple ? roleIds : roleIds[0];
|
||||
}
|
||||
const groupIds = this.userInfo.groupIds
|
||||
if (config.yunzhupaasKey === 'groupSelect' && Array.isArray(groupIds) && groupIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? groupIds : groupIds[0];
|
||||
}
|
||||
const userId = this.userInfo.userId
|
||||
if (config.yunzhupaasKey === 'userSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId] : userId;
|
||||
}
|
||||
if (config.yunzhupaasKey === 'usersSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId + '--user'] : userId + '--user';
|
||||
}
|
||||
if (config.yunzhupaasKey === 'sign' && this.userInfo.signImg) {
|
||||
config.defaultValue = this.userInfo.signImg
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.origin === 'scan') this.$set(item, 'disabled', true)
|
||||
let noShow = !config.noShow ? false : config.noShow
|
||||
let isVisibility = false
|
||||
if (!config.visibility || (Array.isArray(config.visibility) && config.visibility.includes(
|
||||
'app'))) isVisibility = true
|
||||
this.$set(config, 'isVisibility', isVisibility)
|
||||
this.$set(config, 'noShow', noShow)
|
||||
} else {
|
||||
let noShow = false,
|
||||
isVisibility = false
|
||||
if (!config.visibility || (Array.isArray(config.visibility) && config.visibility.includes(
|
||||
'app'))) isVisibility = true
|
||||
this.$set(config, 'isVisibility', isVisibility)
|
||||
this.$set(config, 'noShow', noShow)
|
||||
}
|
||||
if (config && config.children && Array.isArray(config.children)) loop(config.children)
|
||||
}
|
||||
}
|
||||
loop(form.fields)
|
||||
},
|
||||
sumbitForm(data, callback) {
|
||||
if (!data) return
|
||||
this.btnLoading = true
|
||||
this.dataForm.data = JSON.stringify(data)
|
||||
if (callback && typeof callback === "function") callback()
|
||||
createModel(this.modelId, this.dataForm).then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
this.btnLoading = false
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
})
|
||||
},
|
||||
submit() {
|
||||
if (this.isPreview) return this.$u.toast('功能预览不支持数据保存')
|
||||
this.$refs.dynamicForm && this.$refs.dynamicForm.submitForm()
|
||||
},
|
||||
resetForm() {
|
||||
this.loading = true
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
this.$refs.dynamicForm && this.$refs.dynamicForm.resetForm()
|
||||
this.init()
|
||||
this.key = +new Date()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
1066
pages/apply/dynamicModel/components/list/index.vue
Normal file
1066
pages/apply/dynamicModel/components/list/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
199
pages/apply/dynamicModel/components/list/list.vue
Normal file
199
pages/apply/dynamicModel/components/list/list.vue
Normal file
@@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<view class="list u-p-b-20 u-p-l-20 u-p-r-20" ref="tableRef">
|
||||
<view class="list-box">
|
||||
<u-swipe-action :show="item.show" :index="index" v-for="(item, index) in list" :key="index"
|
||||
@click="actionClick" @open="open" :options="options" :btnWidth="160" class="u-m-t-20">
|
||||
<view class="item" @tap.stop="goDetail(item)">
|
||||
<u-checkbox v-if="showCheckbox" @change="checkboxChange($event,item,index)" v-model="item.checked"
|
||||
class="checkbox" @tap.stop shape="circle"></u-checkbox>
|
||||
<view class="item-cell" v-for="(column,i) in columnList" :key="i">
|
||||
<template v-if="column.yunzhupaasKey != 'table'">
|
||||
<text class="item-cell-label">{{column.label}}:</text>
|
||||
<text class="item-cell-content" v-if="['calculate','inputNumber'].includes(column.yunzhupaasKey)">
|
||||
{{toThousands(item[column.prop],column)}}
|
||||
</text>
|
||||
<text class="item-cell-content text-primary" v-else-if="column.yunzhupaasKey == 'relationForm'"
|
||||
@click.stop="relationFormClick(item,column)">
|
||||
{{item[column.prop]}}
|
||||
</text>
|
||||
<view class="item-cell-content" v-else-if="column.yunzhupaasKey == 'sign'">
|
||||
<YunzhupaasSign v-model="item[column.prop]" align="left" detailed />
|
||||
</view>
|
||||
<view class="item-cell-content" v-else-if="column.yunzhupaasKey == 'signature'">
|
||||
<YunzhupaasSignature v-model="item[column.prop]" align="left" detailed />
|
||||
</view>
|
||||
<view class="item-cell-content" v-else-if="column.yunzhupaasKey == 'uploadImg'" @click.stop>
|
||||
<YunzhupaasUploadImg v-model="item[column.prop]" detailed simple
|
||||
v-if="item[column.prop]&&item[column.prop].length" />
|
||||
</view>
|
||||
<!-- #ifndef APP-HARMONY -->
|
||||
<view class="item-cell-content" v-else-if="column.yunzhupaasKey == 'uploadFile'" @click.stop>
|
||||
<YunzhupaasUploadFile v-model="item[column.prop]" detailed
|
||||
v-if="item[column.prop]&&item[column.prop].length" align="left" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view class="item-cell-content" v-else-if="column.yunzhupaasKey == 'rate'">
|
||||
<YunzhupaasRate v-model="item[column.prop]" :max="column.count" :allowHalf="column.allowHalf"
|
||||
disabled />
|
||||
</view>
|
||||
<view class="item-cell-content item-cell-slider" v-else-if="column.yunzhupaasKey == 'slider'">
|
||||
<YunzhupaasSlider v-model="item[column.prop]" :min="column.min" :max="column.max"
|
||||
:step="column.step" disabled />
|
||||
</view>
|
||||
<view class="item-cell-content" v-else-if="column.yunzhupaasKey == 'input'">
|
||||
<YunzhupaasInput v-model="item[column.prop]" detailed showOverflow :useMask="column.useMask"
|
||||
:maskConfig="column.maskConfig" align='left' />
|
||||
</view>
|
||||
<text class="item-cell-content" v-else>{{item[column.prop]}}</text>
|
||||
</template>
|
||||
<tableCell v-else @click.stop class="tableCell" ref="tableCell" :label="column.label"
|
||||
:childList="item[column.prop]" :children="column.children" :pageLen="3"
|
||||
@cRelationForm="relationFormClick">
|
||||
</tableCell>
|
||||
</view>
|
||||
<view class="item-cell" v-if="config.enableFlow==1">
|
||||
<text class="item-cell-label">审批状态:</text>
|
||||
<text :style="{color:useDefine.getFlowStatusColor(item.flowState)}">
|
||||
{{useDefine.getFlowStatusContent(item.flowState)}}
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</u-swipe-action>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
useDefineSetting
|
||||
} from '@/utils/useDefineSetting';
|
||||
import tableCell from '../tableCell.vue'
|
||||
export default {
|
||||
emits: ['selectCheckbox', 'handleClick', 'handleMoreClick', 'goDetail', 'relationFormClick', 'update:modelValue'],
|
||||
components: {
|
||||
tableCell
|
||||
},
|
||||
props: ['config', 'list', 'columnList', 'actionOptions', 'showSelect', 'checkedAll', 'modelValue', 'isMoreBtn',
|
||||
'customBtnsList'
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
selectData: [],
|
||||
useDefine: useDefineSetting()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
checkedAll: {
|
||||
handler(val) {
|
||||
this.handleCheckAll()
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
options() {
|
||||
if (!this.customBtnsList?.length) return this.actionOptions;
|
||||
return [{
|
||||
text: this.$t('common.moreText'),
|
||||
value: 'more',
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
...this.actionOptions,
|
||||
];
|
||||
},
|
||||
showCheckbox() {
|
||||
return this.showSelect
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open(index) {
|
||||
this.list[index].show = true;
|
||||
this.list.map((val, idx) => {
|
||||
if (index != idx) this.list[idx].show = false;
|
||||
})
|
||||
},
|
||||
/* 关联表单操作 */
|
||||
relationFormClick(item, column) {
|
||||
this.$emit('relationFormClick', item, column)
|
||||
},
|
||||
/* 跳转详情 */
|
||||
goDetail(item) {
|
||||
this.$emit('goDetail', item)
|
||||
},
|
||||
actionClick(itemIndex, btnIndex) {
|
||||
if (this.options[btnIndex].value === 'remove') return this.$emit('handleClick', itemIndex)
|
||||
if (this.options[btnIndex].value === 'more') return this.$emit('handleMoreClick', itemIndex)
|
||||
},
|
||||
/* 列表选择框 */
|
||||
checkboxChange(e, item) {
|
||||
const isSelected = e.value;
|
||||
const itemIndex = this.list.indexOf(item);
|
||||
if (itemIndex === -1) return;
|
||||
const selectedItemsSet = new Set(this.selectData.map(selectedItem => {
|
||||
return selectedItem.id;
|
||||
}));
|
||||
if (isSelected) {
|
||||
selectedItemsSet.add(item.id);
|
||||
} else {
|
||||
selectedItemsSet.delete(item.id);
|
||||
}
|
||||
this.selectData = [...selectedItemsSet.values()].map(id => {
|
||||
return this.list.find(listItem => listItem.id === id);
|
||||
});
|
||||
this.$emit('selectCheckbox', this.selectData);
|
||||
},
|
||||
/* 全部选中 */
|
||||
handleCheckAll() {
|
||||
this.selectData = []
|
||||
if (this.checkedAll) this.selectData = this.list.filter(o => o.checked)
|
||||
this.$emit('selectCheckbox', this.selectData)
|
||||
},
|
||||
/* 千分位操作 */
|
||||
toThousands(val, column) {
|
||||
if (val) {
|
||||
let valList = val.toString().split('.')
|
||||
let num = Number(valList[0])
|
||||
let newVal = column.thousands ? num.toLocaleString() : num
|
||||
return valList[1] ? newVal + '.' + valList[1] : newVal
|
||||
} else {
|
||||
return val
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.item {
|
||||
padding: 0 !important;
|
||||
|
||||
.checkbox {
|
||||
position: absolute;
|
||||
top: 6rpx;
|
||||
left: 8rpx;
|
||||
z-index: 9999;
|
||||
}
|
||||
}
|
||||
|
||||
.right-option-box {
|
||||
display: flex;
|
||||
width: max-content;
|
||||
|
||||
.right-option {
|
||||
width: 144rpx;
|
||||
height: 100%;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
background-color: #dd524d;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.more-option {
|
||||
background-color: #1890ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
166
pages/apply/dynamicModel/components/parser/index.vue
Normal file
166
pages/apply/dynamicModel/components/parser/index.vue
Normal file
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<u-form :model="formData" ref="dataForm" :errorType="['toast']" label-position="left" label-width="150">
|
||||
<u-form-item :label="item.label" :prop="item.id" v-for="(item, i) in formConfCopy" :key="i">
|
||||
<YunzhupaasInput v-if="useInputList.includes(item.__config__.yunzhupaasKey)" input-align='right'
|
||||
v-model="formData[item.id]" :placeholder="textPrefix+item.label" clearable />
|
||||
<template v-if="['inputNumber','calculate'].includes(item.__config__.yunzhupaasKey)">
|
||||
<YunzhupaasInputNumber v-model="formData[item.id]" :precision="item.precision"
|
||||
:placeholder="textPrefix+item.__config__.label" v-if="item.__config__.isFromParam" />
|
||||
<YunzhupaasNumberRange v-model="formData[item.id]"
|
||||
:precision="!item.precision && item.__config__.yunzhupaasKey=='calculate'?0:item.precision" v-else />
|
||||
</template>
|
||||
<template v-if="['rate', 'slider'].includes(item.__config__.yunzhupaasKey)">
|
||||
<YunzhupaasNumberRange v-model="formData[item.id]" :precision="item.allowHalf ? 1 : 0" />
|
||||
</template>
|
||||
<YunzhupaasSelect v-if="useSelectList.includes(item.__config__.yunzhupaasKey)" v-model="formData[item.id]"
|
||||
:placeholder="selectPrefix+item.label" :options="item.options" :props="item.props"
|
||||
:multiple="item.searchMultiple" :key="key" filterable />
|
||||
<YunzhupaasCascader v-if="item.__config__.yunzhupaasKey==='cascader'" v-model="formData[item.id]"
|
||||
:placeholder="selectPrefix+item.label" :options="item.options" :props="item.props" filterable
|
||||
:showAllLevels="item.showAllLevels" :multiple="item.searchMultiple" />
|
||||
<YunzhupaasAutoComplete v-if="item.__config__.yunzhupaasKey==='autoComplete'" v-model="formData[item.id]"
|
||||
:interfaceName="item.interfaceName" :placeholder="selectPrefix+item.label"
|
||||
:interfaceId="item.interfaceId" :total="item.total" :templateJson="item.templateJson"
|
||||
:formData='formData' :relationField="item.relationField" :propsValue="item.propsValue"
|
||||
:clearable='item.clearable' />
|
||||
<YunzhupaasGroupSelect v-if="item.__config__.yunzhupaasKey==='groupSelect'" v-model="formData[item.id]"
|
||||
:vModel='item.id' :multiple="item.searchMultiple" :disabled="item.disabled"
|
||||
:placeholder="selectPrefix+item.label" :ableIds="item.ableIds" :selectType="item.selectType" />
|
||||
<YunzhupaasRoleSelect v-if="item.__config__.yunzhupaasKey==='roleSelect'" v-model="formData[item.id]"
|
||||
:multiple="item.searchMultiple" :disabled="item.disabled" :placeholder="selectPrefix+item.label"
|
||||
:ableIds="item.ableIds" :selectType="item.selectType" />
|
||||
<YunzhupaasOrganizeSelect v-if="['organizeSelect','currOrganize'].includes(item.__config__.yunzhupaasKey)"
|
||||
v-model="formData[item.id]" :placeholder="selectPrefix+item.label" :multiple="item.searchMultiple"
|
||||
:ableIds="item.ableIds" :selectType="item.selectType" />
|
||||
<YunzhupaasDepSelect v-if="['depSelect','currDept'].includes(item.__config__.yunzhupaasKey)" v-model="formData[item.id]"
|
||||
:placeholder="selectPrefix+item.label" :ableIds="item.ableIds" :selectType="item.selectType"
|
||||
:multiple="item.searchMultiple" />
|
||||
<YunzhupaasPosSelect v-if="['posSelect','currPosition'].includes(item.__config__.yunzhupaasKey)"
|
||||
v-model="formData[item.id]" :placeholder="selectPrefix+item.label" :ableIds="item.ableIds"
|
||||
:selectType="item.selectType" :multiple="item.searchMultiple" />
|
||||
<YunzhupaasUserSelect v-if="['userSelect','createUser', 'modifyUser'].includes(item.__config__.yunzhupaasKey)"
|
||||
v-model="formData[item.id]" :placeholder="selectPrefix+item.label" :ableDepIds="item.ableDepIds"
|
||||
:ableIds="item.ableIds" :selectType="item.selectType!='custom'?'all':'custom'"
|
||||
:multiple="item.searchMultiple" />
|
||||
<YunzhupaasUsersSelect v-if="item.__config__.yunzhupaasKey==='usersSelect'" v-model="formData[item.id]"
|
||||
:multiple="item.searchMultiple" :placeholder="selectPrefix+item.label" :selectType="item.selectType"
|
||||
:ableIds="item.ableIds" :clearable="item.clearable" />
|
||||
<YunzhupaasTreeSelect v-if="item.__config__.yunzhupaasKey==='treeSelect'" v-model="formData[item.id]"
|
||||
:options="item.options" :props="item.props" :placeholder="selectPrefix+item.label" filterable
|
||||
:multiple="item.searchMultiple" />
|
||||
<YunzhupaasAreaSelect v-if="item.__config__.yunzhupaasKey==='areaSelect'" v-model="formData[item.id]"
|
||||
:placeholder="selectPrefix+item.label" :level="item.level" :multiple="item.searchMultiple" />
|
||||
<template v-if="useDateList.includes(item.__config__.yunzhupaasKey)||item.__config__.yunzhupaasKey==='datePicker'">
|
||||
<YunzhupaasDatePicker v-model="formData[item.id]" :format='item.format' v-if="item.__config__.isFromParam" />
|
||||
<YunzhupaasDateRange v-model="formData[item.id]" :format='item.format' v-else />
|
||||
</template>
|
||||
<YunzhupaasTimeRange v-if="item.__config__.yunzhupaasKey==='timePicker'" v-model="formData[item.id]"
|
||||
:format='item.format' />
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getDictionaryDataSelector,
|
||||
getDataInterfaceRes
|
||||
} from '@/api/common'
|
||||
const dyOptionsList = ['radio', 'checkbox', 'select', 'cascader', 'treeSelect'];
|
||||
const useSelectList = ['radio', 'checkbox', 'select'];
|
||||
const useInputList = ['input', 'textarea', 'text', 'link', 'billRule', 'location'];
|
||||
const useDateList = ['createTime', 'modifyTime'];
|
||||
const useArrList = ['cascader', 'address', 'numInput', 'calculate', ...useDateList]
|
||||
export default {
|
||||
props: ['formConf', 'webType', 'searchFormData'],
|
||||
data() {
|
||||
const data = {
|
||||
useInputList,
|
||||
useDateList,
|
||||
useSelectList,
|
||||
formConfCopy: this.$u.deepClone(this.formConf),
|
||||
formData: this.$u.deepClone(this.searchFormData),
|
||||
key: +new Date(),
|
||||
textPrefix: this.$t('common.inputTextPrefix') + ' ',
|
||||
selectPrefix: this.$t('common.chooseTextPrefix') + ' ',
|
||||
}
|
||||
this.initRelationForm(data.formConfCopy)
|
||||
this.initFormData(data.formConfCopy, data.formData)
|
||||
return data
|
||||
},
|
||||
watch: {
|
||||
searchFormData(val) {
|
||||
this.formData = val
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initFormData(componentList, formData) {
|
||||
componentList.forEach(cur => {
|
||||
const config = cur.__config__
|
||||
if (dyOptionsList.indexOf(config.yunzhupaasKey) > -1) {
|
||||
if (config.dataType === 'dictionary' && config.dictionaryType) {
|
||||
getDictionaryDataSelector(config.dictionaryType).then(res => {
|
||||
cur.options = res.data.list || []
|
||||
this.key = +new Date()
|
||||
this.resetForm()
|
||||
})
|
||||
}
|
||||
if (config.dataType === 'dynamic' && config.propsUrl) {
|
||||
const query = {
|
||||
paramList: this.yunzhupaas.getParamList(config.templateJson) || []
|
||||
};
|
||||
getDataInterfaceRes(config.propsUrl, query).then(res => {
|
||||
let list = res.data || []
|
||||
cur.options = Array.isArray(list) ? list : [];
|
||||
this.key = +new Date()
|
||||
this.resetForm()
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
initRelationForm(componentList) {
|
||||
componentList.forEach(cur => {
|
||||
const config = cur.__config__
|
||||
if (config.yunzhupaasKey == 'relationFormAttr' || config.yunzhupaasKey == 'popupAttr') {
|
||||
const relationKey = cur.relationField.split("_yunzhupaasTable_")[0]
|
||||
componentList.forEach(item => {
|
||||
const noVisibility = Array.isArray(item.__config__.visibility) && !item
|
||||
.__config__.visibility.includes('app')
|
||||
if ((relationKey == item.id) && (noVisibility || !!item.__config__
|
||||
.noShow)) {
|
||||
cur.__config__.noShow = true
|
||||
}
|
||||
})
|
||||
}
|
||||
if (cur.__config__.children && cur.__config__.children.length) this.initRelationForm(cur
|
||||
.__config__.children)
|
||||
})
|
||||
},
|
||||
allCondition() {
|
||||
for (let key in this.formData) {
|
||||
if (!this.formData[key]) this.formData[key] = undefined
|
||||
if (this.formData[key] && Array.isArray(this.formData[key]) && !this.formData[key]
|
||||
.length) {
|
||||
this.formData[key] = undefined
|
||||
}
|
||||
}
|
||||
return this.formData
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs.dataForm.validate(valid => {
|
||||
if (!valid) return
|
||||
for (let key in this.formData) {
|
||||
if (!this.formData[key]) this.formData[key] = undefined
|
||||
if (this.formData[key] && Array.isArray(this.formData[key]) && !this.formData[key]
|
||||
.length) {
|
||||
this.formData[key] = undefined
|
||||
}
|
||||
}
|
||||
this.$emit('submit', this.formData)
|
||||
})
|
||||
},
|
||||
resetForm() {
|
||||
this.$refs.dataForm.resetFields()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
119
pages/apply/dynamicModel/components/tableCell.vue
Normal file
119
pages/apply/dynamicModel/components/tableCell.vue
Normal file
@@ -0,0 +1,119 @@
|
||||
<template>
|
||||
<uni-collapse class='collapse' accordion ref="collapse" @change="collapseChange" @click.stop>
|
||||
<uni-collapse-item :key="key">
|
||||
<template v-slot:title>
|
||||
<view class="u-font-24 u-flex">
|
||||
<view style="width: 124rpx;text-align: right;">
|
||||
<text>{{label+':'}}</text>
|
||||
</view>
|
||||
<text style="color: #606266;" class="u-m-l-28">{{$t('app.apply.expandData')}}</text>
|
||||
</view>
|
||||
</template>
|
||||
<view class="collapse-item" v-for="(item,d) in dataList" :key="d">
|
||||
<view v-if="d<allPageLen" class="item-cell-children">
|
||||
<view class="item-cell" v-for="(cld,c) in children" :key="c">
|
||||
<text
|
||||
class="item-cell-label">{{cld.labelI18nCode ? $t(cld.labelI18nCode, cld.label) : cld.label}}:</text>
|
||||
<text class="item-cell-content"
|
||||
v-if="['calculate','inputNumber'].includes(cld.__config__.yunzhupaasKey)">
|
||||
{{toThousands(item[cld.vModel],cld) }}
|
||||
</text>
|
||||
<text class="item-cell-content text-primary"
|
||||
v-else-if="cld.__config__.yunzhupaasKey === 'relationForm'"
|
||||
@click.stop="relationFormClick(item,cld)">
|
||||
{{item[cld.vModel]}}
|
||||
</text>
|
||||
<view class="item-cell-content" v-else-if="cld.yunzhupaasKey == 'sign'">
|
||||
<YunzhupaasSign v-model="item[cld.vModel]" align="left" detailed />
|
||||
</view>
|
||||
<view class="item-cell-content" v-else-if="cld.yunzhupaasKey == 'signature'">
|
||||
<YunzhupaasSignature v-model="item[cld.vModel]" align="left" detailed />
|
||||
</view>
|
||||
<view class="item-cell-content" v-else-if="cld.yunzhupaasKey == 'uploadImg'" @click.stop>
|
||||
<YunzhupaasUploadImg v-model="item[cld.vModel]" detailed simple
|
||||
v-if="item[cld.vModel]&&item[cld.vModel].length" />
|
||||
</view>
|
||||
<!-- #ifndef APP-HARMONY -->
|
||||
<view class="item-cell-content" v-else-if="cld.yunzhupaasKey == 'uploadFile'" @click.stop>
|
||||
<YunzhupaasUploadFile v-model="item[cld.vModel]" detailed
|
||||
v-if="item[cld.vModel]&&item[cld.vModel].length" align="left" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view class="item-cell-content" v-else-if="cld.yunzhupaasKey == 'rate'">
|
||||
<YunzhupaasRate v-model="item[cld.vModel]" :max="cld.count" :allowHalf="cld.allowHalf" disabled />
|
||||
</view>
|
||||
<view class="item-cell-content item-cell-slider" v-else-if="cld.yunzhupaasKey == 'slider'">
|
||||
<YunzhupaasSlider v-model="item[cld.vModel]" :min="cld.min" :max="cld.max" :step="cld.step"
|
||||
disabled />
|
||||
</view>
|
||||
<view class="item-cell-content" v-else-if="cld.yunzhupaasKey == 'input'">
|
||||
<YunzhupaasInput v-model="item[cld.vModel]" detailed showOverflow :useMask="cld.useMask"
|
||||
:maskConfig="cld.maskConfig" align='left' />
|
||||
</view>
|
||||
<text class="item-cell-content" v-else>{{item[cld.vModel]}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="loadMore" @click.stop="loadMore" v-if="!isAllData&&this.dataList.length>allPageLen">
|
||||
加载更多
|
||||
</view>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['childList', 'label', 'children', 'pageLen', 'thousands', 'thousandsField'],
|
||||
data() {
|
||||
return {
|
||||
dataList: [],
|
||||
isAllData: false,
|
||||
key: +new Date(),
|
||||
allPageLen: 3
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
childList: {
|
||||
handler(val) {
|
||||
this.dataList = val || []
|
||||
this.allPageLen = this.pageLen
|
||||
this.children.map(o => {
|
||||
if (o.childLabel.length > 4) o.childLabel = o.childLabel.substring(0, 4)
|
||||
})
|
||||
},
|
||||
immediate: true,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toThousands(val, column) {
|
||||
if (val) {
|
||||
let valList = val.toString().split('.')
|
||||
let num = Number(valList[0])
|
||||
let newVal = column.thousands ? num.toLocaleString() : num
|
||||
return valList[1] ? newVal + '.' + valList[1] : newVal
|
||||
}
|
||||
},
|
||||
relationFormClick(item, cld) {
|
||||
this.$emit('cRelationForm', item, cld)
|
||||
},
|
||||
loadMore() {
|
||||
this.allPageLen = this.childList.length
|
||||
this.isAllData = true
|
||||
this.resizeCollapse()
|
||||
},
|
||||
collapseChange(e) {
|
||||
if (!e) {
|
||||
this.isAllData = false
|
||||
setTimeout(() => {
|
||||
this.allPageLen = this.pageLen
|
||||
}, 500)
|
||||
}
|
||||
this.resizeCollapse()
|
||||
},
|
||||
resizeCollapse() {
|
||||
setTimeout(() => {
|
||||
this.$refs.collapse && this.$refs.collapse.resize()
|
||||
}, 50)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
420
pages/apply/dynamicModel/detail.vue
Normal file
420
pages/apply/dynamicModel/detail.vue
Normal file
@@ -0,0 +1,420 @@
|
||||
<template>
|
||||
<view class="dynamicModel-form-v yunzhupaas-wrap yunzhupaas-wrap-form" v-if="showPage">
|
||||
<Parser :formConf="formConf" :formData="formData" ref="dynamicForm" v-if="!loading" :key="key"
|
||||
@toDetail="toDetail" />
|
||||
<view class="u-m-t-20 dataLog-box u-flex-col u-m-b-20" v-if="formConf.dataLog && !setting.noDataLog">
|
||||
<view class="title u-flex">
|
||||
<u-icon name=" icon-ym-generator-menu" custom-prefix="icon-ym"></u-icon>
|
||||
<text class="u-m-l-10">修改记录</text>
|
||||
</view>
|
||||
<view class="dataLog-v" v-if="dataLogList.length">
|
||||
<dataLog :dataLogList="dataLogList"></dataLog>
|
||||
</view>
|
||||
<NoData v-else paddingTop="0" backgroundColor="#fff" zIndex="9"></NoData>
|
||||
</view>
|
||||
<view class="buttom-actions">
|
||||
<CustomButton class="u-flex buttom-btn-left-inner" v-if="showMoreBtn" btnText="更多" btnType="more"
|
||||
iconName="more-dot-fill" size="28" @handleBtn="showAction = $event" :btnLoading="loading" />
|
||||
<template v-if="showEditBtn">
|
||||
<CustomButton class="u-flex buttom-btn-left-inner" :btnText="$t('common.cancelText')"
|
||||
btnIcon="icon-ym icon-ym-add-cancel" customIcon :btnLoading="loading" />
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="handleEdit" :loading="loading">
|
||||
{{labelS.btn_edit}}
|
||||
</u-button>
|
||||
</template>
|
||||
<u-button class="cancel" @click.stop="yunzhupaas.goBack()"
|
||||
v-if="!showEditBtn && !showMoreBtn">{{$t('common.cancelText')}}</u-button>
|
||||
</view>
|
||||
<u-select :list="actionList" v-model="showAction" @confirm="selectBtnconfirm" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import NoData from '@/components/noData'
|
||||
import CustomButton from '@/components/CustomButton'
|
||||
import {
|
||||
getConfigData,
|
||||
getOnlineLog,
|
||||
getModelInfo,
|
||||
getDataChange,
|
||||
launchFlow
|
||||
} from "@/api/apply/visualDev";
|
||||
import {
|
||||
getRelationFormDetail,
|
||||
getDataInterfaceRes
|
||||
} from "@/api/common.js";
|
||||
import Parser from "./components/detail/Parser";
|
||||
import dataLog from '@/components/dataLog'
|
||||
import deepClone from '../../../uni_modules/vk-uview-ui/libs/function/deepClone';
|
||||
export default {
|
||||
components: {
|
||||
Parser,
|
||||
dataLog,
|
||||
NoData,
|
||||
CustomButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataLogList: [],
|
||||
actionList: [],
|
||||
showAction: false,
|
||||
showPage: false,
|
||||
loading: true,
|
||||
isPreview: "0",
|
||||
modelId: "",
|
||||
formConf: {},
|
||||
formData: {},
|
||||
dataForm: {
|
||||
id: "",
|
||||
data: "",
|
||||
},
|
||||
btnType: "",
|
||||
formPermissionList: {},
|
||||
formList: [],
|
||||
labelS: {}
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.$t('common.detailText')
|
||||
})
|
||||
let config = JSON.parse(this.yunzhupaas.base64.decode(option.config));
|
||||
this.formPermissionList = !config.currentMenu ? [] :
|
||||
JSON.parse(decodeURIComponent(config.currentMenu));
|
||||
this.formList = this.formPermissionList.formList;
|
||||
this.btnType = config.btnType || "";
|
||||
this.labelS = config.labelS || {
|
||||
btn_edit: this.$t('common.editText')
|
||||
}
|
||||
this.modelId = config.modelId;
|
||||
this.isPreview = config.isPreview || "0";
|
||||
this.dataForm.id = config.id || "";
|
||||
this.setting = config;
|
||||
this.getConfigData();
|
||||
uni.$on("refresh", () => {
|
||||
this.getConfigData();
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
showMoreBtn() {
|
||||
if (this.actionList.length && !this.setting?.noShowBtn || 0 && this.setting?.noDataLog) return true
|
||||
return false
|
||||
},
|
||||
showEditBtn() {
|
||||
if (this.btnType === 'btn_edit' && !this.setting.noShowBtn && this.setting.enableEdit) return true
|
||||
return false
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
setTimeout(() => {
|
||||
uni.$emit('initCollapse')
|
||||
}, 100)
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off("refresh");
|
||||
},
|
||||
methods: {
|
||||
// 自定义按钮事件
|
||||
selectBtnconfirm(e) {
|
||||
var i = this.actionList.findIndex((item) => {
|
||||
return item.value == e[0].value
|
||||
})
|
||||
const item = this.actionList[i].actionConfig
|
||||
const row = this.formData
|
||||
// 自定义启用规则判断
|
||||
if (item.btnType == 1) this.handlePopup(item, row)
|
||||
if (item.btnType == 2) this.handleScriptFunc(item, row)
|
||||
if (item.btnType == 3) this.handleInterface(item, row)
|
||||
if (item.btnType == 4) this.handleLaunchFlow(item, [row])
|
||||
},
|
||||
//自定义按钮发起流程
|
||||
handleLaunchFlow(item, records) {
|
||||
const data = deepClone(item.launchFlow)
|
||||
let dataList = [];
|
||||
for (let i = 0; i < records.length; i++) {
|
||||
dataList.push(this.yunzhupaas.getLaunchFlowParamList(data.transferList, records[i], this.getRowKey));
|
||||
}
|
||||
const query = {
|
||||
template: data.flowId,
|
||||
btnCode: item.value,
|
||||
currentUser: data.currentUser,
|
||||
customUser: data.customUser,
|
||||
initiator: data.initiator,
|
||||
dataList
|
||||
};
|
||||
launchFlow(query, this.modelId).then(res => {
|
||||
this.$u.toast(res.msg)
|
||||
});
|
||||
},
|
||||
//自定义按钮弹窗操作
|
||||
handlePopup(item, row) {
|
||||
let data = {
|
||||
config: item,
|
||||
modelId: this.modelId,
|
||||
id: row.id,
|
||||
row,
|
||||
}
|
||||
data = encodeURIComponent(JSON.stringify(data))
|
||||
uni.navigateTo({
|
||||
url: '/pages/apply/customBtn/index?data=' + data
|
||||
})
|
||||
},
|
||||
//自定义按钮JS操作
|
||||
handleScriptFunc(item, row) {
|
||||
const parameter = {
|
||||
data: row,
|
||||
refresh: this.initData,
|
||||
onlineUtils: this.yunzhupaas.onlineUtils,
|
||||
}
|
||||
const func = this.yunzhupaas.getScriptFunc.call(this, item.func)
|
||||
if (!func) return
|
||||
func.call(this, parameter)
|
||||
},
|
||||
//自定义按钮接口操作
|
||||
handleInterface(item, row, index) {
|
||||
const handlerData = () => {
|
||||
getModelInfo(this.modelId, row.id).then(res => {
|
||||
const dataForm = res.data || {};
|
||||
if (!dataForm.data) return;
|
||||
const data = {
|
||||
...JSON.parse(dataForm.data),
|
||||
id: row.id
|
||||
};
|
||||
handlerInterface(data);
|
||||
})
|
||||
}
|
||||
const handlerInterface = (data) => {
|
||||
let query = {
|
||||
paramList: this.yunzhupaas.getParamList(item.templateJson, data) || [],
|
||||
}
|
||||
getDataInterfaceRes(item.interfaceId, query).then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none'
|
||||
})
|
||||
if (item.isRefresh) this.initData();
|
||||
})
|
||||
}
|
||||
const handleFun = () => {
|
||||
handlerData();
|
||||
};
|
||||
if (!item.useConfirm) return handleFun()
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: item.confirmTitle || '确认执行此操作',
|
||||
success: (res) => {
|
||||
if (!res.cancel) handleFun()
|
||||
}
|
||||
})
|
||||
},
|
||||
getOnlineLog() {
|
||||
getOnlineLog(this.setting.modelId, this.setting.id).then(res => {
|
||||
this.dataLogList = res.data.list || []
|
||||
})
|
||||
},
|
||||
getConfigData() {
|
||||
this.loading = true;
|
||||
getConfigData(this.modelId).then((res) => {
|
||||
if (res.code !== 200 || !res.data) {
|
||||
uni.showToast({
|
||||
title: "暂无此页面",
|
||||
icon: "none",
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.formConf = res.data.formData ? JSON.parse(res.data.formData) : {};
|
||||
this.actionList = this.formConf?.customBtns || []
|
||||
this.actionList.map((o) => {
|
||||
if (o.labelI18nCode) o.label = this.$t(o.labelI18nCode, o.label)
|
||||
})
|
||||
this.beforeInit(this.formConf.fields || []);
|
||||
this.showPage = true;
|
||||
this.key = +new Date();
|
||||
this.initData();
|
||||
});
|
||||
},
|
||||
beforeInit(fields) {
|
||||
const loop = (list) => {
|
||||
for (var index = 0; index < list.length; index++) {
|
||||
const config = list[index].__config__;
|
||||
if (config.children && config.children.length) loop(config.children);
|
||||
if (config.yunzhupaasKey == "tableGrid") {
|
||||
let newList = [];
|
||||
for (var i = 0; i < config.children.length; i++) {
|
||||
let element = config.children[i];
|
||||
for (var j = 0; j < element.__config__.children.length; j++) {
|
||||
let item = element.__config__.children[j];
|
||||
newList.push(...item.__config__.children);
|
||||
}
|
||||
}
|
||||
list.splice(index, 1, ...newList);
|
||||
}
|
||||
}
|
||||
};
|
||||
loop(fields);
|
||||
},
|
||||
initData() {
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
let extra = {
|
||||
modelId: this.modelId,
|
||||
id: this.dataForm.id,
|
||||
type: 2,
|
||||
};
|
||||
uni.setStorageSync('dynamicModelExtra', extra)
|
||||
this.getRelationFormDetail()
|
||||
} else {
|
||||
this.loading = false;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.getOnlineLog()
|
||||
})
|
||||
this.key = +new Date();
|
||||
});
|
||||
},
|
||||
getRelationFormDetail() {
|
||||
const processResponse = (res) => {
|
||||
this.dataForm = res.data;
|
||||
this.loading = false;
|
||||
if (!this.dataForm.data) return;
|
||||
this.formData = {
|
||||
...JSON.parse(this.dataForm.data),
|
||||
id: this.dataForm.id,
|
||||
};
|
||||
this.fillFormData(this.formConf, this.formData);
|
||||
this.initRelationForm(this.formConf.fields);
|
||||
};
|
||||
let requestParams = {
|
||||
id: this.dataForm.id
|
||||
};
|
||||
if (this.setting?.sourceRelationForm) {
|
||||
if (this.setting.propsValue) requestParams.propsValue = this.setting.propsValue;
|
||||
}
|
||||
getDataChange(requestParams, this.modelId).then(res => {
|
||||
processResponse(res)
|
||||
}).catch(err => {
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
fillFormData(form, data) {
|
||||
const loop = (list, parent) => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let item = list[i];
|
||||
if (item.__vModel__) {
|
||||
if (
|
||||
item.__config__.yunzhupaasKey === "relationForm" ||
|
||||
item.__config__.yunzhupaasKey === "popupSelect"
|
||||
) {
|
||||
item.__config__.defaultValue = data[item.__vModel__ + "_id"];
|
||||
this.$set(item, "name", item.__config__.defaultValue || "");
|
||||
} else {
|
||||
let val = data.hasOwnProperty(item.__vModel__) ?
|
||||
data[item.__vModel__] :
|
||||
item.__config__.defaultValue;
|
||||
item.__config__.defaultValue = val;
|
||||
}
|
||||
if (this.formPermissionList.useFormPermission) {
|
||||
let id = item.__config__.isSubTable ?
|
||||
parent.__vModel__ + "-" + item.__vModel__ :
|
||||
item.__vModel__;
|
||||
let noShow = true;
|
||||
if (this.formList && this.formList.length) {
|
||||
noShow = !this.formList.some((o) => o.enCode === id);
|
||||
}
|
||||
noShow = item.__config__.noShow ? item.__config__.noShow : noShow;
|
||||
this.$set(item.__config__, "noShow", noShow);
|
||||
}
|
||||
} else {
|
||||
if (['relationFormAttr', 'popupAttr'].includes(item.__config__.yunzhupaasKey)) {
|
||||
item.__config__.defaultValue =
|
||||
data[item.relationField.split('_yunzhupaasTable_')[0] + '_' + item.showField];
|
||||
}
|
||||
}
|
||||
if (
|
||||
item.__config__ &&
|
||||
item.__config__.children &&
|
||||
Array.isArray(item.__config__.children)
|
||||
) {
|
||||
loop(item.__config__.children, item);
|
||||
}
|
||||
}
|
||||
};
|
||||
loop(form.fields);
|
||||
this.loading = false;
|
||||
},
|
||||
initRelationForm(componentList) {
|
||||
componentList.forEach((cur) => {
|
||||
const config = cur.__config__;
|
||||
if (
|
||||
config.yunzhupaasKey == "relationFormAttr" ||
|
||||
config.yunzhupaasKey == "popupAttr"
|
||||
) {
|
||||
const relationKey = cur.relationField.split("_yunzhupaasTable_")[0];
|
||||
componentList.forEach((item) => {
|
||||
const noVisibility =
|
||||
Array.isArray(item.__config__.visibility) &&
|
||||
!item.__config__.visibility.includes("app");
|
||||
if (
|
||||
relationKey == item.__vModel__ &&
|
||||
(noVisibility || !!item.__config__.noShow) && !cur.__vModel__
|
||||
) {
|
||||
cur.__config__.noShow = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (cur.__config__.children && cur.__config__.children.length)
|
||||
this.initRelationForm(cur.__config__.children);
|
||||
});
|
||||
},
|
||||
toDetail(item) {
|
||||
const id = item.__config__.defaultValue;
|
||||
if (!id) return;
|
||||
let config = {
|
||||
modelId: item.modelId,
|
||||
id: id,
|
||||
formTitle: "详情",
|
||||
noShowBtn: 1,
|
||||
noDataLog: 1,
|
||||
sourceRelationForm: item?.sourceRelationForm || false,
|
||||
propsValue: item?.propsValue || ''
|
||||
};
|
||||
this.$nextTick(() => {
|
||||
const url =
|
||||
"/pages/apply/dynamicModel/detail?config=" +
|
||||
this.yunzhupaas.base64.encode(JSON.stringify(config));
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
});
|
||||
},
|
||||
handleEdit() {
|
||||
if (this.setting.disableEdit) return;
|
||||
const currentMenu = encodeURIComponent(JSON.stringify(this.formPermissionList));
|
||||
let config = {
|
||||
modelId: this.modelId,
|
||||
isPreview: this.isPreview,
|
||||
id: this.setting.id,
|
||||
btnType: "btn_edit",
|
||||
currentMenu,
|
||||
list: this.setting.list,
|
||||
index: this.setting.index,
|
||||
};
|
||||
const url =
|
||||
"/pages/apply/dynamicModel/form?config=" +
|
||||
this.yunzhupaas.base64.encode(JSON.stringify(config));
|
||||
uni.navigateTo({
|
||||
url: url,
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
</style>
|
||||
285
pages/apply/dynamicModel/form.vue
Normal file
285
pages/apply/dynamicModel/form.vue
Normal file
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<view class="dynamicModel-form-v yunzhupaas-wrap yunzhupaas-wrap-form" v-if="showPage">
|
||||
<YunzhupaasParser :formConf="formConf" ref="dynamicForm" v-if="!loading" @submit="sumbitForm" :key="key" />
|
||||
<view class="buttom-actions" v-if="btnType === 'btn_edit' || btnType === 'btn_add'">
|
||||
<CustomButton class="u-flex buttom-btn-left-inner" :btnText="getCancelText"
|
||||
btnIcon="icon-ym icon-ym-add-cancel" customIcon :btnLoading="btnLoading" />
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="submit" :loading="btnLoading">
|
||||
{{getOkText}}
|
||||
</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import CustomButton from '@/components/CustomButton'
|
||||
import {
|
||||
getConfigData,
|
||||
createModel,
|
||||
updateModel,
|
||||
getModelInfo
|
||||
} from '@/api/apply/visualDev'
|
||||
export default {
|
||||
components: {
|
||||
CustomButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webType: '',
|
||||
showPage: false,
|
||||
btnLoading: false,
|
||||
loading: true,
|
||||
isPreview: '0',
|
||||
modelId: '',
|
||||
formConf: {},
|
||||
formData: {},
|
||||
dataForm: {
|
||||
id: '',
|
||||
data: ''
|
||||
},
|
||||
btnType: '',
|
||||
formPermissionList: {},
|
||||
formList: [],
|
||||
key: +new Date(),
|
||||
config: {},
|
||||
clickType: 'submit',
|
||||
prevDis: false,
|
||||
nextDis: false,
|
||||
index: 0,
|
||||
userInfo: {},
|
||||
isAdd: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
getOkText() {
|
||||
const text = this.formConf.confirmButtonTextI18nCode ?
|
||||
this.$t(this.formConf.confirmButtonTextI18nCode, this.formConf.confirmButtonText) :
|
||||
this.formConf.confirmButtonText;
|
||||
return text || this.$t('common.okText');
|
||||
},
|
||||
getCancelText() {
|
||||
const text = this.formConf.cancelButtonTextI18nCode ?
|
||||
this.$t(this.formConf.cancelButtonTextI18nCode, this.formConf.cancelButtonText) :
|
||||
this.formConf.cancelButtonText;
|
||||
return text || this.$t('common.cancelText');
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.userInfo = uni.getStorageSync('userInfo') || {}
|
||||
this.config = JSON.parse(this.yunzhupaas.base64.decode(option.config))
|
||||
this.index = this.config.index
|
||||
this.formPermissionList = !this.config.currentMenu ? [] : JSON.parse(decodeURIComponent(this.config
|
||||
.currentMenu))
|
||||
this.formList = this.formPermissionList.formList
|
||||
this.btnType = this.config.btnType || ''
|
||||
this.modelId = this.config.modelId;
|
||||
this.isPreview = this.config.isPreview || '0';
|
||||
this.dataForm.id = this.config.id || ''
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.dataForm.id ? this.$t('common.editText') : this.$t('common.addText')
|
||||
})
|
||||
this.getConfigData()
|
||||
},
|
||||
methods: {
|
||||
getConfigData() {
|
||||
getConfigData(this.modelId).then(res => {
|
||||
if (res.code !== 200 || !res.data) {
|
||||
uni.showToast({
|
||||
title: '暂无此页面',
|
||||
icon: 'none',
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
this.formConf = res.data.formData ? JSON.parse(res.data.formData) : {};
|
||||
this.showPage = true
|
||||
this.initData()
|
||||
})
|
||||
},
|
||||
initData() {
|
||||
this.$nextTick(() => {
|
||||
if (this.dataForm.id) {
|
||||
let extra = {
|
||||
modelId: this.modelId,
|
||||
id: this.dataForm.id,
|
||||
type: 1
|
||||
}
|
||||
uni.setStorageSync('dynamicModelExtra', extra)
|
||||
getModelInfo(this.modelId, this.dataForm.id).then(res => {
|
||||
this.dataForm = res.data
|
||||
if (!this.dataForm.data) return
|
||||
this.formData = {
|
||||
...JSON.parse(this.dataForm.data),
|
||||
id: this.dataForm.id
|
||||
}
|
||||
this.fillFormData(this.formConf, this.formData)
|
||||
this.$nextTick(() => {
|
||||
this.loading = false
|
||||
})
|
||||
})
|
||||
} else {
|
||||
this.isAdd = true
|
||||
this.formData = {}
|
||||
this.loading = false
|
||||
this.fillFormData(this.formConf, this.formData)
|
||||
}
|
||||
this.key = +new Date()
|
||||
})
|
||||
},
|
||||
fillFormData(form, data) {
|
||||
this.key = +new Date()
|
||||
const loop = (list, parent) => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let item = list[i]
|
||||
let vModel = item.__vModel__
|
||||
let config = item.__config__
|
||||
if (vModel) {
|
||||
let val = data.hasOwnProperty(vModel) ? data[vModel] : config.defaultValue
|
||||
if (!config.isSubTable) config.defaultValue = val
|
||||
if (this.isAdd || config.isSubTable) { //新增时候,默认当前
|
||||
if (config.defaultCurrent) {
|
||||
if (config.yunzhupaasKey === 'datePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
let format = this.yunzhupaas.handelFormat(item.format)
|
||||
let dateStr = this.yunzhupaas.toDate(new Date().getTime(), format)
|
||||
let time = format === 'yyyy' ? '-01-01 00:00:00' : format === 'yyyy-MM' ?
|
||||
'-01 00:00:00' : format === 'yyyy-MM-dd' ?
|
||||
' 00:00:00' : ''
|
||||
val = new Date(dateStr + time).getTime()
|
||||
config.defaultValue = val
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'timePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
config.defaultValue = this.yunzhupaas.toDate(new Date(), item.format)
|
||||
}
|
||||
}
|
||||
const organizeIdList = this.userInfo.organizeIdList
|
||||
if (config.yunzhupaasKey === 'organizeSelect' && Array.isArray(organizeIdList) &&
|
||||
organizeIdList.length) {
|
||||
config.defaultValue = item.multiple ? [organizeIdList] : organizeIdList
|
||||
}
|
||||
const departmentId = this.userInfo.departmentId
|
||||
if (config.yunzhupaasKey === 'depSelect' && departmentId) {
|
||||
config.defaultValue = item.multiple ? [departmentId] : departmentId;
|
||||
}
|
||||
const positionIds = this.userInfo.positionIds
|
||||
if (config.yunzhupaasKey === 'posSelect' && Array.isArray(positionIds) && positionIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? positionIds.map(o => o.id) : positionIds[
|
||||
0].id
|
||||
}
|
||||
const roleIds = this.userInfo.roleIds
|
||||
if (config.yunzhupaasKey === 'roleSelect' && Array.isArray(roleIds) && roleIds.length) {
|
||||
config.defaultValue = item.multiple ? roleIds : roleIds[0];
|
||||
}
|
||||
const groupIds = this.userInfo.groupIds
|
||||
if (config.yunzhupaasKey === 'groupSelect' && Array.isArray(groupIds) && groupIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? groupIds : groupIds[0];
|
||||
}
|
||||
const userId = this.userInfo.userId
|
||||
if (config.yunzhupaasKey === 'userSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId] : userId;
|
||||
}
|
||||
if (config.yunzhupaasKey === 'usersSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId + '--user'] : userId + '--user';
|
||||
}
|
||||
if (config.yunzhupaasKey === 'sign' && this.userInfo.signImg) {
|
||||
config.defaultValue = this.userInfo.signImg
|
||||
}
|
||||
}
|
||||
}
|
||||
const btn_detail = this.$permission.hasBtnP('btn_detail', this.formPermissionList
|
||||
.menuId)
|
||||
const btn_edit = this.$permission.hasBtnP('btn_edit', this.formPermissionList
|
||||
.menuId)
|
||||
if (!!this.dataForm.id && !btn_edit && btn_detail) item.disabled = btn_detail
|
||||
let noShow = !config.noShow ? false : config.noShow
|
||||
let isVisibility = false
|
||||
if (!config.visibility || (Array.isArray(config.visibility) && config.visibility.includes(
|
||||
'app'))) isVisibility = true
|
||||
this.$set(config, 'isVisibility', isVisibility)
|
||||
if (this.formPermissionList.useFormPermission) {
|
||||
let id = config.isSubTable ? parent.__vModel__ + '-' + vModel : vModel
|
||||
noShow = true
|
||||
if (this.formList && this.formList.length) {
|
||||
noShow = !this.formList.some(o => o.enCode === id)
|
||||
}
|
||||
noShow = config.noShow ? config.noShow : noShow
|
||||
this.$set(config, 'noShow', noShow)
|
||||
}
|
||||
} else {
|
||||
let noShow = config.noShow ? config.noShow : false,
|
||||
isVisibility = false
|
||||
if (!config.visibility || (Array.isArray(config.visibility) && config.visibility.includes(
|
||||
'app'))) isVisibility = true
|
||||
this.$set(config, 'isVisibility', isVisibility)
|
||||
this.$set(config, 'noShow', noShow)
|
||||
}
|
||||
if (config && config.children && Array.isArray(config.children)) {
|
||||
loop(config.children, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
loop(form.fields)
|
||||
form.formData = data
|
||||
this.key = +new Date()
|
||||
},
|
||||
sumbitForm(data, callback) {
|
||||
if (!data) return
|
||||
this.btnLoading = true
|
||||
const formData = {
|
||||
...this.formData,
|
||||
...data
|
||||
}
|
||||
this.dataForm.data = JSON.stringify(formData)
|
||||
if (callback && typeof callback === "function") callback()
|
||||
const formMethod = this.dataForm.id ? updateModel : createModel
|
||||
formMethod(this.modelId, this.dataForm).then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
if (this.clickType == 'save_add') {
|
||||
this.key = +new Date()
|
||||
this.$nextTick(() => {
|
||||
this.$refs.dynamicForm && this.$refs
|
||||
.dynamicForm.resetForm()
|
||||
})
|
||||
}
|
||||
this.btnLoading = false
|
||||
this.initData()
|
||||
if (this.clickType != 'save_proceed' && this.clickType !=
|
||||
'save_add') {
|
||||
uni.$emit('refresh')
|
||||
uni.navigateBack()
|
||||
}
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.btnLoading = false
|
||||
})
|
||||
},
|
||||
commonSubmit(type) {
|
||||
this.clickType = type
|
||||
this.submit(type)
|
||||
},
|
||||
submit(type) {
|
||||
this.clickType = type
|
||||
if (this.isPreview == '1') return this.$u.toast('功能预览不支持数据保存')
|
||||
this.$refs.dynamicForm && this.$refs.dynamicForm.submitForm()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
</style>
|
||||
120
pages/apply/dynamicModel/index.vue
Normal file
120
pages/apply/dynamicModel/index.vue
Normal file
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<view class="dynamicModel-v">
|
||||
<Form v-if="webType == 1" :config="config" :modelId="modelId" :isPreview="isPreview" />
|
||||
<List v-if="webType == 2 || webType == 4" :config="config" :modelId="modelId" :isPreview="isPreview"
|
||||
:title="title" :menuId="menuId" ref="List" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Form from "./components/form/index.vue";
|
||||
import List from "./components/list/index.vue";
|
||||
import {
|
||||
getFlowStartFormId
|
||||
} from "@/api/workFlow/flowEngine";
|
||||
import {
|
||||
getConfigData
|
||||
} from "@/api/apply/visualDev";
|
||||
import {
|
||||
useBaseStore
|
||||
} from '@/store/modules/base'
|
||||
const baseStore = useBaseStore()
|
||||
|
||||
export default {
|
||||
name: "dynamicModel",
|
||||
components: {
|
||||
Form,
|
||||
List,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webType: "",
|
||||
showPage: false,
|
||||
isPreview: false,
|
||||
modelId: "",
|
||||
menuId: "",
|
||||
title: "",
|
||||
config: {},
|
||||
preview: false,
|
||||
flowId: '',
|
||||
enableFlow: 0,
|
||||
};
|
||||
},
|
||||
onLoad(obj) {
|
||||
baseStore.getDictionaryDataAll()
|
||||
this.config = JSON.parse(this.yunzhupaas.base64.decode(obj.config)) || {};
|
||||
this.isPreview = this.config.isPreview || false;
|
||||
this.enableFlow = this.config.type === 9 ? 1 : 0;
|
||||
this.title = this.config.fullName || "";
|
||||
this.menuId = this.config.id || "";
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.title,
|
||||
});
|
||||
if (!this.enableFlow) return this.getConfigData();
|
||||
this.flowId = this.config.moduleId
|
||||
this.getModelId()
|
||||
},
|
||||
methods: {
|
||||
// 获取流程版本ID和发起节点表单ID
|
||||
getModelId() {
|
||||
getFlowStartFormId(this.flowId).then(res => {
|
||||
if (!res.data || !res.data.formId) return;
|
||||
this.config.moduleId = res.data.formId
|
||||
this.getConfigData();
|
||||
})
|
||||
},
|
||||
getConfigData() {
|
||||
getConfigData(this.config.moduleId, undefined).then((res) => {
|
||||
if (res.code !== 200 || !res.data) return this.handleError('暂无此页面')
|
||||
if (this.enableFlow && res.data.webType == 1) return this.jump();
|
||||
this.config = {
|
||||
...res.data,
|
||||
...this.config,
|
||||
enableFlow: this.enableFlow,
|
||||
flowId: this.flowId
|
||||
};
|
||||
this.showPage = true;
|
||||
this.isPreview = !!this.config.isPreview;
|
||||
this.modelId = this.config.moduleId;
|
||||
this.menuId = this.config.id || "";
|
||||
this.webType = this.config.webType || 2;
|
||||
this.title = this.config.fullName || "";
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.title,
|
||||
});
|
||||
});
|
||||
},
|
||||
jump() {
|
||||
const config = {
|
||||
id: "",
|
||||
flowId: this.flowId,
|
||||
opType: "-1",
|
||||
hideCancelBtn: true,
|
||||
hideSaveBtn: true
|
||||
};
|
||||
uni.redirectTo({
|
||||
url: "/pages/workFlow/flowBefore/index?config=" +
|
||||
this.yunzhupaas.base64.encode(JSON.stringify(config)),
|
||||
fail: () => {
|
||||
this.$u.toast("暂无此页面");
|
||||
},
|
||||
});
|
||||
},
|
||||
handleError(msg) {
|
||||
this.$u.toast(msg);
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.dynamicModel-v {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
196
pages/apply/dynamicModel/scanForm.vue
Normal file
196
pages/apply/dynamicModel/scanForm.vue
Normal file
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<view class="dynamicModel-v">
|
||||
<template v-if="showPage">
|
||||
<view class="yunzhupaas-wrap yunzhupaas-wrap-form" v-if="config.mt == 2">
|
||||
<YunzhupaasParser :formConf="formConf" ref="dynamicForm" @submit="sumbitForm" :key="key" />
|
||||
</view>
|
||||
<template v-else>
|
||||
<FlowForm ref="flowForm" />
|
||||
</template>
|
||||
</template>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import FlowForm from '@/pages/workFlow/flowBefore/flowForm'
|
||||
import {
|
||||
getConfigData,
|
||||
getModelInfo
|
||||
} from '@/api/apply/visualDev'
|
||||
export default {
|
||||
name: 'scanForm',
|
||||
components: {
|
||||
FlowForm
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
webType: '',
|
||||
showPage: false,
|
||||
origin: '',
|
||||
id: '',
|
||||
config: {},
|
||||
formConf: {},
|
||||
key: +new Date(),
|
||||
isAdd: false,
|
||||
userInfo: {}
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.userInfo = uni.getStorageSync('userInfo') || {}
|
||||
this.config = JSON.parse(option.config)
|
||||
this.initData()
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
this.showPage = false
|
||||
if (this.config.mt == 2) {
|
||||
this.getConfigData()
|
||||
} else {
|
||||
this.isAdd = true
|
||||
let data = {
|
||||
flowId: this.config.fid,
|
||||
id: this.config.pid,
|
||||
formType: 2,
|
||||
opType: this.config.opt,
|
||||
taskId: this.config.ftid
|
||||
}
|
||||
this.showPage = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.flowForm.init(data)
|
||||
})
|
||||
}
|
||||
},
|
||||
getConfigData() {
|
||||
getConfigData(this.config.mid).then(res => {
|
||||
if (res.code !== 200 || !res.data) {
|
||||
uni.showToast({
|
||||
title: '暂无此页面',
|
||||
icon: 'none',
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
this.formConf = JSON.parse(res.data.formData)
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.data.fullName
|
||||
})
|
||||
let extra = {
|
||||
modelId: this.config.mid,
|
||||
id: this.config.id,
|
||||
type: this.config.mt
|
||||
}
|
||||
uni.setStorageSync('dynamicModelExtra', extra)
|
||||
getModelInfo(this.config.mid, this.config.id).then(res => {
|
||||
if (!res.data.data) return
|
||||
let formData = JSON.parse(res.data.data)
|
||||
this.fillFormData(this.formConf, formData)
|
||||
this.$nextTick(() => {
|
||||
this.showPage = true
|
||||
this.key = +new Date()
|
||||
})
|
||||
})
|
||||
})
|
||||
},
|
||||
fillFormData(form, data) {
|
||||
const loop = list => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
let item = list[i]
|
||||
let vModel = item.__vModel__
|
||||
let config = item.__config__
|
||||
if (vModel) {
|
||||
let val = data.hasOwnProperty(vModel) ? data[vModel] : config.defaultValue
|
||||
if (!config.isSubTable) config.defaultValue = val
|
||||
if (this.isAdd || config.isSubTable) { //新增时候,默认当前
|
||||
if (config.defaultCurrent) {
|
||||
if (config.yunzhupaasKey === 'datePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
let format = this.yunzhupaas.handelFormat(item.format)
|
||||
let dateStr = this.yunzhupaas.toDate(new Date().getTime(), format)
|
||||
let time = format === 'yyyy' ? '-01-01 00:00:00' : format === 'yyyy-MM' ?
|
||||
'-01 00:00:00' : format === 'yyyy-MM-dd' ?
|
||||
' 00:00:00' : ''
|
||||
val = new Date(dateStr + time).getTime()
|
||||
config.defaultValue = val
|
||||
}
|
||||
}
|
||||
if (config.yunzhupaasKey === 'timePicker') {
|
||||
if (!data.hasOwnProperty(vModel)) {
|
||||
config.defaultValue = this.yunzhupaas.toDate(new Date(), item.format)
|
||||
}
|
||||
}
|
||||
const organizeIdList = this.userInfo.organizeIdList
|
||||
if (config.yunzhupaasKey === 'organizeSelect' && Array.isArray(organizeIdList) &&
|
||||
organizeIdList.length) {
|
||||
config.defaultValue = item.multiple ? [organizeIdList] : organizeIdList
|
||||
}
|
||||
const departmentId = this.userInfo.departmentId
|
||||
if (config.yunzhupaasKey === 'depSelect' && departmentId) {
|
||||
config.defaultValue = item.multiple ? [departmentId] : departmentId;
|
||||
}
|
||||
const positionIds = this.userInfo.positionIds
|
||||
if (config.yunzhupaasKey === 'posSelect' && Array.isArray(positionIds) && positionIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? positionIds.map(o => o.id) : positionIds[
|
||||
0].id
|
||||
}
|
||||
const roleIds = this.userInfo.roleIds
|
||||
if (config.yunzhupaasKey === 'roleSelect' && Array.isArray(roleIds) && roleIds.length) {
|
||||
config.defaultValue = item.multiple ? roleIds : roleIds[0];
|
||||
}
|
||||
const groupIds = this.userInfo.groupIds
|
||||
if (config.yunzhupaasKey === 'groupSelect' && Array.isArray(groupIds) && groupIds
|
||||
.length) {
|
||||
config.defaultValue = item.multiple ? groupIds : groupIds[0];
|
||||
}
|
||||
const userId = this.userInfo.userId
|
||||
if (config.yunzhupaasKey === 'userSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId] : userId;
|
||||
}
|
||||
if (config.yunzhupaasKey === 'usersSelect' && userId) {
|
||||
config.defaultValue = item.multiple ? [userId + '--user'] : userId + '--user';
|
||||
}
|
||||
if (config.yunzhupaasKey === 'sign' && this.userInfo.signImg) {
|
||||
config.defaultValue = this.userInfo.signImg
|
||||
}
|
||||
}
|
||||
}
|
||||
this.$set(item, 'disabled', true)
|
||||
let noShow = !item.__config__.noShow ? false : item.__config__.noShow
|
||||
let isVisibility = false
|
||||
if (!item.__config__.visibility || (Array.isArray(item.__config__.visibility) && item
|
||||
.__config__.visibility.includes('app'))) isVisibility = true
|
||||
this.$set(item.__config__, 'isVisibility', isVisibility)
|
||||
this.$set(item.__config__, 'noShow', noShow)
|
||||
} else {
|
||||
let noShow = false,
|
||||
isVisibility = false
|
||||
if (!item.__config__.visibility || (Array.isArray(item.__config__.visibility) && item
|
||||
.__config__.visibility.includes('app'))) isVisibility = true
|
||||
this.$set(item.__config__, 'isVisibility', isVisibility)
|
||||
this.$set(item.__config__, 'noShow', noShow)
|
||||
}
|
||||
if (item.__config__ && item.__config__.yunzhupaasKey !== 'table' && item.__config__.children && Array
|
||||
.isArray(item.__config__.children)) {
|
||||
loop(item.__config__.children)
|
||||
}
|
||||
}
|
||||
}
|
||||
loop(form.fields)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.dynamicModel-v {
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
23
pages/apply/externalLink/index.vue
Normal file
23
pages/apply/externalLink/index.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<view>
|
||||
<web-view :src="url"></web-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
url: ''
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.url = decodeURIComponent(option.url)
|
||||
const title = option.fullName || ''
|
||||
if (option.type == 5 || !title) return
|
||||
uni.setNavigationBarTitle({
|
||||
title
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
186
pages/apply/interPage/signInvokeList.vue
Normal file
186
pages/apply/interPage/signInvokeList.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<view class="">
|
||||
<NoData v-if="!signListInvoke.length"></NoData>
|
||||
<view class="page_v u-flex-col" v-else>
|
||||
<view v-for="(item,index) in signListInvoke" :key="index" :class="item.isDefault ? 'active' : '' "
|
||||
class="lists_box" @click="setMainSignInvoke(item,index)">
|
||||
<view class="signImgBox">
|
||||
<image :src="item.signImg" mode="scaleToFill" class="signImg"></image>
|
||||
</view>
|
||||
<view class="icon-checked-box" v-if="item.isDefault==1">
|
||||
<view class="icon-checked">
|
||||
<u-icon name="checkbox-mark" color="#fff" size="28"></u-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="flowBefore-actions">
|
||||
<u-button class="buttom-btn" @click.stop="eventLauncher('cancel')">{{$t('common.cancelText')}}</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="eventLauncher('confirm')">{{$t('common.okText')}}</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import NoData from "@/components/noData";
|
||||
import {
|
||||
getSignImgList
|
||||
} from "@/api/common";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
NoData
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
signListInvoke: [],
|
||||
};
|
||||
},
|
||||
async onLoad(config) {
|
||||
this.signListInvoke = await this.getSignData()
|
||||
this.clearChoose()
|
||||
let val = decodeURIComponent(config.signVal)
|
||||
if (val) {
|
||||
this.setMainSignInvokeWithValue(val)
|
||||
}
|
||||
uni.setStorageSync('sign-fieldKey', config.fieldKey)
|
||||
},
|
||||
methods: {
|
||||
getSignData() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!this.signListInvoke.length) {
|
||||
getSignImgList().then(res => {
|
||||
resolve(res.data || [])
|
||||
})
|
||||
} else {
|
||||
resolve(this.signListInvoke)
|
||||
}
|
||||
})
|
||||
},
|
||||
clearChoose() {
|
||||
for (let i = 0; i < this.signListInvoke.length; i++) {
|
||||
let item = this.signListInvoke[i]
|
||||
item.isDefault = 0
|
||||
this.$set(this.signListInvoke, i, item)
|
||||
}
|
||||
},
|
||||
setMainSignInvokeWithValue(val) {
|
||||
for (let i = 0; i < this.signListInvoke.length; i++) {
|
||||
let item = this.signListInvoke[i]
|
||||
if (item.signImg === val) {
|
||||
this.setMainSignInvoke(item, i)
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
eventLauncher(type) {
|
||||
if (type === 'cancel') uni.navigateBack();
|
||||
if (type === 'confirm') {
|
||||
let choose = this.signListInvoke.filter(item => item.isDefault === 1)
|
||||
if (!choose || !choose.length) return this.$u.toast(`请选择签名`)
|
||||
this.$nextTick(() => uni.$emit('setSignValue', choose[0].signImg))
|
||||
uni.navigateBack()
|
||||
}
|
||||
},
|
||||
setMainSignInvoke(item, index) {
|
||||
this.clearChoose()
|
||||
item.isDefault = 1
|
||||
this.$set(this.signListInvoke, index, item)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
height: 100%;
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.page_v {
|
||||
height: 100%;
|
||||
padding: 0 10px 60px;
|
||||
|
||||
.active {
|
||||
border: 1rpx solid #2979FF;
|
||||
color: #2979FF;
|
||||
|
||||
.icon-ym-organization {
|
||||
&::before {
|
||||
color: #2979FF !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sign-mask {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
background: rgba(0, 0, 0, .3);
|
||||
position: absolute;
|
||||
top: 0;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
.sign-mask-btn {
|
||||
width: 60%;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
.lists_box {
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
border-radius: 8rpx;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
background-color: #FFFFFF;
|
||||
margin-top: 20rpx;
|
||||
|
||||
.signImgBox {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
text-align: center;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.signImg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-checked-box {
|
||||
display: flex;
|
||||
width: 140rpx;
|
||||
height: 80rpx;
|
||||
position: absolute;
|
||||
transform: scale(0.9);
|
||||
right: -4rpx;
|
||||
bottom: -2rpx;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
|
||||
.icon-checked {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
border: 40rpx solid #1890ff;
|
||||
border-left: 40rpx solid transparent;
|
||||
border-top: 40rpx solid transparent;
|
||||
border-bottom-right-radius: 12rpx;
|
||||
position: absolute;
|
||||
transform: scale(0.95);
|
||||
right: -8rpx;
|
||||
bottom: -6rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
563
pages/apply/location/index.vue
Normal file
563
pages/apply/location/index.vue
Normal file
@@ -0,0 +1,563 @@
|
||||
<template>
|
||||
<view class="yunzhupaas-location-map">
|
||||
<u-top-tips ref="uTips" />
|
||||
<view class="content">
|
||||
<view class="user-select u-flex-col">
|
||||
<view class="user-select-search">
|
||||
<u-search :placeholder="$t('common.searchText')" v-model="keyword" height="72" :show-action="false" bg-color="#f0f2f6"
|
||||
shape="square" @change='search'>
|
||||
</u-search>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="header">
|
||||
<view class="map-container">
|
||||
<map class='map' id="maps" :latitude="location.latitude" :longitude="location.longitude"
|
||||
:circles="circles" :polygons="polygons" :scale='15' @regionchange="regionChange">
|
||||
<!-- #ifdef H5 -->
|
||||
<cover-image class="map-marker h5-map-marker" src="/static/image/mark.png" />
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef H5-->
|
||||
<cover-image class="map-marker" src="/static/image/mark.png" />
|
||||
<!-- #endif -->
|
||||
<cover-view class="map-locate" @click="handleLocate">
|
||||
<cover-image v-if="!locateLoading" src="/static/image/locate.png" />
|
||||
<cover-image v-else class="map-locate-img" src="/static/image/waite.png" />
|
||||
</cover-view>
|
||||
</map>
|
||||
</view>
|
||||
</view>
|
||||
<view class="around-contain">
|
||||
<scroll-view style="height:100%" id="scroll-view-h" class="scroll-view2" :refresher-enabled="false"
|
||||
:refresher-threshold="50" :scroll-with-animation='true' @scrolltolower="handleScrollToLower"
|
||||
:scroll-y="true">
|
||||
<radio-group class="around-contain-item" v-for="(item,index) in list" :key="index" v-if="list.length"
|
||||
@change="onSelectValueChange(item,index)">
|
||||
<label class="u-radio-label">
|
||||
<radio class="u-radio" :value="item.id" :checked="item.id === selectId" />
|
||||
<view class="around-item-title-box">
|
||||
<view class="around-item-title u-line-1"> {{ item.name }}</view>
|
||||
<view class="around-item-sub-title u-line-1"> {{ item.address }}</view>
|
||||
</view>
|
||||
</label>
|
||||
</radio-group>
|
||||
<u-loading class="loading" mode="circle" size="44" v-if="loading" />
|
||||
<view v-if="!loading&&!list.length" class="nodata u-flex-col">
|
||||
<image :src="noDataIcon" mode="widthFix" class="noDataIcon" />
|
||||
{{$t('common.noData')}}
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="yunzhupaas-bottom-actions">
|
||||
<u-button class="buttom-btn" @click="close()">{{$t('common.cancelText')}}</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="handleConfirm()">{{$t('common.okText')}}</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import resources from '@/libs/resources.js'
|
||||
import {
|
||||
getAroundList,
|
||||
getTextList
|
||||
} from '@/api/common.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
noDataIcon: resources.message.nodata,
|
||||
tabWidth: 150,
|
||||
tabIndex: 0,
|
||||
keyword: '',
|
||||
location: {
|
||||
longitude: 116.404, // 经度
|
||||
latitude: 39.915, // 纬度
|
||||
},
|
||||
circles: [],
|
||||
list: [],
|
||||
pagination: {
|
||||
currentPage: 1,
|
||||
pageSize: 50
|
||||
},
|
||||
total: 0,
|
||||
currentLocation: {},
|
||||
selectId: '',
|
||||
selectItem: {},
|
||||
enableLocation: '',
|
||||
showPopup: false,
|
||||
locateLoading: false,
|
||||
polygons: [],
|
||||
enableLocationScope: false,
|
||||
adjustmentScope: 500,
|
||||
enableDesktopLocation: false,
|
||||
locationScope: [],
|
||||
emitKey: '',
|
||||
// #ifdef APP
|
||||
dragLoading: false
|
||||
// #endif
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
const data = e.data ? JSON.parse(e.data) : {}
|
||||
this.enableLocationScope = data.enableLocationScope || false
|
||||
this.adjustmentScope = data.adjustmentScope || 500
|
||||
this.enableDesktopLocation = data.enableDesktopLocation || false
|
||||
this.locationScope = data.locationScope || []
|
||||
this.emitKey = data.emitKey
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.circles = []
|
||||
this.polygons = []
|
||||
this.selectId = ''
|
||||
this.list = []
|
||||
this.locateLoading = false
|
||||
// #ifdef APP
|
||||
this.dragLoading = false
|
||||
// #endif
|
||||
this.getLocation()
|
||||
},
|
||||
getLocation() {
|
||||
this.loading = true;
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
this.location.longitude = res.longitude // 经度
|
||||
this.location.latitude = res.latitude // 纬度
|
||||
//查询附近位置
|
||||
this.getList()
|
||||
//添加可选区域圆形
|
||||
this.handelCircle();
|
||||
//添加微调区域圆形
|
||||
this.handleScopeCircle();
|
||||
},
|
||||
fail: (err) => {
|
||||
//查询附近位置
|
||||
this.getList()
|
||||
//添加可选区域圆形
|
||||
this.handelCircle();
|
||||
//添加微调区域圆形
|
||||
this.handleScopeCircle();
|
||||
}
|
||||
});
|
||||
},
|
||||
handleGetCenter() {
|
||||
this.mapContext = uni.createMapContext("maps", this);
|
||||
this.mapContext.getCenterLocation({
|
||||
type: 'gcj02',
|
||||
geocode: true,
|
||||
isHighAccuracy: true,
|
||||
altitude: true,
|
||||
success: (res) => {
|
||||
this.location.longitude = res.longitude
|
||||
this.location.latitude = res.latitude
|
||||
if (this.enableLocationScope) {
|
||||
const discount = this.yunzhupaas.getDistance(this.currentLocation.latitude, this
|
||||
.currentLocation.longitude, this.location.latitude, this.location.longitude
|
||||
) || 0;
|
||||
if (discount > (this.adjustmentScope || 500)) return this.$refs.uTips.show({
|
||||
title: '超出微调范围',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handelCircle() {
|
||||
if (!this.enableDesktopLocation || !this.locationScope.length) return;
|
||||
for (let i = 0; i < this.locationScope.length; i++) {
|
||||
const o = this.locationScope[i];
|
||||
if (!o.lng || !o.lat || !o.radius) continue;
|
||||
o.longitude = o.lng
|
||||
o.latitude = o.lat
|
||||
this.addCircle({
|
||||
...o,
|
||||
color: '#54d65e99',
|
||||
fillColor: '#54d65e66',
|
||||
});
|
||||
}
|
||||
},
|
||||
handleScopeCircle() {
|
||||
if (!this.enableLocationScope) return;
|
||||
this.currentLocation = this.$u.deepClone(this.location);
|
||||
this.addCircle({
|
||||
...this.location,
|
||||
radius: this.adjustmentScope || 500,
|
||||
color: '#1890ff99',
|
||||
fillColor: '#1890ff66'
|
||||
});
|
||||
},
|
||||
addCircle(o) {
|
||||
// #ifdef H5
|
||||
this.polygons.push({
|
||||
points: this.CreateSimpleCircle(o.latitude, o.longitude, o.radius, 100),
|
||||
strokeColor: o.color,
|
||||
fillColor: o.fillColor,
|
||||
strokeWidth: 1
|
||||
})
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
this.circles.push({
|
||||
...o,
|
||||
strokeWidth: 1,
|
||||
})
|
||||
// #endif
|
||||
},
|
||||
// #ifdef H5
|
||||
CreateSimpleCircle(lat, lng, radius, pointCount) {
|
||||
var km = radius / 1000;
|
||||
var a = km < 5 ? 0.01 : km < 50 ? 0.1 : km < 500 ? 1 : 10;
|
||||
var b = this.getCircleDistance(lng, lat, lng + a, lat);
|
||||
var c = this.getCircleDistance(lng, lat, lng, lat + a);
|
||||
var rb = radius / b * a;
|
||||
var rc = radius / c * a;
|
||||
var arr = [];
|
||||
var n = 0,
|
||||
step = 360.0 / pointCount,
|
||||
N = 360 - step / 2; //注意浮点数±0.000000001的差异
|
||||
for (var i = 0; n < N; i++, n += step) {
|
||||
var x = lng + rb * Math.cos(n * Math.PI / 180);
|
||||
var y = lat + rc * Math.sin(n * Math.PI / 180);
|
||||
arr[i] = {
|
||||
latitude: y,
|
||||
longitude: x
|
||||
}
|
||||
}
|
||||
arr.push({
|
||||
latitude: arr[0].latitude,
|
||||
longitude: arr[0].longitude
|
||||
});
|
||||
return arr;
|
||||
},
|
||||
getCircleDistance(lng1, lat1, lng2, lat2) {
|
||||
var d = Math.PI / 180;
|
||||
var f = lat1 * d,
|
||||
h = lat2 * d;
|
||||
var i = lng2 * d - lng1 * d;
|
||||
var e = (1 - Math.cos(h - f) + (1 - Math.cos(i)) * Math.cos(f) * Math.cos(h)) / 2;
|
||||
return 2 * 6378137 * Math.asin(Math.sqrt(e));
|
||||
},
|
||||
// #endif
|
||||
regionChange(e) {
|
||||
// #ifdef APP
|
||||
if (this.dragLoading) return (this.dragLoading = false);
|
||||
this.list = [];
|
||||
this.handleGetCenter()
|
||||
// #endif
|
||||
// #ifndef APP
|
||||
if (e.detail.causedBy == 'drag' && e.type == 'end') {
|
||||
this.list = [];
|
||||
this.handleGetCenter()
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
handleScrollToLower() {
|
||||
if (this.pagination.pageSize * this.pagination.currentPage < this.total) {
|
||||
this.pagination.currentPage = this.pagination.currentPage + 1;
|
||||
this.getList()
|
||||
} else {
|
||||
this.$u.toast('没有更多信息啦!')
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
const query = {
|
||||
key: this.define.aMapWebKey,
|
||||
location: this.location.longitude + ',' + this.location.latitude,
|
||||
radius: -1,
|
||||
offset: this.pagination.pageSize,
|
||||
page: this.pagination.currentPage,
|
||||
};
|
||||
getAroundList(query).then(res => {
|
||||
this.handleResult(res)
|
||||
}).catch(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
handleResult(res) {
|
||||
this.loading = false;
|
||||
if (res.data.status == '1') {
|
||||
this.list = [...this.list, ...res.data.pois || []];
|
||||
this.total = Number(res.data.count || 0)
|
||||
} else {
|
||||
this.$u.toast(res.data.info)
|
||||
}
|
||||
},
|
||||
onSelectValueChange(item, index) {
|
||||
// #ifdef APP
|
||||
this.dragLoading = true
|
||||
// #endif
|
||||
this.selectStatus = true
|
||||
this.selectId = item.id
|
||||
this.selectItem = item
|
||||
const [longitude, latitude] = (item.location || '').split(',');
|
||||
this.location = {
|
||||
longitude,
|
||||
latitude
|
||||
};
|
||||
// #ifdef APP
|
||||
setTimeout(() => {
|
||||
this.dragLoading = false
|
||||
}, 800)
|
||||
// #endif
|
||||
},
|
||||
handleConfirm() {
|
||||
if (!this.selectId) return this.$u.toast('请选择地址')
|
||||
const data = this.selectItem
|
||||
const [lng, lat] = data.location.split(',');
|
||||
if (this.enableLocationScope) {
|
||||
const discount = this.yunzhupaas.getDistance(this.currentLocation.latitude, this.currentLocation
|
||||
.longitude, lat,
|
||||
lng) || 0;
|
||||
if (discount > (this.adjustmentScope || 500)) return this.$refs.uTips.show({
|
||||
title: '超出微调范围',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
//判断可选范围
|
||||
if (this.enableDesktopLocation && this.locationScope.length) {
|
||||
let list = [];
|
||||
for (let i = 0; i < this.locationScope.length; i++) {
|
||||
const o = this.locationScope[i];
|
||||
const discount = this.yunzhupaas.getDistance(o.lat, o.lng, lat, lng) || 0;
|
||||
list.push(discount > o.radius);
|
||||
}
|
||||
if (list.every(o => o === true)) return this.$refs.uTips.show({
|
||||
title: '超出规定范围',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
const address = data.address && data.address.length ? data.address : '';
|
||||
//台湾、北京、上海、重庆、深圳地址特殊处理
|
||||
let fullAddress = data.pname + data.cityname + data.adname + address + data.name;
|
||||
if (data.pname == data.cityname) fullAddress = data.pname + data.adname + address + data.name;
|
||||
if (data.pname == data.cityname && data.pname == data.adname) fullAddress = data.pname + address +
|
||||
data.name;
|
||||
this.innerValue = {
|
||||
pName: data.pname,
|
||||
cName: data.cityname,
|
||||
adName: data.adname,
|
||||
address,
|
||||
name: data.name,
|
||||
lng,
|
||||
lat,
|
||||
fullAddress,
|
||||
};
|
||||
uni.$emit(this.emitKey, JSON.stringify(this.innerValue))
|
||||
this.close();
|
||||
},
|
||||
close() {
|
||||
uni.navigateBack({
|
||||
delta: 1
|
||||
});
|
||||
},
|
||||
getDistance(lat1, lon1, lat2, lon2) {
|
||||
const toRadians = (degrees) => {
|
||||
return degrees * (Math.PI / 180);
|
||||
}
|
||||
const R = 6371;
|
||||
const dLat = toRadians(lat2 - lat1);
|
||||
const dLon = toRadians(lon2 - lon1);
|
||||
const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
|
||||
Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) *
|
||||
Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
||||
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
const distance = R * c;
|
||||
return distance * 1000;
|
||||
},
|
||||
search() {
|
||||
// 节流,避免输入过快多次请求
|
||||
this.searchTimer && clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.list = [];
|
||||
this.pagination.currentPage = 1
|
||||
this.keyword ? this.handleSearch() : this.getList();
|
||||
}, 300)
|
||||
},
|
||||
handleSearch() {
|
||||
this.loading = true;
|
||||
const query = {
|
||||
key: this.define.aMapWebKey,
|
||||
keywords: this.keyword,
|
||||
radius: this.enableLocationScope ? this.adjustmentScope || 500 : -1,
|
||||
offset: this.pagination.pageSize,
|
||||
page: this.pagination.currentPage,
|
||||
};
|
||||
getTextList(query).then(res => {
|
||||
this.handleResult(res);
|
||||
});
|
||||
},
|
||||
handleLocate() {
|
||||
if (this.locateLoading) return
|
||||
this.locateLoading = true
|
||||
uni.getLocation({
|
||||
type: 'gcj02',
|
||||
isHighAccuracy: true,
|
||||
success: (res) => {
|
||||
this.locateLoading = false
|
||||
if (!res.longitude || !res.latitude) return
|
||||
this.mapContext = uni.createMapContext("maps", this);
|
||||
this.mapContext.moveToLocation({
|
||||
longitude: res.longitude,
|
||||
latitude: res.latitude,
|
||||
})
|
||||
},
|
||||
fail: (res) => {
|
||||
this.locateLoading = false
|
||||
this.$u.toast('获取定位失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.yunzhupaas-location-map {
|
||||
/* #ifdef H5 */
|
||||
height: calc(100vh - 44px);
|
||||
/* #endif */
|
||||
/* #ifndef H5 */
|
||||
height: 100vh;
|
||||
/* #endif */
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.header {
|
||||
.map-container {
|
||||
position: relative;
|
||||
padding: 0rpx 20rpx;
|
||||
|
||||
.map {
|
||||
width: 100%;
|
||||
height: 600rpx;
|
||||
}
|
||||
|
||||
.map-marker {
|
||||
width: 38rpx;
|
||||
height: 64rpx;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, calc(-50% - 20rpx));
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.h5-map-marker {
|
||||
transform: translate(-50%, calc(-50% - 30rpx));
|
||||
}
|
||||
|
||||
.map-locate {
|
||||
position: absolute;
|
||||
bottom: 10px;
|
||||
right: 10px;
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
padding: 4px;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 5px silver;
|
||||
z-index: 999;
|
||||
|
||||
.map-locate-img {
|
||||
-webkit-animation: rotate 2s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
0% {
|
||||
-webkit-transform: rotate(0deg);
|
||||
}
|
||||
|
||||
25% {
|
||||
-webkit-transform: rotate(90deg);
|
||||
}
|
||||
|
||||
50% {
|
||||
-webkit-transform: rotate(180deg);
|
||||
}
|
||||
|
||||
75% {
|
||||
-webkit-transform: rotate(270deg);
|
||||
}
|
||||
|
||||
100% {
|
||||
-webkit-transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 100%;
|
||||
|
||||
.user-select {
|
||||
.user-select-search {
|
||||
padding: 0rpx 20rpx;
|
||||
margin: 20rpx 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.around-contain {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
.loading {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 250rpx auto 0;
|
||||
}
|
||||
|
||||
.around-contain-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10rpx 0;
|
||||
height: 60px;
|
||||
line-height: 22px;
|
||||
border-bottom: 1px solid #f2f2f6;
|
||||
|
||||
.u-radio-label {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
// #ifdef MP
|
||||
:deep(.u-radio) {
|
||||
margin: 0 16rpx 0 20rpx;
|
||||
|
||||
}
|
||||
|
||||
// #endif
|
||||
// #ifndef MP
|
||||
:deep(.uni-radio-input) {
|
||||
margin: 0 16rpx 0 20rpx;
|
||||
}
|
||||
|
||||
// #endif
|
||||
.around-item-title-box {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-right: 16rpx;
|
||||
|
||||
.around-item-title {
|
||||
font-size: 30rpx;
|
||||
color: #171a1d;
|
||||
}
|
||||
|
||||
.around-item-sub-title {
|
||||
font-size: 28rpx;
|
||||
color: #b9babb;
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
387
pages/apply/order/index.vue
Normal file
387
pages/apply/order/index.vue
Normal file
@@ -0,0 +1,387 @@
|
||||
<template>
|
||||
<view class="order-v">
|
||||
<view class="head-warp com-dropdown">
|
||||
<u-dropdown class="u-dropdown" ref="uDropdown">
|
||||
<u-dropdown-item :title="$t('app.apply.sort')" :options="sortOptions">
|
||||
<view class="dropdown-slot-content">
|
||||
<view class="dropdown-slot-content-main">
|
||||
<u-cell-group>
|
||||
<u-cell-item @click="cellClick(item.value)" :arrow="false" :title="item.label"
|
||||
v-for="(item, index) in sortOptions" :key="index" :title-style="{
|
||||
color: sortValue == item.value ? '#2979ff' : '#606266' }">
|
||||
<u-icon v-if="sortValue == item.value" name="checkbox-mark" color="#2979ff"
|
||||
size="32"></u-icon>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
<view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
|
||||
</view>
|
||||
</u-dropdown-item>
|
||||
<u-dropdown-item :title="$t('app.apply.screen')">
|
||||
<view class="dropdown-slot-content">
|
||||
<view class="dropdown-slot-content-main">
|
||||
<view class="u-p-l-32 u-p-r-32">
|
||||
<u-form label-position="left" label-width="150" label-align="left">
|
||||
<u-form-item :label="$t('component.yunzhupaas.dateRange.startPlaceholder')" prop="startTime">
|
||||
<YunzhupaasDatePicker v-model="listQuery.startTime" />
|
||||
</u-form-item>
|
||||
<u-form-item :label="$t('component.yunzhupaas.dateRange.endPlaceholder')" prop="endTime">
|
||||
<YunzhupaasDatePicker v-model="listQuery.endTime" />
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</view>
|
||||
<view class="buttom-actions">
|
||||
<u-button class="buttom-btn" @click="reset">{{$t('component.cropper.btn_reset')}}</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click="closeDropdown">{{$t('common.queryText')}}</u-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="dropdown-slot-bg" @click="$refs.uDropdown.close()"></view>
|
||||
</view>
|
||||
</u-dropdown-item>
|
||||
</u-dropdown>
|
||||
</view>
|
||||
<view class="list-warp">
|
||||
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" top="100"
|
||||
:up="upOption">
|
||||
<view class="flow-list">
|
||||
<uni-swipe-action ref="swipeAction">
|
||||
<uni-swipe-action-item v-for="(item, index) in list" :key="item.id" :right-options="options"
|
||||
@click="handleClick(index)">
|
||||
<view class="order-item" @click="goDetail(item.id,item.currentState,item.flowId)"
|
||||
:id="'item'+index">
|
||||
<view class="order-item-title u-border-bottom">
|
||||
<text class="order-title u-line-1">{{item.customerName}}</text>
|
||||
</view>
|
||||
<view class="order-item-down">
|
||||
<view class="order-item-cell u-flex">
|
||||
<text class="time">{{item.orderCode}}</text>
|
||||
<text :class="'status '+getFlowStatus(item.currentState).statusCss">
|
||||
{{getFlowStatus(item.currentState).text}}
|
||||
</text>
|
||||
</view>
|
||||
<view class="order-item-cell u-flex">
|
||||
<text class="time">{{item.salesmanName}}</text>
|
||||
<text class="time">{{$u.timeFormat(item.orderDate,'yyyy-mm-dd')}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-swipe-action-item>
|
||||
</uni-swipe-action>
|
||||
</view>
|
||||
</mescroll-uni>
|
||||
</view>
|
||||
<view class="com-addBtn" @click="addPage()" v-if="showAddBtn">
|
||||
<u-icon name="plus" size="48" color="#fff" />
|
||||
</view>
|
||||
<u-picker mode="selector" v-model="show" :default-selector="[0]" title="请选择流程" :range="selector"
|
||||
range-key="fullName" @confirm="confirm"></u-picker>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import resources from '@/libs/resources.js'
|
||||
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
||||
import {
|
||||
getOrderList,
|
||||
Delete
|
||||
} from '@/api/apply/order'
|
||||
import {
|
||||
getFlowStartFormId
|
||||
} from '@/api/workFlow/flowEngine'
|
||||
export default {
|
||||
mixins: [MescrollMixin],
|
||||
data() {
|
||||
return {
|
||||
templateId: '',
|
||||
selector: [],
|
||||
show: false,
|
||||
sortValue: 0,
|
||||
sortOptions: [{
|
||||
label: '单据升序',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '单据降序',
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: '日期升序',
|
||||
value: 3,
|
||||
},
|
||||
{
|
||||
label: '日期降序',
|
||||
value: 4,
|
||||
}
|
||||
],
|
||||
upOption: {
|
||||
page: {
|
||||
num: 0,
|
||||
size: 20,
|
||||
time: null
|
||||
},
|
||||
empty: {
|
||||
icon: resources.message.nodata,
|
||||
tip: this.$t('common.noData'),
|
||||
top: "300rpx"
|
||||
},
|
||||
textNoMore: this.$t('app.apply.noMoreData'),
|
||||
toTop: {
|
||||
bottom: 250
|
||||
}
|
||||
},
|
||||
list: [],
|
||||
listQuery: {
|
||||
sort: 'desc',
|
||||
sidx: '',
|
||||
keyword: '',
|
||||
startTime: '',
|
||||
endTime: ''
|
||||
},
|
||||
options: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}],
|
||||
menuId: '',
|
||||
flowId: '585361795057715206',
|
||||
key: +new Date()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
showAddBtn() {
|
||||
return this.$permission.hasBtnP('btn_add', this.menuId)
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.menuId = e.menuId
|
||||
},
|
||||
onShow() {
|
||||
this.$nextTick(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('refresh')
|
||||
},
|
||||
methods: {
|
||||
confirm(e) {
|
||||
this.jumPage()
|
||||
},
|
||||
upCallback(page) {
|
||||
let query = {
|
||||
currentPage: page.num,
|
||||
pageSize: page.size,
|
||||
flowId: this.flowId,
|
||||
...this.listQuery
|
||||
}
|
||||
getOrderList(query, {
|
||||
load: page.num == 1
|
||||
}).then(res => {
|
||||
if (page.num == 1) this.list = [];
|
||||
this.mescroll.endSuccess(res.data.list.length);
|
||||
const list = res.data.list.map(o => ({
|
||||
show: false,
|
||||
...o
|
||||
}));
|
||||
this.list = this.list.concat(list);
|
||||
this.$nextTick(() => {
|
||||
this.key = +new Date()
|
||||
})
|
||||
}).catch(() => {
|
||||
this.mescroll.endErr();
|
||||
})
|
||||
},
|
||||
handleClick(index, index1) {
|
||||
const item = this.list[index]
|
||||
if ([1, 2, 3, 5].includes(item.currentState)) {
|
||||
this.$u.toast("流程正在审核,请勿删除")
|
||||
this.list[index].show = false
|
||||
return
|
||||
}
|
||||
if (!this.$permission.hasBtnP('btn_remove', this.menuId)) return this.$u.toast("未开启删除权限")
|
||||
Delete(item.id).then(res => {
|
||||
this.$u.toast(res.msg)
|
||||
this.list.splice(index, 1)
|
||||
if (!this.list.length) this.mescroll.resetUpScroll()
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.key = +new Date()
|
||||
})
|
||||
},
|
||||
open(index) {
|
||||
this.list[index].show = true;
|
||||
this.list.map((val, idx) => {
|
||||
if (index != idx) this.list[idx].show = false;
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.searchTimer && clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
}, 300)
|
||||
},
|
||||
addPage() {
|
||||
this.jumPage()
|
||||
},
|
||||
jumPage(id, status) {
|
||||
let opType = '-1'
|
||||
if ([1, 2, 4, 5, 6].includes(status)) opType = 0
|
||||
const config = {
|
||||
id: id,
|
||||
flowId: this.flowId,
|
||||
opType: opType,
|
||||
status: status,
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: '/pages/workFlow/flowBefore/index?config=' +
|
||||
this.yunzhupaas.base64.encode(JSON.stringify(config))
|
||||
})
|
||||
},
|
||||
goDetail(id, status, flowId) {
|
||||
if (!this.$permission.hasBtnP('btn_edit', this.menuId) && status == 3) return
|
||||
if (!this.$permission.hasBtnP('btn_detail', this.menuId) && [1, 2, 4, 5, 6].includes(status)) return
|
||||
this.jumPage(id, status)
|
||||
},
|
||||
getFlowStatus(val) {
|
||||
let status
|
||||
switch (val) {
|
||||
case 0:
|
||||
status = {
|
||||
text: '等待提交',
|
||||
statusCss: 'u-type-info'
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
status = {
|
||||
text: '等待审核',
|
||||
statusCss: 'u-type-primary'
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
status = {
|
||||
text: '审核通过',
|
||||
statusCss: 'u-type-success'
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
status = {
|
||||
text: '审核退回',
|
||||
statusCss: 'u-type-error'
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 7:
|
||||
status = {
|
||||
text: '流程撤回',
|
||||
statusCss: 'u-type-warning'
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
status = {
|
||||
text: '审核终止',
|
||||
statusCss: 'u-type-info'
|
||||
}
|
||||
break;
|
||||
default:
|
||||
status = {
|
||||
text: '等待提交',
|
||||
statusCss: 'u-type-info'
|
||||
}
|
||||
break;
|
||||
}
|
||||
return status
|
||||
},
|
||||
cellClick(val) {
|
||||
this.listQuery.sort = val == 1 || val == 3 ? 'asc' : 'desc'
|
||||
this.listQuery.sidx = val == 1 || val == 2 ? 'orderCode' : 'orderDate'
|
||||
this.sortValue = val
|
||||
this.$refs.uDropdown.close();
|
||||
this.$nextTick(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
},
|
||||
reset() {
|
||||
this.listQuery.startTime = ''
|
||||
this.listQuery.endTime = ''
|
||||
},
|
||||
closeDropdown() {
|
||||
this.$refs.uDropdown.close();
|
||||
this.$nextTick(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
height: 100%;
|
||||
/* #ifdef MP-ALIPAY */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
}
|
||||
|
||||
|
||||
|
||||
.order-v {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
.mescroll-empty {
|
||||
padding: 211px 27px
|
||||
}
|
||||
|
||||
.head-warp {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.list-warp {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
|
||||
.flow-list {
|
||||
margin: 0 20rpx;
|
||||
|
||||
:deep(.uni-swipe) {
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.order-item {
|
||||
background-color: #fff;
|
||||
padding: 0 32rpx;
|
||||
|
||||
.order-item-down {
|
||||
.order-item-cell {
|
||||
font-size: 28rpx;
|
||||
color: #333333;
|
||||
justify-content: space-between;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
}
|
||||
|
||||
.order-item-title {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
width: 100%;
|
||||
font-size: 30rpx;
|
||||
|
||||
.order-title {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
248
pages/apply/popSelect/index.vue
Normal file
248
pages/apply/popSelect/index.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<view class="yunzhupaas-pop-select">
|
||||
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :sticky="true"
|
||||
:down="downOption" :up="upOption">
|
||||
<view class="search-box search-box_sticky">
|
||||
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
|
||||
:show-action="false" @change="search" bg-color="#f0f2f6" shape="square">
|
||||
</u-search>
|
||||
</view>
|
||||
<view class="u-flex-col tableList">
|
||||
<view class="u-flex list-card" v-for="(item,index) in list" :key="index">
|
||||
<u-radio-group v-model="selectId[0]" v-if="!onLoadData.multiple">
|
||||
<u-radio :name="item[publicField]" @change="radioChange(item)">
|
||||
<view class="u-flex-col fieldContent u-m-l-10">
|
||||
<view v-for="(column,c) in onLoadData.columnOptions" :key="c"
|
||||
class="fieldList u-line-1 u-flex">
|
||||
<view class="val">{{column.label+':'}} {{item[column.value]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-radio>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="flowBefore-actions">
|
||||
<u-button class="buttom-btn" @click.stop="handleClose()">{{$t('common.cancelText')}}</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="handleConfirm()">{{$t('common.okText')}}</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getRelationSelect,
|
||||
getPopSelect
|
||||
} from '@/api/common.js'
|
||||
import resources from '@/libs/resources.js'
|
||||
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
||||
export default {
|
||||
mixins: [MescrollMixin],
|
||||
data() {
|
||||
return {
|
||||
downOption: {
|
||||
use: true,
|
||||
auto: true
|
||||
},
|
||||
upOption: {
|
||||
page: {
|
||||
num: 0,
|
||||
size: 20,
|
||||
time: null
|
||||
},
|
||||
empty: {
|
||||
use: true,
|
||||
icon: resources.message.nodata,
|
||||
tip: this.$t('common.noData'),
|
||||
fixed: true,
|
||||
top: "300rpx",
|
||||
},
|
||||
textNoMore: this.$t('app.apply.noMoreData'),
|
||||
},
|
||||
list: [],
|
||||
type: '',
|
||||
onLoadData: {},
|
||||
keyword: '',
|
||||
innerValue: '',
|
||||
listQuery: {
|
||||
keyword: ''
|
||||
},
|
||||
modelId: '',
|
||||
cur: null,
|
||||
firstId: 0,
|
||||
selectId: [],
|
||||
publicField: '',
|
||||
selectRow: [],
|
||||
columnOptions: []
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
try {
|
||||
this.onLoadData = JSON.parse(decodeURIComponent(e.data));
|
||||
this.columnOptions = this.onLoadData.columnOptions.map(option => option.value);
|
||||
this.innerValue = this.onLoadData.innerValue;
|
||||
this.type = this.onLoadData.type;
|
||||
this.publicField = this.onLoadData.propsValue;
|
||||
this.selectId = [this.onLoadData?.id] || []
|
||||
this.modelId = this.onLoadData.modelId;
|
||||
// 更新导航栏标题
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.onLoadData.popupTitle
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error processing data:', error);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
upCallback(page) {
|
||||
const method = this.type === 'popup' ? getPopSelect : getRelationSelect
|
||||
const paramList = this.onLoadData.paramList
|
||||
let query = {
|
||||
...this.listQuery,
|
||||
currentPage: page.num,
|
||||
pageSize: this.onLoadData.hasPage ? this.onLoadData.pageSize : 10000,
|
||||
interfaceId: this.onLoadData.modelId,
|
||||
propsValue: this.onLoadData.propsValue,
|
||||
relationField: this.onLoadData.relationField,
|
||||
columnOptions: this.columnOptions.join(','),
|
||||
paramList
|
||||
}
|
||||
if (this.type === 'relation') query = {
|
||||
...query,
|
||||
queryType: this.onLoadData.queryType
|
||||
}
|
||||
method(this.modelId, query, {
|
||||
load: page.num == 1
|
||||
}).then(res => {
|
||||
if (!this.onLoadData.hasPage) {
|
||||
this.mescroll.endBySize(res.data.list.length, res.data.pagination.total)
|
||||
} else {
|
||||
this.mescroll.endSuccess(res.data.list.length);
|
||||
}
|
||||
if (page.num == 1) this.list = [];
|
||||
this.list = this.list.concat(res.data.list);
|
||||
if (this.onLoadData.multiple) {
|
||||
this.list = this.list.map((o, i) => ({
|
||||
...o,
|
||||
checked: false
|
||||
}))
|
||||
if (this.selectId.length) this.setSelectValue()
|
||||
} else {
|
||||
var index = this.list.findIndex((item) => {
|
||||
return item[this.publicField] == this.selectId
|
||||
})
|
||||
if (index >= 0) this.selectRow = [this.list[index]]
|
||||
}
|
||||
}).catch(() => {
|
||||
this.mescroll.endErr();
|
||||
})
|
||||
},
|
||||
setSelectValue() {
|
||||
outer: for (let i = 0; i < this.selectId.length; i++) {
|
||||
inner: for (let j = 0; j < this.list.length; j++) {
|
||||
if (this.selectId[i] === this.list[j][this.publicField]) {
|
||||
this.list[j].checked = true
|
||||
break inner
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
radioChange(item) {
|
||||
this.selectId = []
|
||||
this.selectRow = []
|
||||
this.selectId.push(item[this.publicField]);
|
||||
this.selectRow.push(item)
|
||||
},
|
||||
handleConfirm() {
|
||||
this.list.map((o, i) => {
|
||||
if (this.selectId == o[this.publicField]) {
|
||||
this.firstId = o[this.publicField];
|
||||
const val = this.type == 'popup' ? o[this.onLoadData.propsValue] : o[this.publicField];
|
||||
const emit = this.type == 'popup' ? 'popConfirm' : 'relationConfirm'
|
||||
uni.$emit(emit, val, this.innerValue, this.onLoadData.vModel, this.selectRow[0])
|
||||
}
|
||||
})
|
||||
uni.navigateBack();
|
||||
},
|
||||
handleClose() {
|
||||
this.selectId = ""
|
||||
uni.navigateBack();
|
||||
},
|
||||
search() {
|
||||
// 节流,避免输入过快多次请求
|
||||
this.searchTimer && clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.list = [];
|
||||
this.listQuery.keyword = this.keyword
|
||||
this.listQuery.currentPage = 1
|
||||
this.mescroll.resetUpScroll();
|
||||
}, 300)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.yunzhupaas-pop-select {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding-bottom: 106rpx;
|
||||
|
||||
.tableList {
|
||||
overflow: hidden auto;
|
||||
padding: 0 20rpx;
|
||||
|
||||
.list-card {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
border-radius: 8rpx;
|
||||
margin-top: 20rpx;
|
||||
padding: 0rpx 20rpx;
|
||||
min-height: 88rpx;
|
||||
|
||||
.fieldContent {
|
||||
width: 100%;
|
||||
|
||||
.fieldList {
|
||||
width: 752rpx;
|
||||
|
||||
.key {
|
||||
width: 136rpx;
|
||||
margin-right: 10rpx;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
line-height: 60rpx;
|
||||
}
|
||||
|
||||
.val {
|
||||
flex: 0.85;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.nodata {
|
||||
margin-top: 258rpx;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 280rpx;
|
||||
height: 215rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
133
pages/apply/reportLog/form.vue
Normal file
133
pages/apply/reportLog/form.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<view class="logForm-v yunzhupaas-wrap">
|
||||
<u-form :model="dataForm" :rules="rules" ref="dataForm" :errorType="['toast']" label-position="left"
|
||||
label-width="150" label-align="left">
|
||||
<view class="u-p-l-20 u-p-r-20 form-item-box">
|
||||
<u-form-item label="日志标题" prop="title" required>
|
||||
<u-input v-model="dataForm.title" placeholder="请输入日志标题" :disabled="disabled" />
|
||||
</u-form-item>
|
||||
<u-form-item label="今日内容" prop="todayContent" required>
|
||||
<u-input v-model="dataForm.todayContent" type="textarea" placeholder="请输入今日内容"
|
||||
:disabled="disabled" />
|
||||
</u-form-item>
|
||||
<u-form-item label="明日内容" prop="tomorrowContent" required>
|
||||
<u-input v-model="dataForm.tomorrowContent" type="textarea" placeholder="请输入明日内容"
|
||||
:disabled="disabled" />
|
||||
</u-form-item>
|
||||
<u-form-item label="遇到问题" prop="question" required>
|
||||
<u-input v-model="dataForm.question" type="textarea" placeholder="请输入遇到问题" :disabled="disabled" />
|
||||
</u-form-item>
|
||||
<u-form-item label="发送给谁" prop="userIds" required>
|
||||
<YunzhupaasUserSelect v-model="dataForm.userIds" multiple :disabled="disabled" />
|
||||
</u-form-item>
|
||||
</view>
|
||||
</u-form>
|
||||
<view class="com-saveBox" v-if="!disabled">
|
||||
<u-button type="primary" @click="save">保存</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getLogInfo,
|
||||
createLog,
|
||||
updateLog
|
||||
} from '@/api/apply/reportLog.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dataForm: {
|
||||
title: '',
|
||||
todayContent: '',
|
||||
tomorrowContent: '',
|
||||
question: '',
|
||||
userIds: ''
|
||||
},
|
||||
rules: {
|
||||
title: [{
|
||||
required: true,
|
||||
message: '日志标题不能为空',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
todayContent: [{
|
||||
required: true,
|
||||
message: '今日内容不能为空',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
tomorrowContent: [{
|
||||
required: true,
|
||||
message: '明日内容不能为空',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
question: [{
|
||||
required: true,
|
||||
message: '问题不能为空',
|
||||
trigger: ['change', 'blur']
|
||||
}],
|
||||
userIds: [{
|
||||
required: true,
|
||||
message: '用户不能为空',
|
||||
trigger: ['change', 'blur'],
|
||||
type: 'array'
|
||||
}],
|
||||
},
|
||||
type: '0',
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.$refs.dataForm.setRules(this.rules);
|
||||
},
|
||||
onLoad(option) {
|
||||
this.type = option.type
|
||||
if (!option.id) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '新增日志'
|
||||
});
|
||||
let userInfo = uni.getStorageSync('userInfo') || {}
|
||||
if (!userInfo.userName) return
|
||||
this.dataForm.title = userInfo.userName + '的日志'
|
||||
} else {
|
||||
if (this.type == '1') this.disabled = true
|
||||
getLogInfo(option.id).then(res => {
|
||||
this.dataForm = res.data;
|
||||
this.dataForm.userIds = this.dataForm.userIds.split(',')
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.dataForm.title
|
||||
});
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
save() {
|
||||
this.$refs.dataForm.validate((valid) => {
|
||||
this.dataForm.toUserId = this.dataForm.userIds.join(',')
|
||||
if (valid) {
|
||||
const method = this.dataForm.id ? updateLog : createLog
|
||||
method(this.dataForm).then(res => {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
complete: () => {
|
||||
setTimeout(() => {
|
||||
uni.$emit('refresh')
|
||||
uni.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.logForm-v {
|
||||
padding-bottom: 140rpx;
|
||||
}
|
||||
</style>
|
||||
177
pages/apply/reportLog/index.vue
Normal file
177
pages/apply/reportLog/index.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<view class="reportLog-v">
|
||||
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :sticky="true"
|
||||
:down="downOption" :up="upOption" :bottombar="false">
|
||||
<view class="search-box_sticky">
|
||||
<u-tabs :list="tabsList" :current="current" @change="change" :is-scroll='false'>
|
||||
</u-tabs>
|
||||
<view class="search-box">
|
||||
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72"
|
||||
:show-action="false" @change="search" bg-color="#f0f2f6" shape="square">
|
||||
</u-search>
|
||||
</view>
|
||||
</view>
|
||||
<view class="log-list" v-for="(item, index) in list" :key="index">
|
||||
<u-swipe-action :index="index" :show="item.show" @click="handleClick" @open="open" :options="options"
|
||||
@content-click="goDetail(item.id)">
|
||||
<view class="log-list-txt u-flex-col">
|
||||
<view class="u-font-30 u-flex u-m-b-10 log-title">
|
||||
<text class="title u-line-1">{{item.title}}</text>
|
||||
<text>{{yunzhupaas.toDate(item.creatorTime ,'MM-dd')}}</text>
|
||||
</view>
|
||||
<text class="u-m-t-10">{{userInfo.userName}}/{{userInfo.userAccount}}</text>
|
||||
</view>
|
||||
</u-swipe-action>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
<view class="com-addBtn" @click="goDetail()">
|
||||
<u-icon name="plus" size="48" color="#fff" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getSendList,
|
||||
getReceiveList,
|
||||
delLog
|
||||
} from '@/api/apply/reportLog.js'
|
||||
import resources from '@/libs/resources.js'
|
||||
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
||||
export default {
|
||||
mixins: [MescrollMixin],
|
||||
data() {
|
||||
return {
|
||||
downOption: {
|
||||
use: true,
|
||||
auto: true
|
||||
},
|
||||
upOption: {
|
||||
page: {
|
||||
num: 0,
|
||||
size: 20,
|
||||
time: null
|
||||
},
|
||||
empty: {
|
||||
use: true,
|
||||
icon: resources.message.nodata,
|
||||
tip: this.$t('common.noData'),
|
||||
fixed: true,
|
||||
top: "300rpx",
|
||||
},
|
||||
textNoMore: this.$t('app.apply.noMoreData'),
|
||||
},
|
||||
current: 0,
|
||||
tabsList: [{
|
||||
name: '我发出的'
|
||||
},
|
||||
{
|
||||
name: '我收到的'
|
||||
}
|
||||
],
|
||||
keyword: '',
|
||||
list: [],
|
||||
userInfo: {},
|
||||
options: [{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#dd524d'
|
||||
}
|
||||
}]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.userInfo = uni.getStorageSync('userInfo') || {}
|
||||
uni.$on('refresh', () => {
|
||||
this.list = [];
|
||||
this.current = 0
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
},
|
||||
onUnload() {
|
||||
uni.$off('refresh')
|
||||
},
|
||||
methods: {
|
||||
upCallback(page) {
|
||||
let query = {
|
||||
currentPage: page.num,
|
||||
pageSize: page.size,
|
||||
keyword: this.keyword
|
||||
}
|
||||
const method = this.current ? getReceiveList : getSendList
|
||||
method(query, {
|
||||
load: page.num == 1
|
||||
}).then(res => {
|
||||
this.mescroll.endSuccess(res.data.list.length);
|
||||
if (page.num == 1) this.list = [];
|
||||
const list = res.data.list.map(o => ({
|
||||
show: false,
|
||||
...o
|
||||
}));
|
||||
this.list = this.list.concat(list);
|
||||
}).catch(() => {
|
||||
this.mescroll.endErr();
|
||||
})
|
||||
},
|
||||
open(index) {
|
||||
this.list[index].show = true;
|
||||
this.list.map((val, idx) => {
|
||||
if (index != idx) this.list[idx].show = false;
|
||||
})
|
||||
},
|
||||
handleClick(index, index1) {
|
||||
const item = this.list[index]
|
||||
delLog(item.id).then(res => {
|
||||
this.$u.toast(res.msg)
|
||||
this.list.splice(index, 1)
|
||||
if (!this.list.length) this.mescroll.resetUpScroll()
|
||||
})
|
||||
},
|
||||
goDetail(id) {
|
||||
const url = './form?type=' + this.current + (id ? '&id=' + id : '')
|
||||
uni.navigateTo({
|
||||
url: url
|
||||
})
|
||||
},
|
||||
change(index) {
|
||||
this.current = index;
|
||||
this.mescroll.resetUpScroll()
|
||||
},
|
||||
search() {
|
||||
this.searchTimer && clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
}, 300)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.reportLog-v {
|
||||
|
||||
.log-list {
|
||||
width: 100%;
|
||||
margin-bottom: 20rpx;
|
||||
color: #9a9a9a;
|
||||
|
||||
.log-list-txt {
|
||||
padding: 16rpx 32rpx;
|
||||
|
||||
.log-title {
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
color: #333333;
|
||||
width: 500rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
268
pages/apply/tableLinkage/index.vue
Normal file
268
pages/apply/tableLinkage/index.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<view class="yunzhupaas-pop-select">
|
||||
<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :sticky="true"
|
||||
:down="downOption" :up="upOption">
|
||||
<view class="search-box search-box_sticky">
|
||||
<u-search :placeholder="$t('app.apply.pleaseKeyword')" v-model="keyword" height="72" :show-action="false" @change="search"
|
||||
bg-color="#f0f2f6" shape="square">
|
||||
</u-search>
|
||||
</view>
|
||||
<view class="u-flex-col tableList">
|
||||
<view class="u-flex list-card" v-for="(item,index) in list" :key="index">
|
||||
<u-checkbox-group wrap @change="checkboxGroupChange(item,index)">
|
||||
<u-checkbox v-model="item.checked">
|
||||
<view class="u-flex-col fieldContent u-m-l-10">
|
||||
<view class="fieldList u-line-1 u-flex" v-for="(column,c) in realColumnOptions"
|
||||
:key="c">
|
||||
<view class="val">{{column.label+':'}} {{item[column.value]}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-checkbox>
|
||||
</u-checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
<!-- 底部按钮 -->
|
||||
<view class="flowBefore-actions">
|
||||
<u-button class="buttom-btn" @click.stop="handleClose">{{$t('common.cancelText')}}</u-button>
|
||||
<u-button class="buttom-btn" type="primary" @click.stop="handleConfirm">{{$t('common.okText')}}</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getPopSelect,
|
||||
getRelationSelect
|
||||
} from '@/api/common.js'
|
||||
import resources from '@/libs/resources.js'
|
||||
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
|
||||
export default {
|
||||
mixins: [MescrollMixin],
|
||||
data() {
|
||||
return {
|
||||
downOption: {
|
||||
use: true,
|
||||
auto: true
|
||||
},
|
||||
upOption: {
|
||||
page: {
|
||||
num: 0,
|
||||
size: 20,
|
||||
time: null
|
||||
},
|
||||
empty: {
|
||||
use: true,
|
||||
icon: resources.message.nodata,
|
||||
tip: this.$t('common.noData'),
|
||||
fixed: true,
|
||||
top: "300rpx",
|
||||
},
|
||||
textNoMore: this.$t('app.apply.noMoreData'),
|
||||
},
|
||||
list: [],
|
||||
type: '',
|
||||
onLoadData: {},
|
||||
keyword: '',
|
||||
innerValue: '',
|
||||
listQuery: {
|
||||
keyword: '',
|
||||
pageSize: 20
|
||||
},
|
||||
cur: null,
|
||||
firstVal: '',
|
||||
firstId: 0,
|
||||
selectId: "",
|
||||
publicField: '',
|
||||
selectItem: [],
|
||||
actionConfig: {},
|
||||
formData: {},
|
||||
userInfo: {},
|
||||
subVal: [],
|
||||
columnOptions: [],
|
||||
realColumnOptions: [],
|
||||
isDynamic: true,
|
||||
}
|
||||
},
|
||||
onLoad(e) {
|
||||
this.userInfo = uni.getStorageSync('userInfo') || {}
|
||||
this.onLoadData = JSON.parse(e.data);
|
||||
this.actionConfig = this.onLoadData.actionConfig
|
||||
this.isDynamic = this.actionConfig.dataSource == 'dynamic'
|
||||
this.realColumnOptions = this.actionConfig.columnOptions.filter(o => o.ifShow || o.ifShow === undefined)
|
||||
this.columnOptions = this.actionConfig.columnOptions.map(o => o.value)
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.actionConfig.popupTitle || '选择数据'
|
||||
})
|
||||
this.formData = this.onLoadData.formData
|
||||
this.listQuery.pageSize = this.actionConfig.hasPage && this.isDynamic ? this.actionConfig.pageSize : 10000
|
||||
uni.$on('refresh', () => {
|
||||
this.list = [];
|
||||
this.mescroll.resetUpScroll();
|
||||
})
|
||||
},
|
||||
computed: {
|
||||
paramList() {
|
||||
return this.getParamList
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
upCallback(page) {
|
||||
const interfaceId = this.actionConfig.interfaceId
|
||||
const modelId = this.actionConfig.modelId
|
||||
if (this.isDynamic && !interfaceId) return this.handleEmpty()
|
||||
if (!this.isDynamic && !modelId) return this.handleEmpty()
|
||||
let query = {
|
||||
...this.listQuery,
|
||||
currentPage: page.num,
|
||||
keyword: this.keyword,
|
||||
columnOptions: this.columnOptions.join(',')
|
||||
}
|
||||
if (this.isDynamic) {
|
||||
query.interfaceId = interfaceId
|
||||
query.paramList = this.paramList()
|
||||
} else {
|
||||
query.modelId = this.actionConfig.modelId
|
||||
query.relationField = this.actionConfig.relationField
|
||||
}
|
||||
const id = this.isDynamic ? interfaceId : modelId
|
||||
const method = this.isDynamic ? getPopSelect : getRelationSelect
|
||||
method(id, query, {
|
||||
load: page.num == 1
|
||||
}).then(res => {
|
||||
this.mescroll.endSuccess(res.data.list.length);
|
||||
if (page.num == 1) this.list = [];
|
||||
this.list = this.list.concat(res.data.list);
|
||||
this.list = this.list.map((o, i) => ({
|
||||
...o,
|
||||
checked: false
|
||||
}))
|
||||
}).catch(() => {
|
||||
this.mescroll.endErr();
|
||||
})
|
||||
},
|
||||
handleEmpty() {
|
||||
this.mescroll.endSuccess(0);
|
||||
this.mescroll.endErr()
|
||||
},
|
||||
getParamList() {
|
||||
let templateJson = this.actionConfig.templateJson
|
||||
for (let i = 0; i < templateJson.length; i++) {
|
||||
templateJson[i].defaultValue = this.formData[templateJson[i].relationField] || ''
|
||||
if (templateJson[i].yunzhupaasKey === 'createUser') {
|
||||
templateJson[i].defaultValue = this.userInfo.userId
|
||||
}
|
||||
if (templateJson[i].yunzhupaasKey === 'createTime') {
|
||||
templateJson[i].defaultValue = new Date().getTime()
|
||||
}
|
||||
if (templateJson[i].yunzhupaasKey === 'currOrganize') {
|
||||
templateJson[i].defaultValue = this.userInfo.organizeId
|
||||
}
|
||||
if (templateJson[i].yunzhupaasKey === 'currPosition') {
|
||||
templateJson[i].defaultValue = this.userInfo.positionIds && this.userInfo.positionIds.length ? this
|
||||
.userInfo.positionIds[0] : ''
|
||||
}
|
||||
}
|
||||
return templateJson
|
||||
},
|
||||
checkboxGroupChange(e, index) {
|
||||
this.selectItem = this.list.filter(o => o.checked)
|
||||
let subVal = []
|
||||
for (let i = 0; i < this.selectItem.length; i++) {
|
||||
const e = this.selectItem[i]
|
||||
let item = {}
|
||||
for (let j = 0; j < this.actionConfig.relationOptions.length; j++) {
|
||||
let row = this.actionConfig.relationOptions[j]
|
||||
item[row.field] = row.type == 1 ? e[!this.isDynamic ? row.value + '_yunzhupaasId' : row.value] : row
|
||||
.value
|
||||
}
|
||||
subVal.push(item)
|
||||
}
|
||||
this.subVal = subVal
|
||||
},
|
||||
interfaceDataHandler(data) {
|
||||
if (!data.dataProcessing) return data.list
|
||||
const dataHandler = this.yunzhupaas.getScriptFunc(data.dataProcessing)
|
||||
if (!dataHandler) return data.list
|
||||
return dataHandler(data.list)
|
||||
},
|
||||
radioChange(item) {
|
||||
this.selectId = item[this.publicField];
|
||||
this.innerValue = item[this.onLoadData.relationField];
|
||||
},
|
||||
handleConfirm() {
|
||||
uni.$emit('linkPageConfirm', this.subVal, this.onLoadData.tableVmodel)
|
||||
this.handleClose()
|
||||
},
|
||||
handleClose() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
search() {
|
||||
this.searchTimer && clearTimeout(this.searchTimer)
|
||||
this.searchTimer = setTimeout(() => {
|
||||
this.list = [];
|
||||
this.listQuery.keyword = this.keyword
|
||||
this.listQuery.currentPage = 1
|
||||
this.listQuery.pageSize = this.hasPage ? this.pageSize : 10000
|
||||
this.mescroll.resetUpScroll();
|
||||
}, 300)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
page {
|
||||
background-color: #f0f2f6;
|
||||
}
|
||||
|
||||
.yunzhupaas-pop-select {
|
||||
background-color: #f0f2f6;
|
||||
width: 100%;
|
||||
padding-bottom: 90rpx;
|
||||
|
||||
.tableList {
|
||||
overflow: hidden auto;
|
||||
padding: 0 20rpx;
|
||||
|
||||
.list-card {
|
||||
background-color: #fff;
|
||||
width: 100%;
|
||||
border-radius: 8rpx;
|
||||
margin-top: 20rpx;
|
||||
padding: 20rpx 20rpx;
|
||||
align-items: flex-start;
|
||||
|
||||
.u-checkbox-group {
|
||||
width: 100%;
|
||||
|
||||
.u-checkbox__label {
|
||||
.fieldContent {
|
||||
width: 100%;
|
||||
|
||||
.fieldList {
|
||||
width: 752rpx;
|
||||
|
||||
.key {
|
||||
width: 136rpx;
|
||||
margin-right: 10rpx;
|
||||
text-align: right;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.val {
|
||||
flex: 0.85;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user