Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
eef0b4a6ec
|
|
@ -19,6 +19,15 @@
|
|||
>编码检索</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<div v-if="optionList.length > 1" class="select-container">
|
||||
<uni-data-select
|
||||
v-model="maId"
|
||||
:localdata="optionList"
|
||||
@change="changeTag"
|
||||
placeholder="请选择相关联编号"
|
||||
class="data-select"
|
||||
></uni-data-select>
|
||||
</div>
|
||||
</view>
|
||||
|
||||
<view class="form-section">
|
||||
|
|
@ -27,66 +36,66 @@
|
|||
</view>
|
||||
<view class="form-content">
|
||||
<uni-forms :model="formData" label-width="100" :border="true">
|
||||
<uni-forms-item label="设备类型:" name="leaseUnit">
|
||||
<span class="form-view">激动角膜</span>
|
||||
<uni-forms-item label="设备类型:" name="maName">
|
||||
<span class="form-view">{{formData?.maName ?? ''}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="规格型号:" name="leaseProject">
|
||||
<span class="form-view">CJM-2</span>
|
||||
<uni-forms-item label="规格型号:" name="maModel">
|
||||
<span class="form-view">{{formData?.maModel ?? ''}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="二维码编码:" name="maTypeName">
|
||||
<span class="form-view">ceshi123</span>
|
||||
<uni-forms-item label="二维码编码:" name="qrCode">
|
||||
<span class="form-view">{{formData?.qrCode ?? ''}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码:" name="typeName">
|
||||
<span class="form-view">ceshi123</span>
|
||||
<uni-forms-item label="设备编码:" name="maCode">
|
||||
<span class="form-view">{{formData?.maCode ?? ''}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备状态:" name="maxNum">
|
||||
<span class="form-view">在用</span>
|
||||
<uni-forms-item label="设备状态:" name="maStatus">
|
||||
<span class="form-view">{{formData?.maStatus ?? ''}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="本次检修时间:" name="checkTimeSynch">
|
||||
<text class="form-view">{{formData?.thisCheckTime ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="下次检修时间:" name="nextCheckTimeSynch">
|
||||
<text class="form-view">{{formData?.nextCheckTime ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出入库次数:" name="inOutNum">
|
||||
<text class="form-view">{{formData?.inOutNum ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="初次入库:" name="inTime">
|
||||
<text class="form-view">{{formData?.inTime ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="服务工程次数:" name="serviceNum">
|
||||
<text class="form-view">{{formData?.serviceNum ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="检验次数:" name="checkNum">
|
||||
<text class="form-view">{{formData?.checkNum ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="更换配件次数:" name="checkNum">
|
||||
<text class="form-view">{{formData?.checkNum ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="报废:" name="scrapTime">
|
||||
<text class="form-view">{{formData?.scrapTime ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="生产厂家:" name="statusName">
|
||||
<text class="form-view">{{}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料单位:" name="leaseUnit">
|
||||
<text class="form-view">{{formData?.leaseUnit ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料工程:" name="leaseProject">
|
||||
<text class="form-view">{{formData?.leaseProject ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料时间:" name="leaseTime">
|
||||
<text class="form-view">{{formData?.leaseTime ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料单位:" name="backUnit">
|
||||
<text class="form-view">{{formData?.backUnit ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料工程:" name="backProject">
|
||||
<text class="form-view">{{formData?.backProject ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料时间:" name="backTime">
|
||||
<text class="form-view">{{formData?.backTime ?? ''}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="本次检修时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="下次检修时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出入库次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="初次入库:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="服务工程次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="检验次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="更换配件次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="报废:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="生产厂家:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料单位:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料工程:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料单位:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料工程:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -102,12 +111,36 @@
|
|||
import { ref, computed, onUnmounted } from 'vue'
|
||||
import { onLoad, onShow, } from '@dcloudio/uni-app'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { getDeviceListAPI } from '@/services/picking/outbound.js'
|
||||
const queryParams = ref({})
|
||||
const formData = ref({})
|
||||
const formData = ref({
|
||||
maName: '',
|
||||
maModel: '',
|
||||
qrCode: '',
|
||||
maCode: '',
|
||||
maStatus: '',
|
||||
thisCheckTime: '',
|
||||
nextCheckTime: '',
|
||||
inOutNum: '',
|
||||
inTime: '',
|
||||
serviceNum: '',
|
||||
checkNum: '',
|
||||
scrapTime: '',
|
||||
statusName: '',
|
||||
leaseUnit: '',
|
||||
leaseProject: '',
|
||||
leaseTime: '',
|
||||
backUnit: '',
|
||||
backProject: '',
|
||||
backTime: ''
|
||||
})
|
||||
// 编码设备列表查询参数
|
||||
const queryCodeParams = ref({
|
||||
maCode: '',
|
||||
maId:'',
|
||||
})
|
||||
const maId = ref('')
|
||||
const optionList = ref([])
|
||||
// 页面加载完毕
|
||||
onLoad((options) => {})
|
||||
|
||||
|
|
@ -121,12 +154,55 @@ const onCodeSearch = () => {
|
|||
const getCodeDeviceInfoData = async () => {
|
||||
console.log(queryCodeParams.value)
|
||||
// const res = await getCodeDeviceListAPI(queryCodeParams.value)
|
||||
// console.log(res)
|
||||
getDeviceListAPI({'maCode': queryCodeParams.value.maCode}).then(response => {
|
||||
console.log("xxxxxxxxxxx",response)
|
||||
if (response.data && response.data.length !== 0) {
|
||||
optionList.value = response.data.map(option => ({
|
||||
value: option.maId,
|
||||
text: option.maCode
|
||||
}))
|
||||
if(response.data.length === 1){
|
||||
formData.value = response.data[0]
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: '未查询到该编号信息',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(res)
|
||||
}
|
||||
|
||||
// 标签变更处理
|
||||
const changeTag = async () => {
|
||||
if (!maId.value) return
|
||||
|
||||
try {
|
||||
const response = await getDeviceListAPI({'maId': maId.value})
|
||||
if (response.data && response.data.length !== 0) {
|
||||
formData.value = response.data[0]
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取编号信息失败", error)
|
||||
uni.showToast({
|
||||
title: '获取信息失败',
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-forms-item--border[data-v-4c3fe719] {
|
||||
margin-bottom: 0;
|
||||
padding: 0 0;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
.page-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
|
|
|||
|
|
@ -3,72 +3,72 @@
|
|||
<!-- 表单信息区域 -->
|
||||
<scroll-view scroll-y style="height: 100vh;">
|
||||
<view class="outbound-btn" @click="scanStart"> 二维码扫描 </view>
|
||||
<ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" />
|
||||
<!-- <ScanQrCode ref="scanQrCodeRef" @scanSuccess="handleScanSuccess" @scanError="handleScanError" /> -->
|
||||
<view class="form-section">
|
||||
<view class="section-header">
|
||||
<text class="title">设备信息</text>
|
||||
</view>
|
||||
<view class="form-content">
|
||||
<uni-forms :model="formData" label-width="100" :border="true">
|
||||
<uni-forms-item label="设备类型:" name="leaseUnit">
|
||||
<span class="form-view">激动角膜</span>
|
||||
<uni-forms-item label="设备类型:" name="maName">
|
||||
<span class="form-view">{{codeData.maName}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="规格型号:" name="leaseProject">
|
||||
<span class="form-view">CJM-2</span>
|
||||
<uni-forms-item label="规格型号:" name="maModel">
|
||||
<span class="form-view">{{codeData.maModel}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="二维码编码:" name="maTypeName">
|
||||
<span class="form-view">ceshi123</span>
|
||||
<uni-forms-item label="二维码编码:" name="qrCode">
|
||||
<span class="form-view">{{codeData.qrCode}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备编码:" name="typeName">
|
||||
<span class="form-view">ceshi123</span>
|
||||
<uni-forms-item label="设备编码:" name="maCode">
|
||||
<span class="form-view">{{codeData.maCode}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="设备状态:" name="maxNum">
|
||||
<span class="form-view">在用</span>
|
||||
<uni-forms-item label="设备状态:" name="maStatus">
|
||||
<span class="form-view">{{codeData.maStatus}}</span>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="本次检修时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="本次检修时间:" name="checkTimeSynch">
|
||||
<text class="form-view">{{codeData.thisCheckTime}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="下次检修时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="下次检修时间:" name="nextCheckTimeSynch">
|
||||
<text class="form-view">{{codeData.nextCheckTime}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="出入库次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="出入库次数:" name="inOutNum">
|
||||
<text class="form-view">{{codeData.inOutNum}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="初次入库:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="初次入库:" name="inTime">
|
||||
<text class="form-view">{{codeData.inTime}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="服务工程次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="服务工程次数:" name="serviceNum">
|
||||
<text class="form-view">{{codeData.serviceNum}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="检验次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="检验次数:" name="serviceNum">
|
||||
<text class="form-view">{{codeData.serviceNum}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="更换配件次数:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="更换配件次数:" name="checkNum">
|
||||
<text class="form-view">{{codeData.checkNum}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="报废:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="报废:" name="scrapTime">
|
||||
<text class="form-view">{{codeData.scrapTime}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="生产厂家:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<text class="form-view">{{}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料单位:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="领料单位:" name="leaseUnit">
|
||||
<text class="form-view">{{codeData.leaseUnit}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料工程:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="领料工程:" name="leaseProject">
|
||||
<text class="form-view">{{codeData.leaseProject}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="领料时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="领料时间:" name="leaseTime">
|
||||
<text class="form-view">{{codeData.leaseTime}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料单位:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="退料单位:" name="backUnit">
|
||||
<text class="form-view">{{codeData.backUnit}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料工程:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="退料工程:" name="backProject">
|
||||
<text class="form-view">{{codeData.backProject}}</text>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="退料时间:" name="statusName">
|
||||
<text class="form-view"></text>
|
||||
<uni-forms-item label="退料时间:" name="backTime">
|
||||
<text class="form-view">{{codeData.backTime}}</text>
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
</view>
|
||||
|
|
@ -85,7 +85,7 @@ import { ref, computed, onUnmounted } from 'vue'
|
|||
import { onLoad, onShow, } from '@dcloudio/uni-app'
|
||||
import { debounce } from 'lodash-es'
|
||||
import ScanQrCode from '@/pages/devicesSearch/ScanQrCode.vue'
|
||||
import { getCodeScanAPI } from '@/services/picking/outbound.js'
|
||||
import { getScanCodeAPI } from '@/services/picking/outbound.js'
|
||||
const scanQrCodeRef = ref(null)
|
||||
|
||||
const queryParams = ref({})
|
||||
|
|
@ -138,9 +138,11 @@ onShow(() => {
|
|||
// }
|
||||
// 扫码识别按钮点击事件
|
||||
const scanStart = () => {
|
||||
if (scanQrCodeRef.value) {
|
||||
scanQrCodeRef.value.scanQrCode()
|
||||
}
|
||||
// if (scanQrCodeRef.value) {
|
||||
// scanQrCodeRef.value.scanQrCode()
|
||||
// }
|
||||
qrCodeScan.value = '202502-00027'
|
||||
getMaInfoScan()
|
||||
}
|
||||
|
||||
// 处理扫描成功事件
|
||||
|
|
@ -160,11 +162,12 @@ const getMaInfoScan = async () => {
|
|||
let param = {
|
||||
qrCode: qrCodeScan.value,
|
||||
}
|
||||
const res = await getCodeScanAPI(param)
|
||||
console.log(param)
|
||||
const res = await getScanCodeAPI(param)
|
||||
console.log(res)
|
||||
if (res.code == 200) {
|
||||
if (res.data && res.data.recordList.length > 0) {
|
||||
codeData.value = res.data.recordList[0]
|
||||
if (res.data) {
|
||||
codeData.value = res.data
|
||||
}else{
|
||||
uni.showToast({ title: res.data.msg, icon: 'none'})
|
||||
}
|
||||
|
|
@ -179,6 +182,11 @@ const getMaInfoScan = async () => {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.uni-forms-item--border[data-v-4c3fe719] {
|
||||
margin-bottom: 0;
|
||||
padding: 0 0;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
.page-container {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -122,7 +122,7 @@ const getUserInfoByUserName = async () => {
|
|||
const userName = userInfo.value.userName
|
||||
console.log('🚀 ~ getUserInfoByUserName ~ userName:', userName)
|
||||
const res = await getUserInfoByUserNameApi({ userName })
|
||||
idCard.value = res.data.idCard
|
||||
idCard.value = res?.data?.idCard
|
||||
console.log('🚀 ~ getUserInfoByUserName ~ idCard.value:', idCard.value)
|
||||
uni.setStorageSync('idCard', idCard.value)
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ const getTeamList = async () => {
|
|||
const getProjectListApi = async () => {
|
||||
console.log('🚀 ~ 工程')
|
||||
try {
|
||||
const res = await getProjectList({ unitId: null, isApp: true, teamName: formData.teamName })
|
||||
const res = await getProjectList({ unitId: null, isApp: true, teamId: formData.teamId })
|
||||
if (!res.data || !res.data.length) return
|
||||
console.log('🚀 ~ getProjectListApi ~ res:', res)
|
||||
prodRange.value = res.data.map((item) => {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<!-- 滚动列表 -->
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower" class="scroll-container">
|
||||
<uni-swipe-action class="swipe-action">
|
||||
<uni-swipe-action class="swipe-action" ref="swipeRef">
|
||||
<uni-swipe-action-item
|
||||
v-for="(item, index) in tableList"
|
||||
:right-options="item.options"
|
||||
|
|
@ -112,6 +112,7 @@ const items = ref(['未完成', '已完成'])
|
|||
const current = ref(0)
|
||||
const tableList = ref([])
|
||||
const total = ref(0)
|
||||
const swipeRef = ref()
|
||||
const finish = computed(() => {
|
||||
if (total.value === tableList.value.length) return true
|
||||
})
|
||||
|
|
@ -199,12 +200,14 @@ const onClickSwipe = async (e, item) => {
|
|||
// 删除
|
||||
await deleteItem(item)
|
||||
}
|
||||
swipeRef.value.closeAll()
|
||||
} catch (error) {
|
||||
console.error('操作失败:', error)
|
||||
uni.showToast({
|
||||
title: error.message || '操作失败',
|
||||
icon: 'error',
|
||||
})
|
||||
swipeRef.value.closeAll()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@
|
|||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">规格型号:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<view class="cont">{{ item.materialModel }}</view>
|
||||
<view class="cont">{{ item.typeName }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
|
|
@ -191,7 +191,7 @@ const queryCodeParams = ref({
|
|||
pageNum: 1,
|
||||
pageSize: 9999,
|
||||
typeId: '',
|
||||
maStatus: 1,
|
||||
// maStatus: 1,
|
||||
maCode: '',
|
||||
})
|
||||
const qrCodeScan = ref('')
|
||||
|
|
@ -217,6 +217,8 @@ onLoad((opt) => {
|
|||
// queryParamsTemp.value.id = queryParamsTemp.value.parentId
|
||||
console.log('xxxxxxxx', queryParamsTemp.value)
|
||||
queryCodeParams.value.typeId = queryParamsTemp.value.typeId
|
||||
queryCodeParams.value.proId = queryParamsTemp.value.proId
|
||||
queryCodeParams.value.teamId = queryParamsTemp.value.teamId
|
||||
queryParams.value = { ...queryParamsTemp.value }
|
||||
if (queryParamsTemp.value.isBack) {
|
||||
getCodeList() // 获取编码列表
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
<!-- 滚动列表 -->
|
||||
<scroll-view scroll-y @scrolltolower="onScrollTolower">
|
||||
<uni-swipe-action>
|
||||
<uni-swipe-action ref="swipeRef">
|
||||
<uni-swipe-action-item
|
||||
v-for="(item, index) in tableList"
|
||||
:right-options="item.options"
|
||||
|
|
@ -110,6 +110,7 @@ const items = ref(['未完成', '已完成'])
|
|||
const current = ref(0)
|
||||
const tableList = ref([])
|
||||
const total = ref(0)
|
||||
const swipeRef = ref()
|
||||
|
||||
const finish = computed(() => {
|
||||
if (total.value === tableList.value.length) return true
|
||||
|
|
@ -196,7 +197,7 @@ const onScrollTolower = () => {
|
|||
}
|
||||
|
||||
// 滑动
|
||||
const onClickSwipe = async (e, item) => {
|
||||
const onClickSwipe = async (e, item, itemIndex) => {
|
||||
console.log('🚀 ~ onClickSwipe ~ e:', e, item)
|
||||
if (e.content.text == '电子签名') {
|
||||
// 电子签名
|
||||
|
|
@ -205,6 +206,7 @@ const onClickSwipe = async (e, item) => {
|
|||
const params = {
|
||||
id: item.id,
|
||||
leaseSignUrl: item.leaseSignUrl,
|
||||
leaseSignType: item.leaseSignType,
|
||||
isToolsLease: true,
|
||||
}
|
||||
uni.navigateTo({
|
||||
|
|
@ -225,6 +227,7 @@ const onClickSwipe = async (e, item) => {
|
|||
// 删除
|
||||
deleteItem(item)
|
||||
}
|
||||
swipeRef.value.closeAll()
|
||||
}
|
||||
|
||||
// 删除
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
<uni-th width="180" align="center">规格型号</uni-th>
|
||||
<uni-th width="80" align="center">在库数</uni-th>
|
||||
<uni-th width="80" align="center">在用数</uni-th>
|
||||
<uni-th width="80" align="center">预领数</uni-th>
|
||||
<uni-th width="80" align="center" v-if="opts.isOut">预领数</uni-th>
|
||||
<uni-th width="100" align="center">{{ opts.isOut ? '出库数' : '领用数' }}</uni-th>
|
||||
<uni-th width="100" align="center">操作</uni-th>
|
||||
</uni-tr>
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
</uni-td>
|
||||
<uni-td align="center">{{ item.storageNum }}</uni-td>
|
||||
<uni-td align="center">{{ item.useNum }}</uni-td>
|
||||
<uni-td align="center">{{ item.preNum }}</uni-td>
|
||||
<uni-td align="center" v-if="opts.isOut">{{ item.preNum }}</uni-td>
|
||||
<uni-td align="center"
|
||||
><uni-easyinput
|
||||
v-if="item.manageType == 1 || !opts.isOut"
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
删除
|
||||
</button>
|
||||
<button
|
||||
v-if="item.manageType == 0 && !item.maCodeList"
|
||||
v-if="item.manageType == 0 && item.maCodeList"
|
||||
class="uni-button"
|
||||
size="mini"
|
||||
@click="handleDetail(item)"
|
||||
|
|
@ -401,8 +401,9 @@ const changeEquipment = (e) => {
|
|||
const equipment = findEquipmentById(equipmentList.value, e.parentId)
|
||||
tableData.value.push({
|
||||
...JSON.parse(JSON.stringify(e)),
|
||||
storageNum: e.num,
|
||||
maTypeName: equipment.typeName,
|
||||
preNum: e.manageType == 1 ? 1 : 0, // 数量默认为1
|
||||
preNum: 1, // 数量默认为1
|
||||
maCodeList: [],
|
||||
})
|
||||
setTimeout(() => {
|
||||
|
|
@ -441,7 +442,9 @@ const getCode = (item) => {
|
|||
}
|
||||
item.isEdit = opts.value.isEdit
|
||||
uni.navigateTo({
|
||||
url: '/pages/materialsStation/toolsLease/codeOut?params=' + JSON.stringify(item),
|
||||
url:
|
||||
'/pages/materialsStation/toolsLease/codeOut?params=' +
|
||||
JSON.stringify({ ...item, proId: formData.projectId, teamId: formData.teamId }),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -571,7 +574,7 @@ onShow(() => {
|
|||
// 监听添加编码
|
||||
uni.$on('maCodeList', (data) => {
|
||||
console.log('🚀 ~ onShow ~ data:', data)
|
||||
const item = tableData.value.find((item) => item.typeId === data[0].typeId)
|
||||
const item = tableData.value.find((item) => item.typeId == data[0].typeId)
|
||||
console.log('🚀 ~ onShow ~ item:', item)
|
||||
if (item) {
|
||||
item.maCodeList = data
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
updateLeaseApplyInfoSign,
|
||||
updateSignById,
|
||||
} from '@/services/signature.js'
|
||||
import { toolsLeaseApplyInfoSign } from '@/services/materialsStation'
|
||||
import { baseURL } from '@/utils/http'
|
||||
|
||||
let isCanvas = ref(false)
|
||||
|
|
@ -37,7 +38,7 @@ onLoad((opt) => {
|
|||
// console.log('🚀 ~ onLoad ~ opt:', opt)
|
||||
const params = opt.params ? JSON.parse(opt.params) : {}
|
||||
Object.assign(opts, params)
|
||||
if (opts.isLease) {
|
||||
if (opts.isLease || opts.isToolsLease) {
|
||||
signType.value = opts.leaseSignType
|
||||
imgPath.value = opts.leaseSignUrl
|
||||
}
|
||||
|
|
@ -206,7 +207,7 @@ const onCameraSuccess = (file) => {
|
|||
publishTask: opts.publishTask || '',
|
||||
}
|
||||
console.log('🚀 ~ success: ~ params:', params)
|
||||
updateLeaseApplyInfoSign(params).then((res) => {
|
||||
toolsLeaseApplyInfoSign(params).then((res) => {
|
||||
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
|
||||
uni.navigateBack()
|
||||
})
|
||||
|
|
@ -262,7 +263,7 @@ const uploadImg2 = async (base64Data) => {
|
|||
publishTask: opts.publishTask || '',
|
||||
}
|
||||
console.log('🚀 ~ success: ~ params:', params)
|
||||
const res = await updateLeaseApplyInfoSign(params)
|
||||
const res = await toolsLeaseApplyInfoSign(params)
|
||||
console.log('🚀 ~ uploadImg-领料 ~ res:', res)
|
||||
uni.navigateBack()
|
||||
} else if (opts.isBack) {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ export function updateTeamProjectApi(data) {
|
|||
// 预警统计
|
||||
export function getToolsLedgerDetailsListApi(data) {
|
||||
return http({
|
||||
url: '/material/complex_query/getToolsLedgerDetailsList',
|
||||
url: '/material/material_maMachine/getToolsLedgerDetailsList',
|
||||
method: 'get',
|
||||
data,
|
||||
})
|
||||
|
|
@ -84,8 +84,8 @@ export const getProjectList = (data = {}) => {
|
|||
// 类型规格-树
|
||||
export const getTypeTreeList = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/ma_type/equipmentType',
|
||||
method: 'post',
|
||||
url: '/material/material_lease_apply_info/equipmentType',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ export const getMachineByIdApi = (data) => {
|
|||
export const getCodeDeviceListAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/ma_machine/list',
|
||||
url: '/material/material_lease_apply_info/getMachineById',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ export const editBackTask = (data) => {
|
|||
export const getUseTypeTree = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/select/getUseTypeTree',
|
||||
url: '/material/material_back_apply_info/getUseTypeTree',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ export const getMachine = (data) => {
|
|||
export const getToolsLedgerList = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/complex_query/getToolsLedgerList',
|
||||
url: '/material/material_maMachine/getToolsLedgerList',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ export const getToolsLedgerList = (data) => {
|
|||
export const getTeamUseNumList = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/complex_query/getTeamUseNumList',
|
||||
url: '/material/material_maMachine/getTeamUseNumList',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -251,8 +251,17 @@ export const getTeamUseNumList = (data) => {
|
|||
// 班组预警
|
||||
export function getTeamWarnDetailsListApi(data) {
|
||||
return http({
|
||||
url: '/material/complex_query/getTeamWarnDetailsList',
|
||||
url: '/material/material_maMachine/getTeamWarnDetailsList',
|
||||
method: 'get',
|
||||
data
|
||||
data,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// 签名-领料
|
||||
export const toolsLeaseApplyInfoSign = (data) => {
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/material/material_lease_apply_info/updateLeaseApplyInfoSign',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,6 +76,22 @@ export const getCodeScanAPI = (data) => {
|
|||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const getScanCodeAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/ma_machine/getHisByQrcode',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
export const getDeviceListAPI = (data) => {
|
||||
return http({
|
||||
method: 'GET',
|
||||
url: '/material/ma_machine/getHisByCode',
|
||||
data,
|
||||
})
|
||||
}
|
||||
//出库退回
|
||||
export const leaseOutBackApi = (data) => {
|
||||
return http({
|
||||
|
|
|
|||
|
|
@ -1,562 +1,432 @@
|
|||
<template>
|
||||
<view class="uni-stat__select">
|
||||
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ':'}}</span>
|
||||
<view class="uni-stat-box" :class="{'uni-stat__actived': current}">
|
||||
<view class="uni-select" :class="{'uni-select--disabled':disabled}">
|
||||
<view class="uni-select__input-box" @click="toggleSelector">
|
||||
<view v-if="current" class="uni-select__input-text">{{textShow}}</view>
|
||||
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
|
||||
<view v-if="current && clear && !disabled" @click.stop="clearVal">
|
||||
<uni-icons type="clear" color="#c0c4cc" size="24" />
|
||||
</view>
|
||||
<view v-else>
|
||||
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
|
||||
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
|
||||
<view :class="placement=='bottom'?'uni-popper__arrow_bottom':'uni-popper__arrow_top'"></view>
|
||||
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
|
||||
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
|
||||
<text>{{emptyTips}}</text>
|
||||
</view>
|
||||
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
|
||||
@click="change(item)">
|
||||
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-stat__select">
|
||||
<span v-if="label" class="uni-label-text hide-on-phone">{{ label + ':' }}</span>
|
||||
<view class="uni-stat-box" :class="{ 'uni-stat__actived': current }">
|
||||
<view class="uni-select" :class="{ 'uni-select--disabled': disabled }">
|
||||
<view class="uni-select__input-box" @click="toggleSelector">
|
||||
<view v-if="current" class="uni-select__input-text">{{ textShow }}</view>
|
||||
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{
|
||||
typePlaceholder
|
||||
}}</view>
|
||||
<view v-if="current && clear && !disabled" @click.stop="clearVal">
|
||||
<uni-icons type="clear" color="#c0c4cc" size="24" />
|
||||
</view>
|
||||
<view v-else>
|
||||
<uni-icons :type="showSelector ? 'top' : 'bottom'" size="14" color="#999" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
|
||||
<view class="uni-select__selector" :style="getOffsetByPlacement" v-if="showSelector">
|
||||
<view
|
||||
:class="placement == 'bottom' ? 'uni-popper__arrow_bottom' : 'uni-popper__arrow_top'"
|
||||
></view>
|
||||
|
||||
<!-- 🔍 搜索输入框,受 searchable 控制 -->
|
||||
<view v-if="searchable" class="uni-select__search-box">
|
||||
<uni-easyinput
|
||||
v-model="searchValue"
|
||||
placeholder="请输入关键词"
|
||||
clearable
|
||||
@input="onSearchInput"
|
||||
/>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
|
||||
<view class="uni-select__selector-empty" v-if="filteredData.length === 0">
|
||||
<text>{{ emptyTips }}</text>
|
||||
</view>
|
||||
<view
|
||||
v-else
|
||||
class="uni-select__selector-item"
|
||||
v-for="(item, index) in filteredData"
|
||||
:key="index"
|
||||
@click="change(item)"
|
||||
>
|
||||
<text :class="{ 'uni-select__selector__disabled': item.disable }">
|
||||
{{ formatItemName(item) }}
|
||||
</text>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
* DataChecklist 数据选择器
|
||||
* @description 通过数据渲染的下拉框组件
|
||||
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
|
||||
* @property {String} value 默认值
|
||||
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
|
||||
* @property {Boolean} clear 是否可以清空已选项
|
||||
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
|
||||
* @property {String} label 左侧标题
|
||||
* @property {String} placeholder 输入框的提示文字
|
||||
* @property {Boolean} disabled 是否禁用
|
||||
* @property {String} placement 弹出位置
|
||||
* @value top 顶部弹出
|
||||
* @value bottom 底部弹出(default)
|
||||
* @event {Function} change 选中发生变化触发
|
||||
*/
|
||||
|
||||
export default {
|
||||
name: "uni-data-select",
|
||||
mixins: [uniCloud.mixinDatacom || {}],
|
||||
props: {
|
||||
localdata: {
|
||||
type: Array,
|
||||
default () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: ''
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择'
|
||||
},
|
||||
emptyTips: {
|
||||
type: String,
|
||||
default: '无选项'
|
||||
},
|
||||
clear: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
defItem: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
|
||||
format: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
placement: {
|
||||
type: String,
|
||||
default: 'bottom'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSelector: false,
|
||||
current: '',
|
||||
mixinDatacomResData: [],
|
||||
apps: [],
|
||||
channels: [],
|
||||
cacheKey: "uni-data-select-lastSelectedValue",
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.debounceGet = this.debounce(() => {
|
||||
this.query();
|
||||
}, 300);
|
||||
if (this.collection && !this.localdata.length) {
|
||||
this.debounceGet();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
typePlaceholder() {
|
||||
const text = {
|
||||
'opendb-stat-app-versions': '版本',
|
||||
'opendb-app-channels': '渠道',
|
||||
'opendb-app-list': '应用'
|
||||
}
|
||||
const common = this.placeholder
|
||||
const placeholder = text[this.collection]
|
||||
return placeholder ?
|
||||
common + placeholder :
|
||||
common
|
||||
},
|
||||
valueCom() {
|
||||
// #ifdef VUE3
|
||||
return this.modelValue;
|
||||
// #endif
|
||||
// #ifndef VUE3
|
||||
return this.value;
|
||||
// #endif
|
||||
},
|
||||
textShow() {
|
||||
// 长文本显示
|
||||
let text = this.current;
|
||||
if (text.length > 10) {
|
||||
return text.slice(0, 25) + '...';
|
||||
}
|
||||
return text;
|
||||
},
|
||||
getOffsetByPlacement() {
|
||||
switch (this.placement) {
|
||||
case 'top':
|
||||
return "bottom:calc(100% + 12px);";
|
||||
case 'bottom':
|
||||
return "top:calc(100% + 12px);";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
localdata: {
|
||||
immediate: true,
|
||||
handler(val, old) {
|
||||
if (Array.isArray(val) && old !== val) {
|
||||
this.mixinDatacomResData = val
|
||||
}
|
||||
}
|
||||
},
|
||||
valueCom(val, old) {
|
||||
this.initDefVal()
|
||||
},
|
||||
mixinDatacomResData: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val.length) {
|
||||
this.initDefVal()
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
debounce(fn, time = 100) {
|
||||
let timer = null
|
||||
return function(...args) {
|
||||
if (timer) clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
fn.apply(this, args)
|
||||
}, time)
|
||||
}
|
||||
},
|
||||
// 执行数据库查询
|
||||
query() {
|
||||
this.mixinDatacomEasyGet();
|
||||
},
|
||||
// 监听查询条件变更事件
|
||||
onMixinDatacomPropsChange() {
|
||||
if (this.collection) {
|
||||
this.debounceGet();
|
||||
}
|
||||
},
|
||||
initDefVal() {
|
||||
let defValue = ''
|
||||
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
|
||||
defValue = this.valueCom
|
||||
} else {
|
||||
let strogeValue
|
||||
if (this.collection) {
|
||||
strogeValue = this.getCache()
|
||||
}
|
||||
if (strogeValue || strogeValue === 0) {
|
||||
defValue = strogeValue
|
||||
} else {
|
||||
let defItem = ''
|
||||
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
|
||||
defItem = this.mixinDatacomResData[this.defItem - 1].value
|
||||
}
|
||||
defValue = defItem
|
||||
}
|
||||
if (defValue || defValue === 0) {
|
||||
this.emit(defValue)
|
||||
}
|
||||
}
|
||||
const def = this.mixinDatacomResData.find(item => item.value === defValue)
|
||||
this.current = def ? this.formatItemName(def) : ''
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {[String, Number]} value
|
||||
* 判断用户给的 value 是否同时为禁用状态
|
||||
*/
|
||||
isDisabled(value) {
|
||||
let isDisabled = false;
|
||||
|
||||
this.mixinDatacomResData.forEach(item => {
|
||||
if (item.value === value) {
|
||||
isDisabled = item.disable
|
||||
}
|
||||
})
|
||||
|
||||
return isDisabled;
|
||||
},
|
||||
|
||||
clearVal() {
|
||||
this.emit('')
|
||||
if (this.collection) {
|
||||
this.removeCache()
|
||||
}
|
||||
},
|
||||
change(item) {
|
||||
if (!item.disable) {
|
||||
this.showSelector = false
|
||||
this.current = this.formatItemName(item)
|
||||
this.emit(item.value)
|
||||
}
|
||||
},
|
||||
emit(val) {
|
||||
this.$emit('input', val)
|
||||
this.$emit('update:modelValue', val)
|
||||
this.$emit('change', val)
|
||||
if (this.collection) {
|
||||
this.setCache(val);
|
||||
}
|
||||
},
|
||||
toggleSelector() {
|
||||
if (this.disabled) {
|
||||
return
|
||||
}
|
||||
|
||||
this.showSelector = !this.showSelector
|
||||
},
|
||||
formatItemName(item) {
|
||||
let {
|
||||
text,
|
||||
value,
|
||||
channel_code
|
||||
} = item
|
||||
channel_code = channel_code ? `(${channel_code})` : ''
|
||||
|
||||
if (this.format) {
|
||||
// 格式化输出
|
||||
let str = "";
|
||||
str = this.format;
|
||||
for (let key in item) {
|
||||
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
return this.collection.indexOf('app-list') > 0 ?
|
||||
`${text}(${value})` :
|
||||
(
|
||||
text ?
|
||||
text :
|
||||
`未命名${channel_code}`
|
||||
)
|
||||
}
|
||||
},
|
||||
// 获取当前加载的数据
|
||||
getLoadData() {
|
||||
return this.mixinDatacomResData;
|
||||
},
|
||||
// 获取当前缓存key
|
||||
getCurrentCacheKey() {
|
||||
return this.collection;
|
||||
},
|
||||
// 获取缓存
|
||||
getCache(name = this.getCurrentCacheKey()) {
|
||||
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
||||
return cacheData[name];
|
||||
},
|
||||
// 设置缓存
|
||||
setCache(value, name = this.getCurrentCacheKey()) {
|
||||
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
||||
cacheData[name] = value;
|
||||
uni.setStorageSync(this.cacheKey, cacheData);
|
||||
},
|
||||
// 删除缓存
|
||||
removeCache(name = this.getCurrentCacheKey()) {
|
||||
let cacheData = uni.getStorageSync(this.cacheKey) || {};
|
||||
delete cacheData[name];
|
||||
uni.setStorageSync(this.cacheKey, cacheData);
|
||||
},
|
||||
}
|
||||
}
|
||||
/**
|
||||
* DataChecklist 数据选择器
|
||||
* @description 通过数据渲染的下拉框组件
|
||||
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
|
||||
* @property {String} value 默认值
|
||||
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
|
||||
* @property {Boolean} clear 是否可以清空已选项
|
||||
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
|
||||
* @property {String} label 左侧标题
|
||||
* @property {String} placeholder 输入框的提示文字
|
||||
* @property {Boolean} disabled 是否禁用
|
||||
* @property {String} placement 弹出位置
|
||||
* @value top 顶部弹出
|
||||
* @value bottom 底部弹出(default)
|
||||
* @event {Function} change 选中发生变化触发
|
||||
* @property {Boolean} searchable 是否显示搜索框
|
||||
*/
|
||||
export default {
|
||||
name: 'uni-data-select',
|
||||
mixins: [uniCloud.mixinDatacom || {}],
|
||||
props: {
|
||||
localdata: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
},
|
||||
},
|
||||
value: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
modelValue: {
|
||||
type: [String, Number],
|
||||
default: '',
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: '请选择',
|
||||
},
|
||||
emptyTips: {
|
||||
type: String,
|
||||
default: '无选项',
|
||||
},
|
||||
clear: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
defItem: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
format: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
placement: {
|
||||
type: String,
|
||||
default: 'bottom',
|
||||
},
|
||||
searchable: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showSelector: false,
|
||||
current: '',
|
||||
searchValue: '',
|
||||
mixinDatacomResData: [],
|
||||
cacheKey: 'uni-data-select-lastSelectedValue',
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.debounceGet = this.debounce(() => {
|
||||
this.query()
|
||||
}, 300)
|
||||
if (this.collection && !this.localdata?.length) {
|
||||
this.debounceGet()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
typePlaceholder() {
|
||||
const map = {
|
||||
'opendb-stat-app-versions': '版本',
|
||||
'opendb-app-channels': '渠道',
|
||||
'opendb-app-list': '应用',
|
||||
}
|
||||
const p = map[this.collection] || ''
|
||||
return this.placeholder + (p ? p : '')
|
||||
},
|
||||
valueCom() {
|
||||
return this.modelValue ?? this.value
|
||||
},
|
||||
textShow() {
|
||||
const text = this.current
|
||||
return text.length > 10 ? text.slice(0, 25) + '...' : text
|
||||
},
|
||||
getOffsetByPlacement() {
|
||||
return this.placement === 'top' ? 'bottom:calc(100% + 12px);' : 'top:calc(100% + 12px);'
|
||||
},
|
||||
filteredData() {
|
||||
const keyword = this.searchValue.trim().toLowerCase()
|
||||
if (!this.searchable || !keyword) return this.mixinDatacomResData
|
||||
return this.mixinDatacomResData.filter((item) =>
|
||||
this.formatItemName(item).toLowerCase().includes(keyword),
|
||||
)
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
localdata: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (Array.isArray(val)) {
|
||||
this.mixinDatacomResData = val
|
||||
}
|
||||
},
|
||||
},
|
||||
valueCom() {
|
||||
this.initDefVal()
|
||||
},
|
||||
mixinDatacomResData: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
if (val.length) this.initDefVal()
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
debounce(fn, time = 100) {
|
||||
let timer = null
|
||||
return function (...args) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => fn.apply(this, args), time)
|
||||
}
|
||||
},
|
||||
query() {
|
||||
this.mixinDatacomEasyGet()
|
||||
},
|
||||
onMixinDatacomPropsChange() {
|
||||
if (this.collection) this.debounceGet()
|
||||
},
|
||||
initDefVal() {
|
||||
let defValue = ''
|
||||
if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
|
||||
defValue = this.valueCom
|
||||
} else {
|
||||
const stored = this.getCache()
|
||||
if (stored || stored === 0) {
|
||||
defValue = stored
|
||||
} else if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
|
||||
defValue = this.mixinDatacomResData[this.defItem - 1].value
|
||||
}
|
||||
if (defValue || defValue === 0) {
|
||||
this.emit(defValue)
|
||||
}
|
||||
}
|
||||
const item = this.mixinDatacomResData.find((i) => i.value === defValue)
|
||||
this.current = item ? this.formatItemName(item) : ''
|
||||
},
|
||||
isDisabled(value) {
|
||||
return this.mixinDatacomResData.some((item) => item.value === value && item.disable)
|
||||
},
|
||||
clearVal() {
|
||||
this.emit('')
|
||||
if (this.collection) this.removeCache()
|
||||
},
|
||||
change(item) {
|
||||
if (!item.disable) {
|
||||
this.showSelector = false
|
||||
this.searchValue = ''
|
||||
this.current = this.formatItemName(item)
|
||||
this.emit(item.value)
|
||||
}
|
||||
},
|
||||
emit(val) {
|
||||
this.$emit('input', val)
|
||||
this.$emit('update:modelValue', val)
|
||||
this.$emit('change', val)
|
||||
if (this.collection) this.setCache(val)
|
||||
},
|
||||
toggleSelector() {
|
||||
if (this.disabled) return
|
||||
this.showSelector = !this.showSelector
|
||||
if (!this.showSelector && this.searchable) this.searchValue = ''
|
||||
},
|
||||
onSearchInput(val) {
|
||||
this.searchValue = val
|
||||
},
|
||||
formatItemName(item) {
|
||||
if (this.format) {
|
||||
let str = this.format
|
||||
for (const key in item) {
|
||||
str = str.replace(new RegExp(`{${key}}`, 'g'), item[key])
|
||||
}
|
||||
return str
|
||||
}
|
||||
if (this.collection?.includes('app-list')) {
|
||||
return `${item.text}(${item.value})`
|
||||
}
|
||||
return item.text || `未命名${item.channel_code ? '(' + item.channel_code + ')' : ''}`
|
||||
},
|
||||
getCache(name = this.collection) {
|
||||
return (uni.getStorageSync(this.cacheKey) || {})[name]
|
||||
},
|
||||
setCache(value, name = this.collection) {
|
||||
const cache = uni.getStorageSync(this.cacheKey) || {}
|
||||
cache[name] = value
|
||||
uni.setStorageSync(this.cacheKey, cache)
|
||||
},
|
||||
removeCache(name = this.collection) {
|
||||
const cache = uni.getStorageSync(this.cacheKey) || {}
|
||||
delete cache[name]
|
||||
uni.setStorageSync(this.cacheKey, cache)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
$uni-base-color: #6a6a6a !default;
|
||||
$uni-main-color: #333 !default;
|
||||
$uni-secondary-color: #909399 !default;
|
||||
$uni-border-3: #e5e5e5;
|
||||
.uni-select__search-box {
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
/* #ifndef APP-NVUE */
|
||||
@media screen and (max-width: 500px) {
|
||||
.hide-on-phone {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.uni-stat__select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.uni-stat__select {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// padding: 15px;
|
||||
/* #ifdef H5 */
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.uni-stat-box {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-stat-box {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
.uni-stat__actived {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.uni-stat__actived {
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
// outline: 1px solid #2979ff;
|
||||
}
|
||||
.uni-label-text {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #6a6a6a;
|
||||
margin: auto 0;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.uni-label-text {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: $uni-base-color;
|
||||
margin: auto 0;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.uni-select {
|
||||
font-size: 14px;
|
||||
border: 1px solid #e5e5e5;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
padding: 0 5px;
|
||||
padding-left: 10px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
user-select: none;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-bottom: solid 1px #e5e5e5;
|
||||
width: 100%;
|
||||
height: 35px;
|
||||
|
||||
.uni-select {
|
||||
font-size: 14px;
|
||||
border: 1px solid $uni-border-3;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
padding: 0 5px;
|
||||
padding-left: 10px;
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
user-select: none;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
border-bottom: solid 1px $uni-border-3;
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
height: 35px;
|
||||
&--disabled {
|
||||
background-color: #f5f7fa;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
background-color: #f5f7fa;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
.uni-select__input-box {
|
||||
height: 35px;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.uni-select__label {
|
||||
font-size: 16px;
|
||||
// line-height: 22px;
|
||||
height: 35px;
|
||||
padding-right: 10px;
|
||||
color: $uni-secondary-color;
|
||||
}
|
||||
.uni-select__input-text {
|
||||
width: 100%;
|
||||
color: #333;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.uni-select__input-box {
|
||||
height: 35px;
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
flex: 1;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
.uni-select__input-placeholder {
|
||||
color: #6a6a6a;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.uni-select__input {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
}
|
||||
.uni-select__selector {
|
||||
box-sizing: border-box;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ebeef5;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
||||
z-index: 3;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.uni-select__input-plac {
|
||||
font-size: 14px;
|
||||
color: $uni-secondary-color;
|
||||
}
|
||||
.uni-select__selector-scroll {
|
||||
max-height: 200px;
|
||||
}
|
||||
|
||||
.uni-select__selector {
|
||||
/* #ifndef APP-NVUE */
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
background-color: #FFFFFF;
|
||||
border: 1px solid #EBEEF5;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
z-index: 3;
|
||||
padding: 4px 0;
|
||||
}
|
||||
.uni-select__selector-empty,
|
||||
.uni-select__selector-item {
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
line-height: 35px;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.uni-select__selector-scroll {
|
||||
/* #ifndef APP-NVUE */
|
||||
max-height: 200px;
|
||||
box-sizing: border-box;
|
||||
/* #endif */
|
||||
}
|
||||
.uni-select__selector-item:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
/* #ifdef H5 */
|
||||
@media (min-width: 768px) {
|
||||
.uni-select__selector-scroll {
|
||||
max-height: 600px;
|
||||
}
|
||||
}
|
||||
.uni-select__selector__disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
.uni-select--mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.uni-select__selector-empty,
|
||||
.uni-select__selector-item {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
cursor: pointer;
|
||||
/* #endif */
|
||||
line-height: 35px;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
/* border-bottom: solid 1px $uni-border-3; */
|
||||
padding: 0px 10px;
|
||||
}
|
||||
.uni-popper__arrow_bottom,
|
||||
.uni-popper__arrow_top {
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 6px solid transparent;
|
||||
}
|
||||
|
||||
.uni-select__selector-item:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.uni-popper__arrow_bottom {
|
||||
top: -6px;
|
||||
left: 10%;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #ebeef5;
|
||||
}
|
||||
|
||||
.uni-select__selector-empty:last-child,
|
||||
.uni-select__selector-item:last-child {
|
||||
/* #ifndef APP-NVUE */
|
||||
border-bottom: none;
|
||||
/* #endif */
|
||||
}
|
||||
.uni-popper__arrow_top {
|
||||
bottom: -6px;
|
||||
left: 10%;
|
||||
border-bottom-width: 0;
|
||||
border-top-color: #ebeef5;
|
||||
}
|
||||
|
||||
.uni-select__selector__disabled {
|
||||
opacity: 0.4;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* picker 弹出层通用的指示小三角 */
|
||||
.uni-popper__arrow_bottom,
|
||||
.uni-popper__arrow_bottom::after,
|
||||
.uni-popper__arrow_top,
|
||||
.uni-popper__arrow_top::after,
|
||||
{
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-color: transparent;
|
||||
border-style: solid;
|
||||
border-width: 6px;
|
||||
}
|
||||
|
||||
.uni-popper__arrow_bottom {
|
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
||||
top: -6px;
|
||||
left: 10%;
|
||||
margin-right: 3px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #EBEEF5;
|
||||
}
|
||||
|
||||
.uni-popper__arrow_bottom::after {
|
||||
content: " ";
|
||||
top: 1px;
|
||||
margin-left: -6px;
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
.uni-popper__arrow_top {
|
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
|
||||
bottom: -6px;
|
||||
left: 10%;
|
||||
margin-right: 3px;
|
||||
border-bottom-width: 0;
|
||||
border-top-color: #EBEEF5;
|
||||
}
|
||||
|
||||
.uni-popper__arrow_top::after {
|
||||
content: " ";
|
||||
bottom: 1px;
|
||||
margin-left: -6px;
|
||||
border-bottom-width: 0;
|
||||
border-top-color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.uni-select__input-text {
|
||||
// width: 280px;
|
||||
width: 100%;
|
||||
color: $uni-main-color;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
-o-text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.uni-select__input-placeholder {
|
||||
color: $uni-base-color;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.uni-select--mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
@media screen and (max-width: 500px) {
|
||||
.hide-on-phone {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ const httpInterceptor = {
|
|||
const memberStore = useMemberStore()
|
||||
const token = memberStore.token
|
||||
|
||||
// const token = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6IjQ2NDdmYjlkLWI5OTItNDRiNy05MTdkLTMwZjg0ZjUxYzM5MCIsInVzZXJuYW1lIjoiYWRtaW4ifQ.9xM5bFhrmHK09-4ZgL5SS8WraNIJjIijuB-1P0lJF-n0KlVM5Bglvyjltk1NQbdqgi1hwRocZS1OU41cLiwuig"
|
||||
if (token) {
|
||||
options.header.Authorization = token
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export default defineConfig({
|
|||
// 在此处编写代理规则
|
||||
'/api': {
|
||||
// target: 'http://192.168.2.76:18080',
|
||||
target: 'http://192.168.0.41:18080',
|
||||
target: 'http://192.168.0.96:18080',
|
||||
// target: 'http://36.33.26.201:19988/prod-api/',
|
||||
// target: 'http://192.168.0.234:18080',
|
||||
// target: 'http://localhost:18080',
|
||||
|
|
|
|||
Loading…
Reference in New Issue