库存盘点
This commit is contained in:
parent
024fb2400a
commit
7ae500dde2
2
App.vue
2
App.vue
|
|
@ -37,5 +37,7 @@ page {
|
|||
background-color: #fff;
|
||||
min-height: 100%;
|
||||
height: auto;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
//获取库存列表
|
||||
export function getInventoryList(params) {
|
||||
return request({
|
||||
url: '/app/inventory/getInventoryList',
|
||||
method: 'get',
|
||||
params
|
||||
});
|
||||
}
|
||||
29
api/login.js
29
api/login.js
|
|
@ -1,21 +1,16 @@
|
|||
import request from '@/utils/request'
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 登录方法
|
||||
export function login(username, password, code, uuid) {
|
||||
const data = {
|
||||
username,
|
||||
password,
|
||||
code,
|
||||
uuid
|
||||
}
|
||||
export function login(data) {
|
||||
return request({
|
||||
'url': '/login',
|
||||
url: '/login/appUserLogin', // login - ruoyi
|
||||
headers: {
|
||||
isToken: false
|
||||
isToken: false,
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
'method': 'post',
|
||||
'data': data
|
||||
})
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
// 注册方法
|
||||
|
|
@ -27,7 +22,7 @@ export function register(data) {
|
|||
},
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 获取用户详细信息
|
||||
|
|
@ -35,7 +30,7 @@ export function getInfo() {
|
|||
return request({
|
||||
'url': '/getInfo',
|
||||
'method': 'get'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 退出方法
|
||||
|
|
@ -43,7 +38,7 @@ export function logout() {
|
|||
return request({
|
||||
'url': '/logout',
|
||||
'method': 'post'
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// 获取验证码
|
||||
|
|
@ -55,5 +50,5 @@ export function getCodeImg() {
|
|||
},
|
||||
method: 'get',
|
||||
timeout: 20000
|
||||
})
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
// 应用全局配置
|
||||
module.exports = {
|
||||
baseUrl: 'https://vue.ruoyi.vip/prod-api',
|
||||
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
|
||||
baseUrl: 'http://192.168.0.39:21995',
|
||||
baseUrl2: 'http://localhost:8080',
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
name: "ruoyi-app",
|
||||
name: "gz_safety_app",
|
||||
// 应用版本
|
||||
version: "1.1.0",
|
||||
// 应用logo
|
||||
|
|
|
|||
3
main.js
3
main.js
|
|
@ -4,8 +4,11 @@ import store from './store' // store
|
|||
import plugins from './plugins' // plugins
|
||||
import './permission' // permission
|
||||
import uView from "@/uni_modules/uview-ui";
|
||||
import Navbar from 'pages/components/Navbar'
|
||||
|
||||
Vue.use(plugins)
|
||||
Vue.use(uView);
|
||||
Vue.component('Navbar', Navbar)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
Vue.prototype.$store = store
|
||||
|
|
|
|||
|
|
@ -80,6 +80,13 @@
|
|||
{
|
||||
"navigationBarTitleText" : "库存查询"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/returnInventory/index",
|
||||
"style" :
|
||||
{
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}],
|
||||
"tabBar": {
|
||||
"color": "#000000",
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ export default {
|
|||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showRightText: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
|
|
@ -72,17 +76,18 @@ export default {
|
|||
|
||||
<style lang="scss">
|
||||
.status_bar_placeholder {
|
||||
height: 135px;
|
||||
height: 44px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
padding: 0 25px;
|
||||
width: 100%;
|
||||
height: 136px;
|
||||
height: 44px;
|
||||
border: 0;
|
||||
background: url('/static/images/imgs/nav.png');
|
||||
background-size: 100% 100%;
|
||||
background-color: #fff;
|
||||
/* background: url('/static/images/imgs/nav.png'); */
|
||||
/* background-size: 100% 100%; */
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default {
|
|||
},
|
||||
{
|
||||
name: 'lock',
|
||||
title: '锁头'
|
||||
title: '退料清点'
|
||||
},
|
||||
{
|
||||
name: 'star',
|
||||
|
|
@ -45,9 +45,13 @@ export default {
|
|||
methods: {
|
||||
click(index) {
|
||||
console.log('🚀 ~ click ~ index:', index)
|
||||
uni.navigateTo({
|
||||
url: '/pages/inventory/index'
|
||||
})
|
||||
let url = ''
|
||||
if (index === 0) {
|
||||
url = '/pages/inventory/index'
|
||||
} else if (index === 1) {
|
||||
url = '/pages/returnInventory/index'
|
||||
}
|
||||
uni.navigateTo({ url })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,140 @@
|
|||
<template>
|
||||
<view>
|
||||
<!-- 搜索 -->
|
||||
<div class="search">
|
||||
<u-input
|
||||
v-model="keyWord"
|
||||
placeholder="请输入搜索内容"
|
||||
suffixIcon="search"
|
||||
suffixIconStyle="color: #909399"
|
||||
suffixIconStyle="color: #666"
|
||||
shape="circle"
|
||||
clearable
|
||||
@blur="handleSearch"
|
||||
></u-input>
|
||||
</div>
|
||||
<!-- 列表 -->
|
||||
<div class="list-cont" v-for="(item, index) in tableList" :key="index">
|
||||
<u-row justify="space-between" customStyle="margin-bottom: 10px; padding: 0 15px;">
|
||||
<u-col span="6">
|
||||
<div>{{ item.name }}</div>
|
||||
</u-col>
|
||||
<u-col span="6">
|
||||
<div style="text-align: end; color: #999">{{ item.code }}</div>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<u-line style="margin-bottom: 5px"></u-line>
|
||||
<div class="list-item">
|
||||
<span>材料类型:</span>
|
||||
<span>{{ item.type }}</span>
|
||||
</div>
|
||||
<div class="list-item">
|
||||
<span>库存数量:</span>
|
||||
<span style="color: #5ae725">{{ item.storageNum }}</span>
|
||||
</div>
|
||||
<div class="list-item">
|
||||
<span>报废数量:</span>
|
||||
<span style="color: #f9ae3d">{{ item.scrapNum }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<u-loadmore :status="status" line />
|
||||
|
||||
<!-- 空状态 -->
|
||||
<u-empty v-if="tableList.length == 0" mode="data"></u-empty>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getInventoryList } from '@/api/aqSafety'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
keyWord: '',
|
||||
tableList: []
|
||||
status: 'loadmore',
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
tableList: [
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
type: '安全用品',
|
||||
storageNum: 1000,
|
||||
scrapNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
type: '安全用品',
|
||||
storageNum: 1000,
|
||||
scrapNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
type: '安全用品',
|
||||
storageNum: 1000,
|
||||
scrapNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
type: '安全用品',
|
||||
storageNum: 1000,
|
||||
scrapNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
type: '安全用品',
|
||||
storageNum: 1000,
|
||||
scrapNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
type: '安全用品',
|
||||
storageNum: 1000,
|
||||
scrapNum: 100
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleSearch(val) {
|
||||
console.log('🚀 ~ handleSearch ~ handleSearch', val)
|
||||
this.keyWord = val
|
||||
handleSearch() {
|
||||
this.pageSize = 10
|
||||
this.getList()
|
||||
},
|
||||
async getList() {
|
||||
try {
|
||||
const params = {
|
||||
keyWord: this.keyWord,
|
||||
pageNum: this.pageNum,
|
||||
pageSize: this.pageSize
|
||||
}
|
||||
console.log('🚀 ~ getList ~ params', params)
|
||||
const res = await getInventoryList
|
||||
console.log('🚀 ~ getList ~ res', res)
|
||||
// this.tableList =
|
||||
// this.total = res.
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ getList ~ error', error)
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('🚀 ~ onReachBottom ~ ')
|
||||
if (this.total < 10 || this.total == this.tableList.length) {
|
||||
this.status = 'nomore'
|
||||
return
|
||||
}
|
||||
this.status = 'loading'
|
||||
setTimeout(() => {
|
||||
this.pageSize += 10
|
||||
this.getList()
|
||||
if (this.tableList.length != this.total) this.status = 'loadmore'
|
||||
else this.status = 'nomore'
|
||||
}, 500)
|
||||
console.log('加载..', this.pageSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,8 +143,20 @@ export default {
|
|||
<style lang="scss">
|
||||
page {
|
||||
padding: 15px;
|
||||
|
||||
height: 900px;
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
.search {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
.list-cont {
|
||||
padding: 15px 0;
|
||||
margin-bottom: 15px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
||||
|
||||
.list-item {
|
||||
padding: 5px 15px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@
|
|||
<view class="iconfont icon-password icon"></view>
|
||||
<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
|
||||
</view>
|
||||
<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
||||
<!-- <view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
|
||||
<view class="iconfont icon-code icon"></view>
|
||||
<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
|
||||
<view class="login-code">
|
||||
<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="action-btn">
|
||||
<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登录</button>
|
||||
</view>
|
||||
|
|
@ -50,15 +50,15 @@
|
|||
register: false,
|
||||
globalConfig: getApp().globalData.config,
|
||||
loginForm: {
|
||||
username: "admin",
|
||||
password: "admin123",
|
||||
username: "bns", // admin - admin123
|
||||
password: "1769fb2837e10e9d22c1c25add76355a", // bns - 1769fb2837e10e9d22c1c25add76355a
|
||||
code: "",
|
||||
uuid: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCode()
|
||||
// this.getCode()
|
||||
},
|
||||
methods: {
|
||||
// 用户注册
|
||||
|
|
@ -91,8 +91,8 @@
|
|||
this.$modal.msgError("请输入您的账号")
|
||||
} else if (this.loginForm.password === "") {
|
||||
this.$modal.msgError("请输入您的密码")
|
||||
} else if (this.loginForm.code === "" && this.captchaEnabled) {
|
||||
this.$modal.msgError("请输入验证码")
|
||||
// } else if (this.loginForm.code === "" && this.captchaEnabled) {
|
||||
// this.$modal.msgError("请输入验证码")
|
||||
} else {
|
||||
this.$modal.loading("登录中,请耐心等待...")
|
||||
this.pwdLogin()
|
||||
|
|
@ -101,12 +101,12 @@
|
|||
// 密码登录
|
||||
async pwdLogin() {
|
||||
this.$store.dispatch('Login', this.loginForm).then(() => {
|
||||
this.$modal.closeLoading()
|
||||
this.$modal.closeLoading() // 关闭加载框
|
||||
this.loginSuccess()
|
||||
}).catch(() => {
|
||||
if (this.captchaEnabled) {
|
||||
this.getCode()
|
||||
}
|
||||
// if (this.captchaEnabled) {
|
||||
// this.getCode()
|
||||
// }
|
||||
})
|
||||
},
|
||||
// 登录成功后,处理函数
|
||||
|
|
|
|||
|
|
@ -0,0 +1,478 @@
|
|||
<template>
|
||||
<view>
|
||||
<Navbar title="退料清点" :showRightText="true" :text="'退料记录'" @chickIcon="handleRightText" />
|
||||
<uni-section title="退料信息填写" type="line"></uni-section>
|
||||
<div class="cont">
|
||||
<u-form :model="formData" :rules="rules" ref="uForm" labelWidth="auto" labelPosition="left" errorType="toast">
|
||||
<u-form-item label="退料工程" prop="returnPro" borderBottom required>
|
||||
<u-cell-group :border="false">
|
||||
<u-cell
|
||||
:value="formData.returnPro"
|
||||
isLink
|
||||
:label="formData.returnPro ? '' : '请选择退料工程'"
|
||||
:border="false"
|
||||
@click="showPicker = true"
|
||||
></u-cell>
|
||||
</u-cell-group>
|
||||
</u-form-item>
|
||||
<u-form-item label="退料日期" prop="returnTime" borderBottom required>
|
||||
<u-cell-group :border="false">
|
||||
<u-cell
|
||||
isLink
|
||||
:label="formData.returnTime ? '' : '请选择发现日期'"
|
||||
:value="formData.returnTime"
|
||||
:border="false"
|
||||
@click="showPickerTime = true"
|
||||
></u-cell>
|
||||
</u-cell-group>
|
||||
</u-form-item>
|
||||
<u-form-item label="经办人" prop="manager" borderBottom required>
|
||||
<u-input v-model="formData.manager" placeholder="请输入经办人" border="none" inputAlign="right"></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="经办人电话" prop="phone" borderBottom required>
|
||||
<u-input
|
||||
v-model="formData.phone"
|
||||
type="number"
|
||||
placeholder="请输入经办人电话"
|
||||
border="none"
|
||||
inputAlign="right"
|
||||
></u-input>
|
||||
</u-form-item>
|
||||
<u-form-item label="备注" prop="remark" required>
|
||||
<u-textarea v-model="formData.remark" placeholder="请输入备注" :rows="5" maxlength="300" count></u-textarea>
|
||||
</u-form-item>
|
||||
<u-form-item label="附件上传" prop="fileList">
|
||||
<uni-file-picker
|
||||
v-model="formData.fileList"
|
||||
:auto-upload="false"
|
||||
ref="files"
|
||||
limit="9"
|
||||
@select="selectImg"
|
||||
@delete="deleteImg"
|
||||
:readonly="false"
|
||||
/>
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</div>
|
||||
|
||||
<uni-section title="退料物资明细" type="line"></uni-section>
|
||||
<div class="cont">
|
||||
<div class="list-no" v-if="inventoryList.length == 0">
|
||||
<u-icon name="/static/images/no_data_icon.png" width="98" height="64"></u-icon>
|
||||
<span style="font-weight: 800; margin: 8px 0">您还没有选择退料的类型</span>
|
||||
<span style="color: #999">需要选择类型后才能进行退料</span>
|
||||
<u-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="coupon-fill"
|
||||
text="选择退料类型"
|
||||
style="margin: 8px 0"
|
||||
@click="showType = true"
|
||||
></u-button>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="top-cont">
|
||||
<div class="top-cont-item">
|
||||
<u-input
|
||||
v-model="typeName"
|
||||
placeholder="请输入名称"
|
||||
suffixIcon="search"
|
||||
suffixIconStyle="color: #666"
|
||||
shape="circle"
|
||||
@blur="handleSearch"
|
||||
></u-input>
|
||||
</div>
|
||||
<div class="top-cont-item">
|
||||
<u-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="coupon-fill"
|
||||
text="选择退料类型"
|
||||
style="margin: 8px 0"
|
||||
@click="handleShowType"
|
||||
></u-button>
|
||||
</div>
|
||||
</div>
|
||||
<u-row justify="space-around" customStyle="margin: 10px 0;" gutter="6">
|
||||
<u-col span="2" textAlign="center">
|
||||
<div>序号</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="center">
|
||||
<div>名称</div>
|
||||
</u-col>
|
||||
<u-col span="4" textAlign="center">
|
||||
<div>规格</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="right">
|
||||
<div>
|
||||
<span style="color: red">*</span>
|
||||
退回数量
|
||||
</div>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<div class="list-item" v-for="(item, index) in searchList" :key="index">
|
||||
<u-row justify="space-around" customStyle="margin-bottom: 10px;" gutter="6">
|
||||
<u-col span="2" textAlign="center">
|
||||
<div>{{ index + 1 }}</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="center">
|
||||
<div>{{ item.name }}</div>
|
||||
</u-col>
|
||||
<u-col span="4" textAlign="center">
|
||||
<div>{{ item.code }}</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="right">
|
||||
<div>
|
||||
<u-input placeholder="返回数量" border="surround" v-model="item.returnNum"></u-input>
|
||||
</div>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="height: 60px"></div>
|
||||
<div class="bt-btn" v-if="inventoryList.length > 0">
|
||||
<u-button type="primary" text="保 存" style="margin: 8px 0" @click="submit"></u-button>
|
||||
</div>
|
||||
|
||||
<!-- 选择器 -->
|
||||
<u-picker
|
||||
v-if="showPicker"
|
||||
:show="showPicker"
|
||||
:columns="[columns]"
|
||||
keyName="label"
|
||||
@cancel="showPicker = false"
|
||||
@confirm="confirm"
|
||||
></u-picker>
|
||||
|
||||
<!-- 日期 -->
|
||||
<u-datetime-picker
|
||||
v-if="showPickerTime"
|
||||
:show="showPickerTime"
|
||||
v-model="dataTime"
|
||||
mode="date"
|
||||
@cancel="showPickerTime = false"
|
||||
@confirm="confirmTime"
|
||||
></u-datetime-picker>
|
||||
|
||||
<!-- 类型弹出层 -->
|
||||
<u-popup :show="showType" mode="center" :closeOnClickOverlay="false" round="8">
|
||||
<div class="uPopup">
|
||||
<div class="pop-title">选择退回的名称</div>
|
||||
<u-input
|
||||
v-model="typePopName"
|
||||
placeholder="请输入名称"
|
||||
suffixIcon="search"
|
||||
suffixIconStyle="color: #666"
|
||||
shape="circle"
|
||||
@blur="handlePopSearch"
|
||||
></u-input>
|
||||
<!-- 列表 -->
|
||||
<div class="type-list">
|
||||
<u-row justify="space-around" customStyle="margin: 10px 0;" gutter="6">
|
||||
<u-col span="2" textAlign="center">
|
||||
<div>序号</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="center">
|
||||
<div>名称</div>
|
||||
</u-col>
|
||||
<u-col span="4" textAlign="center">
|
||||
<div>规格</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="right">
|
||||
<div>
|
||||
<span style="color: red">*</span>
|
||||
退回数量
|
||||
</div>
|
||||
</u-col>
|
||||
</u-row>
|
||||
<div class="list-item" v-for="(item, index) in inventoryPopList" :key="index">
|
||||
<u-row justify="space-around" customStyle="margin-bottom: 10px;" gutter="6">
|
||||
<u-col span="2" textAlign="center">
|
||||
<div>{{ index + 1 }}</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="center">
|
||||
<div>{{ item.name }}</div>
|
||||
</u-col>
|
||||
<u-col span="4" textAlign="center">
|
||||
<div>{{ item.code }}</div>
|
||||
</u-col>
|
||||
<u-col span="3" textAlign="right">
|
||||
<div>
|
||||
<u-input placeholder="返回数量" border="surround" v-model="item.returnNum"></u-input>
|
||||
</div>
|
||||
</u-col>
|
||||
</u-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn">
|
||||
<u-button plain text="取消" style="margin: 8px 0" @click="showType = false"></u-button>
|
||||
<u-button type="primary" plain text="确定" style="margin: 8px 0" @click="selectType"></u-button>
|
||||
</div>
|
||||
</div>
|
||||
</u-popup>
|
||||
|
||||
<!-- loading -->
|
||||
<u-loading-page :loading="isLoading" icon-size="39" style="z-index: 99999"></u-loading-page>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
actionUrl: '',
|
||||
isLoading: false,
|
||||
showPicker: false,
|
||||
columns: [
|
||||
{
|
||||
label: '工程1',
|
||||
value: '1'
|
||||
},
|
||||
{
|
||||
label: '工程2',
|
||||
value: '2'
|
||||
},
|
||||
{
|
||||
label: '工程3',
|
||||
value: '3'
|
||||
}
|
||||
],
|
||||
showPickerTime: false,
|
||||
dataTime: new Date().getTime(),
|
||||
showType: false, // 退料类型弹框
|
||||
formData: {
|
||||
returnPro: '', // 退料工程
|
||||
returnProId: '', // 退料工程id
|
||||
returnTime: '', // 退料日期
|
||||
manager: '', // 经办人
|
||||
phone: '', // 经办人电话
|
||||
remark: '', // 备注
|
||||
fileList: [] // 附件
|
||||
},
|
||||
rules: {
|
||||
returnPro: [{ required: true, message: '请选择退料工程', trigger: 'change' }],
|
||||
returnTime: [{ required: true, message: '请选择退料日期', trigger: 'change' }],
|
||||
manager: [{ required: true, message: '请输入经办人', trigger: 'change' }],
|
||||
phone: [{ required: true, message: '请输入经办人电话', trigger: 'change' }],
|
||||
remark: [{ required: true, message: '请输入备注', trigger: 'change' }]
|
||||
},
|
||||
// 退料物资明细-列表
|
||||
inventoryList: [],
|
||||
searchList: [], // 搜索列表
|
||||
inventoryPopList: [
|
||||
{
|
||||
name: '针式资绝缘子',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
returnNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子1',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
returnNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子2',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
returnNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子3',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
returnNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子4',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
returnNum: 100
|
||||
},
|
||||
{
|
||||
name: '针式资绝缘子5',
|
||||
code: 'JKLYJ-10kV-120',
|
||||
returnNum: 100
|
||||
}
|
||||
], // 退料物资明细弹框列表
|
||||
typeName: '', // 退料物资明细-搜索名称
|
||||
typePopName: '' // 退料物资明细弹框-搜索名称
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 右侧文字点击事件
|
||||
handleRightText() {
|
||||
console.log('🚀 ~ handleRightText ~ ')
|
||||
// uni.navigateTo({
|
||||
// url: '/pages/returnInventoryRecord/index'
|
||||
// })
|
||||
},
|
||||
// 日期选择器
|
||||
confirmTime() {
|
||||
this.formData.returnTime = this.formatTimestamp(this.dataTime)
|
||||
this.showPickerTime = false
|
||||
},
|
||||
// 将时间戳转换为日期格式 yyyy-MM-dd
|
||||
formatTimestamp(timestamp) {
|
||||
const date = new Date(timestamp)
|
||||
const year = date.getFullYear()
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(date.getDate()).padStart(2, '0')
|
||||
return `${year}-${month}-${day}`
|
||||
},
|
||||
// 选择器
|
||||
confirm(e) {
|
||||
console.log('🚀 ~ confirm ~ e', e)
|
||||
this.formData.returnPro = e.value[0].label
|
||||
this.formData.returnProId = e.value[0].value
|
||||
this.showPicker = false
|
||||
},
|
||||
selectImg(e) {
|
||||
console.log('🚀 ~ selectImg ~ e:', e)
|
||||
e.tempFiles.forEach(file => {
|
||||
this.formData.fileList.push(file)
|
||||
})
|
||||
console.log('🚀 ~ selectImg ~ this.formData:', this.formData)
|
||||
},
|
||||
deleteImg(e) {
|
||||
console.log('🚀 ~ deleteImg ~ e:', e)
|
||||
this.formData.fileList.splice(e.index, 1)
|
||||
console.log('🚀 ~ deleteImg ~ this.formData.fileList:', this.formData.fileList)
|
||||
},
|
||||
upload(path) {
|
||||
uni.uploadFile({
|
||||
url: this.actionUrl,
|
||||
filePath: path,
|
||||
name: 'photoType',
|
||||
header: {
|
||||
Authorization: this.token,
|
||||
tokenType: 'APP'
|
||||
},
|
||||
success: res => {
|
||||
console.log('🚀 ~ selectImg ~ res:', res)
|
||||
console.log('🚀 ~ selectImg ~ res--data:', decryptCBC(JSON.parse(res.data).data))
|
||||
this.formData.handlePhotoList.push(JSON.parse(res.data).data[0])
|
||||
console.log('🚀 ~ upload ~ this.handlePhotoList:', this.formData.handlePhotoList)
|
||||
},
|
||||
fail: err => {
|
||||
console.log('🚀 ~ selectImg ~ err:', err)
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSearch() {
|
||||
console.log('🚀 ~ handleSearch ~ ', this.typeName)
|
||||
// 前端搜索, 根据typeName搜索
|
||||
if (this.typeName == '') {
|
||||
this.searchList = this.inventoryList
|
||||
} else {
|
||||
this.searchList = this.inventoryList.filter(item => item.name.includes(this.typeName))
|
||||
}
|
||||
},
|
||||
handlePopSearch() {
|
||||
console.log('🚀 ~ handlePopSearch ~ ')
|
||||
},
|
||||
// 选择退料类型
|
||||
selectType() {
|
||||
console.log('🚀 ~ selectType ~ ')
|
||||
// 根据 inventoryPopList 中的 returnNum 有值则为选择的退料类型, 将其添加到 inventoryList 中
|
||||
this.inventoryList = []
|
||||
this.inventoryPopList.forEach(item => {
|
||||
if (item.returnNum) {
|
||||
this.inventoryList.push(item)
|
||||
}
|
||||
})
|
||||
this.searchList = this.inventoryList
|
||||
console.log('🚀 ~ selectType ~ this.inventoryList:', this.inventoryList)
|
||||
this.showType = false
|
||||
},
|
||||
// 显示退料类型弹框
|
||||
handleShowType() {
|
||||
// 如果 inventoryList 有值, 则回显到弹框中
|
||||
if (this.inventoryList.length > 0) {
|
||||
this.inventoryPopList.forEach(item => {
|
||||
this.inventoryList.forEach(list => {
|
||||
if (item.name === list.name) {
|
||||
item.returnNum = list.returnNum
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.showType = true
|
||||
}, 200)
|
||||
},
|
||||
// 提交
|
||||
submit() {
|
||||
console.log('🚀 ~ submit ~ ')
|
||||
console.log('🚀 ~ submit ~ this.formData:', this.formData)
|
||||
console.log('🚀 ~ submit ~ this.inventoryList:', this.inventoryList)
|
||||
// 校验表单
|
||||
this.$refs.uForm.validate().then(res => {
|
||||
let valid = true
|
||||
// 校验退料物资明细
|
||||
this.inventoryList.forEach(item => {
|
||||
if (!item.returnNum) {
|
||||
this.$modal.msgError('请填写退回数量')
|
||||
valid = false
|
||||
return
|
||||
}
|
||||
})
|
||||
if (!valid) return
|
||||
console.log('🚀 ~ submit ~ 提交-校验通过')
|
||||
this.isLoading = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.cont {
|
||||
padding: 0 15px;
|
||||
|
||||
.list-no {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.top-cont {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 10px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.bt-btn {
|
||||
padding-bottom: 8px;
|
||||
width: calc(100% - 30px);
|
||||
background: #fff;
|
||||
// 固定底部
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 15px;
|
||||
}
|
||||
.uPopup {
|
||||
width: 90vw;
|
||||
height: 80vh;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
box-sizing: border-box;
|
||||
.pop-title {
|
||||
font-size: 16px;
|
||||
font-weight: 800;
|
||||
margin-bottom: 10px;
|
||||
text-align: center;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
.btn {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
width: calc(90vw - 30px);
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
|
|
@ -1,10 +1,10 @@
|
|||
import config from '@/config'
|
||||
import storage from '@/utils/storage'
|
||||
import constant from '@/utils/constant'
|
||||
import { login, logout, getInfo } from '@/api/login'
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth'
|
||||
import config from '@/config';
|
||||
import storage from '@/utils/storage';
|
||||
import constant from '@/utils/constant';
|
||||
import { login, logout, getInfo } from '@/api/login';
|
||||
import { getToken, setToken, removeToken } from '@/utils/auth';
|
||||
|
||||
const baseUrl = config.baseUrl
|
||||
const baseUrl = config.baseUrl;
|
||||
|
||||
const user = {
|
||||
state: {
|
||||
|
|
@ -17,82 +17,86 @@ const user = {
|
|||
|
||||
mutations: {
|
||||
SET_TOKEN: (state, token) => {
|
||||
state.token = token
|
||||
state.token = token;
|
||||
},
|
||||
SET_NAME: (state, name) => {
|
||||
state.name = name
|
||||
storage.set(constant.name, name)
|
||||
state.name = name;
|
||||
storage.set(constant.name, name);
|
||||
},
|
||||
SET_AVATAR: (state, avatar) => {
|
||||
state.avatar = avatar
|
||||
storage.set(constant.avatar, avatar)
|
||||
state.avatar = avatar;
|
||||
storage.set(constant.avatar, avatar);
|
||||
},
|
||||
SET_ROLES: (state, roles) => {
|
||||
state.roles = roles
|
||||
storage.set(constant.roles, roles)
|
||||
state.roles = roles;
|
||||
storage.set(constant.roles, roles);
|
||||
},
|
||||
SET_PERMISSIONS: (state, permissions) => {
|
||||
state.permissions = permissions
|
||||
storage.set(constant.permissions, permissions)
|
||||
state.permissions = permissions;
|
||||
storage.set(constant.permissions, permissions);
|
||||
}
|
||||
},
|
||||
|
||||
actions: {
|
||||
// 登录
|
||||
Login({ commit }, userInfo) {
|
||||
const username = userInfo.username.trim()
|
||||
const password = userInfo.password
|
||||
const code = userInfo.code
|
||||
const uuid = userInfo.uuid
|
||||
const formData = {
|
||||
username: userInfo.username.trim(),
|
||||
password: userInfo.password,
|
||||
// code: userInfo.code,
|
||||
// uuid: userInfo.uuid
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
login(username, password, code, uuid).then(res => {
|
||||
setToken(res.token)
|
||||
commit('SET_TOKEN', res.token)
|
||||
resolve()
|
||||
console.log('🚀 ~ login ~ formData11:', formData)
|
||||
login(formData).then(res => {
|
||||
console.log('🚀 ~ login ~ res:', res)
|
||||
setToken(res.token);
|
||||
commit('SET_TOKEN', res.token);
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar
|
||||
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName
|
||||
const user = res.user;
|
||||
const avatar = (user == null || user.avatar == "" || user.avatar == null) ? require("@/static/images/profile.jpg") : baseUrl + user.avatar;
|
||||
const username = (user == null || user.userName == "" || user.userName == null) ? "" : user.userName;
|
||||
if (res.roles && res.roles.length > 0) {
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
commit('SET_ROLES', res.roles);
|
||||
commit('SET_PERMISSIONS', res.permissions);
|
||||
} else {
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT']);
|
||||
}
|
||||
commit('SET_NAME', username)
|
||||
commit('SET_AVATAR', avatar)
|
||||
resolve(res)
|
||||
commit('SET_NAME', username);
|
||||
commit('SET_AVATAR', avatar);
|
||||
resolve(res);
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 退出系统
|
||||
LogOut({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
logout(state.token).then(() => {
|
||||
commit('SET_TOKEN', '')
|
||||
commit('SET_ROLES', [])
|
||||
commit('SET_PERMISSIONS', [])
|
||||
removeToken()
|
||||
storage.clean()
|
||||
resolve()
|
||||
commit('SET_TOKEN', '');
|
||||
commit('SET_ROLES', []);
|
||||
commit('SET_PERMISSIONS', []);
|
||||
removeToken();
|
||||
storage.clean();
|
||||
resolve();
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default user
|
||||
export default user;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ let baseUrl = config.baseUrl
|
|||
const request = config => {
|
||||
// 是否需要设置 token
|
||||
const isToken = (config.headers || {}).isToken === false
|
||||
config.header = config.header || {}
|
||||
config.header = config.headers || {}
|
||||
if (getToken() && !isToken) {
|
||||
config.header['Authorization'] = 'Bearer ' + getToken()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue