配料功能完成

This commit is contained in:
赵正易 2024-09-18 17:39:34 +08:00
parent f40021e8f8
commit 2a7124d40d
20 changed files with 1190 additions and 529 deletions

View File

@ -12,7 +12,7 @@ export default {
initApp() {
//
this.initConfig();
//
// H5 debug
//#ifdef H5
this.checkLogin();
//#endif
@ -31,4 +31,7 @@ export default {
<style lang="scss">
@import '@/static/scss/index.scss';
.border {
border: 1px solid #000000;
}
</style>

View File

@ -0,0 +1,46 @@
import request from '@/utils/request'
// 获取全部线
export function getLineOptions(params) {
return request({
url: '/mes/Mobile/PreparationTask/get_lines',
method: 'get',
params
})
}
// 根据线获取工单
export function getWorkOrderList(params) {
return request({
url: '/mes/Mobile/PreparationTask/get_workorder',
method: 'get',
params
})
}
// 根据工单获取任务
export function getWorkOrderTaskList(params) {
return request({
url: '/mes/Mobile/PreparationTask/get_workorder_task',
method: 'get',
params
})
}
// 获取任务详情
export function getTaskInfoList(params) {
return request({
url: '/mes/Mobile/PreparationTask/get_task_info',
method: 'get',
params
})
}
// 任务生成
export function generateIngredientTask(data) {
return request({
url: '/mes/Mobile/PreparationTask/generate_ingredient_task',
method: 'post',
data
})
}

10
api/scan/index.js Normal file
View File

@ -0,0 +1,10 @@
import request from '@/utils/request'
// 解析标签信息
export function analysisScanCode(params) {
return request({
url: '/mes/Mobile/PreparationTask/parse_material_code',
method: 'get',
params
})
}

View File

@ -0,0 +1,62 @@
<template>
<view class="sacn-box">
<!-- inputmode="none" -->
<input class="uni-input scan-border" v-model="scanValue" :maxlength="-1" :focus="focus" placeholder="请扫码" @input="onKeyInput" @confirm="inputConfirm" />
<!-- <uni-icons type="scan" size="32" color="#b9b9b9" @click="getFocus"></uni-icons> -->
</view>
</template>
<script>
export default {
name: 'scan-input',
data() {
return {
focus: true,
scanValue: ''
};
},
methods: {
onKeyInput: function (event) {
this.scanValue = event.target.value;
},
emitValue() {
this.$nextTick(() => {
this.$emit('scanConfirm', this.scanValue);
setTimeout(() => {
this.scanValue = '';
}, 500);
this.getFocus();
});
},
inputConfirm() {
this.emitValue();
},
//
getFocus() {
//
this.focus = false;
setTimeout(() => {
this.focus = true;
}, 200);
}
}
};
</script>
<style scoped>
.sacn-box {
width: 100%;
display: flex;
flex-direction: row;
align-item: center;
justify-content: center;
}
.uni-input {
width: 100%;
font-size: 24px;
}
.scan-border {
border-radis: 10%;
border: 1px solid #b9b9b9;
}
</style>

15
main.js
View File

@ -3,15 +3,24 @@ import App from './App'
import store from './store' // store
import plugins from './plugins' // plugins
import './permission' // permission
// dayjs
import dayjs from 'dayjs'
// 插件安装
import scanInputVue from './components/scan-input/scan-input.vue'
Vue.component('ScanInput', scanInputVue)
Vue.use(plugins)
Vue.config.productionTip = false
Vue.prototype.$store = store
Vue.prototype.$dayjs = dayjs
App.mpType = 'app'
const app = new Vue({
...App
...App
})
app.$mount()
app.$mount()

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"dayjs": "^1.11.13"
}
}

View File

@ -1,79 +1,108 @@
{
"pages": [{
"path": "pages/login",
"style": {
"navigationBarTitleText": "登录"
"path": "pages/login",
"style": {
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
}, {
"path": "pages/register",
"style": {
"navigationBarTitleText": "注册"
}
}, {
"path": "pages/index",
"style": {
"navigationBarTitleText": "首页"
}
}, {
"path": "pages/work/index",
"style": {
"navigationBarTitleText": "功能"
}
}, {
"path": "pages/mine/index",
"style": {
"navigationBarTitleText": "我的",
"navigationStyle": "custom"
}
}, {
"path": "pages/mine/avatar/index",
"style": {
"navigationBarTitleText": "修改头像"
}
}, {
"path": "pages/mine/info/index",
"style": {
"navigationBarTitleText": "个人信息"
}
}, {
"path": "pages/mine/info/edit",
"style": {
"navigationBarTitleText": "编辑资料"
}
}, {
"path": "pages/mine/pwd/index",
"style": {
"navigationBarTitleText": "修改密码"
}
}, {
"path": "pages/mine/setting/index",
"style": {
"navigationBarTitleText": "应用设置"
}
}, {
"path": "pages/mine/help/index",
"style": {
"navigationBarTitleText": "常见问题"
}
}, {
"path": "pages/mine/about/index",
"style": {
"navigationBarTitleText": "关于我们"
}
}, {
"path": "pages/common/webview/index",
"style": {
"navigationBarTitleText": "浏览网页"
}
}, {
"path": "pages/common/textview/index",
"style": {
"navigationBarTitleText": "浏览文本"
}
},
{
"path": "pages/materialManagement/materialPreparation/index",
"style": {
"navigationBarTitleText": "备料管理"
}
},
{
"path" : "pages/materialManagement/materialPreparation/batching",
"style" :
{
"navigationBarTitleText" : "配料任务"
}
},
{
"path" : "pages/materialManagement/materialPreparation/taskDetail",
"style" :
{
"navigationBarTitleText" : "任务详情"
}
},
{
"path" : "pages/materialManagement/materialPreparation/scanAddBatching",
"style" :
{
"navigationBarTitleText" : "扫码配料"
}
}
}, {
"path": "pages/register",
"style": {
"navigationBarTitleText": "注册"
}
}, {
"path": "pages/index",
"style": {
"navigationBarTitleText": "首页",
"navigationStyle": "custom"
}
}, {
"path": "pages/work/index",
"style": {
"navigationBarTitleText": "工作台"
}
}, {
"path": "pages/mine/index",
"style": {
"navigationBarTitleText": "我的"
}
}, {
"path": "pages/mine/avatar/index",
"style": {
"navigationBarTitleText": "修改头像"
}
}, {
"path": "pages/mine/info/index",
"style": {
"navigationBarTitleText": "个人信息"
}
}, {
"path": "pages/mine/info/edit",
"style": {
"navigationBarTitleText": "编辑资料"
}
}, {
"path": "pages/mine/pwd/index",
"style": {
"navigationBarTitleText": "修改密码"
}
}, {
"path": "pages/mine/setting/index",
"style": {
"navigationBarTitleText": "应用设置"
}
}, {
"path": "pages/mine/help/index",
"style": {
"navigationBarTitleText": "常见问题"
}
}, {
"path": "pages/mine/about/index",
"style": {
"navigationBarTitleText": "关于我们"
}
}, {
"path": "pages/common/webview/index",
"style": {
"navigationBarTitleText": "浏览网页"
}
}, {
"path": "pages/common/textview/index",
"style": {
"navigationBarTitleText": "浏览文本"
}
}],
],
"tabBar": {
"color": "#000000",
"selectedColor": "#000000",
"selectedColor": "#2979ff",
"borderStyle": "white",
"backgroundColor": "#ffffff",
"list": [{
@ -85,7 +114,7 @@
"pagePath": "pages/work/index",
"iconPath": "static/images/tabbar/work.png",
"selectedIconPath": "static/images/tabbar/work_.png",
"text": "工作台"
"text": "功能"
}, {
"pagePath": "pages/mine/index",
"iconPath": "static/images/tabbar/mine.png",
@ -94,8 +123,8 @@
}]
},
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "RuoYi",
"navigationBarBackgroundColor": "#FFFFFF"
"navigationBarTextStyle": "white",
"navigationBarTitleText": "首页",
"navigationBarBackgroundColor": "#2979ff"
}
}

View File

@ -1,43 +1,59 @@
<template>
<view class="content">
<image class="logo" src="@/static/logo.png"></image>
<view class="text-area">
<text class="title">Hello RuoYi</text>
</view>
</view>
<view class="content">
<div class="scan-row">
<ScanInput @scanConfirm="scanConfirm"></ScanInput>
</div>
</view>
</template>
<script>
export default {
onLoad: function() {
}
}
import { analysisScanCode } from '@/api/scan/index';
export default {
onLoad: function () {},
onShow() {},
data() {
return {
dateTime: this.$dayjs(),
value: ''
};
},
methods: {
scanConfirm(val) {
analysisScanCode({ materialCode: val }).then((res) => {
if (res.code === 200) {
console.log(res.data);
}
});
}
}
};
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: white;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

View File

@ -20,28 +20,34 @@
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
</view>
</view>
<!-- 后台地址 -->
<view class="input-item flex align-center">
<view class="iconfont icon-setting icon"></view>
<input v-model="baseUrl" class="input" type="text" placeholder="请输入服务地址" maxlength="255" @confirm="handlerBaseUrlConfirm" />
</view>
<view class="action-btn">
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
</view>
<view class="reg text-center" v-if="register">
<!-- <view class="reg text-center" v-if="register">
<text class="text-grey1">没有账号</text>
<!-- <text @click="handleUserRegister" class="text-blue">立即注册</text> -->
<text @click="handleUserRegister" class="text-blue">立即注册</text>
</view>
<view class="xieyi text-center">
<text class="text-grey1">登录即代表同意</text>
<!-- <text @click="handleUserAgrement" class="text-blue">用户协议</text>
<text @click="handlePrivacy" class="text-blue">隐私协议</text> -->
</view>
<text @click="handleUserAgrement" class="text-blue">用户协议</text>
<text @click="handlePrivacy" class="text-blue">隐私协议</text>
</view> -->
</view>
</view>
</template>
<script>
import { getCodeImg } from '@/api/login';
import { getBaseUrl, setBaseUrl, removeBaseUrl } from '@/utils/baseUrl';
export default {
data() {
return {
baseUrl: '',
codeUrl: '',
captchaEnabled: true,
//
@ -56,9 +62,20 @@ export default {
};
},
created() {
this.init();
this.getCode();
},
methods: {
init() {
//
let _baseUrl = getBaseUrl();
if (!_baseUrl) {
// _baseUrl = '192.168.0.58:7000';
_baseUrl = '192.168.50.163:7000';
setBaseUrl(_baseUrl);
}
this.baseUrl = _baseUrl;
},
//
handleUserRegister() {
this.$tab.redirectTo(`/pages/register`);
@ -75,7 +92,7 @@ export default {
},
//
getCode() {
this.captchaEnabled = false
this.captchaEnabled = false;
// getCodeImg().then((res) => {
// this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
// if (this.captchaEnabled) {
@ -117,6 +134,16 @@ export default {
this.$store.dispatch('GetInfo').then((res) => {
this.$tab.reLaunch('/pages/index');
});
},
//
handlerBaseUrlConfirm() {
const _baseUrl = this.baseUrl;
// console.log('changeBaseUrl', baseUrl);
uni.showToast({
title: '链接地址已修改:' + _baseUrl,
icon: 'none'
});
setBaseUrl(_baseUrl);
}
}
};

View File

@ -0,0 +1,84 @@
<template>
<!-- 配料任务 -->
<view>
<uni-card :title="title">
<text>{{ note }}</text>
</uni-card>
<uni-list style="width: 100%">
<uni-list-item v-for="(item, index) in workOrderTaskList" :key="index" :title="item.title" link rightText="任务详情" @click="onListItemClick(item)"></uni-list-item>
</uni-list>
<view>
<button type="primary" @click="toScanBatching">扫码配料</button>
</view>
</view>
</template>
<script>
import { getWorkOrderTaskList, getTaskInfoList } from '@/api/preparationTask/index.js';
import { tansParams } from '@/utils/common';
export default {
onLoad: function (option) {
this.workOrder = option.workOrder;
this.title = option.title;
this.note = option.note;
},
onShow:function(){
this.$nextTick(() => {
this.doGetWorkOrderTaskList();
});
},
data() {
return {
title: '',
note: '',
workOrder: '',
workOrderTaskList: []
};
},
methods: {
doGetWorkOrderTaskList() {
uni.showLoading();
const params = {
workorder: this.workOrder
};
getWorkOrderTaskList(params)
.then((res) => {
if (res.code === 200) {
this.workOrderTaskList = res.data.map((item) => {
return {
id: item.id,
workOrder: item.fkWorkorder,
taskCode: item.taskCode,
title: `任务号:${item.taskCode}`,
taskList: []
};
});
}
})
.finally(() => {
uni.hideLoading();
});
},
//
onListItemClick(item) {
const params = {
taskCode: item.taskCode,
title: item.title
};
uni.navigateTo({
url: '/pages/materialManagement/materialPreparation/taskDetail?' + tansParams(params)
});
},
toScanBatching() {
const params = {
workOrder: this.workOrder
};
uni.navigateTo({
url: '/pages/materialManagement/materialPreparation/scanAddBatching?' + tansParams(params)
});
}
}
};
</script>
<style></style>

View File

@ -0,0 +1,146 @@
<template>
<!-- 备料 -->
<view class="content">
<view class="row">
<uni-forms style="width: 100%" ref="form">
<uni-forms-item label="日期">
<uni-datetime-picker type="date" :clear-icon="false" v-model="dateTime" @change="dateChange" />
</uni-forms-item>
<uni-forms-item label="线别">
<uni-data-select v-model="routeCode" :localdata="routeOptions" @change="routeSelectChange"></uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
<uni-list style="width: 100%">
<uni-list-item
v-for="(item, index) in workOrderList"
:key="index"
:title="item.title"
:note="item.note"
rightText="配料任务"
link
@click="onListItemClick(item)"
></uni-list-item>
</uni-list>
</view>
</template>
<script>
import { getLineOptions, getWorkOrderList } from '@/api/preparationTask/index.js';
import { tansParams } from '@/utils/common';
export default {
data() {
return {
dateTime: this.$dayjs().format('YYYY-MM-DD'),
value: '',
// 线
routeOptions: [],
routeCode: '',
//
workOrderList: [],
workOrderSelect: ''
};
},
created() {
this.init();
},
onShow:function(){
this.$nextTick(() => {
this.handlerGetWorkOrderList();
});
},
methods: {
init() {
this.getLineSelectOptions();
},
getLineSelectOptions() {
uni.showLoading();
getLineOptions()
.then((res) => {
if (res.code === 200) {
this.routeOptions = res.data.map((item) => {
return {
id: item.id,
text: `${item.name}`,
value: `${item.code}`
};
});
this.$nextTick(() => {
if (this.routeOptions.length > 0) {
this.routeCode = this.routeOptions[0].value;
this.handlerGetWorkOrderList();
}
});
}
})
.finally(() => {
uni.hideLoading();
});
},
//
dateChange() {
this.handlerGetWorkOrderList();
},
// 线
routeSelectChange() {
this.handlerGetWorkOrderList();
},
//
handlerGetWorkOrderList() {
const params = {
HandleDate: this.dateTime,
route_code: this.routeCode
};
getWorkOrderList(params).then((res) => {
if (res.code === 200) {
this.workOrderList = res.data.map((item) => {
return {
id: item.id,
workOrder: item.workorder,
title: `工单号:${item.workorder}`,
note: `零件号:${item.productionCode} \n描述:${item.productionName ?? ''}\n规格:${item.specification ?? ''}`
};
});
}
});
},
WorkOrderStatusColor(status) {
const list = ['', '未开始', '已开始', '已完成'];
const colorList = ['#fff', '#8f939c', '#2979ff', '#18bc37'];
return colorList[status * 1];
},
//
onListItemClick(item) {
const params = {
workOrder: item.workOrder,
title: item.title,
note: item.note
};
uni.navigateTo({
url: '/pages/materialManagement/materialPreparation/batching?' + tansParams(params)
});
}
}
};
</script>
<style scoped>
.content {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.row {
background-color: #fff;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.card-box {
width: 100%;
}
</style>

View File

@ -0,0 +1,130 @@
<template>
<view>
<uni-card>
<text>{{ '工单号:' + workOrder }}</text>
<ScanInput @scanConfirm="scanConfirm"></ScanInput>
</uni-card>
<uni-card v-for="(item, index) in materialList" :key="index" :title="item.title">
<uni-forms ref="formRef" :modelValue="item">
<uni-forms-item label="已扫箱" required name="cases">
<uni-easyinput type="number" :clearable="false" v-model.number="item.cases" />
</uni-forms-item>
<uni-forms-item label="零件数" required name="quantity">
<uni-easyinput type="number" :clearable="false" v-model.number="item.quantity" />
</uni-forms-item>
</uni-forms>
<!-- <uni-list style="width: 100%">
<uni-list-item :title="item.materialCode" :rightText="item.materialName"></uni-list-item>
</uni-list> -->
</uni-card>
<uni-row :gutter="20">
<uni-col :span="12">
<button type="default" @click="clear">清空</button>
</uni-col>
<uni-col :span="12">
<button type="primary" @click="submit()">提交</button>
</uni-col>
</uni-row>
</view>
</template>
<script>
import { analysisScanCode } from '@/api/scan/index';
import { generateIngredientTask } from '@/api/preparationTask/index.js';
import { warn } from 'vue';
export default {
onLoad: function (option) {
this.workOrder = option.workOrder;
this.$nextTick(() => {});
},
data() {
return {
formRef: null,
workOrder: '',
clearMaterialList: [],
materialList: []
};
},
methods: {
//
scanConfirm(val) {
analysisScanCode({ materialCode: val }).then((res) => {
if (res.code === 200) {
console.log(res.data);
const _data = res.data;
let options = {
title: `${_data.partnumber} ${_data.materialName}`,
materialCode: _data.partnumber,
materialName: _data.materialName,
specification: _data.specification,
color: _data.color,
unit: _data.unit,
cases: 1,
quantity: 0
};
let _index = this.hasMaterial(options.materialCode);
if (_index === -1) {
this.materialList.push(options);
} else {
this.materialList[_index].cases += 1;
}
}
});
},
//
hasMaterial(materialCode) {
let index = 0;
const list = this.materialList;
for (index; index < list.length; index++) {
if (list[index].materialCode === materialCode) {
return index;
}
}
return -1;
},
clear() {
this.materialList = JSON.parse(JSON.stringify(this.clearMaterialList));
},
submit(ref) {
if (!this.formValidate()) {
return;
}
const postData = {
Ingredient_task: this.materialList,
workorder: this.workOrder
};
generateIngredientTask(postData).then((res) => {
if (res.code === 200) {
uni.showToast({
icon: 'success',
title: '提交成功'
});
this.clear();
}
});
},
//
formValidate() {
for (let item of this.materialList) {
if (item.quantity === 0) {
uni.showToast({
icon: 'none',
title: item.materialCode + '零件号不可为0'
});
return false;
}
if (item.quantity === '') {
uni.showToast({
icon: 'none',
title: item.materialCode + '零件号不可为空'
});
return false;
}
}
return true;
}
}
};
</script>
<style></style>

View File

@ -0,0 +1,59 @@
<template>
<view>
<uni-card>
<text>{{ title }}</text>
</uni-card>
<uni-list style="width: 100%">
<uni-list-item v-for="(item, index) in taskList" :key="index" :title="item.title" :note="item.note" :rightText="item.rightText"></uni-list-item>
</uni-list>
</view>
</template>
<script>
import { getTaskInfoList } from '@/api/preparationTask/index.js';
export default {
onLoad: function (option) {
this.taskCode = option.taskCode;
this.title = option.title;
},
onShow:function(){
this.$nextTick(() => {
this.doGetTaskInfoList();
});
},
data() {
return {
title:'',
taskCode: '',
taskList: []
};
},
methods: {
doGetTaskInfoList() {
uni.showLoading();
const params = {
task_code: this.taskCode
};
getTaskInfoList(params)
.then((res) => {
if (res.code === 200) {
this.taskList = res.data.map((item) => {
return {
id: item.id,
title: `物料号:${item.materialCode}`,
note: `描述:${item.materialName ?? ''} 规格:${item.specification ?? ''}`,
rightText: `配料数量:${item.quantity}`
};
});
}
})
.finally(() => {
uni.hideLoading();
});
}
}
};
</script>
<style></style>

View File

@ -1,198 +1,191 @@
<template>
<view class="mine-container" :style="{height: `${windowHeight}px`}">
<!--顶部个人信息栏-->
<view class="header-section">
<view class="flex padding justify-between">
<view class="flex align-center">
<view v-if="!avatar" class="cu-avatar xl round bg-white">
<view class="iconfont icon-people text-gray icon"></view>
</view>
<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
</image>
<view v-if="!name" @click="handleToLogin" class="login-tip">
点击登录
</view>
<view v-if="name" @click="handleToInfo" class="user-info">
<view class="u_title">
用户名{{ name }}
</view>
</view>
</view>
<view @click="handleToInfo" class="flex align-center">
<text>个人信息</text>
<view class="iconfont icon-right"></view>
</view>
</view>
</view>
<view class="mine-container" :style="{ height: `${windowHeight}px` }">
<!--顶部个人信息栏-->
<view class="header-section">
<view class="flex padding justify-between">
<view class="flex align-center">
<view v-if="!avatar" class="cu-avatar xl round bg-white">
<view class="iconfont icon-people text-gray icon"></view>
</view>
<image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix"></image>
<view v-if="!name" @click="handleToLogin" class="login-tip">点击登录</view>
<view v-if="name" @click="handleToInfo" class="user-info">
<view class="u_title">用户名{{ name }}</view>
</view>
</view>
<view @click="handleToInfo" class="flex align-center">
<text>个人信息</text>
<view class="iconfont icon-right"></view>
</view>
</view>
</view>
<view class="content-section">
<view class="mine-actions grid col-4 text-center">
<view class="action-item" @click="handleJiaoLiuQun">
<view class="iconfont icon-friendfill text-pink icon"></view>
<text class="text">交流群</text>
</view>
<view class="action-item" @click="handleBuilding">
<view class="iconfont icon-service text-blue icon"></view>
<text class="text">在线客服</text>
</view>
<view class="action-item" @click="handleBuilding">
<view class="iconfont icon-community text-mauve icon"></view>
<text class="text">反馈社区</text>
</view>
<view class="action-item" @click="handleBuilding">
<view class="iconfont icon-dianzan text-green icon"></view>
<text class="text">点赞我们</text>
</view>
</view>
<view class="content-section">
<view class="mine-actions grid col-4 text-center">
<view class="action-item" @click="handleJiaoLiuQun">
<view class="iconfont icon-friendfill text-pink icon"></view>
<text class="text">交流群</text>
</view>
<view class="action-item" @click="handleBuilding">
<view class="iconfont icon-service text-blue icon"></view>
<text class="text">在线客服</text>
</view>
<view class="action-item" @click="handleBuilding">
<view class="iconfont icon-community text-mauve icon"></view>
<text class="text">反馈社区</text>
</view>
<view class="action-item" @click="handleBuilding">
<view class="iconfont icon-dianzan text-green icon"></view>
<text class="text">点赞我们</text>
</view>
</view>
<view class="menu-list">
<view class="list-cell list-cell-arrow" @click="handleToEditInfo">
<view class="menu-item-box">
<view class="iconfont icon-user menu-icon"></view>
<view>编辑资料</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleHelp">
<view class="menu-item-box">
<view class="iconfont icon-help menu-icon"></view>
<view>常见问题</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleAbout">
<view class="menu-item-box">
<view class="iconfont icon-aixin menu-icon"></view>
<view>关于我们</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleToSetting">
<view class="menu-item-box">
<view class="iconfont icon-setting menu-icon"></view>
<view>应用设置</view>
</view>
</view>
</view>
</view>
</view>
<view class="menu-list">
<view class="list-cell list-cell-arrow" @click="handleToEditInfo">
<view class="menu-item-box">
<view class="iconfont icon-user menu-icon"></view>
<view>编辑资料</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleHelp">
<view class="menu-item-box">
<view class="iconfont icon-help menu-icon"></view>
<view>常见问题</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleAbout">
<view class="menu-item-box">
<view class="iconfont icon-aixin menu-icon"></view>
<view>关于我们</view>
</view>
</view>
<view class="list-cell list-cell-arrow" @click="handleToSetting">
<view class="menu-item-box">
<view class="iconfont icon-setting menu-icon"></view>
<view>应用设置</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import storage from '@/utils/storage'
export default {
data() {
return {
name: this.$store.state.user.name,
version: getApp().globalData.config.appInfo.version
}
},
computed: {
avatar() {
return this.$store.state.user.avatar
},
windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50
}
},
methods: {
handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index')
},
handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/info/edit')
},
handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index')
},
handleToLogin() {
this.$tab.reLaunch('/pages/login')
},
handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index')
},
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/index')
})
})
},
handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index')
},
handleAbout() {
this.$tab.navigateTo('/pages/mine/about/index')
},
handleJiaoLiuQun() {
this.$modal.showToast('QQ群①133713780、②146013835')
},
handleBuilding() {
this.$modal.showToast('模块建设中~')
}
}
}
import storage from '@/utils/storage';
export default {
data() {
return {
name: this.$store.state.user.name,
version: getApp().globalData.config.appInfo.version
};
},
computed: {
avatar() {
return this.$store.state.user.avatar;
},
windowHeight() {
return uni.getSystemInfoSync().windowHeight - 50;
}
},
methods: {
handleToInfo() {
this.$tab.navigateTo('/pages/mine/info/index');
},
handleToEditInfo() {
this.$tab.navigateTo('/pages/mine/info/edit');
},
handleToSetting() {
this.$tab.navigateTo('/pages/mine/setting/index');
},
handleToLogin() {
this.$tab.reLaunch('/pages/login');
},
handleToAvatar() {
this.$tab.navigateTo('/pages/mine/avatar/index');
},
handleLogout() {
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
this.$store.dispatch('LogOut').then(() => {
this.$tab.reLaunch('/pages/index');
});
});
},
handleHelp() {
this.$tab.navigateTo('/pages/mine/help/index');
},
handleAbout() {
this.$tab.navigateTo('/pages/mine/about/index');
},
handleJiaoLiuQun() {
this.$modal.showToast('QQ群①133713780、②146013835');
},
handleBuilding() {
this.$modal.showToast('模块建设中~');
}
}
};
</script>
<style lang="scss">
page {
background-color: #f5f6f7;
}
page {
background-color: #f5f6f7;
}
.mine-container {
width: 100%;
height: 100%;
.mine-container {
width: 100%;
height: 100%;
.header-section {
padding: 15px 15px 45px 15px;
background-color: #3c96f3;
color: white;
.header-section {
padding: 15px 15px 45px 15px;
background-color: #3c96f3;
color: white;
.login-tip {
font-size: 18px;
margin-left: 10px;
}
.login-tip {
font-size: 18px;
margin-left: 10px;
}
.cu-avatar {
border: 2px solid #eaeaea;
.cu-avatar {
border: 2px solid #eaeaea;
.icon {
font-size: 40px;
}
}
.icon {
font-size: 40px;
}
}
.user-info {
margin-left: 15px;
.user-info {
margin-left: 15px;
.u_title {
font-size: 18px;
line-height: 30px;
}
}
}
.u_title {
font-size: 18px;
line-height: 30px;
}
}
}
.content-section {
position: relative;
top: -50px;
.content-section {
position: relative;
top: -50px;
.mine-actions {
margin: 15px 15px;
padding: 20px 0px;
border-radius: 8px;
background-color: white;
.mine-actions {
margin: 15px 15px;
padding: 20px 0px;
border-radius: 8px;
background-color: white;
.action-item {
.icon {
font-size: 28px;
}
.action-item {
.icon {
font-size: 28px;
}
.text {
display: block;
font-size: 13px;
margin: 8px 0px;
}
}
}
}
}
.text {
display: block;
font-size: 13px;
margin: 8px 0px;
}
}
}
}
}
</style>

View File

@ -1,183 +1,165 @@
<template>
<view class="work-container">
<!-- 轮播图 -->
<uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
<swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
<swiper-item v-for="(item, index) in data" :key="index">
<view class="swiper-item" @click="clickBannerItem(item)">
<image :src="item.image" mode="aspectFill" :draggable="false" />
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
<view class="work-container">
<!-- 轮播图 -->
<uni-swiper-dot class="uni-swiper-dot-box" :info="bannerList" :current="current" field="content">
<swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
<swiper-item v-for="(item, index) in bannerList" :key="index">
<view class="swiper-item" @click="clickBannerItem(item)">
<image :src="item.image" mode="aspectFill" :draggable="false" />
</view>
</swiper-item>
</swiper>
</uni-swiper-dot>
<!-- 宫格组件 -->
<uni-section title="系统管理" type="line"></uni-section>
<view class="grid-body">
<uni-grid :column="4" :showBorder="false" @change="changeGrid">
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="person-filled" size="30"></uni-icons>
<text class="text">用户管理</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="staff-filled" size="30"></uni-icons>
<text class="text">角色管理</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="color" size="30"></uni-icons>
<text class="text">菜单管理</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="settings-filled" size="30"></uni-icons>
<text class="text">部门管理</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="heart-filled" size="30"></uni-icons>
<text class="text">岗位管理</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="bars" size="30"></uni-icons>
<text class="text">字典管理</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="gear-filled" size="30"></uni-icons>
<text class="text">参数设置</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="chat-filled" size="30"></uni-icons>
<text class="text">通知公告</text>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="grid-item-box">
<uni-icons type="wallet-filled" size="30"></uni-icons>
<text class="text">日志管理</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
<!-- 宫格组件 -->
<uni-section title="物料管理" type="line"></uni-section>
<view class="grid-body">
<uni-grid :column="4" :showBorder="false" @change="changeGrid">
<uni-grid-item v-for="(item, index) in materialOptions" :key="index" :index="index">
<view class="grid-item-box">
<uni-icons :type="item.icon" size="30"></uni-icons>
<text class="text">{{ item.name }}</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</template>
<script>
export default {
data() {
return {
current: 0,
swiperDotIndex: 0,
data: [{
image: '/static/images/banner/banner01.jpg'
},
{
image: '/static/images/banner/banner02.jpg'
},
{
image: '/static/images/banner/banner03.jpg'
}
]
}
},
methods: {
clickBannerItem(item) {
console.info(item)
},
changeSwiper(e) {
this.current = e.detail.current
},
changeGrid(e) {
this.$modal.showToast('模块建设中~')
}
}
}
import { fail } from 'assert';
export default {
data() {
return {
current: 0,
swiperDotIndex: 0,
bannerList: [
{
image: '/static/images/banner/banner01.jpg'
},
{
image: '/static/images/banner/banner02.jpg'
},
{
image: '/static/images/banner/banner03.jpg'
}
],
//
materialOptions: [
{
name: '备料管理',
icon: 'upload-filled',
url: '/pages/materialManagement/materialPreparation/index'
},
{
name: '参数设置',
icon: 'gear-filled',
url: ''
},
{
name: '通知公告',
icon: 'chat-filled',
url: ''
},
{
name: '配料日志',
icon: 'wallet-filled',
url: ''
}
]
};
},
methods: {
clickBannerItem(item) {
console.info(item);
},
changeSwiper(e) {
this.current = e.detail.current;
},
changeGrid(e) {
const _url = this.materialOptions[e.detail.index].url;
uni.navigateTo({
url: _url,
fail: () => {
this.$modal.showToast('模块建设中~');
}
});
}
}
};
</script>
<style lang="scss">
/* #ifndef APP-NVUE */
page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #fff;
min-height: 100%;
height: auto;
}
/* #ifndef APP-NVUE */
page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #fff;
min-height: 100%;
height: auto;
}
view {
font-size: 14px;
line-height: inherit;
}
view {
font-size: 14px;
line-height: inherit;
}
/* #endif */
/* #endif */
.text {
text-align: center;
font-size: 26rpx;
margin-top: 10rpx;
}
.text {
text-align: center;
font-size: 26rpx;
margin-top: 10rpx;
}
.grid-item-box {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 15px 0;
}
.grid-item-box {
flex: 1;
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
align-items: center;
justify-content: center;
padding: 15px 0;
}
.uni-margin-wrap {
width: 690rpx;
width: 100%;
;
}
.uni-margin-wrap {
width: 690rpx;
width: 100%;
}
.swiper {
height: 300rpx;
}
.swiper {
height: 300rpx;
}
.swiper-box {
height: 150px;
}
.swiper-box {
height: 150px;
}
.swiper-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
color: #fff;
height: 300rpx;
line-height: 300rpx;
}
.swiper-item {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
flex-direction: column;
justify-content: center;
align-items: center;
color: #fff;
height: 300rpx;
line-height: 300rpx;
}
@media screen and (min-width: 500px) {
.uni-swiper-dot-box {
width: 400px;
/* #ifndef APP-NVUE */
margin: 0 auto;
/* #endif */
margin-top: 8px;
}
@media screen and (min-width: 500px) {
.uni-swiper-dot-box {
width: 400px;
/* #ifndef APP-NVUE */
margin: 0 auto;
/* #endif */
margin-top: 8px;
}
.image {
width: 100%;
}
}
.image {
width: 100%;
}
}
</style>

View File

@ -20,9 +20,9 @@ list.forEach(item => {
uni.addInterceptor(item, {
invoke(to) {
if (getToken()) {
if (to.url === loginPage) {
uni.reLaunch({ url: "/" })
}
// if (to.url === loginPage) {
// uni.reLaunch({ url: "/" })
// }
return true
} else {
if (checkWhite(to.url)) {

View File

@ -22,69 +22,68 @@
}
.list-cell-arrow::before {
content: ' ';
height: 10px;
width: 10px;
border-width: 2px 2px 0 0;
border-color: #c0c0c0;
border-style: solid;
-webkit-transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
position: absolute;
top: 50%;
margin-top: -6px;
right: 30rpx;
}
.list-cell {
position: relative;
width: 100%;
box-sizing: border-box;
background-color: #fff;
color: #333;
padding: 26rpx 30rpx;
}
.list-cell:first-child {
border-radius: 8rpx 8rpx 0 0;
}
.list-cell:last-child {
border-radius: 0 0 8rpx 8rpx;
}
.list-cell::after {
content: '';
position: absolute;
border-bottom: 1px solid #eaeef1;
-webkit-transform: scaleY(0.5) translateZ(0);
transform: scaleY(0.5) translateZ(0);
transform-origin: 0 100%;
bottom: 0;
right: 0;
left: 0;
pointer-events: none;
}
.menu-list {
margin: 15px 15px;
.menu-item-box {
width: 100%;
display: flex;
align-items: center;
.menu-icon {
color: #007AFF;
font-size: 16px;
margin-right: 5px;
}
.text-right {
margin-left: auto;
margin-right: 34rpx;
color: #999;
}
}
}
content: ' ';
height: 10px;
width: 10px;
border-width: 2px 2px 0 0;
border-color: #c0c0c0;
border-style: solid;
-webkit-transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
position: absolute;
top: 50%;
margin-top: -6px;
right: 30rpx;
}
.list-cell {
position: relative;
width: 100%;
box-sizing: border-box;
background-color: #fff;
color: #333;
padding: 26rpx 30rpx;
}
.list-cell:first-child {
border-radius: 8rpx 8rpx 0 0;
}
.list-cell:last-child {
border-radius: 0 0 8rpx 8rpx;
}
.list-cell::after {
content: '';
position: absolute;
border-bottom: 1px solid #eaeef1;
-webkit-transform: scaleY(0.5) translateZ(0);
transform: scaleY(0.5) translateZ(0);
transform-origin: 0 100%;
bottom: 0;
right: 0;
left: 0;
pointer-events: none;
}
.menu-list {
margin: 15px 15px;
.menu-item-box {
width: 100%;
display: flex;
align-items: center;
.menu-icon {
color: #007aff;
font-size: 16px;
margin-right: 5px;
}
.text-right {
margin-left: auto;
margin-right: 34rpx;
color: #999;
}
}
}

13
utils/baseUrl.js Normal file
View File

@ -0,0 +1,13 @@
const BaseUrlKey = 'BaseUrl'
export function getBaseUrl() {
return uni.getStorageSync(BaseUrlKey)
}
export function setBaseUrl(BaseUrl) {
return uni.setStorageSync(BaseUrlKey, BaseUrl)
}
export function removeBaseUrl() {
return uni.removeStorageSync(BaseUrlKey)
}

View File

@ -3,6 +3,11 @@ import config from '@/config'
import {
getToken
} from '@/utils/auth'
import {
getBaseUrl,
setBaseUrl,
removeBaseUrl
} from '@/utils/baseUrl';
import errorCode from '@/utils/errorCode'
import {
toast,
@ -15,6 +20,7 @@ const baseUrl = config.baseUrl
const request = config => {
// 是否需要设置 token
const storageBaseUrl = 'http://' + getBaseUrl();
const isToken = (config.headers || {}).isToken === false
config.header = config.header || {}
if (getToken() && !isToken) {
@ -30,7 +36,7 @@ const request = config => {
uni.request({
method: config.method || 'get',
timeout: config.timeout || timeout,
url: config.baseUrl || baseUrl + config.url,
url: config.baseUrl || storageBaseUrl + config.url,
data: config.data,
header: config.header,
dataType: 'json'

42
utils/scan.js Normal file
View File

@ -0,0 +1,42 @@
// 案例
const example = ["20103484/20240907//2142","20103237/20240907//2142"]
export function formatValue(value) {
try {
if (value === "" || value === null || value === undefined) {
return ""
}
return analysisScanValue1(value)
} catch (err) {
uni.showToast({
title: '标题',
duration: 2000
});
return ""
}
}
// 反馈对象 零件号,批次号(日期),数量,供应商代码
let jsonObj = {
partnumber: '',
batchnumber: '',
quantity: 0.0,
code: ''
}
export function getNewJsonObj() {
return JSON.parse(JSON.stringify(jsonObj))
}
function analysisScanValue1(value) {
const parts = value.split('/');
const filteredParts = parts.filter(part => part !== '');
const [first, second, third] = filteredParts;
let newJsonObj = getNewJsonObj();
newJsonObj.partnumber = first;
newJsonObj.batchnumber = second;
newJsonObj.code = third;
return newJsonObj
}