用户中心和采购计划完善

This commit is contained in:
砂糖
2025-10-13 17:51:27 +08:00
parent 8db5eb7707
commit d0520e7872
48 changed files with 4833 additions and 713 deletions

View File

@@ -0,0 +1,10 @@
// 汇率API直接请求第三方服务
import request from "@/util/oaRequest"
// 获取美元兑人民币汇率dateStr可选便于后续扩展
export async function getExchangeRate(dateStr) {
return request({
url: '/oa/exchangeRate/usd2cny',
date: dateStr
})
}

194
api/oa/finance/finance.js Normal file
View File

@@ -0,0 +1,194 @@
import request from "@/util/oaRequest"
// 查询进出账管理列表
export function listFinance(query) {
return request({
url: '/oa/finance/list',
method: 'get',
params: query
})
}
// // 查询进出账管理列表
// export function barData(query) {
// return request({
// url: '/oa/finance/barData',
// method: 'get',
// params: query
// })
// }
// 查询进项目出账管理列表
export function listFinancePro(query) {
return request({
url: '/oa/finance/listPro',
method: 'get',
params: query
})
}
// 查询进出账管理详细
export function getFinance(financeId) {
return request({
url: '/oa/finance/' + financeId,
method: 'get'
})
}
export function getFinancePro(financeId) {
return request({
url: '/oa/finance/financePro' + financeId,
method: 'get'
})
}
// 根据时间范围查询列表
export function findFinance(params) {
return request({
url: '/oa/finance/getFinanceByTime',
method: 'get',
params:params
})
}
// 项目资金管理,根据时间范围查询列表
export function findProjectFinance(query) {
return request({
url: '/oa/finance/findFinanceByTimeAndProjectId',
method: 'get',
params:query
})
}
// 最近6个月核算列表
export function findFinanceList(query) {
return request({
url: '/oa/finance/findFinanceByMonth/',
method: 'get',
params:query
})
}
// 新增进出账管理
export function addFinance(data) {
return request({
url: '/oa/finance',
method: 'post',
data: data
})
}
// 修改进出账管理
export function updateFinance(data) {
return request({
url: '/oa/finance',
method: 'put',
data: data
})
}
// 删除进出账管理
export function delFinance(financeId) {
return request({
url: '/oa/finance/' + financeId,
method: 'delete'
})
}
/**
*
* @returns 获取进出账管理列表
*/
export function getCostDetailList(query) {
return request({
url: '/oa/cost/list',
method: 'get',
params:query
})
}
/**
* @param costId 进出账管理id
* @returns 根据id获取进出账管理详情
* */
export function getCostDetailById(costId) {
return request({
url: `/oa/cost/${costId}`,
method: 'get'
})
}
/**
*
* @param {*} data 创建成本详情
* @returns
*/
export function createCostDetail(data) {
return request({
url: '/oa/cost/add',
method: 'post',
data: data
})
}
/**
*
* @param {*} costId 删除成本详情
* @returns
*/
export function deleteCostDetail(costId) {
return request({
url: `/oa/cost/${costId}`,
method: 'delete'
})
}
/**
* 获取月度收支对比数据
* @param {{ projectId?: number, financeType?: string }} params
*/
export function barData(params) {
return request({
url: '/oa/finance/barData',
method: 'get',
params
});
}
/**
* 获取明细列表(含币种区分)
* @param {{ projectId?: number, financeType?: string }} params
*/
export function findFinanceList2(params) {
return request({
url: '/oa/finance/findFinanceList',
method: 'get',
params
});
}
// 新增进出账管理withBalance
export function addFinanceWithBalance(data) {
return request({
url: '/oa/finance/addBalance',
method: 'post',
data: data
})
}
// 修改进出账管理withBalance
export function updateFinanceWithBalance(data) {
return request({
url: '/oa/finance/editBalance',
method: 'put',
data: data
})
}
// 删除进出账管理withBalance
export function delFinanceWithBalance(financeId) {
return request({
url: '/oa/finance/removeDataBalance/' + financeId,
method: 'delete'
})
}

44
api/oa/post.js Normal file
View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询岗位列表
export function listPost(query) {
return request({
url: '/system/post/list',
method: 'get',
params: query
})
}
// 查询岗位详细
export function getPost(postId) {
return request({
url: '/system/post/' + postId,
method: 'get'
})
}
// 新增岗位
export function addPost(data) {
return request({
url: '/system/post',
method: 'post',
data: data
})
}
// 修改岗位
export function updatePost(data) {
return request({
url: '/system/post',
method: 'put',
data: data
})
}
// 删除岗位
export function delPost(postId) {
return request({
url: '/system/post/' + postId,
method: 'delete'
})
}

127
api/oa/role.js Normal file
View File

@@ -0,0 +1,127 @@
import request from "@/utils/request";
// 查询角色列表
export function listRole(query) {
return request({
url: "/system/role/list",
method: "get",
params: query,
});
}
// 查询角色详细
export function getRole(roleId) {
return request({
url: "/system/role/" + roleId,
method: "get",
});
}
// 查询角色详细
export function currentRole() {
return request({
url: "/system/role/currentRole",
method: "get",
});
}
// 新增角色
export function addRole(data) {
return request({
url: "/system/role",
method: "post",
data: data,
});
}
// 修改角色
export function updateRole(data) {
return request({
url: "/system/role",
method: "put",
data: data,
});
}
// 角色数据权限
export function dataScope(data) {
return request({
url: "/system/role/dataScope",
method: "put",
data: data,
});
}
// 角色状态修改
export function changeRoleStatus(roleId, status) {
const data = {
roleId,
status,
};
return request({
url: "/system/role/changeStatus",
method: "put",
data: data,
});
}
// 删除角色
export function delRole(roleId) {
return request({
url: "/system/role/" + roleId,
method: "delete",
});
}
// 查询角色已授权用户列表
export function allocatedUserList(query) {
return request({
url: "/system/role/authUser/allocatedList",
method: "get",
params: query,
});
}
// 查询角色未授权用户列表
export function unallocatedUserList(query) {
return request({
url: "/system/role/authUser/unallocatedList",
method: "get",
params: query,
});
}
// 取消用户授权角色
export function authUserCancel(data) {
return request({
url: "/system/role/authUser/cancel",
method: "put",
data: data,
});
}
// 批量取消用户授权角色
export function authUserCancelAll(data) {
return request({
url: "/system/role/authUser/cancelAll",
method: "put",
params: data,
});
}
// 授权用户选择
export function authUserSelectAll(data) {
return request({
url: "/system/role/authUser/selectAll",
method: "put",
params: data,
});
}
// 根据角色ID查询部门树结构
export function deptTreeSelect(roleId) {
return request({
url: "/system/role/deptTree/" + roleId,
method: "get",
});
}

View File

@@ -0,0 +1,53 @@
import request from "@/util/oaRequest"
// 查询流程分类列表
export function listCategory(query) {
return request({
url: '/workflow/category/list',
method: 'get',
params: query
})
}
// 查询流程分类列表
export function listAllCategory(query) {
return request({
url: '/workflow/category/listAll',
method: 'get',
params: query
})
}
// 查询流程分类详细
export function getCategory(categoryId) {
return request({
url: '/workflow/category/' + categoryId,
method: 'get'
})
}
// 新增流程分类
export function addCategory(data) {
return request({
url: '/workflow/category',
method: 'post',
data: data
})
}
// 修改流程分类
export function updateCategory(data) {
return request({
url: '/workflow/category',
method: 'put',
data: data
})
}
// 删除流程分类
export function delCategory(categoryId) {
return request({
url: '/workflow/category/' + categoryId,
method: 'delete'
})
}

51
api/oa/workflow/deploy.js Normal file
View File

@@ -0,0 +1,51 @@
import request from "@/util/oaRequest"
// 查询流程部署列表
export function listDeploy(query) {
return request({
url: '/workflow/deploy/list',
method: 'get',
params: query
})
}
export function listPublish(query) {
return request({
url: '/workflow/deploy/publishList',
method: 'get',
params: query
})
}
// 获取流程模型流程图
export function getBpmnXml(definitionId) {
return request({
url: '/workflow/deploy/bpmnXml/' + definitionId,
method: 'get'
})
}
// 修改流程状态
export function changeState(params) {
return request({
url: '/workflow/deploy/changeState',
method: 'put',
params: params
})
}
// 删除流程部署
export function delDeploy(deployIds) {
return request({
url: '/workflow/deploy/' + deployIds,
method: 'delete'
})
}
// 查询流程部署关联表单信息
export function getFormByDeployId(deployId) {
return request({
url: '/workflow/deploy/form/' + deployId,
method: 'get',
})
}

View File

@@ -0,0 +1,10 @@
import request from "@/util/oaRequest"
// 撤回任务
export function revokeProcess(data) {
return request({
url: '/workflow/task/revokeProcess',
method: 'post',
data: data
})
}

52
api/oa/workflow/form.js Normal file
View File

@@ -0,0 +1,52 @@
import request from "@/util/oaRequest"
// 查询流程表单列表
export function listForm(query) {
return request({
url: '/workflow/form/list',
method: 'get',
params: query
})
}
// 查询流程表单详细
export function getForm(formId) {
return request({
url: '/workflow/form/' + formId,
method: 'get'
})
}
// 新增流程表单
export function addForm(data) {
return request({
url: '/workflow/form',
method: 'post',
data: data
})
}
// 修改流程表单
export function updateForm(data) {
return request({
url: '/workflow/form',
method: 'put',
data: data
})
}
// 挂载表单
export function addDeployForm(data) {
return request({
url: '/workflow/form/addDeployForm',
method: 'post',
data: data
})
}
// 删除流程表单
export function delForm(formId) {
return request({
url: '/workflow/form/' + formId,
method: 'delete'
})
}

View File

@@ -0,0 +1,10 @@
import request from "@/util/oaRequest"
// 查询流程实例详情信息
export function getDetailInstance(query) {
return request({
url: '/workflow/instance/detail',
method: 'get',
params: query
})
}

84
api/oa/workflow/model.js Normal file
View File

@@ -0,0 +1,84 @@
import request from "@/util/oaRequest"
// 查询流程模型信息
export function listModel(query) {
return request({
url: '/workflow/model/list',
method: 'get',
params: query
})
}
// 查询流程模型信息
export function historyModel(query) {
return request({
url: '/workflow/model/historyList',
method: 'get',
params: query
})
}
export function getModel(modelId) {
return request({
url: '/workflow/model/' + modelId,
method: 'get'
})
}
// 新增模型信息
export function addModel(data) {
return request({
url: '/workflow/model',
method: 'post',
data: data
})
}
// 修改模型信息
export function updateModel(data) {
return request({
url: '/workflow/model',
method: 'put',
data: data
})
}
// 保存流程模型
export function saveModel(data) {
return request({
url: '/workflow/model/save',
method: 'post',
data: data
})
}
export function latestModel(params) {
return request({
url: '/workflow/model/latest',
method: 'post',
params: params
})
}
export function delModel(modelIds) {
return request({
url: '/workflow/model/' + modelIds,
method: 'delete'
})
}
export function deployModel(params) {
return request({
url: '/workflow/model/deploy',
method: 'post',
params: params
})
}
// 获取流程模型流程图
export function getBpmnXml(modelId) {
return request({
url: '/workflow/model/bpmnXml/' + modelId,
method: 'get'
})
}

132
api/oa/workflow/process.js Normal file
View File

@@ -0,0 +1,132 @@
import request from "@/util/oaRequest"
// 查询流程列表
export function listProcess(query) {
return request({
url: '/workflow/process/list',
method: 'get',
params: query
})
}
// 查询流程列表
export function getProcessForm(query) {
return request({
url: '/workflow/process/getProcessForm',
method: 'get',
params: query
})
}
// 部署流程实例
export function startProcess(processDefId, data) {
return request({
url: '/workflow/process/start/' + processDefId,
method: 'post',
data: data
})
}
// 部署流程实例
export function startClaim(data) {
return request({
url: '/workflow/process/startClaim',
method: 'post',
data: data
})
}
// 部署流程实例
export function startMoney(data) {
return request({
url: '/workflow/process/startMoney',
method: 'post',
data: data
})
}
// 删除流程实例
export function delProcess(ids) {
return request({
url: '/workflow/process/instance/' + ids,
method: 'delete'
})
}
// 获取流程图
export function getBpmnXml(processDefId) {
return request({
url: '/workflow/process/bpmnXml/' + processDefId,
method: 'get'
})
}
export function detailProcess(query) {
return request({
url: '/workflow/process/detail',
method: 'get',
params: query
})
}
// 我的发起的流程
export function listOwnProcess(query) {
return request({
url: '/workflow/process/ownList',
method: 'get',
params: query
})
}
// 我的发起的流程
export function listTripAndAbsence(query) {
return request({
url: '/workflow/process/trip-absence',
method: 'get',
params: query
})
}
// 我待办的流程
export function listTodoProcess(query) {
return request({
url: '/workflow/process/todoList',
method: 'get',
params: query
})
}
// 我待签的流程
export function listClaimProcess(query) {
return request({
url: '/workflow/process/claimList',
method: 'get',
params: query
})
}
// 我已办的流程
export function listFinishedProcess(query) {
return request({
url: '/workflow/process/finishedList',
method: 'get',
params: query
})
}
// 查询流程抄送列表
export function listCopyProcess(query) {
return request({
url: '/workflow/process/copyList',
method: 'get',
params: query
})
}
// 取消申请
export function stopProcess(data) {
return request({
url: '/workflow/task/stopProcess',
method: 'post',
data: data
})
}

71
api/oa/workflow/task.js Normal file
View File

@@ -0,0 +1,71 @@
import request from "@/util/oaRequest"
// 完成任务
export function complete(data) {
return request({
url: '/workflow/task/complete',
method: 'post',
data: data
})
}
// 委派任务
export function delegate(data) {
return request({
url: '/workflow/task/delegate',
method: 'post',
data: data
})
}
// 转办任务
export function transfer(data) {
return request({
url: '/workflow/task/transfer',
method: 'post',
data: data
})
}
// 退回任务
export function returnTask(data) {
return request({
url: '/workflow/task/return',
method: 'post',
data: data
})
}
// 拒绝任务
export function rejectTask(data) {
return request({
url: '/workflow/task/reject',
method: 'post',
data: data
})
}
// 签收任务
export function claimTask(data) {
return request({
url: '/workflow/task/claim',
method: 'post',
data: data
})
}
// 可退回任务列表
export function returnList(data) {
return request({
url: '/workflow/task/returnList',
method: 'post',
data: data
})
}
export function getTaskFormDetail(taskId) {
return request({
url: '/workflow/task/processVariables/'+taskId,
method: 'get',
})
}

View File

@@ -66,15 +66,12 @@ export default {
},
methods: {
getFixedSourceUrl(url) {
console.log('替换头像', url)
// 如果 url 以 http://49.232.154.205/api/object/ 开头,则替换为带端口的
if (typeof url === 'string' && url.startsWith('http://49.232.154.205/api/object/')) {
console.log('替换1')
return url.replace('http://49.232.154.205/api/object/', 'http://49.232.154.205:10006/api/object/');
}
else if (typeof url === 'string' && url.startsWith('http://47.117.71.33/api/object/')) {
console.log("替换2")
return url.replace('http://47.117.71.33/api/object/', 'http://49.232.154.205:10006/api/object/');
}

View File

@@ -0,0 +1,91 @@
<template>
<view class="">
<uni-forms ref="form" :model="form">
<uni-forms-item v-for="item in fields" :label="item.label" :name="item.name">
<uni-easyinput v-if="item.tag == 'el-input'" v-model="form[item.name]" />
<uni-datetime-picker v-else-if="item.tag == 'el-date-picker'" v-model="form[item.name]"></uni-datetime-picker>
<uni-data-select
v-else-if="item.tag == 'el-select'"
v-model="form[item.name]"
:localdata="item.slot.localData"
>
</uni-data-select>
<view v-else-if="item.tag == 'el-upload'">
手机端暂不支持文件上传
</view>
<view v-else>未知表单</view>
</uni-forms-item>
</uni-forms>
<view class="submitter">
<button @click="submitForm">提交</button>
<button @click="reset">重置</button>
</view>
</view>
</template>
<script>
export default {
props: {
formConf: {
required: true,
type: Object,
},
submitter: {
default: true,
type: Boolean
}
},
data() {
return {
fields: [],
form: {}
}
},
watch: {
formConf: {
immediate: true,
deep: true,
handler(newVal) {
this.SchemaToJsonForm(newVal)
}
}
},
methods: {
async SchemaToJsonForm(schema) {
console.log(schema, 'watch 打印')
const fields = []
for (const row of schema.fields) {
const o = {
label: row.__config__.label,
tag: row.__config__.tag,
name: row.__vModel__,
_row: row
}
if (row.__slot__ && row.__slot__.options) {
o['slot'] = {
localData: row.__slot__.options.map(item => {
return {
value: item.value,
text: item.label
}
})
}
}
this.$set(this.form, o.name, '')
fields.push(o)
}
this.fields = fields;
},
submitForm() {
this.$emit('finish', this.form)
},
reset() {
}
}
}
</script>
<style>
</style>

View File

@@ -429,6 +429,70 @@
"navigationBarTitleText" : "出库记录",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/process/process",
"style" :
{
"navigationBarTitleText" : "流程管理",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/workflow/apply/apply",
"style" :
{
"navigationBarTitleText" : "我的申请",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/workflow/todo/todo",
"style" :
{
"navigationBarTitleText" : "代办任务",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/workflow/finished/finished",
"style" :
{
"navigationBarTitleText" : "已办任务",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/workflow/detail/detail",
"style" :
{
"navigationBarTitleText" : "流程详情",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/workflow/start/start",
"style" :
{
"navigationBarTitleText" : "发起流程",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/user/user",
"style" :
{
"navigationBarTitleText" : "用户管理",
"navigationStyle": "default"
}
},
{
"path" : "pages/workbench/cost/cost",
"style" :
{
"navigationBarTitleText" : "项目成本",
"navigationStyle": "default"
}
}
],
"tabBar": {

View File

@@ -0,0 +1,48 @@
<template>
<view class="charts-box">
<qiun-data-charts
type="column"
:chartData="chartData"
:opts="chartOpts"
/>
</view>
</template>
<script>
export default {
name: 'InventoryTrend',
// 接收父组件传入的日期参数YYYY-mm格式
props: {
chartData: {
type: Object,
default: {
categories: [], // 日期1日-当前日或当月总天数)
series: [] // 库存趋势数据
}
}
},
data() {
return {
// 图表配置
chartOpts: {
title: { text:'月度收支', left:'center' },
tooltip:{ trigger:'axis' },
legend:{ data:['支出','收入(CNY)','收入(USD)'], bottom:0 },
}
};
},
};
</script>
<style scoped>
.charts-box {
width: 100%;
height: 300px;
padding: 16rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
margin-bottom: 20rpx;
}
</style>

View File

@@ -0,0 +1,102 @@
<template>
<view class="charts-box">
<qiun-data-charts
type="line"
:chartData="chartData"
:opts="chartOpts"
/>
</view>
</template>
<script>
import { monthDataAnalysis } from "@/api/oa/wms/oaWarehouse";
export default {
data() {
return {
// 图表数据符合uCharts格式
chartData: {
categories: [], // 月份
series: [] // 入库量、出库量数据
},
// 图表配置项
chartOpts: {
legend: true, // 显示图例
dataLabel: false, // 不显示数据标签
column: {
type: "group" // 分组柱状图
},
xAxis: {
fontColor: "#666",
fontSize: 12
},
yAxis: {
fontColor: "#666",
fontSize: 12,
gridColor: "#eee"
},
color: ["#007aff", "#ff9500"] // 入库、出库颜色
}
};
},
mounted() {
// 页面就绪后获取数据
this.getServerData();
},
methods: {
getServerData() {
// 显示加载提示
uni.showLoading({
title: '加载数据中...',
mask: true
});
// 调用接口获取数据(当前年份作为参数)
const currentYear = new Date().getFullYear() + '-01';
monthDataAnalysis({ month: currentYear }).then(res => {
// 隐藏加载提示
uni.hideLoading();
// 格式化接口数据为uCharts所需格式
this.chartData = {
categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
series: [
{
name: "入库量",
data: res.data.inData["月"] || [] // 从接口取入库数据
},
{
name: "出库量",
data: res.data.outData["月"] || [] // 从接口取出库数据
}
]
};
}).catch(err => {
// 隐藏加载提示
uni.hideLoading();
// 错误处理
uni.showToast({
title: '数据加载失败',
icon: 'none',
duration: 2000
});
console.error('获取出入库数据失败:', err);
});
}
}
};
</script>
<style scoped>
.charts-box {
width: 100%;
height: 300px; /* 固定图表高度,适配手机屏幕 */
padding: 16rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
margin-bottom: 20rpx;
}
</style>

View File

@@ -0,0 +1,59 @@
<template>
<view class="charts-box">
<qiun-data-charts type="pie" :chartData="chartData" :opts="chartOpts" />
</view>
</template>
<script>
export default {
props: {
projectList: {
required: true,
type: Array
}
},
data() {
return {
chartData: {},
chartOpts: {
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
padding: [5, 5, 5, 5],
enableScroll: false,
extra: {
pie: {
activeOpacity: 0.5,
activeRadius: 10,
offsetAngle: 0,
labelWidth: 15,
border: false,
borderWidth: 3,
borderColor: "#FFFFFF"
}
}
}
}
},
watch: {
projectList: {
handler(newVal) {
const pieData = this.projectList
// .filter(p => p.totalPrice > 0)
.map(p => ({
name: p.projectName,
value: p.totalPrice,
}));
this.chartData = {
series: [{
data: pieData
}]
}
},
immediate: true,
},
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,179 @@
<template>
<view class="recent-records-container">
<view class="table-header">
<text class="title">最近记录</text>
</view>
<scroll-view
scroll-x="true"
class="table-scroll"
show-scrollbar="false"
>
<view class="table-wrapper">
<!-- 表头 -->
<view class="table-row header-row">
<view class="table-cell">物料名称</view>
<view class="table-cell">型号</view>
<view class="table-cell">当前库存</view>
<view class="table-cell">安全库存</view>
<view class="table-cell">在途数量</view>
<view class="table-cell">库存状态</view>
</view>
<!-- 表体 -->
<view
class="table-row"
v-for="(item, index) in tableData"
:key="index"
:class="{ 'odd-row': index % 2 === 1 }"
>
<view class="table-cell">{{ item.name }}</view>
<view class="table-cell">{{ item.model }}</view>
<view class="table-cell">{{ item.inventory }}</view>
<view class="table-cell">{{ item.threshold }}</view>
<view class="table-cell">{{ item.taskInventory }}</view>
<view class="table-cell">
<view
class="status-tag"
:class="calcInventoryStatus(item.inventory, item.taskInventory, item.threshold).type"
>
{{ calcInventoryStatus(item.inventory, item.taskInventory, item.threshold).status }}
</view>
</view>
</view>
<!-- 空状态 -->
<view v-if="tableData.length === 0" class="empty-state">
<uni-icons type="empty" size="60" color="#cccccc"></uni-icons>
<text class="empty-text">暂无记录</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
name: 'RecentRecords',
props: {
// 接收表格数据
tableData: {
type: Array,
default: () => []
}
},
methods: {
// 计算库存状态
calcInventoryStatus(inventory, inTransit, threshold) {
const total = inventory + inTransit;
if (total > threshold + 10) {
return { status: '库存积压', type: 'warning' };
} else if (total > threshold) {
return { status: '正常', type: 'success' };
} else if (total <= threshold && total > threshold - 2) {
return { status: '库存预警', type: 'danger' };
} else {
return { status: '库存不足', type: 'info' };
}
}
}
};
</script>
<style scoped>
.recent-records-container {
width: 100%;
background-color: #ffffff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
overflow: hidden;
}
.table-header {
padding: 20rpx 16rpx;
border-bottom: 1px solid #f5f5f5;
}
.title {
font-size: 28rpx;
font-weight: bold;
color: #333333;
}
.table-scroll {
width: 100%;
}
.table-wrapper {
width: 100%;
min-width: 900rpx; /* 确保表格有足够宽度展示内容 */
}
.table-row {
display: flex;
width: 100%;
border-bottom: 1px solid #f5f5f5;
}
.table-row:last-child {
border-bottom: none;
}
.header-row {
background-color: #f9f9f9;
}
.odd-row {
background-color: #fafafa;
}
.table-cell {
flex: 1;
padding: 20rpx 10rpx;
font-size: 24rpx;
color: #666666;
text-align: center;
word-break: break-all;
display: flex;
align-items: center;
justify-content: center;
}
.status-tag {
padding: 4rpx 12rpx;
border-radius: 14rpx;
font-size: 22rpx;
color: #ffffff;
}
.status-tag.success {
background-color: #00b42a;
}
.status-tag.warning {
background-color: #ff7d00;
}
.status-tag.danger {
background-color: #f53f3f;
}
.status-tag.info {
background-color: #86909c;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 80rpx 0;
}
.empty-text {
font-size: 26rpx;
color: #999999;
margin-top: 20rpx;
}
</style>

View File

@@ -0,0 +1,106 @@
<template>
<view class="summary-cards-container">
<scroll-view
scroll-x="true"
class="cards-scroll"
show-scrollbar="false"
>
<view class="cards-wrapper">
<view
class="summary-card"
v-for="(card, index) in cardsData"
:key="index"
>
<view class="card-title">{{ card.title }}</view>
<view class="card-value">人民币{{ card.valueCNY }}</view>
<view class="card-value">美元{{ card.valueUSD }}</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
export default {
name: 'SummaryCards',
props: {
// 接收卡片数据,格式为数组对象
cardsData: {
type: Array,
default: () => [
{ title: '当前总库存量', value: 0, trend: 0 },
{ title: '在途物料数量', value: 0, trend: 0 },
{ title: '今日入库量', value: 0, trend: 0 },
{ title: '今日出库量', value: 0, trend: 0 },
{ title: '预警信息', value: 0, trend: 0 }
]
}
},
methods: {
// 格式化数字,添加千位分隔符
formatNumber(num) {
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
}
};
</script>
<style scoped>
.summary-cards-container {
width: 100%;
margin-bottom: 20rpx;
}
.cards-scroll {
width: 100%;
white-space: nowrap;
padding: 10rpx 0;
}
.cards-wrapper {
display: inline-flex;
gap: 16rpx;
padding: 0 16rpx;
}
.summary-card {
min-width: 240rpx;
background-color: #ffffff;
border-radius: 12rpx;
padding: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.card-title {
font-size: 26rpx;
color: #666666;
margin-bottom: 10rpx;
}
.card-value {
font-size: 34rpx;
font-weight: bold;
color: #333333;
margin-bottom: 8rpx;
}
.card-trend {
font-size: 22rpx;
display: flex;
align-items: center;
justify-content: center;
gap: 4rpx;
}
.trend-up {
color: #00b42a;
}
.trend-down {
color: #f53f3f;
}
.trend-flat {
color: #888888;
}
</style>

View File

@@ -0,0 +1,289 @@
<template>
<view class="container">
<!-- 加载状态 -->
<view v-if="loading" class="loading-view">
<uni-loading-icon size="24" color="#007aff"></uni-loading-icon>
<text class="loading-text">加载中...</text>
</view>
<!-- 内容区域加载完成后显示 -->
<view v-else>
<!-- 月份选择 -->
<view class="date-picker-container">
<picker mode="date" @change="onDateChange" fields="month" :value="currentDate" class="date-picker">
<view class="picker-view">
<text>{{ formattedDate }}</text>
</view>
</picker>
</view>
<fad-collapse title="指标汇总">
<SummaryCardsVue :cardsData="cardData"/>
</fad-collapse>
<fad-collapse title="月度收支">
<!-- <BarVue :chart-data="barChartData"></BarVue> -->
</fad-collapse>
<fad-collapse title="近六月趋势">
</fad-collapse>
<fad-collapse title="项目支出占比">
<PieVue :project-list="projectList"></PieVue>
</fad-collapse>
<fad-collapse title="明细表格">
</fad-collapse>
</view>
</view>
</template>
<script>
import {
barData,
findFinanceList2
} from '@/api/oa/finance/finance';
import {
getExchangeRate
} from '@/api/oa/finance/exchangeRate';
import {
projectData2
} from '@/api/oa/project';
import SummaryCardsVue from './components/SummaryCards.vue';
import PieVue from './components/Pie.vue'
import BarVue from './components/Bar.vue';
export default {
data() {
return {
loading: true,
currentDate: '',
cardData: [], // 改为数组,存储汇总卡片数据(核心)
monthlyDataMap: {}, // 初始化月度数据映射(用于图表/卡片)
currentList: [], // barData接口返回的列表
projectList: [], // projectData2接口返回的列表
financeList: [], // findFinanceList2接口返回的列表
queryFinanceParams: {}, // 接口请求参数(需确保已定义)
dateForProject: '' ,// 项目接口日期参数(需确保已定义)
barChartData: {},
exchangeRate: 7,
};
},
computed: {
formattedDate() {
const [year, month] = this.currentDate.split('-');
return `${year}${month}`;
}
},
components: {
SummaryCardsVue,
PieVue,
BarVue
},
onLoad() {
// 初始化日期为当前月份
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth() + 1;
this.currentDate = `${year}-${month.toString().padStart(2, '0')}-01`;
this.loadAllData()
},
methods: {
async loadAllExchangeRates(months) {
for (const m of months) {
if (!this.monthlyDataMap[m]) this.monthlyDataMap[m] = {};
if (this.monthlyDataMap[m].exchangeRate) continue;
this.monthlyDataMap[m].exchangeRate = this.exchangeRate;
}
},
onDateChange(e) {
const value = e.detail.value;
this.currentDate = value + '-01';
this.loadAllData()
},
async loadAllData() {
this.loading = true;
this.exchangeRate = await getExchangeRate()
barData(this.queryFinanceParams)
.then(res => {
this.currentList = res.data;
})
.then(async () => {
const months = this.currentList.map(i => i.month);
await this.loadAllExchangeRates(months);
return Promise.all([
projectData2(this.currentDate),
findFinanceList2({
date: this.currentDate
})
]);
})
.then(([projRes, finRes]) => {
this.projectList = projRes.data;
this.financeList = finRes.data;
this.computeSummaries();
})
.finally(() => {
this.loading = false;
console.log('loadAllData done', this.monthlyDataMap);
this.$nextTick(this.initCharts);
});
},
computeSummaries() {
// 1. 获取当前选中月份格式YYYY-MM从currentDate提取
const currentMonth = this.currentDate.slice(0, 7);
// 2. 初始化月度数据映射(确保每个月份的基础结构存在)
this.currentList.forEach(item => {
const month = item.month;
if (!this.monthlyDataMap[month]) {
this.monthlyDataMap[month] = {
outTotal: 0,
inCNY: 0,
inUSD: 0,
exchangeRate: this.monthlyDataMap[month]?.exchangeRate || 0 // 保留已有汇率
};
}
// 赋值出库总额从barData接口获取
this.monthlyDataMap[month].outTotal = item.totalOut;
});
// 3. 初始化统计变量(月度/项目收支)
const initStats = {
monthlyOutCNY: 0, // 月度总支出(人民币)
monthlyOutUSD: 0, // 月度总支出(美元)
monthlyInCNY: 0, // 月度总收入(人民币)
monthlyInUSD: 0, // 月度总收入(美元)
projectOutCNY: 0, // 项目支出(人民币)
projectOutUSD: 0, // 项目支出(美元)
projectInCNY: 0, // 项目收入(人民币)
projectInUSD: 0 // 项目收入(美元)
};
Object.assign(this, initStats);
// 4. 遍历财务明细,计算收支数据
this.financeList.forEach(finItem => {
const itemMonth = finItem.date.slice(0, 7); // 明细所属月份
const amount = Number(finItem.amount) || 0; // 金额转数字避免NaN
const isOut = finItem.type === '0'; // 0=支出1=收入(按业务定义)
const currency = finItem.currency === 'USD' ? 'USD' : 'CNY'; // 货币类型
// 4.1 更新月度收入数据存入monthlyDataMap
const monthData = this.monthlyDataMap[itemMonth];
if (monthData && !isOut) {
monthData[`in${currency}`] += amount;
}
// 4.2 计算「当前选中月份」的统计数据
if (itemMonth === currentMonth) {
if (isOut) {
// 支出:更新月度总支出 + 项目支出有projectId才统计项目
this[`monthlyOut${currency}`] += amount;
if (finItem.projectId) {
this[`projectOut${currency}`] += amount;
}
} else {
// 收入:更新月度总收入 + 项目收入有projectId才统计项目
this[`monthlyIn${currency}`] += amount;
if (finItem.projectId) {
this[`projectIn${currency}`] += amount;
}
}
}
});
// 5. 构建汇总卡片数据核心适配SummaryCards组件
console.log(this.monthlyDataMap, '月度数据')
this.cardData = [
{
title: '月度总支出',
valueCNY: Number(this.monthlyOutCNY.toFixed(2)), // 保留2位小数转数字
valueUSD: Number(this.monthlyOutUSD.toFixed(2))
},
{
title: '月度总收入',
valueCNY: Number(this.monthlyInCNY.toFixed(2)),
valueUSD: Number(this.monthlyInUSD.toFixed(2))
},
{
title: '项目支出',
valueCNY: Number(this.projectOutCNY.toFixed(2)),
valueUSD: Number(this.projectOutUSD.toFixed(2))
},
{
title: '项目收入',
valueCNY: Number(this.projectInCNY.toFixed(2)),
valueUSD: Number(this.projectInUSD.toFixed(2))
}
];
},
}
};
</script>
<style scoped>
.container {
padding: 16rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
/* 日期选择器在折叠卡片额外内容中的样式 */
.picker-view {
display: flex;
align-items: center;
color: #666;
font-size: 24rpx;
padding: 4rpx 8rpx;
}
.icon-margin {
margin-right: 8rpx;
}
/* 图表样式调整 */
.chart-item {
width: 100%;
}
/* 加载状态样式 */
.loading-view {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 100rpx 0;
}
.loading-text {
margin-top: 20rpx;
font-size: 28rpx;
color: #666;
}
/* 折叠卡片间距 */
.fad-collapse {
margin-bottom: 16rpx;
}
.date-picker-container {
background-color: #fff;
border-radius: 8rpx;
padding: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.date-picker {
width: 100%;
}
.picker-view {
text-align: center;
font-size: 28rpx;
color: #007aff;
padding: 8rpx 0;
}
</style>

View File

@@ -109,6 +109,12 @@ export default {
category: '财务中心',
access: ['vice', 'baomi', 'ceo'] // 需要特定权限才能访问
},
// {
// text: '项目成本',
// icon: '/static/images/cost.png',
// url: '/pages/workbench/cost/cost',
// category: '财务中心',
// },
{
text: '智慧库房',
icon: '/static/images/smartStock.png',
@@ -133,11 +139,35 @@ export default {
url: '/pages/workbench/wms/out',
category: '库房管理',
},
// {
// text: '我的申请',
// icon: '/static/images/apply.png',
// url: '/pages/workbench/workflow/apply/apply',
// category: '办公流程'
// },
// {
// text: '代办任务',
// icon: '/static/images/todo.png',
// url: '/pages/workbench/workflow/todo/todo',
// category: '办公流程'
// },
// {
// text: '已办任务',
// icon: '/static/images/finished.png',
// url: '/pages/workbench/workflow/finished/finished',
// category: '办公流程'
// },
{
text: '线上营销',
icon: '/static/images/yingxiao.png',
url: '/pages/workbench/sales/sales',
},
{
text: "用户管理",
icon: '/static/images/user.png',
url: '/pages/workbench/user/user',
// access: ['vice', 'ceo']
}
],
};
},

View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,664 @@
<template>
<view class="report-schedule">
<!-- header始终显示 -->
<view class="search-bar">
<view class="search-container">
<view class="task-type-button-container">
<view class="task-type-button" @click="openDrawer">
<uni-icons type="settings" color="#2979ff" size="22"></uni-icons>
</view>
</view>
<view class="search-input custom-search-input">
<input v-model="queryParams.userName" class="input" type="text" placeholder="搜索用户名称" @confirm="onSearch"
@keyup.enter="onSearch" />
<view class="search-icon" @click="onSearch">
<uni-icons type="search" color="#bbb" size="20"></uni-icons>
</view>
<view v-if="searchName" class="clear-icon" @click="onClearSearch">
<uni-icons type="closeempty" color="#bbb" size="18"></uni-icons>
</view>
</view>
<view class="add-button" @click="handleAdd">
<uni-icons type="plusempty" color="#2979ff" size="22"></uni-icons>
</view>
</view>
</view>
<!-- 筛选抽屉 -->
<uni-drawer ref="drawerRef" mode="left" :width="320">
<view class="drawer-content">
<view class="drawer-title">筛选</view>
<view class="drawer-form">
<view class="drawer-form-item">
<text class="drawer-label">手机号</text>
<uni-easyinput v-model="queryParams.phonenumber" placeholder="请输入手机号" />
</view>
<view class="drawer-form-item">
<text class="drawer-label">状态</text>
<oa-dict-select v-model="queryParams.status" dictType="sys_normal_disable"/>
</view>
</view>
<view class="drawer-btns">
<button class="drawer-btn-primary" @click="applyFilterAndClose">确定</button>
<button class="drawer-btn" @click="resetFilterAndClose">重置</button>
<button class="drawer-btn" @click="closeDrawer">关闭</button>
</view>
</view>
</uni-drawer>
<view>
<!-- 自定义列表右滑菜单uni-ui实现 -->
<scroll-view scroll-y style="height: 100vh;" @scrolltolower="loadMore">
<view v-if="reportScheduleList.length">
<uni-swipe-action>
<block v-for="(item, index) in reportScheduleList" :key="item.userId">
<uni-swipe-action-item :right-options="getSwipeOptions(item)" @click="swipeActionClick($event, item)"
style="margin-bottom: 16rpx;">
<view class="card">
<view class="card-title">
<text class="project">{{ item.nickName }}</text>
</view>
<view class="card-content">
<view>用户名称{{ item.userName }}</view>
<view>部门{{ item.dept.deptName }}</view>
<view>手机号码{{ item.phonenumber }}</view>
<view>注册时间{{ item.createTime }}</view>
</view>
</view>
</uni-swipe-action-item>
</block>
</uni-swipe-action>
</view>
<view v-else class="empty">暂无数据</view>
<view class="load-more-tips">
<u-loading-icon v-if="loadingMore" text="加载中..." size="20" textSize="14" />
<text v-else-if="!hasMore && reportScheduleList.length">没有更多了</text>
</view>
</scroll-view>
<!-- 新增/编辑弹窗 -->
<uni-popup ref="popupRef" type="bottom">
<view class="popup-content">
<view class="uni-form">
<view class="uni-form-item">
<text class="uni-form-label">用户昵称</text>
<uni-easyinput v-model="form.nickName" placeholder="请输入用户昵称" />
</view>
<view class="uni-form-item">
<text class="uni-form-label">手机号码</text>
<uni-easyinput type='phone' :disabled="form.userId" v-model="form.phonenumber" placeholder="请输入用户手机号" />
</view>
<view class="uni-form-item">
<text class="uni-form-label">用户邮箱</text>
<uni-easyinput type="email" v-model="form.email" placeholder="请输入用户邮箱" />
</view>
<view class="uni-form-item">
<text class="uni-form-label">用户名称</text>
<uni-easyinput v-model="form.userName" placeholder="请输入用户名称" />
</view>
<view class="uni-form-item" v-if="form.userId">
<text class="uni-form-label">用户密码</text>
<uni-easyinput type="password" v-model="form.password" placeholder="请输入用户密码" />
</view>
<view class="uni-form-item">
<text class="uni-form-label">用户性别</text>
<oa-dict-select v-model="form.sex" dictType="sys_user_sex"></oa-dict-select>
</view>
<view class="uni-form-item">
<text class="uni-form-label">薪资</text>
<uni-easyinput v-model="form.laborCost" placeholder="请输入薪资(工人为日薪)" />
</view>
<view class="uni-form-item">
<text class="uni-form-label">保险金</text>
<uni-easyinput v-model="form.insure" placeholder="请输入保险金" />
</view>
<view class="uni-form-item">
<text class="uni-form-label">岗位</text>
<uni-data-select v-model="form.postIds" multiple :localdata="roleOptions"></uni-data-select>
</view>
<view class="uni-form-item">
<text class="uni-form-label">角色</text>
<uni-data-select v-model="form.roleIds" multiple :localdata="roleOptions"></uni-data-select>
</view>
<view class="uni-form-item">
<text class="uni-form-label">部门</text>
<uni-data-picker :localdata="deptOptions" v-model="form.deptId"></uni-data-picker>
</view>
<view class="uni-form-item">
<text class="uni-form-label">备注</text>
<u-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</view>
</view>
<view class="popup-btns">
<u-button type="primary" @click="submitForm">确定</u-button>
<u-button @click="closePopup">取消</u-button>
</view>
</view>
</uni-popup>
</view>
</view>
</template>
<script>
import {
addUser,
changeUserStatus,
delUser,
deptTreeSelect,
getUser,
listUser,
resetUserPwd,
updateUser
} from "@/api/oa/user";
export default {
data() {
return {
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
userName: undefined,
phonenumber: undefined,
status: undefined,
deptId: undefined
},
projectOptions: [],
headerOptions: [],
reportScheduleList: [],
total: 0,
single: true,
multiple: true,
form: {},
viewType: 'table',
showStartDate: false,
showEndDate: false,
swipeOptions: [{
text: '编辑',
style: {
backgroundColor: '#2979ff',
color: '#fff'
}
},
{
text: '删除',
style: {
backgroundColor: '#fa3534',
color: '#fff'
}
},
],
// 新增:筛选相关
searchName: '',
filterProject: '',
filterHeader: '',
filterDateRange: [],
pageNum: 1,
pageSize: 10,
loadingMore: false,
hasMore: true,
startForm: {
reportTitle: '',
reportDate: '',
reporter: '',
projectId: '',
remark: '',
type: 1
},
startLoading: false,
startPopupOpen: false,
_startuserId: null,
showGanttView: false,
postOptions: [],
roleOptions: [],
deptOptions: [],
}
},
onLoad() {
this.pageNum = 1
this.hasMore = true
this.handleQuery()
deptTreeSelect().then(res => {
console.log(res.data, '部门数据')
// 递归转换函数value直接使用原id
function transformStructure(source) {
// 处理单个节点的转换
function transformNode(node) {
// 基础转换text映射labelvalue直接使用原id
const transformed = {
text: node.label,
value: node.id // 直接使用原始id作为value
};
// 递归处理子节点(如果存在)
if (node.children && node.children.length > 0) {
transformed.children = node.children.map(child => transformNode(child));
}
return transformed;
}
// 处理整个数组
return source.map(item => transformNode(item));
}
this.deptOptions = transformStructure(res.data)
})
},
methods: {
openDrawer() {
this.$refs.drawerRef.open();
},
closeDrawer() {
this.$refs.drawerRef.close();
},
applyFilterAndClose() {
this.applyFilter();
this.closeDrawer();
},
resetFilterAndClose() {
this.resetFilter();
this.closeDrawer();
},
// 搜索框检索
onSearch() {
this.searchName = this.searchName
this.handleQuery()
},
onClearSearch() {
this.searchName = ''
this.queryParams.nickName = ''
this.handleQuery()
},
// 筛选抽屉应用
applyFilter() {
this.queryParams.projectId = this.filterProject
this.queryParams.header = this.filterHeader
if (this.filterDateRange && this.filterDateRange.length === 2) {
this.queryParams.dateRange = this.filterDateRange
} else {
this.queryParams.dateRange = []
}
this.handleQuery()
},
// 筛选抽屉重置
resetFilter() {
this.queryParams.phonenumber = '';
this.queryParams.status = null;
},
handleQuery() {
this.pageNum = 1
this.hasMore = true
this.queryParams.pageNum = 1
if (this.queryParams.dateRange && this.queryParams.dateRange.length === 2) {
this.queryParams.startDate = this.queryParams.dateRange[0]
this.queryParams.endDate = this.queryParams.dateRange[1]
} else {
this.queryParams.startDate = ''
this.queryParams.endDate = ''
}
this.getList()
},
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
projectId: '',
nickName: '',
header: '',
dateRange: []
}
this.searchName = ''
this.pageNum = 1
this.hasMore = true
this.getList()
},
getList() {
this.loadingMore = true
this.queryParams.pageNum = this.pageNum
this.queryParams.pageSize = this.pageSize
listUser(this.queryParams).then(res => {
const rows = res.rows || []
if (this.pageNum === 1) {
this.reportScheduleList = rows
} else {
this.reportScheduleList = this.reportScheduleList.concat(rows)
}
// 判断是否还有更多
this.hasMore = rows.length === this.pageSize
this.total = res.total || 0
}).finally(() => {
this.loadingMore = false
})
},
loadMore() {
if (!this.hasMore || this.loadingMore) return
this.pageNum++
this.getList()
},
handleAdd() {
getUser().then((res) => {
this.postOptions = res.data.posts.map(item => ({
text: item.postName,
value: item.postId
}));
this.roleOptions = res.data.roles.map(item => ({
text: item.roleName,
value: item.roleId
}));
this.form = {}
this.$refs.popupRef.open('bottom')
})
},
handleUpdate(row) {
getUser(row.userId).then(res => {
this.postOptions = res.data.posts.map(item => ({
text: item.postName,
value: item.postId
}));
this.roleOptions = res.data.roles.map(item => ({
text: item.roleName,
value: item.roleId
}));
this.form = res.data.user || {}
this.$set(this.form, "postIds", res.data.postIds);
this.$set(this.form, "roleIds", res.data.roleIds);
this.$refs.popupRef.open('bottom')
})
},
handleDelete(item) {
uni.showModal({
title: '确认删除',
content: `确定要删除用户“${item.nickName}”吗?`,
success: (res) => {
if (res.confirm) {
const ids = item ? [item.userId] : this.selectedIds
delUser(ids).then(() => {
uni.showToast({
title: '删除成功',
icon: 'success'
})
this.getList()
})
}
}
})
},
handleExport() {
// 导出逻辑可根据实际API实现
uni.showToast({
title: '导出功能开发中',
icon: 'none'
})
},
submitForm() {
if (this.form.userId) {
updateUser(this.form).then(() => {
uni.showToast({
title: '修改成功',
icon: 'success'
})
this.closePopup()
this.getList()
})
} else {
addUser(this.form).then(() => {
uni.showToast({
title: '新增成功',
icon: 'success'
})
this.closePopup()
this.getList()
})
}
},
closePopup() {
this.$refs.popupRef.close()
},
getSwipeOptions(item) {
const options = [{
text: '编辑',
style: {
backgroundColor: '#2979ff',
color: '#fff'
}
},
{
text: '删除',
style: {
backgroundColor: '#fa3534',
color: '#fff'
}
}
];
return options;
},
swipeActionClick(e, item) {
const text = e.content.text;
if (text === '编辑') {
this.handleUpdate(item);
} else if (text === '删除') {
this.handleDelete(item);
}
},
}
}
</script>
<style scoped>
.report-schedule {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 120rpx;
}
.search-bar {
padding: 20rpx;
position: sticky;
top: 0;
z-index: 100;
background: #fff;
}
.search-container {
display: flex;
align-items: center;
gap: 20rpx;
}
.task-type-button-container {
display: flex;
gap: 12rpx;
}
.task-type-button {
width: 60rpx;
height: 60rpx;
background-color: transparent;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.search-input {
flex: 1;
position: relative;
display: flex;
align-items: center;
background: #f5f5f5;
border-radius: 100rpx;
padding: 0 24rpx;
height: 60rpx;
}
.input {
flex: 1;
border: none;
background: transparent;
font-size: 30rpx;
outline: none;
height: 60rpx;
line-height: 60rpx;
}
.search-icon {
margin-left: 8rpx;
display: flex;
align-items: center;
}
.clear-icon {
margin-left: 8rpx;
display: flex;
align-items: center;
}
.drawer-content {
padding: 32rpx 24rpx 24rpx 24rpx;
}
.drawer-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.drawer-form {
margin-bottom: 32rpx;
}
.drawer-form-item {
margin-bottom: 24rpx;
}
.drawer-label {
display: block;
font-size: 28rpx;
color: #333;
margin-bottom: 8rpx;
}
.drawer-btns {
display: flex;
gap: 16rpx;
margin-top: 24rpx;
}
.drawer-btn-primary {
flex: 1;
background: #2979ff;
color: #fff;
border: none;
border-radius: 8rpx;
padding: 16rpx 0;
font-size: 28rpx;
}
.drawer-btn {
flex: 1;
background: #f5f5f5;
color: #333;
border: none;
border-radius: 8rpx;
padding: 16rpx 0;
font-size: 28rpx;
}
.card {
background: #fff;
border-radius: 16rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
padding: 24rpx;
}
.card-title {
display: flex;
justify-content: space-between;
align-items: center;
font-weight: bold;
margin-bottom: 12rpx;
}
.project {
color: #2979ff;
}
.status {
font-size: 24rpx;
padding: 0 12rpx;
border-radius: 8rpx;
}
.status-1 {
background: #e0f7fa;
color: #009688;
}
.status-0,
.status-undefined {
background: #fffbe6;
color: #faad14;
}
.status-other {
background: #fbeff2;
color: #e91e63;
}
.card-content view {
margin-bottom: 8rpx;
color: #666;
font-size: 26rpx;
}
.empty {
text-align: center;
color: #bbb;
margin: 40rpx 0;
}
.popup-content {
padding: 24rpx;
background: #fff;
max-height: 80vh;
overflow-y: scroll;
border-radius: 16rpx 16rpx 0 0;
}
.uni-form {
margin-bottom: 32rpx;
}
.uni-form-item {
margin-bottom: 32rpx;
}
.uni-form-label {
display: block;
font-size: 28rpx;
color: #333;
margin-bottom: 8rpx;
}
.load-more-tips {
text-align: center;
color: #bbb;
padding: 24rpx 0 32rpx 0;
font-size: 28rpx;
}
.card-ops {
margin-top: 16rpx;
display: flex;
gap: 16rpx;
}
.gantt-toggle-bar {
display: flex;
gap: 16rpx;
padding: 16rpx 0 8rpx 0;
background: #fff;
justify-content: flex-end;
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<view class="container">
<!-- 采购单列表滚动加载区域 -->
<!-- 出库单列表滚动加载区域 -->
<scroll-view
scroll-y
@scrolltolower="loadMore"
@@ -19,7 +19,7 @@
>
<!-- 单据头部 -->
<view class="doc-header">
<view class="doc-title">采购</view>
<view class="doc-title">出库</view>
<uni-tag
:type="item.status === 1 ? 'success' : 'warning'"
class="status-tag"
@@ -72,7 +72,7 @@
<!-- 空状态 -->
<view class="empty-state" v-else-if="!loading && TaskList.length === 0">
<uni-icon type="empty" size="60" color="#ccc"></uni-icon>
<text class="empty-text">暂无采购单数据</text>
<text class="empty-text">暂无出库单数据</text>
</view>
</view>
@@ -98,7 +98,7 @@
<view class="popup-container">
<!-- 弹窗标题栏 -->
<!-- <view class="popup-header">
<text class="popup-title">采购单明细</text>
<text class="popup-title">出库单明细</text>
<uni-icon
type="close"
size="24"
@@ -156,7 +156,7 @@
<view class="empty-state" v-else>
<uni-icon type="empty" size="50" color="#ccc"></uni-icon>
<text class="empty-text">暂无采购单明细</text>
<text class="empty-text">暂无出库单明细</text>
</view>
</view>
</view>
@@ -173,7 +173,7 @@ export default {
name: "PurchaseOrderList",
data() {
return {
// 采购单列表数据
// 出库单列表数据
TaskList: [],
// 详情数据
warehouseTaskList: [],
@@ -219,7 +219,7 @@ export default {
this.getList();
},
/** 查询采购单列表 */
/** 查询出库单列表 */
getList() {
// 显示加载状态
this.loading = true;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,563 @@
<template>
<view class="app-container">
<!-- 流程列表 -->
<view class="list-container" v-if="ownProcessList.length > 0">
<view
v-for="(item, index) in ownProcessList"
:key="index"
class="list-item"
>
<!-- 1. 基础信息区 -->
<view class="base-info">
<view class="base-info__title">
<text class="label">流程标题</text>
<text class="value">{{ (item.procVars) || '无标题' }}</text>
</view>
<view class="base-info__other">
<view class="other-item">
<text class="label">流程名称</text>
<text class="value">{{ item.procDefName || '未知' }}</text>
</view>
<view class="other-item">
<text class="label">版本</text>
<view class="version-tag">v{{ item.procDefVersion || 1 }}</view>
<text class="sort">{{ item.sort || '' }}</text>
</view>
</view>
</view>
<!-- 2. 状态信息区 -->
<view class="status-info">
<view class="status-item">
<text class="label">当前节点</text>
<text class="value">{{ item.taskName || '无' }}</text>
</view>
<view class="status-item">
<text class="label">提交时间</text>
<text class="value">{{ item.createTime || '未知' }}</text>
</view>
<view class="status-item">
<text class="label">流程状态</text>
<view
class="status-tag"
:class="getStatusTagClass(item.processStatus)"
>
{{ getStatusText(item.processStatus) }}
</view>
</view>
<view class="status-item">
<text class="label">耗时</text>
<text class="value">{{ item.duration || '0' }}</text>
</view>
</view>
<!-- 3. 操作按钮区 -->
<view class="action-buttons">
<button
class="action-btn"
@click="handleFlowRecord(item)"
>
详情
</button>
<button
class="action-btn delete-btn"
@click="handleDelete(item)"
v-if="item.finishTime"
>
删除
</button>
<button
class="action-btn cancel-btn"
@click="handleStop(item)"
v-else
>
取消
</button>
<!-- <button
class="action-btn restart-btn"
@click="handleAgain(item)"
>
重新发起
</button> -->
</view>
</view>
</view>
<!-- 空数据提示 -->
<view class="empty-tip" v-if="!loading && ownProcessList.length === 0">
<view class="empty-icon">
<text class="icon">📦</text>
</view>
<text class="empty-text">暂无流程数据</text>
</view>
<!-- 分页控件原生实现 -->
<view class="pagination" v-if="total > queryParams.pageSize">
<button
class="page-btn"
@click="prevPage"
:disabled="queryParams.pageNum <= 1"
>
上一页
</button>
<view class="page-info">
{{ queryParams.pageNum }} / {{ totalPages }}
</view>
<button
class="page-btn"
@click="nextPage"
:disabled="queryParams.pageNum >= totalPages"
>
下一页
</button>
</view>
<uni-fab ref="fab" horizontal="right" vertical="bottom"
direction="horizontal" @fabClick="fabClick" />
<uni-popup ref="startpopup">
<view class="" style="background-color: white; display: flex; flex-wrap: wrap; gap: 3px; justify-content: space-evenly; padding: 20rpx;">
<view v-for="item in applyCategory" @click="jumpStart(item)" style="background-color: gainsboro; padding: 20rpx;">
{{ item.label }}
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { delProcess, listOwnProcess, stopProcess } from '@/api/oa/workflow/process';
const applyCategory = [
{
label: '用印申请',
name: 'seal',
path: '/workflow/process/start',
params: {
deploymentId: '743bf626-355e-11f0-b7d7-fa163e1573b1'
},
query: {
definitionId: 'Process_1741171051790%3A2%3A74715e09-355e-11f0-b7d7-fa163e1573b1'
}
},
// {
// label: '拨款申请',
// name: 'money',
// path: '/money/addMoney'
// },
// {
// label: '报销申请',
// name: 'claim',
// path: '/claim/addTripClaim'
// },
{
label: '请假申请',
name: 'absence',
path: '/workflow/process/start',
params: {
deploymentId: 'f16f31cf-9215-11f0-9545-d8f3bc6f4151'
},
query: {
definitionId: 'Process_1741158926906%3A10%3Af1d17612-9215-11f0-9545-d8f3bc6f4151'
}
},
{
label: '差旅申请',
name: 'trip',
path: '/workflow/process/start',
params: {
deploymentId: 'd7b3b7c2-355f-11f0-b7d7-fa163e1573b1'
},
query: {
definitionId: 'Process_1741509148283%3A2%3Ad7ba4775-355f-11f0-b7d7-fa163e1573b1'
}
},
{
label: '招待申请',
name: 'entertain',
path: '/workflow/process/start',
params: {
deploymentId: '81c87a72-355f-11f0-b7d7-fa163e1573b1'
},
query: {
definitionId: 'Process_1741172554061%3A3%3A81d60f05-355f-11f0-b7d7-fa163e1573b1'
}
},
{
label: '其他申请',
name: 'other',
path: '/workflow/process/start',
params: {
deploymentId: '003a0422-3560-11f0-b7d7-fa163e1573b1'
},
query: {
definitionId: 'Process_1741172337682%3A4%3A00454ec5-3560-11f0-b7d7-fa163e1573b1'
}
}
]
export default {
name: "OwnProcessList",
data() {
return {
loading: false, // 加载状态使用API控制不依赖组件
ownProcessList: [],
total: 0,
queryParams: {
pageNum: 1,
pageSize: 10,
processKey: undefined,
processName: undefined,
category: undefined,
description: undefined
},
dateRange: [],
applyCategory
};
},
computed: {
// 计算总页数
totalPages() {
return Math.ceil(this.total / this.queryParams.pageSize) || 1;
}
},
onLoad() {
this.getList();
},
methods: {
/** 获取列表数据(使用原生加载提示) */
getList() {
this.loading = true;
// 显示原生加载提示
uni.showLoading({
title: '加载中...',
mask: true
});
const params = this.addDateRange({ ...this.queryParams }, this.dateRange);
listOwnProcess(params)
.then(response => {
this.ownProcessList = response.rows || [];
this.total = response.total || 0;
})
.catch(err => {
console.error('获取流程列表失败:', err);
uni.showToast({ title: '加载失败', icon: 'none', duration: 2000 });
})
.finally(() => {
this.loading = false;
// 关闭原生加载提示
uni.hideLoading();
});
},
fabClick() {
this.$refs.startpopup.open('bottom')
},
/** 日期范围处理 */
addDateRange(params, dateRange) {
const result = { ...params };
if (Array.isArray(dateRange) && dateRange.length === 2) {
result.beginTime = dateRange[0];
result.endTime = dateRange[1];
}
return result;
},
/** 上一页 */
prevPage() {
if (this.queryParams.pageNum > 1) {
this.queryParams.pageNum--;
this.getList();
}
},
/** 下一页 */
nextPage() {
if (this.queryParams.pageNum < this.totalPages) {
this.queryParams.pageNum++;
this.getList();
}
},
/** 详情跳转 */
handleFlowRecord(row) {
console.log(row);
const definitionId = row.procDefId;
const deploymentId = row.deployId;
uni.navigateTo({
url: `/pages/workbench/workflow/detail/detail?definitionId=${definitionId}&deployId=${deploymentId}&processed=false`
});
},
/** 删除流程 */
handleDelete(row) {
const procInsId = row.procInsId;
uni.showModal({
title: '警告',
content: `是否确认删除流程编号为"${procInsId}"的数据?`,
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
delProcess(procInsId)
.then(() => {
uni.showToast({ title: '删除成功', duration: 1500 });
this.getList();
})
.catch(err => {
console.error('删除失败:', err);
uni.showToast({ title: '删除失败', icon: 'none' });
});
}
}
});
},
/** 取消流程 */
handleStop(row) {
const params = { procInsId: row.procInsId };
stopProcess(params)
.then(response => {
uni.showToast({ title: response.msg || '取消成功', duration: 1500 });
this.getList();
})
.catch(err => {
console.error('取消失败:', err);
uni.showToast({ title: '取消失败', icon: 'none' });
});
},
/** 重新发起 */
handleAgain(row) {
uni.navigateTo({
url: `/pages/workflow/process/start/${row.deployId}?definitionId=${row.procDefId}&procInsId=${row.procInsId}`
});
},
jumpStart(row) {
const definitionId = row.query.definitionId;
const deploymentId = row.params.deploymentId;
uni.navigateTo({
url: `/pages/workbench/workflow/start/start?definitionId=${definitionId}&deployId=${deploymentId}&processed=false`
});
},
/** 状态标签样式原生实现替代uni-tag */
getStatusTagClass(status) {
switch (status) {
case 1: return 'status-tag--primary'; // 运行中
case 2: return 'status-tag--success'; // 已完成
case 3: return 'status-tag--danger'; // 已取消
default: return 'status-tag--info'; // 未知
}
},
/** 状态文本 */
getStatusText(status) {
switch (status) {
case 1: return '运行中';
case 2: return '已完成';
case 3: return '已取消';
default: return '未知状态';
}
}
}
};
</script>
<style scoped>
.app-container {
padding: 16rpx;
background-color: #f5f5f5;
min-height: 100vh;
}
/* 列表容器 */
.list-container {
background-color: #fff;
border-radius: 16rpx;
overflow: hidden;
margin-bottom: 16rpx;
}
/* 列表项 */
.list-item {
padding: 20rpx;
border-bottom: 1rpx solid #eee;
}
.list-item:last-child {
border-bottom: none;
}
/* 基础信息区 */
.base-info {
margin-bottom: 20rpx;
}
.base-info__title {
font-size: 32rpx;
font-weight: 500;
margin-bottom: 10rpx;
line-height: 1.5;
}
.base-info__other {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
font-size: 28rpx;
color: #666;
}
.other-item {
display: flex;
align-items: center;
gap: 8rpx;
}
/* 版本标签(原生实现) */
.version-tag {
background-color: #e8f3ff;
color: #1677ff;
padding: 2rpx 10rpx;
border-radius: 4rpx;
font-size: 24rpx;
}
.sort {
margin-left: 8rpx;
color: #999;
}
/* 状态信息区 */
.status-info {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
font-size: 28rpx;
color: #666;
margin-bottom: 20rpx;
}
.status-item {
display: flex;
align-items: center;
gap: 8rpx;
}
/* 状态标签(原生实现) */
.status-tag {
padding: 2rpx 10rpx;
border-radius: 4rpx;
font-size: 24rpx;
}
.status-tag--primary {
background-color: #e8f3ff;
color: #1677ff;
}
.status-tag--success {
background-color: #f0fff4;
color: #00b42a;
}
.status-tag--danger {
background-color: #fff1f0;
color: #f53f3f;
}
.status-tag--info {
background-color: #f2f3f5;
color: #86909c;
}
/* 操作按钮区 */
.action-buttons {
display: flex;
flex-wrap: wrap;
gap: 16rpx;
justify-content: flex-end;
}
.action-btn {
padding: 8rpx 20rpx;
font-size: 26rpx;
border: none;
background: transparent;
line-height: 1;
}
.delete-btn {
color: #f53f3f;
}
.cancel-btn {
color: #faad14;
}
.restart-btn {
color: #1677ff;
}
/* 空数据提示 */
.empty-tip {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 400rpx;
color: #999;
}
.empty-icon {
font-size: 80rpx;
margin-bottom: 20rpx;
}
.empty-text {
font-size: 28rpx;
}
/* 分页控件 */
.pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 30rpx;
padding: 30rpx 0;
}
.page-btn {
padding: 12rpx 30rpx;
background-color: #fff;
border: 1rpx solid #eee;
border-radius: 6rpx;
font-size: 28rpx;
color: #333;
}
.page-btn:disabled {
color: #ccc;
background-color: #f5f5f5;
}
.page-info {
font-size: 28rpx;
color: #666;
}
/* 通用样式 */
.label {
color: #999;
}
.value {
color: #333;
}
</style>

View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,33 @@
<template>
<view style="padding: 20rpx;">
<oa-schema-form :formConf="formData" @finish="handleFinish"></oa-schema-form>
</view>
</template>
<script>
import { getProcessForm, startProcess } from '@/api/oa/workflow/process'
export default {
data() {
return {
formData: {}
}
},
onLoad(config) {
console.log(config)
getProcessForm(config).then(res => {
console.log(res)
this.formData = res.data
})
},
methods: {
handleFinish(data) {
console.log(data)
}
}
}
</script>
<style>
</style>

View File

@@ -0,0 +1,22 @@
<template>
<view>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>

BIN
static/images/apply.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
static/images/cost.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/images/finished.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
static/images/todo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
static/images/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -1,3 +1,11 @@
## 1.1.02025-08-19
- 新增 插槽 selected empty option
- 新增 mutiple 属性,支持多选功能
- 新增 wrap 属性,支持选中的文字超过一行显示
- 新增 align 属性,支持修改选中的文字显示的位置
- 新增 hideRight 属性,支持隐藏右侧所有按钮
- 新增 mode 属性,支持修改边框样式
- 新增 事件 open close clear
## 1.0.102025-04-14
- 修复 清除按钮不展示问题
## 1.0.92025-03-26

View File

@@ -2,30 +2,59 @@
<view class="uni-stat__select">
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ''}}</span>
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
<view class="uni-select" :class="{'uni-select--disabled':disabled}">
<view class="uni-select__input-box" @click="toggleSelector">
<view v-if="current" class="uni-select__input-text">{{textShow}}</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
<view key="clear-button" v-if="current && clear && !disabled" @click.stop="clearVal">
<view class="uni-select" :class="{'uni-select--disabled':disabled, 'uni-select--wrap': shouldWrap , 'border-default': mode == 'default','border-bottom': mode == 'underline'}">
<view class="uni-select__input-box" @click="toggleSelector" :class="{'uni-select__input-box--wrap': shouldWrap}">
<view v-if="slotSelected" class="slot-content padding-top-bottom" :class="{'uni-select__input-text--wrap': shouldWrap}">
<slot name="selected" :selectedItems="getSelectedItems()"></slot>
</view>
<template v-else>
<view v-if="textShow" class="uni-select__input-text" :class="{'uni-select__input-text--wrap': shouldWrap}">
<view class="padding-top-bottom" :class="'align-'+align">{{textShow}}</view>
</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder" :class="'align-'+align">{{typePlaceholder}}</view>
</template>
<view key="clear-button" v-if="!hideRight && shouldShowClear && clear && !disabled" @click.stop="clearVal">
<uni-icons type="clear" color="#c0c4cc" size="24" />
</view>
<view key="arrow-button" v-else>
<view key="arrow-button" v-else-if="!hideRight">
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
</view>
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
</view>
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
@click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
</scroll-view>
</view>
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<template v-if="slotEmpty && mixinDatacomResData.length === 0">
<view class="uni-select__selector-empty">
<slot name="empty" :empty="emptyTips"></slot>
</view>
</template>
<template v-else>
<view v-if="mixinDatacomResData.length === 0" class="uni-select__selector-empty">
<text>{{emptyTips}}</text>
</view>
</template>
<template v-if="slotOption">
<view v-for="(itemData,index) in mixinDatacomResData" :key="index" @click="change(itemData)">
<slot name="option" :item="itemData" :itemSelected="multiple? getCurrentValues().includes(itemData.value):getCurrentValues() == itemData.value"></slot>
</view>
</template>
<template v-else>
<view v-if="!multiple && mixinDatacomResData.length > 0" class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
@click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
<view v-if="multiple && mixinDatacomResData.length > 0" >
<checkbox-group @change="checkBoxChange">
<label class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index" >
<checkbox :value="index+''" :checked="getCurrentValues().includes(item.value)" :disabled="item.disable"></checkbox>
<view :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</view>
</label>
</checkbox-group>
</view>
</template>
</scroll-view>
</view>
</view>
</view>
</view>
@@ -36,22 +65,56 @@
* DataChecklist 数据选择器
* @description 通过数据渲染的下拉框组件
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
* @property {String} value 默认值
* @property {String|Array} value 默认值,多选时为数组
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
* @property {Boolean} clear 是否可以清空已选项
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @property {Boolean} multiple 是否多选模式
* @property {Boolean} wrap 是否允许选中文本换行显示
* @property {String} placement 弹出位置
* @value top 顶部弹出
* @value bottom 底部弹出default)
* @property {String} align 选择文字的位置
* @value left 显示左侧
* @value center 显示中间
* @value right 显示 右侧
* @property {Boolean} hideRight 是否隐藏右侧按钮
* @property {String} mode 边框样式
* @value default 四周边框
* @value underline 下边框
* @value none 无边框
* @event {Function} change 选中发生变化触发
* @event {Function} open 选择框开启时触发
* @event {Function} close 选择框关闭时触发
* @event {Function} clear 点击清除按钮之后触发
*/
export default {
name: "uni-data-select",
mixins: [uniCloud.mixinDatacom || {}],
emits: [
'open',
'close',
'update:modelValue',
'input',
'clear',
'change'
],
model: {
prop: 'modelValue',
event: 'update:modelValue'
},
options: {
// #ifdef MP-TOUTIAO
virtualHost: false,
// #endif
// #ifndef MP-TOUTIAO
virtualHost: true
// #endif
},
props: {
localdata: {
type: Array,
@@ -60,11 +123,11 @@
}
},
value: {
type: [String, Number],
type: [String, Number, Array],
default: ''
},
modelValue: {
type: [String, Number],
type: [String, Number, Array],
default: ''
},
label: {
@@ -99,7 +162,27 @@
placement: {
type: String,
default: 'bottom'
}
},
multiple: {
type: Boolean,
default: false
},
wrap: {
type: Boolean,
default: false
},
align:{
type: String,
default: "left"
},
hideRight: {
type: Boolean,
default: false
},
mode:{
type: String,
default: 'default'
}
},
data() {
return {
@@ -133,17 +216,35 @@
common
},
valueCom() {
// #ifdef VUE3
return this.modelValue;
// #endif
// #ifndef VUE3
return this.value;
// #endif
if (this.value === '') return this.modelValue
if (this.modelValue === '') return this.value
return this.value
},
textShow() {
// 长文本显示
let text = this.current;
return text;
if (this.multiple) {
const currentValues = this.getCurrentValues();
if (Array.isArray(currentValues) && currentValues.length > 0) {
const selectedItems = this.mixinDatacomResData.filter(item => currentValues.includes(item.value));
return selectedItems.map(item => this.formatItemName(item)).join(', ');
} else {
return ''; // 空数组时返回空字符串,显示占位符
}
} else {
return this.current;
}
},
shouldShowClear() {
if (this.multiple) {
const currentValues = this.getCurrentValues();
return Array.isArray(currentValues) && currentValues.length > 0;
} else {
return !!this.current;
}
},
shouldWrap() {
// 只有在多选模式、开启换行、且有内容时才应用换行样式
return this.multiple && this.wrap && !!this.textShow;
},
getOffsetByPlacement() {
switch (this.placement) {
@@ -152,10 +253,38 @@
case 'bottom':
return "top:calc(100% + 12px);";
}
},
slotSelected(){
// #ifdef VUE2
return this.$scopedSlots ? this.$scopedSlots.selected : false
// #endif
// #ifdef VUE3
return this.$slots ? this.$slots.selected : false
// #endif
},
slotEmpty(){
// #ifdef VUE2
return this.$scopedSlots ? this.$scopedSlots.empty : false
// #endif
// #ifdef VUE3
return this.$slots ? this.$slots.empty : false
// #endif
},
slotOption(){
// #ifdef VUE2
return this.$scopedSlots ? this.$scopedSlots.option : false
// #endif
// #ifdef VUE3
return this.$slots ? this.$slots.option : false
// #endif
}
},
watch: {
showSelector:{
handler(val,old){
val ? this.$emit('open') : this.$emit('close')
}
},
localdata: {
immediate: true,
handler(val, old) {
@@ -175,9 +304,20 @@
}
}
},
},
methods: {
getSelectedItems() {
const currentValues = this.getCurrentValues();
let _minxData = this.mixinDatacomResData
// #ifdef MP-WEIXIN || MP-TOUTIAO
_minxData = JSON.parse(JSON.stringify(this.mixinDatacomResData))
// #endif
if (this.multiple) {
return _minxData.filter(item => currentValues.includes(item.value)) || [];
} else {
return _minxData.filter(item => item.value === currentValues) || [];
}
},
debounce(fn, time = 100) {
let timer = null
return function(...args) {
@@ -187,6 +327,23 @@
}, time)
}
},
// 检查项目是否已选中
isSelected(item) {
if (this.multiple) {
const currentValues = this.getCurrentValues();
return Array.isArray(currentValues) && currentValues.includes(item.value);
} else {
return this.getCurrentValues() === item.value;
}
},
// 获取当前选中的值
getCurrentValues() {
if (this.multiple) {
return Array.isArray(this.valueCom) ? this.valueCom : (this.valueCom ? [this.valueCom] : []);
} else {
return this.valueCom;
}
},
// 执行数据库查询
query() {
this.mixinDatacomEasyGet();
@@ -198,7 +355,7 @@
}
},
initDefVal() {
let defValue = ''
let defValue = this.multiple ? [] : ''
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
defValue = this.valueCom
} else {
@@ -209,48 +366,105 @@
if (strogeValue || strogeValue === 0) {
defValue = strogeValue
} else {
let defItem = ''
let defItem = this.multiple ? [] : ''
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
defItem = this.mixinDatacomResData[this.defItem - 1].value
defItem = this.multiple ? [this.mixinDatacomResData[this.defItem - 1].value] : this.mixinDatacomResData[this.defItem - 1].value
}
defValue = defItem
}
if (defValue || defValue === 0) {
if (defValue || defValue === 0 || (this.multiple && Array.isArray(defValue) && defValue.length > 0)) {
this.emit(defValue)
}
}
const def = this.mixinDatacomResData.find(item => item.value === defValue)
this.current = def ? this.formatItemName(def) : ''
if (this.multiple) {
const selectedValues = Array.isArray(defValue) ? defValue : (defValue ? [defValue] : []);
const selectedItems = this.mixinDatacomResData.filter(item => selectedValues.includes(item.value));
this.current = selectedItems.map(item => this.formatItemName(item));
} else {
const def = this.mixinDatacomResData.find(item => item.value === defValue)
this.current = def ? this.formatItemName(def) : ''
}
},
/**
* @param {[String, Number]} value
* @param {[String, Number, Array]} value
* 判断用户给的 value 是否同时为禁用状态
*/
isDisabled(value) {
let isDisabled = false;
this.mixinDatacomResData.forEach(item => {
if (item.value === value) {
isDisabled = item.disable
}
})
return isDisabled;
if (Array.isArray(value)) {
// 对于数组,如果任意一个值被禁用,则认为整体被禁用
return value.some(val => {
return this.mixinDatacomResData.some(item => item.value === val && item.disable);
});
} else {
let isDisabled = false;
this.mixinDatacomResData.forEach(item => {
if (item.value === value) {
isDisabled = item.disable
}
})
return isDisabled;
}
},
clearVal() {
this.emit('')
this.current = ''
const emptyValue = this.multiple ? [] : '';
this.emit(emptyValue)
this.current = this.multiple ? [] : ''
if (this.collection) {
this.removeCache()
}
this.$emit('clear')
},
checkBoxChange(res){
let range = res.detail.value
let currentValues = range && range.length > 0? range.map((item)=>{
const index = parseInt(item, 10);
if (isNaN(index)) {
console.error(`无效索引: ${item}`);
}
if (index < 0 || index >= this.mixinDatacomResData.length) {
console.error(`索引越界: ${index}`);
}
return this.mixinDatacomResData[index].value;
}) : []
const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
this.emit(currentValues);
},
change(item) {
if (!item.disable) {
this.showSelector = false
this.current = this.formatItemName(item)
this.emit(item.value)
if (this.multiple) {
// 多选模式
let currentValues = this.getCurrentValues();
if (!Array.isArray(currentValues)) {
currentValues = currentValues ? [currentValues] : [];
}
const itemValue = item.value;
const index = currentValues.indexOf(itemValue);
if (index > -1) {
currentValues.splice(index, 1);
} else {
currentValues.push(itemValue);
}
const selectedItems = this.mixinDatacomResData.filter(dataItem => currentValues.includes(dataItem.value));
this.current = selectedItems.map(dataItem => this.formatItemName(dataItem));
this.emit(currentValues);
} else {
// 单选模式
this.showSelector = false
this.current = this.formatItemName(item)
this.emit(item.value)
}
}
},
emit(val) {
@@ -328,6 +542,11 @@
$uni-main-color: #333 !default;
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
$uni-primary: #2979ff !default;
$uni-success: #4cd964 !default;
$uni-warning: #f0ad4e !default;
$uni-error: #dd524d !default;
$uni-info: #909399 !default;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
@@ -369,9 +588,16 @@
margin-right: 5px;
}
.border-bottom {
border-bottom: solid 1px $uni-border-3;
}
.border-default {
border: 1px solid $uni-border-3;
}
.uni-select {
font-size: 14px;
border: 1px solid $uni-border-3;
box-sizing: border-box;
border-radius: 4px;
padding: 0 5px;
@@ -383,15 +609,20 @@
/* #endif */
flex-direction: row;
align-items: center;
border-bottom: solid 1px $uni-border-3;
width: 100%;
flex: 1;
height: 35px;
min-height: 35px;
&--disabled {
background-color: #f5f7fa;
cursor: not-allowed;
}
&--wrap {
height: auto;
min-height: 35px;
// align-items: flex-start;
}
}
.uni-select__label {
@@ -403,7 +634,7 @@
}
.uni-select__input-box {
height: 35px;
// height: 35px;
width: 0px;
position: relative;
/* #ifndef APP-NVUE */
@@ -412,6 +643,24 @@
flex: 1;
flex-direction: row;
align-items: center;
&--wrap {
.uni-select__input-text {
margin-right: 8px;
}
}
.padding-top-bottom {
padding-top: 5px;
padding-bottom: 5px;
}
.slot-content {
width: 100%;
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
}
.uni-select__input {
@@ -463,15 +712,18 @@
display: flex;
cursor: pointer;
/* #endif */
flex-direction: row;
align-items: center;
line-height: 35px;
font-size: 14px;
text-align: center;
/* border-bottom: solid 1px $uni-border-3; */
padding: 0px 10px;
}
.uni-select__selector-item:hover {
background-color: #f9f9f9;
.uni-select__selector-item-check {
margin-left: auto;
}
.uni-select__selector-empty:last-child,
@@ -490,15 +742,14 @@
.uni-popper__arrow_bottom,
.uni-popper__arrow_bottom::after,
.uni-popper__arrow_top,
.uni-popper__arrow_top::after,
{
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
.uni-popper__arrow_top::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
}
.uni-popper__arrow_bottom {
@@ -544,11 +795,22 @@
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
&--wrap {
white-space: normal;
text-overflow: initial;
-o-text-overflow: initial;
overflow: visible;
word-wrap: break-word;
word-break: break-all;
// line-height: 1.5;
}
}
.uni-select__input-placeholder {
color: $uni-base-color;
font-size: 12px;
margin: 1px 0;
}
.uni-select--mask {
@@ -559,4 +821,17 @@
left: 0;
z-index: 2;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
</style>

View File

@@ -1,7 +1,7 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "1.0.10",
"version": "1.1.0",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
@@ -12,12 +12,14 @@
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": "^3.1.1"
"HBuilderX": "^3.1.1",
"uni-app": "^4.45",
"uni-app-x": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
@@ -35,52 +37,68 @@
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
"type": "component-vue",
"darkmode": "x",
"i18n": "x",
"widescreen": "x"
},
"uni_modules": {
"dependencies": ["uni-load-more"],
"dependencies": [
"uni-load-more"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
"tcb": "",
"aliyun": "",
"alipay": ""
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "n",
"app-harmony": "u",
"app-uvue": "u"
"uni-app": {
"vue": {
"vue2": "",
"vue3": ""
},
"web": {
"safari": "√",
"chrome": "√"
},
"app": {
"vue": "√",
"nvue": "-",
"android": "√",
"ios": "√",
"harmony": "√"
},
"mp": {
"weixin": "√",
"alipay": "√",
"toutiao": "√",
"baidu": "-",
"kuaishou": "-",
"jd": "-",
"harmony": "-",
"qq": "-",
"lark": "-"
},
"quickapp": {
"huawei": "-",
"union": "-"
}
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
"uni-app-x": {
"web": {
"safari": "-",
"chrome": "-"
},
"app": {
"android": "-",
"ios": "-",
"harmony": "-"
},
"mp": {
"weixin": "-"
}
}
}
}

View File

@@ -0,0 +1,25 @@
## 1.2.62024-10-12
- 修复 微信小程序中的getSystemInfo警告
## 1.2.52023-03-29
- 新增 pattern.icon 属性,可自定义图标
## 1.2.42022-09-07
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
## 1.2.32022-09-05
- 修复 nvue 环境下,具有 tabBar 时fab 组件下部位置无法正常获取 --window-bottom 的bug详见[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310)
## 1.2.22021-12-29
- 更新 组件依赖
## 1.2.12021-11-19
- 修复 阴影颜色不正确的bug
## 1.2.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-fab](https://uniapp.dcloud.io/component/uniui/uni-fab)
## 1.1.12021-11-09
- 新增 提供组件设计资源,组件样式调整
## 1.1.02021-07-30
- 组件兼容 vue3如何创建vue3项目详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.0.72021-05-12
- 新增 组件示例地址
## 1.0.62021-02-05
- 调整为uni_modules目录规范
- 优化 按钮背景色调整
- 优化 兼容pc端

View File

@@ -0,0 +1,491 @@
<template>
<view class="uni-cursor-point">
<view v-if="popMenu && (leftBottom||rightBottom||leftTop||rightTop) && content.length > 0" :class="{
'uni-fab--leftBottom': leftBottom,
'uni-fab--rightBottom': rightBottom,
'uni-fab--leftTop': leftTop,
'uni-fab--rightTop': rightTop
}" class="uni-fab"
:style="nvueBottom"
>
<view :class="{
'uni-fab__content--left': horizontal === 'left',
'uni-fab__content--right': horizontal === 'right',
'uni-fab__content--flexDirection': direction === 'vertical',
'uni-fab__content--flexDirectionStart': flexDirectionStart,
'uni-fab__content--flexDirectionEnd': flexDirectionEnd,
'uni-fab__content--other-platform': !isAndroidNvue
}" :style="{ width: boxWidth, height: boxHeight, backgroundColor: styles.backgroundColor }"
class="uni-fab__content" elevation="5">
<view v-if="flexDirectionStart || horizontalLeft" class="uni-fab__item uni-fab__item--first" />
<view v-for="(item, index) in content" :key="index" :class="{ 'uni-fab__item--active': isShow }"
class="uni-fab__item" @click="_onItemClick(index, item)">
<image :src="item.active ? item.selectedIconPath : item.iconPath" class="uni-fab__item-image"
mode="aspectFit" />
<text class="uni-fab__item-text"
:style="{ color: item.active ? styles.selectedColor : styles.color }">{{ item.text }}</text>
</view>
<view v-if="flexDirectionEnd || horizontalRight" class="uni-fab__item uni-fab__item--first" />
</view>
</view>
<view :class="{
'uni-fab__circle--leftBottom': leftBottom,
'uni-fab__circle--rightBottom': rightBottom,
'uni-fab__circle--leftTop': leftTop,
'uni-fab__circle--rightTop': rightTop,
'uni-fab__content--other-platform': !isAndroidNvue
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick">
<uni-icons class="fab-circle-icon" :type="styles.icon" :color="styles.iconColor" size="32"
:class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons>
<!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
<view class="fab-circle-h" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> -->
</view>
</view>
</template>
<script>
let platform = 'other'
// #ifdef APP-NVUE
platform = uni.getSystemInfoSync().platform
// #endif
/**
* Fab 悬浮按钮
* @description 点击可展开一个图形按钮菜单
* @tutorial https://ext.dcloud.net.cn/plugin?id=144
* @property {Object} pattern 可选样式配置项
* @property {Object} horizontal = [left | right] 水平对齐方式
* @value left 左对齐
* @value right 右对齐
* @property {Object} vertical = [bottom | top] 垂直对齐方式
* @value bottom 下对齐
* @value top 上对齐
* @property {Object} direction = [horizontal | vertical] 展开菜单显示方式
* @value horizontal 水平显示
* @value vertical 垂直显示
* @property {Array} content 展开菜单内容配置项
* @property {Boolean} popMenu 是否使用弹出菜单
* @event {Function} trigger 展开菜单点击事件,返回点击信息
* @event {Function} fabClick 悬浮按钮点击事件
*/
export default {
name: 'UniFab',
emits: ['fabClick', 'trigger'],
props: {
pattern: {
type: Object,
default () {
return {}
}
},
horizontal: {
type: String,
default: 'left'
},
vertical: {
type: String,
default: 'bottom'
},
direction: {
type: String,
default: 'horizontal'
},
content: {
type: Array,
default () {
return []
}
},
show: {
type: Boolean,
default: false
},
popMenu: {
type: Boolean,
default: true
}
},
data() {
return {
fabShow: false,
isShow: false,
isAndroidNvue: platform === 'android',
styles: {
color: '#3c3e49',
selectedColor: '#007AFF',
backgroundColor: '#fff',
buttonColor: '#007AFF',
iconColor: '#fff',
icon: 'plusempty'
}
}
},
computed: {
contentWidth(e) {
return (this.content.length + 1) * 55 + 15 + 'px'
},
contentWidthMin() {
return '55px'
},
// 动态计算宽度
boxWidth() {
return this.getPosition(3, 'horizontal')
},
// 动态计算高度
boxHeight() {
return this.getPosition(3, 'vertical')
},
// 计算左下位置
leftBottom() {
return this.getPosition(0, 'left', 'bottom')
},
// 计算右下位置
rightBottom() {
return this.getPosition(0, 'right', 'bottom')
},
// 计算左上位置
leftTop() {
return this.getPosition(0, 'left', 'top')
},
rightTop() {
return this.getPosition(0, 'right', 'top')
},
flexDirectionStart() {
return this.getPosition(1, 'vertical', 'top')
},
flexDirectionEnd() {
return this.getPosition(1, 'vertical', 'bottom')
},
horizontalLeft() {
return this.getPosition(2, 'horizontal', 'left')
},
horizontalRight() {
return this.getPosition(2, 'horizontal', 'right')
},
// 计算 nvue bottom
nvueBottom() {
// #ifdef APP-NVUE
const safeBottom = uni.getSystemInfoSync().windowBottom;
return 30 + safeBottom
// #endif
// #ifndef APP-NVUE
return 30
// #endif
}
},
watch: {
pattern: {
handler(val, oldVal) {
this.styles = Object.assign({}, this.styles, val)
},
deep: true
}
},
created() {
this.isShow = this.show
if (this.top === 0) {
this.fabShow = true
}
// 初始化样式
this.styles = Object.assign({}, this.styles, this.pattern)
},
methods: {
_onClick() {
this.$emit('fabClick')
if (!this.popMenu) {
return
}
this.isShow = !this.isShow
},
open() {
this.isShow = true
},
close() {
this.isShow = false
},
/**
* 按钮点击事件
*/
_onItemClick(index, item) {
if (!this.isShow) {
return
}
this.$emit('trigger', {
index,
item
})
},
/**
* 获取 位置信息
*/
getPosition(types, paramA, paramB) {
if (types === 0) {
return this.horizontal === paramA && this.vertical === paramB
} else if (types === 1) {
return this.direction === paramA && this.vertical === paramB
} else if (types === 2) {
return this.direction === paramA && this.horizontal === paramB
} else {
return this.isShow && this.direction === paramA ? this.contentWidth : this.contentWidthMin
}
}
}
}
</script>
<style lang="scss" >
$uni-shadow-base:0 1px 5px 2px rgba($color: #000000, $alpha: 0.3) !default;
.uni-fab {
position: fixed;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
z-index: 10;
border-radius: 45px;
box-shadow: $uni-shadow-base;
}
.uni-cursor-point {
/* #ifdef H5 */
cursor: pointer;
/* #endif */
}
.uni-fab--active {
opacity: 1;
}
.uni-fab--leftBottom {
left: 15px;
bottom: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
bottom: calc(30px + var(--window-bottom));
/* #endif */
// padding: 10px;
}
.uni-fab--leftTop {
left: 15px;
top: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
top: calc(30px + var(--window-top));
/* #endif */
// padding: 10px;
}
.uni-fab--rightBottom {
right: 15px;
bottom: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
bottom: calc(30px + var(--window-bottom));
/* #endif */
// padding: 10px;
}
.uni-fab--rightTop {
right: 15px;
top: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
top: calc(30px + var(--window-top));
/* #endif */
// padding: 10px;
}
.uni-fab__circle {
position: fixed;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
justify-content: center;
align-items: center;
width: 55px;
height: 55px;
background-color: #3c3e49;
border-radius: 45px;
z-index: 11;
// box-shadow: $uni-shadow-base;
}
.uni-fab__circle--leftBottom {
left: 15px;
bottom: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
bottom: calc(30px + var(--window-bottom));
/* #endif */
}
.uni-fab__circle--leftTop {
left: 15px;
top: 30px;
/* #ifdef H5 */
left: calc(15px + var(--window-left));
top: calc(30px + var(--window-top));
/* #endif */
}
.uni-fab__circle--rightBottom {
right: 15px;
bottom: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
bottom: calc(30px + var(--window-bottom));
/* #endif */
}
.uni-fab__circle--rightTop {
right: 15px;
top: 30px;
/* #ifdef H5 */
right: calc(15px + var(--window-right));
top: calc(30px + var(--window-top));
/* #endif */
}
.uni-fab__circle--left {
left: 0;
}
.uni-fab__circle--right {
right: 0;
}
.uni-fab__circle--top {
top: 0;
}
.uni-fab__circle--bottom {
bottom: 0;
}
.uni-fab__plus {
font-weight: bold;
}
// .fab-circle-v {
// position: absolute;
// width: 2px;
// height: 24px;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// /* #ifndef APP-NVUE */
// margin: auto;
// /* #endif */
// background-color: white;
// transform: rotate(0deg);
// transition: transform 0.3s;
// }
// .fab-circle-h {
// position: absolute;
// width: 24px;
// height: 2px;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// /* #ifndef APP-NVUE */
// margin: auto;
// /* #endif */
// background-color: white;
// transform: rotate(0deg);
// transition: transform 0.3s;
// }
.fab-circle-icon {
transform: rotate(0deg);
transition: transform 0.3s;
font-weight: 200;
}
.uni-fab__plus--active {
transform: rotate(135deg);
}
.uni-fab__content {
/* #ifndef APP-NVUE */
box-sizing: border-box;
display: flex;
/* #endif */
flex-direction: row;
border-radius: 55px;
overflow: hidden;
transition-property: width, height;
transition-duration: 0.2s;
width: 55px;
border-color: #DDDDDD;
border-width: 1rpx;
border-style: solid;
}
.uni-fab__content--other-platform {
border-width: 0px;
box-shadow: $uni-shadow-base;
}
.uni-fab__content--left {
justify-content: flex-start;
}
.uni-fab__content--right {
justify-content: flex-end;
}
.uni-fab__content--flexDirection {
flex-direction: column;
justify-content: flex-end;
}
.uni-fab__content--flexDirectionStart {
flex-direction: column;
justify-content: flex-start;
}
.uni-fab__content--flexDirectionEnd {
flex-direction: column;
justify-content: flex-end;
}
.uni-fab__item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
width: 55px;
height: 55px;
opacity: 0;
transition: opacity 0.2s;
}
.uni-fab__item--active {
opacity: 1;
}
.uni-fab__item-image {
width: 20px;
height: 20px;
margin-bottom: 4px;
}
.uni-fab__item-text {
color: #FFFFFF;
font-size: 12px;
line-height: 12px;
margin-top: 2px;
}
.uni-fab__item--first {
width: 55px;
}
</style>

View File

@@ -0,0 +1,85 @@
{
"id": "uni-fab",
"displayName": "uni-fab 悬浮按钮",
"version": "1.2.6",
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
"keywords": [
"uni-ui",
"uniui",
"按钮",
"悬浮按钮",
"fab"
],
"repository": "https://github.com/dcloudio/uni-ui",
"engines": {
"HBuilderX": ""
},
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": ["uni-scss","uni-icons"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "y"
}
}
}
}
}

View File

@@ -0,0 +1,9 @@
## Fab 悬浮按钮
> **组件名uni-fab**
> 代码块: `uFab`
点击可展开一个图形按钮菜单
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-fab)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

View File

@@ -1,3 +1,5 @@
## 2.0.122025-08-26
- 优化 uni-app x 下 size 类型问题
## 2.0.112025-08-18
- 修复 图标点击事件返回
## 2.0.92024-01-12

View File

@@ -29,8 +29,8 @@
default: '#333333'
},
size: {
type: Object,
default: 16
type: [Number, String],
default: 16
},
fontFamily: {
type: String,
@@ -51,9 +51,9 @@
iconSize() : string {
const size = this.size
if (typeof size == 'string') {
const reg = /^[0-9]*$/g
return reg.test(size as string) ? '' + size + 'px' : '' + size;
// return '' + this.size
const reg = /^[0-9]*$/g
return reg.test(size as string) ? '' + size + 'px' : '' + size;
// return '' + this.size
}
return this.getFontSize(size as number)
},

View File

@@ -1,7 +1,7 @@
{
"id": "uni-icons",
"displayName": "uni-icons 图标",
"version": "2.0.11",
"version": "2.0.12",
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
"keywords": [
"uni-ui",
@@ -64,7 +64,7 @@
},
"app": {
"vue": "√",
"nvue": "",
"nvue": "-",
"android": {
"extVersion": "",
"minVersion": "29"

View File

@@ -28,3 +28,9 @@
## 4.7.1
+ 修改路径替换规则
+ 修改更新地址
## 4.7.2
+ 项目选择器增加搜索
## 4.7.3
+ 修复出库记录的显示错误