瀏覽代碼

app2.0:增加“扫描资产二维码”功能;

新疆影视学院高职
dyy 2 年之前
父節點
當前提交
632767c16c
共有 5 個檔案被更改,包括 273 行新增2 行删除
  1. +16
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/.hbuilderx/launch.json
  2. +2
    -2
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js
  3. +13
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json
  4. +195
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AssetManagementSystem/ScanAssetQRCode/from.vue
  5. +47
    -0
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AssetManagementSystem/ScanAssetQRCode/list.vue

+ 16
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/.hbuilderx/launch.json 查看文件

@@ -0,0 +1,16 @@
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

+ 2
- 2
Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js 查看文件

@@ -16,11 +16,11 @@ export default {
// "http://localhost:8088/"
// ],
"apiHost": [
"http://localhost:8088/"
"http://192.168.10.45:8088/"
],
// 开发环境下自动填充登录账号密码,与接口地址一一对应,只在开发环境下显示
"devAccount": [
{ username: "system", password: "123456" }
{ username: "system", password: "www.qj.com" }
],
//是否分布式部署 指WebApi与Web不在一台服务器
"isDistributed":true,


+ 13
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages.json 查看文件

@@ -1074,6 +1074,19 @@
"style": {
"navigationBarTitleText": "详情"
}
},
//扫描资产二维码
{
"path": "pages/AssetManagementSystem/ScanAssetQRCode/list",
"style": {
"navigationBarTitleText": "扫描资产二维码"
}
},
{
"path": "pages/AssetManagementSystem/ScanAssetQRCode/from",
"style": {
"navigationBarTitleText": "资产详情"
}
}


+ 195
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AssetManagementSystem/ScanAssetQRCode/from.vue 查看文件

@@ -0,0 +1,195 @@
<template>
<view class="welcome">
<view class="welT">资产信息</view>
<view class="welBox">
<!-- <input type="hidden" name="AIId" :value="AIId" id="AIId" /> -->
<l-input title="资产名称" placeholder="请填写" :value="Ass_AssetsInfoItemEntity.AIASSName" disabled right />
<l-input title="资产编号" placeholder="请填写" :value="Ass_AssetsInfoItemEntity.ACode" disabled right />
<l-input title="明细编号" placeholder="请填写" :value="Ass_AssetsInfoItemEntity.AICode" disabled right />
<l-input title="使用人员" placeholder="请填写" :value="displayListItem(Ass_AssetsInfoItemEntity, 'AIUsePeople')" disabled right />
<l-input title="所在库房" placeholder="请填写" :value="displayListItem(Ass_AssetsInfoItemEntity, 'AIIStorageId')" disabled right />
</view>
</view>
</template>

<script>
import moment from 'moment';
import get from 'lodash/get';
import set from 'lodash/set';
import todayTime from '@/common/js/todayTime.js';
export default {
data() {
return {
pageInfo: '',
scheme: {
AIUsePeople: {
type: 'sourceData',
dataSource: '1',
dataSourceId: 'BaseUser,f_realname,f_userid'
},
AIIStorageId: {
type: 'sourceData',
dataSource: '1',
dataSourceId: 'Ass_StorageData,sname,sid'
}
},
userInfo: {},
dataSource:{
AIUsePeople:[],
AIIStorageId:[]
},
AIId: '',
Ass_AssetsInfoItemEntity:{}
};
},
methods: {
init() {
// console.log(this.API)
let _this = this;
Promise.all([
this.FETCH_DATASOURCE('BaseUser').then(data => {
// console.log(data)
this.dataSource.AIUsePeople = data.data.map(t => ({
text: t.f_realname,
value: t.f_userid
}));
}),
this.FETCH_DATASOURCE('Ass_StorageData').then(data => {
// console.log(data)
this.dataSource.AIIStorageId = data.data.map(t => ({
text: t.sname,
value: t.sid
}));
}),
() => {}
]);
_this.LOADING('加载数据…');
_this.pageInfo = _this.GET_PARAM(); //获取页面传递参数
_this.AIId=_this.pageInfo.AIId;
_this.HTTP_GET('/learun/adms/AssetManagementSystem/Ass_AssetsInfoItem/getEntity', _this.pageInfo.AIId, '加载数据时出错').then(res => {
this.HIDE_LOADING();
console.log(res);
_this.Ass_AssetsInfoItemEntity = _this.COPY(res.Ass_AssetsInfoItemEntity);
});
},
// 显示列表中的标题项
displayListItem(item, field) {
const fieldItem = this.scheme[field];
const value = item[field];
// console.log(Object.values(this.GET_GLOBAL('dataDictionary').usersex));
switch (fieldItem.type) {
case 'currentInfo':
case 'organize':
return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '');
case 'dataItem':
const sex = this.dataSource[field].find(t => t.value === String(value));
return get(sex, 'text', '');
case 'sourceData':
const BCdPartyFace = this.dataSource[field].find(t => t.value === String(value));
return get(BCdPartyFace, 'text', '');
case 'radio':
case 'select':
const selectItem = this.dataSource[field].find(t => t.value === String(value));
return get(selectItem, 'text', '');

case 'checkbox':
if (!value || value.split(',').length <= 0) {
return '';
}
const checkboxItems = value.split(',');
return this.dataSource[field]
.filter(t => checkboxItems.includes(t.value))
.map(t => t.text)
.join(',');

case 'datetime':
if (!value) {
return '';
}
return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm');

default:
return value === null || value === undefined ? '' : value;
}
}
},
created() {
this.userInfo = this.GET_GLOBAL('loginUser'); //获取登录信息
this.init();
}
};
</script>

<style lang="less" scoped>
/deep/ .cu-form-group {
min-height: 40px;
}
.welcome {
padding: 1px 0px 20px;
background: #fff;
}

.welT {
font-size: 16px;
margin-bottom: 10px;
line-height: 26px;
padding: 0 12px;
}

.welT text {
width: 26px;
height: 26px;
line-height: 24px;
border: 1px solid #efefef;
border-radius: 4px;
float: right;
text-align: center;
color: #999;
}

.welLine {
height: 1px;
background: #efefef;
// margin: 10px -12px;
}

.welInput {
overflow: hidden;
font-size: 14px;
margin-top: 10px;
}

.welInput span {
float: left;
width: 26%;
text-align: right;
line-height: 30px;
}

.welInput input {
display: block;
margin-left: 28%;
width: 72%;
border: 1px solid #efefef;
border-radius: 4px;
height: 30px;
line-height: 28px;
padding: 0 10px;
margin-bottom: 0;
}

.welCon {
padding: 10px;
border: 1px solid #efefef;
margin-top: 18px;
border-radius: 4px;
position: relative;
}

</style>

+ 47
- 0
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AssetManagementSystem/ScanAssetQRCode/list.vue 查看文件

@@ -0,0 +1,47 @@
<template>
<view class="page">
<view class="btn" @click="tapScan">
扫码
</view>
</view>
</template>

<script>
import scanCodeFun from '@/common/js/scanCodeFun.js';
export default {
data() {
return {}
},
methods: {
init() {
let _this = this;
scanCodeFun.scanCodeFun().then(res => {
console.log(res); //"scanType": "CODABAR"是一维码,QR_CODE是二维码,
if (!res) return;
if (res.scanType=="QR_CODE" && res.result != "" && res.result != null && res.result != undefined) {
this.NAV_TO('./from', {
AIId: res.result
}, true);
}else{
this.TOAST("无法识别到二维码!");
return;
}
})
},
tapScan() {
this.init();
}
},
mounted() {
let _this = this;
setTimeout(function() {
_this.init();
}, 100);
}
};
</script>

<style lang="less" scoped>
@import '~@/common/css/sidepage.less';
@import '~@/common/css/customlist.less';
</style>

Loading…
取消
儲存