添加web的合卷分卷合并操作
This commit is contained in:
77
apps/hand-factory/api/wms/pendingAction.js
Normal file
77
apps/hand-factory/api/wms/pendingAction.js
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询钢卷待操作列表
|
||||||
|
export function listPendingAction(query) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/coilPendingAction/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询钢卷待操作详细
|
||||||
|
export function getPendingAction(actionId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/coilPendingAction/' + actionId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增钢卷待操作
|
||||||
|
export function addPendingAction(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/coilPendingAction',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改钢卷待操作
|
||||||
|
export function updatePendingAction(data) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/coilPendingAction',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除钢卷待操作
|
||||||
|
export function delPendingAction(actionId) {
|
||||||
|
return request({
|
||||||
|
url: '/wms/coilPendingAction/' + actionId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新操作状态
|
||||||
|
export function updateStatus(actionId, status) {
|
||||||
|
return request({
|
||||||
|
url: `/wms/coilPendingAction/status/${actionId}/${status}`,
|
||||||
|
method: 'put'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始处理操作
|
||||||
|
export function startProcess(actionId) {
|
||||||
|
return request({
|
||||||
|
url: `/wms/coilPendingAction/start/${actionId}`,
|
||||||
|
method: 'put'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 完成操作
|
||||||
|
export function completeAction(actionId) {
|
||||||
|
return request({
|
||||||
|
url: `/wms/coilPendingAction/complete/${actionId}`,
|
||||||
|
method: 'put'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 取消操作
|
||||||
|
export function cancelAction(actionId) {
|
||||||
|
return request({
|
||||||
|
url: `/wms/coilPendingAction/cancel/${actionId}`,
|
||||||
|
method: 'put'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
<view class="page-container">
|
<view class="page-container">
|
||||||
<!-- 简洁标签栏 -->
|
<!-- 简洁标签栏 -->
|
||||||
<view class="tab-container">
|
<view class="tab-container">
|
||||||
<view
|
<view
|
||||||
v-for="item in tabData"
|
v-for="item in tabData"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
@click="currentTab = item.value"
|
@click="currentTab = item.value"
|
||||||
class="tab-item"
|
class="tab-item"
|
||||||
@@ -13,24 +13,24 @@
|
|||||||
<view class="tab-indicator" v-if="currentTab === item.value"></view>
|
<view class="tab-indicator" v-if="currentTab === item.value"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 刷新按钮 -->
|
<!-- 刷新按钮 -->
|
||||||
<view class="refresh-btn-fixed" @click="refreshData">
|
<view class="refresh-btn-fixed" @click="refreshData">
|
||||||
<text class="refresh-icon" :class="{ 'rotating': isRefreshing }">⟳</text>
|
<text class="refresh-icon" :class="{ 'rotating': isRefreshing }">⟳</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<scroll-view scroll-y class="scroll-container" v-if="currentTab === 1">
|
<scroll-view scroll-y class="scroll-container" v-if="currentTab === 1">
|
||||||
<!-- 顶部状态栏 -->
|
<!-- 顶部状态栏 -->
|
||||||
<view class="status-bar">
|
<view class="status-bar">
|
||||||
<view class="status-item">
|
<view class="status-item">
|
||||||
<text class="status-label">网络状态</text>
|
<text class="status-label">网络状态</text>
|
||||||
<text class="status-value" :class="'status-' + webStatus[0].value">{{ webStatus[0].value }}</text>
|
<text class="status-value" :class="'status-' + webStatus[0].value">{{ webStatus[0].value }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="status-divider"></view>
|
<view class="status-divider"></view>
|
||||||
<view class="status-item">
|
<view class="status-item">
|
||||||
<text class="status-label">当前班组</text>
|
<text class="status-label">当前班组</text>
|
||||||
<text class="status-value">{{ webStatus[1].value }}</text>
|
<text class="status-value">{{ webStatus[1].value }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="status-divider"></view>
|
<view class="status-divider"></view>
|
||||||
<view class="status-item">
|
<view class="status-item">
|
||||||
<text class="status-label">更新时间</text>
|
<text class="status-label">更新时间</text>
|
||||||
@@ -46,9 +46,9 @@
|
|||||||
<text class="metric-name">{{ item.label }}</text>
|
<text class="metric-name">{{ item.label }}</text>
|
||||||
<text class="metric-value">{{ item.value }}</text>
|
<text class="metric-value">{{ item.value }}</text>
|
||||||
<text class="metric-unit">{{ item.unit }}</text>
|
<text class="metric-unit">{{ item.unit }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 机架压下率 -->
|
<!-- 机架压下率 -->
|
||||||
<view class="section">
|
<view class="section">
|
||||||
@@ -58,17 +58,17 @@
|
|||||||
<text class="metric-name">{{ item.label }}</text>
|
<text class="metric-name">{{ item.label }}</text>
|
||||||
<text class="metric-value">{{ item.value }}</text>
|
<text class="metric-value">{{ item.value }}</text>
|
||||||
<text class="metric-unit">{{ item.unit }}</text>
|
<text class="metric-unit">{{ item.unit }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 轧制力趋势 -->
|
<!-- 轧制力趋势 -->
|
||||||
<view class="section">
|
<view class="section">
|
||||||
<view class="section-title">轧制力趋势</view>
|
<view class="section-title">轧制力趋势</view>
|
||||||
<view class="chart-box">
|
<view class="chart-box">
|
||||||
<qiun-data-charts type="line" :chartData="forceChartData" :opts="lineChartOpts" />
|
<qiun-data-charts type="line" :chartData="forceChartData" :opts="lineChartOpts" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 带钢张力 -->
|
<!-- 带钢张力 -->
|
||||||
<view class="section">
|
<view class="section">
|
||||||
@@ -78,8 +78,8 @@
|
|||||||
<text class="metric-name">{{ item.label }}</text>
|
<text class="metric-name">{{ item.label }}</text>
|
||||||
<text class="metric-value">{{ item.value }}</text>
|
<text class="metric-value">{{ item.value }}</text>
|
||||||
<text class="metric-unit">{{ item.unit }}</text>
|
<text class="metric-unit">{{ item.unit }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 功率百分比 -->
|
<!-- 功率百分比 -->
|
||||||
@@ -90,8 +90,8 @@
|
|||||||
<text class="metric-name">{{ item.label }}</text>
|
<text class="metric-name">{{ item.label }}</text>
|
||||||
<text class="metric-value">{{ item.value }}</text>
|
<text class="metric-value">{{ item.value }}</text>
|
||||||
<text class="metric-unit">{{ item.unit }}</text>
|
<text class="metric-unit">{{ item.unit }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ export default {
|
|||||||
color: ["#0066cc", "#409eff", "#66b1ff", "#a0cfff", "#d9ecff", "#ecf5ff"],
|
color: ["#0066cc", "#409eff", "#66b1ff", "#a0cfff", "#d9ecff", "#ecf5ff"],
|
||||||
padding: [15, 15, 0, 15],
|
padding: [15, 15, 0, 15],
|
||||||
enableScroll: false,
|
enableScroll: false,
|
||||||
legend: {
|
legend: {
|
||||||
show: true,
|
show: true,
|
||||||
position: "top",
|
position: "top",
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
@@ -208,42 +208,42 @@ export default {
|
|||||||
plantStateDefines: []
|
plantStateDefines: []
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.loadAllData()
|
this.loadAllData()
|
||||||
this.startAutoRefresh()
|
this.startAutoRefresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.stopAutoRefresh()
|
this.stopAutoRefresh()
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
startAutoRefresh() {
|
startAutoRefresh() {
|
||||||
this.refreshTimer = setInterval(() => {
|
this.refreshTimer = setInterval(() => {
|
||||||
this.refreshData(true)
|
this.refreshData(true)
|
||||||
}, 30000)
|
}, 30000)
|
||||||
},
|
},
|
||||||
|
|
||||||
stopAutoRefresh() {
|
stopAutoRefresh() {
|
||||||
if (this.refreshTimer) {
|
if (this.refreshTimer) {
|
||||||
clearInterval(this.refreshTimer)
|
clearInterval(this.refreshTimer)
|
||||||
this.refreshTimer = null
|
this.refreshTimer = null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
loadAllData() {
|
loadAllData() {
|
||||||
this.checkNetworkStatus()
|
this.checkNetworkStatus()
|
||||||
this.loadCurrentShift()
|
this.loadCurrentShift()
|
||||||
this.initPlantStateDefines()
|
this.initPlantStateDefines()
|
||||||
this.updateLastTime()
|
this.updateLastTime()
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshData(isSilent = false) {
|
refreshData(isSilent = false) {
|
||||||
if (this.isRefreshing) return
|
if (this.isRefreshing) return
|
||||||
this.isRefreshing = true
|
this.isRefreshing = true
|
||||||
if (!isSilent) uni.showLoading({ title: '刷新中' })
|
if (!isSilent) uni.showLoading({ title: '刷新中' })
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
this.checkNetworkStatus(),
|
this.checkNetworkStatus(),
|
||||||
this.loadCurrentShift(),
|
this.loadCurrentShift(),
|
||||||
@@ -257,7 +257,7 @@ export default {
|
|||||||
this.updateLastTime()
|
this.updateLastTime()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLastTime() {
|
updateLastTime() {
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
const hour = String(now.getHours()).padStart(2, '0')
|
const hour = String(now.getHours()).padStart(2, '0')
|
||||||
@@ -265,7 +265,7 @@ export default {
|
|||||||
const second = String(now.getSeconds()).padStart(2, '0')
|
const second = String(now.getSeconds()).padStart(2, '0')
|
||||||
this.lastUpdateTime = `${hour}:${minute}:${second}`
|
this.lastUpdateTime = `${hour}:${minute}:${second}`
|
||||||
},
|
},
|
||||||
|
|
||||||
checkNetworkStatus() {
|
checkNetworkStatus() {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const startTime = Date.now()
|
const startTime = Date.now()
|
||||||
@@ -291,7 +291,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
loadCurrentShift() {
|
loadCurrentShift() {
|
||||||
return getCurrentShift().then(response => {
|
return getCurrentShift().then(response => {
|
||||||
if (response.code === 200 && response.data) {
|
if (response.code === 200 && response.data) {
|
||||||
@@ -304,20 +304,20 @@ export default {
|
|||||||
console.error('加载班组信息失败:', error)
|
console.error('加载班组信息失败:', error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getShiftName(shift) {
|
getShiftName(shift) {
|
||||||
const shiftMap = { 'A': '早班', 'B': '中班', 'C': '晚班' }
|
const shiftMap = { 'A': '早班', 'B': '中班', 'C': '晚班' }
|
||||||
return shiftMap[shift] || shift || '—'
|
return shiftMap[shift] || shift || '—'
|
||||||
},
|
},
|
||||||
|
|
||||||
getCrewName(crew) {
|
getCrewName(crew) {
|
||||||
const crewMap = { 1: '甲', 2: '乙', 3: '丙', 4: '丁' }
|
const crewMap = { 1: '甲', 2: '乙', 3: '丙', 4: '丁' }
|
||||||
return crewMap[crew] || crew || '—'
|
return crewMap[crew] || crew || '—'
|
||||||
},
|
},
|
||||||
|
|
||||||
initPlantStateDefines(isSilent = false) {
|
initPlantStateDefines(isSilent = false) {
|
||||||
if (!isSilent) uni.showLoading({ title: '加载中' })
|
if (!isSilent) uni.showLoading({ title: '加载中' })
|
||||||
|
|
||||||
return getAllPlantStateDefines().then(response => {
|
return getAllPlantStateDefines().then(response => {
|
||||||
if (response.code === 200 && response.data) {
|
if (response.code === 200 && response.data) {
|
||||||
this.plantStateDefines = response.data
|
this.plantStateDefines = response.data
|
||||||
@@ -332,7 +332,7 @@ export default {
|
|||||||
console.error('加载状态定义失败:', error)
|
console.error('加载状态定义失败:', error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
updateCurrentMetrics() {
|
updateCurrentMetrics() {
|
||||||
// 1. 轧辊速度(ID=36-41:rollSpeed1-6)
|
// 1. 轧辊速度(ID=36-41:rollSpeed1-6)
|
||||||
this.rollSpeedMetrics = [
|
this.rollSpeedMetrics = [
|
||||||
@@ -343,7 +343,7 @@ export default {
|
|||||||
{ label: '5#机架', value: this.formatValue(this.getDefineById(40)?.currentValue), unit: this.getDefineById(40)?.units || 'm/min' },
|
{ label: '5#机架', value: this.formatValue(this.getDefineById(40)?.currentValue), unit: this.getDefineById(40)?.units || 'm/min' },
|
||||||
{ label: '6#机架', value: this.formatValue(this.getDefineById(41)?.currentValue), unit: this.getDefineById(41)?.units || 'm/min' }
|
{ label: '6#机架', value: this.formatValue(this.getDefineById(41)?.currentValue), unit: this.getDefineById(41)?.units || 'm/min' }
|
||||||
]
|
]
|
||||||
|
|
||||||
// 2. 机架压下率(ID=24-29:reduc1-6)
|
// 2. 机架压下率(ID=24-29:reduc1-6)
|
||||||
this.reducMetrics = [
|
this.reducMetrics = [
|
||||||
{ label: '1#机架', value: this.formatValue(this.getDefineById(24)?.currentValue), unit: this.getDefineById(24)?.units || '%' },
|
{ label: '1#机架', value: this.formatValue(this.getDefineById(24)?.currentValue), unit: this.getDefineById(24)?.units || '%' },
|
||||||
@@ -353,7 +353,7 @@ export default {
|
|||||||
{ label: '5#机架', value: this.formatValue(this.getDefineById(28)?.currentValue), unit: this.getDefineById(28)?.units || '%' },
|
{ label: '5#机架', value: this.formatValue(this.getDefineById(28)?.currentValue), unit: this.getDefineById(28)?.units || '%' },
|
||||||
{ label: '6#机架', value: this.formatValue(this.getDefineById(29)?.currentValue), unit: this.getDefineById(29)?.units || '%' }
|
{ label: '6#机架', value: this.formatValue(this.getDefineById(29)?.currentValue), unit: this.getDefineById(29)?.units || '%' }
|
||||||
]
|
]
|
||||||
|
|
||||||
// 3. 带钢张力(ID=42-48:tensionForce0-6)
|
// 3. 带钢张力(ID=42-48:tensionForce0-6)
|
||||||
this.tensionMetrics = [
|
this.tensionMetrics = [
|
||||||
{ label: '0#张力', value: this.formatValue(this.getDefineById(42)?.currentValue), unit: this.getDefineById(42)?.units || 'kN' },
|
{ label: '0#张力', value: this.formatValue(this.getDefineById(42)?.currentValue), unit: this.getDefineById(42)?.units || 'kN' },
|
||||||
@@ -364,7 +364,7 @@ export default {
|
|||||||
{ label: '5#张力', value: this.formatValue(this.getDefineById(47)?.currentValue), unit: this.getDefineById(47)?.units || 'kN' },
|
{ label: '5#张力', value: this.formatValue(this.getDefineById(47)?.currentValue), unit: this.getDefineById(47)?.units || 'kN' },
|
||||||
{ label: '6#张力', value: this.formatValue(this.getDefineById(48)?.currentValue), unit: this.getDefineById(48)?.units || 'kN' }
|
{ label: '6#张力', value: this.formatValue(this.getDefineById(48)?.currentValue), unit: this.getDefineById(48)?.units || 'kN' }
|
||||||
]
|
]
|
||||||
|
|
||||||
// 4. 功率百分比(ID=49-54:powerRatio1-6)
|
// 4. 功率百分比(ID=49-54:powerRatio1-6)
|
||||||
this.powerMetrics = [
|
this.powerMetrics = [
|
||||||
{ label: '1#机架', value: this.formatValue(this.getDefineById(49)?.currentValue), unit: this.getDefineById(49)?.units || '%' },
|
{ label: '1#机架', value: this.formatValue(this.getDefineById(49)?.currentValue), unit: this.getDefineById(49)?.units || '%' },
|
||||||
@@ -375,11 +375,11 @@ export default {
|
|||||||
{ label: '6#机架', value: this.formatValue(this.getDefineById(54)?.currentValue), unit: this.getDefineById(54)?.units || '%' }
|
{ label: '6#机架', value: this.formatValue(this.getDefineById(54)?.currentValue), unit: this.getDefineById(54)?.units || '%' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
loadForceHistory(isSilent = false) {
|
loadForceHistory(isSilent = false) {
|
||||||
return listPlantStateHistory({ pageNum: 1, pageSize: 30 }).then(response => {
|
return listPlantStateHistory({ pageNum: 1, pageSize: 30 }).then(response => {
|
||||||
if (!isSilent) uni.hideLoading()
|
if (!isSilent) uni.hideLoading()
|
||||||
|
|
||||||
if (response.code === 200 && response.rows && response.rows.length > 0) {
|
if (response.code === 200 && response.rows && response.rows.length > 0) {
|
||||||
const categories = []
|
const categories = []
|
||||||
const force1Data = []
|
const force1Data = []
|
||||||
@@ -388,7 +388,7 @@ export default {
|
|||||||
const force4Data = []
|
const force4Data = []
|
||||||
const force5Data = []
|
const force5Data = []
|
||||||
const force6Data = []
|
const force6Data = []
|
||||||
|
|
||||||
response.rows.forEach(item => {
|
response.rows.forEach(item => {
|
||||||
const dateStr = this.formatDate(item.insdate)
|
const dateStr = this.formatDate(item.insdate)
|
||||||
categories.push(dateStr)
|
categories.push(dateStr)
|
||||||
@@ -399,10 +399,10 @@ export default {
|
|||||||
force5Data.push(Number(item.value34) || 0) // ID=34
|
force5Data.push(Number(item.value34) || 0) // ID=34
|
||||||
force6Data.push(Number(item.value35) || 0) // ID=35
|
force6Data.push(Number(item.value35) || 0) // ID=35
|
||||||
})
|
})
|
||||||
|
|
||||||
this.forceChartData = {
|
this.forceChartData = {
|
||||||
categories: categories.reverse(),
|
categories: categories.reverse(),
|
||||||
series: [
|
series: [
|
||||||
{ name: '1#轧制力', data: force1Data.reverse() },
|
{ name: '1#轧制力', data: force1Data.reverse() },
|
||||||
{ name: '2#轧制力', data: force2Data.reverse() },
|
{ name: '2#轧制力', data: force2Data.reverse() },
|
||||||
{ name: '3#轧制力', data: force3Data.reverse() },
|
{ name: '3#轧制力', data: force3Data.reverse() },
|
||||||
@@ -417,11 +417,11 @@ export default {
|
|||||||
console.error('加载轧制力历史失败:', error)
|
console.error('加载轧制力历史失败:', error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefineById(id) {
|
getDefineById(id) {
|
||||||
return this.plantStateDefines.find(item => item.id == id)
|
return this.plantStateDefines.find(item => item.id == id)
|
||||||
},
|
},
|
||||||
|
|
||||||
formatDate(dateStr) {
|
formatDate(dateStr) {
|
||||||
if (!dateStr) return ''
|
if (!dateStr) return ''
|
||||||
const date = new Date(dateStr)
|
const date = new Date(dateStr)
|
||||||
@@ -429,7 +429,7 @@ export default {
|
|||||||
const minute = String(date.getMinutes()).padStart(2, '0')
|
const minute = String(date.getMinutes()).padStart(2, '0')
|
||||||
return `${hour}:${minute}`
|
return `${hour}:${minute}`
|
||||||
},
|
},
|
||||||
|
|
||||||
formatValue(value) {
|
formatValue(value) {
|
||||||
if (value === null || value === undefined || value === '') return '—'
|
if (value === null || value === undefined || value === '') return '—'
|
||||||
const num = Number(value)
|
const num = Number(value)
|
||||||
@@ -459,20 +459,20 @@ export default {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 28rpx 0;
|
padding: 28rpx 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
.tab-label {
|
.tab-label {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #606266;
|
color: #606266;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tab-active {
|
&.tab-active {
|
||||||
.tab-label {
|
.tab-label {
|
||||||
color: #0066cc;
|
color: #0066cc;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-indicator {
|
.tab-indicator {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
@@ -498,7 +498,7 @@ export default {
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
box-shadow: 0 8rpx 20rpx rgba(0, 102, 204, 0.4);
|
box-shadow: 0 8rpx 20rpx rgba(0, 102, 204, 0.4);
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
transform: scale(0.95);
|
transform: scale(0.95);
|
||||||
@@ -510,7 +510,7 @@ export default {
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
display: block;
|
display: block;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
|
|
||||||
&.rotating {
|
&.rotating {
|
||||||
animation: rotate 1s linear infinite;
|
animation: rotate 1s linear infinite;
|
||||||
}
|
}
|
||||||
@@ -555,7 +555,7 @@ export default {
|
|||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
color: #303133;
|
color: #303133;
|
||||||
|
|
||||||
&.status-通畅 { color: #67c23a; }
|
&.status-通畅 { color: #67c23a; }
|
||||||
&.status-卡顿 { color: #e6a23c; }
|
&.status-卡顿 { color: #e6a23c; }
|
||||||
&.status-异常 { color: #f56c6c; }
|
&.status-异常 { color: #f56c6c; }
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// 应用全局配置
|
// 应用全局配置
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// baseUrl: 'http://192.168.31.116:8080',
|
baseUrl: 'http://192.168.31.116:8080',
|
||||||
baseUrl: 'http://140.143.206.120:8080',
|
// baseUrl: 'http://140.143.206.120:8080',
|
||||||
// baseUrl: 'http://localhost:8080',
|
// baseUrl: 'http://localhost:8080',
|
||||||
// 应用信息
|
// 应用信息
|
||||||
appInfo: {
|
appInfo: {
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
<view class="container">
|
<view class="container">
|
||||||
<!-- 标题区域 -->
|
<!-- 标题区域 -->
|
||||||
<view class="page-title">操作类型选择</view>
|
<view class="page-title">操作类型选择</view>
|
||||||
|
|
||||||
<!-- 操作类型按钮区域 -->
|
<!-- 操作类型按钮区域 -->
|
||||||
<view class="btn-grid">
|
<view class="btn-grid">
|
||||||
<button
|
<button
|
||||||
v-for='item in types'
|
v-for='item in types'
|
||||||
:key="item.dictValue"
|
:key="item.dictValue"
|
||||||
@click="handleScan(item.dictValue)"
|
@click="handleScan(item.dictValue)"
|
||||||
class="type-btn"
|
class="type-btn"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
{{ item.dictLabel }}
|
{{ item.dictLabel }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 退出登录按钮(固定在底部) -->
|
<!-- 退出登录按钮(固定在底部) -->
|
||||||
<view class="logout-container">
|
<view class="logout-container">
|
||||||
<button @click='handleLogout' class="logout-btn">
|
<button @click='handleLogout' class="logout-btn">
|
||||||
@@ -27,11 +27,14 @@
|
|||||||
<script>
|
<script>
|
||||||
import { getDicts } from '@/api/system/dict/data.js'
|
import { getDicts } from '@/api/system/dict/data.js'
|
||||||
import { getGenerateRecord } from '@/api/wms/code.js'
|
import { getGenerateRecord } from '@/api/wms/code.js'
|
||||||
|
import { getMaterialCoil } from '@/api/wms/coil.js'
|
||||||
|
import { addPendingAction } from '@/api/wms/pendingAction.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
types: []
|
types: [],
|
||||||
|
loading: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -42,12 +45,146 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleScan(type) {
|
|
||||||
|
// 扫码并创建待操作
|
||||||
|
handleScan(actionType) {
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
success(res) {
|
success: async (res) => {
|
||||||
const result = res.result;
|
console.log('=== 开始扫码流程 ===');
|
||||||
|
console.log('扫码结果:', res.result);
|
||||||
|
console.log('操作类型:', actionType);
|
||||||
|
uni.showLoading({ title: '处理中...' });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const qrcodeId = res.result;
|
||||||
|
// 1. 通过二维码ID获取二维码详情
|
||||||
|
console.log('1. 获取二维码详情,ID:', qrcodeId);
|
||||||
|
const qrcodeRes = await getGenerateRecord(qrcodeId);
|
||||||
|
console.log('二维码响应:', qrcodeRes);
|
||||||
|
|
||||||
|
if (qrcodeRes.code !== 200) {
|
||||||
|
throw new Error('未找到二维码记录');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 解析二维码的content,获取coil_id
|
||||||
|
const qrcodeRecord = qrcodeRes.data;
|
||||||
|
console.log('2. 二维码记录:', qrcodeRecord);
|
||||||
|
|
||||||
|
// 检查二维码状态(0=失效,1=有效)
|
||||||
|
if (qrcodeRecord.status === 0) {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '该二维码已失效,无法创建待操作任务',
|
||||||
|
showCancel: false
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const content = JSON.parse(qrcodeRecord.content);
|
||||||
|
console.log('解析后的内容:', content);
|
||||||
|
|
||||||
|
// 优先使用current_coil_id(当前有效的钢卷ID),如果没有则使用coil_id(兼容旧数据)
|
||||||
|
let coilId = content.current_coil_id && content.current_coil_id !== 'null' ? content.current_coil_id : null;
|
||||||
|
if (!coilId) {
|
||||||
|
coilId = content.coil_id && content.coil_id !== 'null' ? content.coil_id : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('提取钢卷ID - current_coil_id:', content.current_coil_id, 'coil_id:', content.coil_id, '最终使用:', coilId);
|
||||||
|
|
||||||
|
if (!coilId) {
|
||||||
|
throw new Error('二维码中未包含有效的钢卷ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 直接通过钢卷ID获取钢卷详情
|
||||||
|
console.log('3. 获取钢卷详情,钢卷ID:', coilId);
|
||||||
|
const coilRes = await getMaterialCoil(coilId);
|
||||||
|
console.log('钢卷详情响应:', coilRes);
|
||||||
|
|
||||||
|
if (coilRes.code !== 200) {
|
||||||
|
throw new Error(coilRes.msg || '查询钢卷信息失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!coilRes.data) {
|
||||||
|
throw new Error('未找到钢卷信息');
|
||||||
|
}
|
||||||
|
|
||||||
|
const coilData = coilRes.data;
|
||||||
|
console.log('4. 钢卷数据:', coilData);
|
||||||
|
|
||||||
|
// 4. 创建待操作记录
|
||||||
|
const pendingData = {
|
||||||
|
coilId: coilData.coilId,
|
||||||
|
currentCoilNo: coilData.currentCoilNo,
|
||||||
|
actionType: parseInt(actionType),
|
||||||
|
actionStatus: 0, // 待处理
|
||||||
|
sourceType: 'scan', // 扫码来源
|
||||||
|
scanTime: new Date().toISOString(),
|
||||||
|
scanDevice: this.getDeviceInfo(),
|
||||||
|
warehouseId: coilData.warehouseId,
|
||||||
|
priority: 0, // 默认普通优先级
|
||||||
|
remark: `移动端扫码创建 - ${this.getActionTypeName(actionType)}`
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log('5. 创建待操作记录,数据:', pendingData);
|
||||||
|
|
||||||
|
const addRes = await addPendingAction(pendingData);
|
||||||
|
console.log('创建待操作响应:', addRes);
|
||||||
|
|
||||||
|
if (addRes.code !== 200) {
|
||||||
|
throw new Error(addRes.msg || '创建待操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.hideLoading();
|
||||||
|
console.log('=== 扫码流程完成 ===');
|
||||||
|
uni.showToast({
|
||||||
|
title: '创建成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
|
||||||
|
// 延迟后返回或跳转
|
||||||
|
setTimeout(() => {
|
||||||
|
// 可以跳转到待操作列表或返回上一页
|
||||||
|
uni.navigateBack();
|
||||||
|
}, 2000);
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
console.error('=== 扫码处理失败 ===');
|
||||||
|
console.error('错误信息:', err);
|
||||||
|
console.error('错误堆栈:', err.stack);
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message || '处理失败',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 3000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('扫码失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '扫码失败,请重试',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取设备信息
|
||||||
|
getDeviceInfo() {
|
||||||
|
try {
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
return `${systemInfo.platform} ${systemInfo.model}`;
|
||||||
|
} catch (e) {
|
||||||
|
return 'Unknown Device';
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取操作类型名称
|
||||||
|
getActionTypeName(actionType) {
|
||||||
|
const type = this.types.find(t => t.dictValue === String(actionType));
|
||||||
|
return type ? type.dictLabel : '未知操作';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -135,4 +272,4 @@
|
|||||||
background-color: #f5222d;
|
background-color: #f5222d;
|
||||||
transform: scale(0.98);
|
transform: scale(0.98);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user