feat(pda): 添加坯布出仓单功能和扫码设置界面
- 新增坯布出仓单相关API接口,包括列表、详情、新增、审核等功能 - 添加营销体系、往来单位、字典明细等基础数据接口 - 在用户中心添加扫描设置入口,支持PDA扫码枪配置 - 创建扫描设置页面,支持选择PDA品牌并配置广播动作和数据标签 - 重构扫码混入逻辑,支持远程配置和本地配置合并 - 添加扫码配置存储和读取功能,支持配置持久化 - 优化扫码广播注册流程,优先使用用户配置的扫码枪设置
This commit is contained in:
parent
ebfa5bf2a0
commit
cff4debea4
@ -7,9 +7,49 @@ const install = (Vue, vm) => {
|
||||
// 参数配置对象
|
||||
const config = vm.vuex_config;
|
||||
console.log('install u',config)
|
||||
|
||||
// 坯布出仓单接口前缀(apiurl 已在 config.js 统一配置为 hcscm_weave 服务)
|
||||
const GFM_OTHER_DELIVERY_PREFIX = '/grey_fabric_manage/gfmOtherDeliveryOrder/';
|
||||
const gfmOtherDeliveryUrl = (name) => (vm.$store.state.apiurl || '') + GFM_OTHER_DELIVERY_PREFIX + name;
|
||||
|
||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||
vm.$u.api = {
|
||||
|
||||
// 坯布出仓单(其他出货单)相关接口
|
||||
gfmOtherDeliveryOrder: {
|
||||
// 获取坯布出仓单列表(query: page,size,order_no,audit_status)
|
||||
list: (params = {}) => vm.$u.get(gfmOtherDeliveryUrl('getGfmOtherDeliveryOrderList'), params),
|
||||
// 获取坯布出仓单详情(query: id)
|
||||
detail: (params = {}) => vm.$u.get(gfmOtherDeliveryUrl('getGfmOtherDeliveryOrder'), params),
|
||||
// 新增坯布出仓单(提交表头信息保存,返回 { id })
|
||||
add: (params = {}) => vm.$u.postJson(gfmOtherDeliveryUrl('addGfmOtherDeliveryOrder'), params),
|
||||
// 扫码新增/删除细码(scan_type: 1新增 2删除;勾选锁定维度时附带 *_lock 字段),返回最新详情
|
||||
scanUpdate: (params = {}) => vm.$u.putJson(gfmOtherDeliveryUrl('updateGfmOtherDeliveryOrder'), params),
|
||||
// 审核
|
||||
statusPass: (params = {}) => vm.$u.putJson(gfmOtherDeliveryUrl('updateGfmOtherDeliveryOrderStatusPass'), params),
|
||||
// 消审
|
||||
statusWait: (params = {}) => vm.$u.putJson(gfmOtherDeliveryUrl('updateGfmOtherDeliveryOrderStatusWait'), params),
|
||||
// 驳回
|
||||
statusReject: (params = {}) => vm.$u.putJson(gfmOtherDeliveryUrl('updateGfmOtherDeliveryOrderStatusReject'), params),
|
||||
// 作废
|
||||
statusCancel: (params = {}) => vm.$u.putJson(gfmOtherDeliveryUrl('updateGfmOtherDeliveryOrderStatusCancel'), params),
|
||||
},
|
||||
|
||||
// 营销体系下拉(路径相对 apiurl:.../pda/v1/saleSystem/getSaleSystemDropdownList)
|
||||
saleSystem: {
|
||||
getDropdownList: (params = {}) => vm.$u.get('/saleSystem/getSaleSystemDropdownList', params),
|
||||
},
|
||||
|
||||
// 往来单位列表(路径相对 apiurl:.../pda/v1/business_unit/list)
|
||||
businessUnit: {
|
||||
list: (params = {}) => vm.$u.get('/business_unit/list', params),
|
||||
},
|
||||
|
||||
// 字典明细枚举(路径相对 apiurl:.../pda/v1/dictionaryDetail/getDictionaryDetailEnumList)
|
||||
dictionary: {
|
||||
getDetailEnumList: (params = {}) => vm.$u.get('/dictionaryDetail/getDictionaryDetailEnumList', params),
|
||||
},
|
||||
|
||||
// 基础服务:登录登出、身份信息、菜单授权、切换系统、字典数据等
|
||||
lang: (params = {}) => vm.$u.get('/lang/'+params.lang),
|
||||
index: (params = {}) => vm.$u.get(config.productionApiUrl+'/mobile/index', params),
|
||||
|
||||
92
src/common/scanConfig.js
Normal file
92
src/common/scanConfig.js
Normal file
@ -0,0 +1,92 @@
|
||||
export const STORAGE_KEY = 'pda_scan_config';
|
||||
|
||||
export const DICTIONARY_TYPE_SCANNER = 10046;
|
||||
|
||||
const NO_SETUP_HINT_KEY = 'pda_scan_config_hint_shown';
|
||||
|
||||
function enrichFromBuiltinConfig(config, builtinConfigs = []) {
|
||||
if (!config || !builtinConfigs.length) {
|
||||
return config;
|
||||
}
|
||||
|
||||
const builtin = builtinConfigs.find((item) => {
|
||||
return item.action === config.action
|
||||
|| item.name === config.name
|
||||
|| item.brand === config.brand;
|
||||
});
|
||||
|
||||
if (!builtin) {
|
||||
return config;
|
||||
}
|
||||
|
||||
return {
|
||||
...config,
|
||||
needSetup: builtin.needSetup,
|
||||
setupAction: builtin.setupAction || '',
|
||||
setupParams: builtin.setupParams || null,
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeConfig(raw, builtinConfigs = []) {
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
|
||||
const config = enrichFromBuiltinConfig({
|
||||
brand: String(raw.brand || raw.id || raw.dictionary_detail_id || raw.name || ''),
|
||||
name: raw.name || '',
|
||||
action: raw.action || raw.code || '',
|
||||
dataKey: raw.dataKey || raw.data_key || raw.remark || '',
|
||||
needSetup: raw.needSetup != null ? raw.needSetup : !!raw.need_setup,
|
||||
setupAction: raw.setupAction || raw.setup_action || '',
|
||||
setupParams: raw.setupParams || raw.setup_params || null,
|
||||
}, builtinConfigs);
|
||||
|
||||
if (!config.brand || !config.action || !config.dataKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export function mapDictionaryToScannerConfig(raw, builtinConfigs = []) {
|
||||
return normalizeConfig(raw, builtinConfigs);
|
||||
}
|
||||
|
||||
export function getScanConfig() {
|
||||
try {
|
||||
const data = uni.getStorageSync(STORAGE_KEY);
|
||||
return normalizeConfig(data);
|
||||
} catch (e) {
|
||||
console.log('读取扫码枪配置失败', e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function saveScanConfig(config) {
|
||||
const normalized = normalizeConfig(config);
|
||||
if (!normalized) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
uni.setStorageSync(STORAGE_KEY, normalized);
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.log('保存扫码枪配置失败', e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function hasShownNoConfigHint() {
|
||||
try {
|
||||
return !!uni.getStorageSync(NO_SETUP_HINT_KEY);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function markNoConfigHintShown() {
|
||||
try {
|
||||
uni.setStorageSync(NO_SETUP_HINT_KEY, true);
|
||||
} catch (e) {
|
||||
console.log('记录扫码枪提示状态失败', e);
|
||||
}
|
||||
}
|
||||
@ -1,20 +1,27 @@
|
||||
// common/scanMixin.js
|
||||
// 多厂商PDA扫码器兼容方案 - 策略模式 + 配置表驱动
|
||||
import {
|
||||
getScanConfig,
|
||||
hasShownNoConfigHint,
|
||||
markNoConfigHintShown,
|
||||
normalizeConfig,
|
||||
} from '@/common/scanConfig.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
scanReceivers: [], // 支持多个接收器
|
||||
scanReceivers: [],
|
||||
isPageActive: false,
|
||||
registeredBrands: [] // 已注册的品牌
|
||||
registeredBrands: [],
|
||||
remoteScannerConfigs: [],
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 扫码器配置表 - 方便扩展新厂商
|
||||
getScannerConfigs() {
|
||||
return [
|
||||
{
|
||||
brand: 'newland', // 东集
|
||||
brand: 'newland',
|
||||
name: '东集',
|
||||
action: 'com.android.server.scannerservice.broadcast',
|
||||
dataKey: 'scannerdata',
|
||||
@ -27,72 +34,66 @@ export default {
|
||||
}
|
||||
},
|
||||
{
|
||||
brand: 'sunmi', // 商米
|
||||
brand: 'sunmi',
|
||||
name: '商米',
|
||||
action: 'com.sunmi.scanner.ACTION_DATA_CODE_RECEIVED',
|
||||
dataKey: 'data',
|
||||
needSetup: false
|
||||
},
|
||||
// {
|
||||
// brand: 'honeywell', // 霍尼韦尔
|
||||
// name: '霍尼韦尔',
|
||||
// action: 'com.honeywell.decode.intent.action.EDIT_DATA',
|
||||
// dataKey: 'data',
|
||||
// needSetup: false
|
||||
// },
|
||||
// {
|
||||
// brand: 'zebra', // 斑马
|
||||
// name: '斑马',
|
||||
// action: 'com.symbol.datawedge.api.RESULT_ACTION',
|
||||
// dataKey: 'com.symbol.datawedge.data_string',
|
||||
// needSetup: false
|
||||
// },
|
||||
// {
|
||||
// brand: 'idata', // 盈达聚力
|
||||
// name: '盈达聚力',
|
||||
// action: 'android.intent.action.SCANRESULT',
|
||||
// dataKey: 'value',
|
||||
// needSetup: false
|
||||
// },
|
||||
// {
|
||||
// brand: 'urovo', // 优博讯
|
||||
// name: '优博讯',
|
||||
// action: 'android.intent.ACTION_DECODE_DATA',
|
||||
// dataKey: 'barcode_string',
|
||||
// needSetup: false
|
||||
// }
|
||||
];
|
||||
},
|
||||
|
||||
// 注册所有扫码广播(推荐方式:同时注册所有厂商)
|
||||
getAllScannerConfigs() {
|
||||
const builtinConfigs = this.getScannerConfigs();
|
||||
if (!this.remoteScannerConfigs.length) {
|
||||
return builtinConfigs;
|
||||
}
|
||||
|
||||
const configMap = new Map();
|
||||
builtinConfigs.forEach((item) => configMap.set(item.brand, item));
|
||||
this.remoteScannerConfigs.forEach((item) => configMap.set(item.brand, item));
|
||||
return Array.from(configMap.values());
|
||||
},
|
||||
|
||||
getActiveScanConfig() {
|
||||
return getScanConfig();
|
||||
},
|
||||
|
||||
getDefaultScanConfig() {
|
||||
const configs = this.getAllScannerConfigs();
|
||||
return configs.length ? configs[0] : null;
|
||||
},
|
||||
|
||||
registerScanBroadcast(scanCallback) {
|
||||
// #ifdef APP-PLUS
|
||||
const configs = this.getScannerConfigs();
|
||||
const activeConfig = this.getActiveScanConfig();
|
||||
|
||||
configs.forEach(config => {
|
||||
try {
|
||||
this.registerSingleBroadcast(config, scanCallback);
|
||||
this.registeredBrands.push(config.brand);
|
||||
console.log(`${config.name}扫码广播注册成功`);
|
||||
} catch (error) {
|
||||
console.log(`${config.name}扫码广播注册失败:`, error);
|
||||
if (activeConfig) {
|
||||
return this.registerScanBroadcastByConfig(activeConfig, scanCallback);
|
||||
}
|
||||
|
||||
if (!hasShownNoConfigHint()) {
|
||||
markNoConfigHintShown();
|
||||
uni.showToast({
|
||||
title: '请先在「我的-扫描设置」配置扫码枪',
|
||||
icon: 'none',
|
||||
duration: 2500,
|
||||
});
|
||||
|
||||
if (this.registeredBrands.length > 0) {
|
||||
console.log('扫码广播注册完成,已注册厂商:', this.registeredBrands.join(', '));
|
||||
return true;
|
||||
}
|
||||
|
||||
console.error('所有扫码广播注册均失败');
|
||||
const defaultConfig = this.getDefaultScanConfig();
|
||||
if (!defaultConfig) {
|
||||
console.error('未找到默认可用的扫码枪配置');
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.registerScanBroadcastByConfig(defaultConfig, scanCallback);
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 注册指定厂商的扫码广播
|
||||
registerScanBroadcastByBrand(brand, scanCallback) {
|
||||
// #ifdef APP-PLUS
|
||||
const configs = this.getScannerConfigs();
|
||||
const configs = this.getAllScannerConfigs();
|
||||
const config = configs.find(c => c.brand === brand);
|
||||
|
||||
if (!config) {
|
||||
@ -100,23 +101,33 @@ export default {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.registerScanBroadcastByConfig(config, scanCallback);
|
||||
// #endif
|
||||
},
|
||||
|
||||
registerScanBroadcastByConfig(config, scanCallback) {
|
||||
// #ifdef APP-PLUS
|
||||
const normalizedConfig = normalizeConfig(config);
|
||||
if (!normalizedConfig) {
|
||||
console.error('扫码枪配置无效');
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
this.registerSingleBroadcast(config, scanCallback);
|
||||
this.registeredBrands.push(config.brand);
|
||||
console.log(`${config.name}扫码广播注册成功`);
|
||||
this.registerSingleBroadcast(normalizedConfig, scanCallback);
|
||||
this.registeredBrands.push(normalizedConfig.brand);
|
||||
console.log(`${normalizedConfig.name}扫码广播注册成功`);
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.error(`${config.name}扫码广播注册失败:`, error);
|
||||
console.error(`${normalizedConfig.name}扫码广播注册失败:`, error);
|
||||
return false;
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 单个广播注册的核心方法
|
||||
registerSingleBroadcast(config, scanCallback) {
|
||||
const main = plus.android.runtimeMainActivity();
|
||||
|
||||
// 如果需要预配置(如东集)
|
||||
if (config.needSetup && config.setupAction) {
|
||||
try {
|
||||
const Intent = plus.android.importClass('android.content.Intent');
|
||||
@ -133,7 +144,6 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
// 注册广播接收器
|
||||
const IntentFilter = plus.android.importClass('android.content.IntentFilter');
|
||||
const filter = new IntentFilter();
|
||||
filter.addAction(config.action);
|
||||
@ -165,17 +175,14 @@ export default {
|
||||
|
||||
main.registerReceiver(receiver, filter);
|
||||
|
||||
// 保存接收器引用,用于后续注销
|
||||
this.scanReceivers.push({
|
||||
brand: config.brand,
|
||||
receiver: receiver
|
||||
});
|
||||
},
|
||||
|
||||
// 处理扫码结果的统一方法
|
||||
handleScanResult(scanResult, scanCallback) {
|
||||
try {
|
||||
// 数据清理:去除空格、换行符等
|
||||
let cleanCode = scanResult.replace(/\s+/g, '').replace(/[\r\n]/g, '');
|
||||
|
||||
console.log("扫码结果:", cleanCode);
|
||||
@ -188,7 +195,6 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 取消所有扫码广播监听
|
||||
unregisterScanBroadcast() {
|
||||
// #ifdef APP-PLUS
|
||||
if (this.scanReceivers.length === 0) return;
|
||||
@ -214,7 +220,6 @@ export default {
|
||||
// #endif
|
||||
},
|
||||
|
||||
// 通用的商品扫描处理方法
|
||||
handleGoodsScan(scanCode, successCallback, errorCallback) {
|
||||
const trimmedCode = scanCode ? scanCode.toString().trim() : "";
|
||||
|
||||
@ -224,17 +229,14 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据业务类型处理不同的扫码逻辑
|
||||
if (this.processScanCode) {
|
||||
this.processScanCode(trimmedCode, successCallback, errorCallback);
|
||||
} else {
|
||||
// 默认处理方式
|
||||
successCallback && successCallback(trimmedCode);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 页面激活状态管理
|
||||
onShow() {
|
||||
this.isPageActive = true;
|
||||
console.log('页面显示,设置 isPageActive 为 true');
|
||||
|
||||
@ -148,6 +148,13 @@
|
||||
"navigationBarTitleText": "清除缓存"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/sys/user/scan-settings",
|
||||
"style": {
|
||||
"navigationBarTitleText": "扫描设置",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/sys/workbench/index",
|
||||
"style": {
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
<u-cell-item icon="question-circle" :iconStyle="{ color: '#ff8d06' }" title="常见问题" @click="navTo('problem')"></u-cell-item>
|
||||
<u-cell-item icon="kefu-ermai" :iconStyle="{ color: '#5f8dff' }" title="意见反馈" @click="navTo('comment')"></u-cell-item>
|
||||
<u-cell-item icon="map" :iconStyle="{ color: '#316ede' }" title="账号安全" @click="navTo('pwd')"></u-cell-item>
|
||||
<u-cell-item icon="scan" :iconStyle="{ color: '#36cfc9' }" title="扫描设置" @click="navTo('scan-settings')"></u-cell-item>
|
||||
<u-cell-item icon="order" :iconStyle="{ color: '#59bdf9' }" title="清除缓存" @click="navTo('clear-cache')"></u-cell-item>
|
||||
<!--<u-cell-item icon="account" :iconStyle="{ color: '#27c0dc' }" title="关于我们" @click="navTo('about')"></u-cell-item>
|
||||
<u-cell-item icon="kefu-ermai" :iconStyle="{ color: '#ff8a00' }" title="联系客服" @click="navTo('service')"></u-cell-item>!-->
|
||||
|
||||
190
src/pages/sys/user/scan-settings.vue
Normal file
190
src/pages/sys/user/scan-settings.vue
Normal file
@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<view class="wrap">
|
||||
<common-navbar title="扫描设置"></common-navbar>
|
||||
<u-gap height="20" bg-color="#f5f5f5"></u-gap>
|
||||
<u-cell-group :border="false">
|
||||
<u-cell-item title="PDA品牌" :value="form.name || '请选择'" @click="brandSelectShow = true"></u-cell-item>
|
||||
<u-cell-item title="广播动作" :arrow="false">
|
||||
<u-input
|
||||
slot="right-icon"
|
||||
v-model="form.action"
|
||||
placeholder="请输入广播动作"
|
||||
input-align="right"
|
||||
:clearable="false"
|
||||
></u-input>
|
||||
</u-cell-item>
|
||||
<u-cell-item title="数据标签" :arrow="false">
|
||||
<u-input
|
||||
slot="right-icon"
|
||||
v-model="form.dataKey"
|
||||
placeholder="请输入数据标签"
|
||||
input-align="right"
|
||||
:clearable="false"
|
||||
></u-input>
|
||||
</u-cell-item>
|
||||
</u-cell-group>
|
||||
<view class="form-footer">
|
||||
<u-button type="primary" :loading="submitting" @click="submit">确定</u-button>
|
||||
</view>
|
||||
<u-select v-model="brandSelectShow" :list="brandSelectList" @confirm="onBrandConfirm"></u-select>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CommonNavbar from '@/components/common-navbar/index';
|
||||
import scanMixin from '@/common/scanMixin.js';
|
||||
import { getScanConfig, DICTIONARY_TYPE_SCANNER, mapDictionaryToScannerConfig, saveScanConfig } from '@/common/scanConfig.js';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CommonNavbar,
|
||||
},
|
||||
mixins: [scanMixin],
|
||||
data() {
|
||||
return {
|
||||
brandSelectShow: false,
|
||||
submitting: false,
|
||||
configList: [],
|
||||
form: {
|
||||
brand: '',
|
||||
name: '',
|
||||
action: '',
|
||||
dataKey: '',
|
||||
needSetup: false,
|
||||
setupAction: '',
|
||||
setupParams: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
brandSelectList() {
|
||||
return this.configList.map((item) => ({
|
||||
value: item.brand,
|
||||
label: item.name,
|
||||
}));
|
||||
},
|
||||
},
|
||||
onLoad() {
|
||||
this.loadConfigList();
|
||||
},
|
||||
methods: {
|
||||
async loadConfigList() {
|
||||
try {
|
||||
const res = await this.$u.api.dictionary.getDetailEnumList({
|
||||
dictionary_id: DICTIONARY_TYPE_SCANNER,
|
||||
});
|
||||
const list = Array.isArray(res) ? res : [];
|
||||
const builtinConfigs = this.getScannerConfigs();
|
||||
if (list.length) {
|
||||
this.configList = list
|
||||
.map((item) => mapDictionaryToScannerConfig(item, builtinConfigs))
|
||||
.filter(Boolean);
|
||||
this.remoteScannerConfigs = this.configList;
|
||||
} else {
|
||||
this.useFallbackConfigList();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log('获取扫码枪字典配置失败,使用内置配置', error);
|
||||
this.useFallbackConfigList();
|
||||
}
|
||||
this.initFormFromSaved();
|
||||
},
|
||||
useFallbackConfigList() {
|
||||
this.configList = this.getScannerConfigs();
|
||||
this.remoteScannerConfigs = [];
|
||||
},
|
||||
initFormFromSaved() {
|
||||
const savedConfig = getScanConfig();
|
||||
if (savedConfig) {
|
||||
this.applyConfig(savedConfig);
|
||||
return;
|
||||
}
|
||||
if (this.configList.length) {
|
||||
this.applyConfig(this.configList[0]);
|
||||
}
|
||||
},
|
||||
applyConfig(config) {
|
||||
this.form = {
|
||||
brand: config.brand || '',
|
||||
name: config.name || '',
|
||||
action: config.action || '',
|
||||
dataKey: config.dataKey || '',
|
||||
needSetup: !!config.needSetup,
|
||||
setupAction: config.setupAction || '',
|
||||
setupParams: config.setupParams || null,
|
||||
};
|
||||
},
|
||||
onBrandConfirm(selected) {
|
||||
const brand = selected[0]?.value;
|
||||
const config = this.configList.find((item) => item.brand === brand);
|
||||
if (config) {
|
||||
this.applyConfig(config);
|
||||
}
|
||||
},
|
||||
submit() {
|
||||
const action = (this.form.action || '').trim();
|
||||
const dataKey = (this.form.dataKey || '').trim();
|
||||
|
||||
if (!this.form.brand) {
|
||||
this.$u.toast('请选择PDA品牌');
|
||||
return;
|
||||
}
|
||||
if (!action) {
|
||||
this.$u.toast('请输入广播动作');
|
||||
return;
|
||||
}
|
||||
if (!dataKey) {
|
||||
this.$u.toast('请输入数据标签');
|
||||
return;
|
||||
}
|
||||
|
||||
const payload = {
|
||||
...this.form,
|
||||
action,
|
||||
dataKey,
|
||||
};
|
||||
|
||||
this.submitting = true;
|
||||
if (!saveScanConfig(payload)) {
|
||||
this.submitting = false;
|
||||
this.$u.toast('保存失败');
|
||||
return;
|
||||
}
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
this.unregisterScanBroadcast();
|
||||
const registered = this.registerScanBroadcastByConfig(payload);
|
||||
if (!registered) {
|
||||
this.submitting = false;
|
||||
this.$u.toast('保存成功,但广播注册失败');
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
|
||||
this.submitting = false;
|
||||
this.$u.toast('保存成功');
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 500);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
.form-footer {
|
||||
padding: 40rpx 30rpx;
|
||||
}
|
||||
|
||||
::v-deep .u-cell_title {
|
||||
color: #202328;
|
||||
}
|
||||
|
||||
::v-deep .u-input__input {
|
||||
min-width: 360rpx;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user