This commit is contained in:
qianhao.xu 2024-04-29 18:51:09 +08:00
parent 937ecef075
commit 1fdb9d2a8b
6 changed files with 381 additions and 62 deletions

View File

@ -33,4 +33,5 @@ export function generatetasklist(data) {
method: 'post',
data
})
}
}

View File

@ -8,4 +8,40 @@ export function getIngredientTask(data) {
method: 'post',
data
})
}
export function getIngredientTask_son(params) {
return request({
url: '/mes/mm/materialinput/getIngredientTask_son',
method: 'get',
params
})
}
export function getfabgopoints(params) {
return request({
url: '/mes/mm/materialinput/getfabgopoints',
method: 'get',
params
})
}
export function go_workshop(params) {
return request({
url: '/mes/mm/materialinput/go_workshop',
method: 'get',
params
})
}
export function emergency_stop_agv(params) {
return request({
url: '/mes/mm/materialinput/emergency_stop_agv',
method: 'get',
params
})
}

View File

@ -2,24 +2,85 @@
<view>
<u-subsection :list="list" :current="current" @change="sectionChange" mode="subsection" fontSize="1.5rem"></u-subsection>
<view v-if="current == 0">
<view class="area">
<view>
<u-row>
<u-col span="8">
<u-col span="6">
<u-button @click="timeshow = true">选择日期</u-button>
<u-datetime-picker :show="timeshow" v-model="queryParams.workerorder_time" mode="date" @confirm="confirm()" @cancel="timeshow = false"></u-datetime-picker>
<u-datetime-picker :show="timeshow" v-model="queryParams.workerorder_time" mode="date" @confirm="confirm" @cancel="timeshow = false"></u-datetime-picker>
</u-col>
<u-col span="4">
<u-col span="6">
<view style="font-size: 1.2rem">{{ queryParams.workerorder_time | formatDate }}</view>
</u-col>
</u-row>
<u-gap height="10" bgColor="#bbb"></u-gap>
<u-list @scrolltolower="scrolltolower">
<u-list-item v-for="(item, index) in indexList" :key="index">
<u-cell :title="`列表长度-${index + 1}`">
<u-avatar slot="icon" shape="square" size="35" :src="item.url" customStyle="margin: -3px 5px -3px 0"></u-avatar>
</u-cell>
</u-list-item>
</u-list>
<u-row>
<u-col span="2">任务编号</u-col>
<u-col span="2">任务站点</u-col>
<u-col span="3">任务详情</u-col>
<u-col span="2" offset="2">操作</u-col>
</u-row>
<view class="area">
<u-list>
<u-list-item v-for="(item, index) in taskList" :key="index">
<view class="cartoon-list-item">
<u-row>
<u-col span="2">{{ item.id }}</u-col>
<u-col span="1"><u-tag :text="item.agvPosition" size="mini" type="primary"></u-tag></u-col>
<u-col span="3" offset="1"><u-icon name="arrow-right-double" color="#2979ff" size="50" @click="detail_item(item.taskId)"></u-icon></u-col>
<u-col span="2"><u-button type="success" text="开始" size="mini" @click="confirm_startpoint(item.agvPosition)"></u-button></u-col>
<u-col span="2"><u-button type="error" text="结束" size="mini"></u-button></u-col>
</u-row>
</view>
</u-list-item>
</u-list>
</view>
<u-loading-page :loading="loading"></u-loading-page>
<u-modal :show="show_popup" :title="title" @confirm="show_popup = false">
<view style="width: 100%; height: 150px; overflow: hidden; overflow-y: scroll">
<u-row>
<u-col span="4">工单号</u-col>
<u-col span="4">零件号</u-col>
<u-col span="2">计划数</u-col>
<u-col span="2">已配数</u-col>
</u-row>
<u-list>
<u-list-item v-for="(item, index) in taskList_son" :key="index">
<view class="cartoon-list-item">
<u-row>
<u-col span="4">{{ item.workorder }}</u-col>
<u-col span="4">{{ item.partnumber }}</u-col>
<u-col span="2">{{ item.previousNumber }}</u-col>
<u-col span="2">{{ item.previousNumbered }}</u-col>
</u-row>
</view>
</u-list-item>
</u-list>
</view>
</u-modal>
<view class="tip-box">
<u-row>
<u-col span="2">起点</u-col>
<u-col span="2">
<u--input border="surround" v-model="start_point" @change="get_fab_go_points"></u--input>
</u-col>
<u-col span="2" offset="2">终点</u-col>
<u-col span="4">
<uni-data-select v-model="end_point" :localdata="fab_go_points"></uni-data-select>
</u-col>
</u-row>
<u-row>
<u-col span="3" offset="2">
<view class="tip-icon" @click="start_agv"><span>启动</span></view>
</u-col>
<u-col span="3" offset="3">
<view class="tip-icon2" @click="stop_agv"><span style="font-size: 0.5rem">紧急终止</span></view>
</u-col>
</u-row>
<u-toast ref="uToast"></u-toast>
</view>
</view>
</view>
<view v-if="current == 1"></view>
@ -27,23 +88,37 @@
</template>
<script>
import { getIngredientTask } from '@/api/materialManagement/MaterialProductionInput.js';
import { getIngredientTask, getIngredientTask_son, getfabgopoints, go_workshop,emergency_stop_agv } from '@/api/materialManagement/MaterialRequsition.js';
export default {
data() {
return {
list: ['车间叫料', '空车返程'],
current: 0,
queryParams: {
workerorder_time:Number(new Date()),
workerorder_time: Number(new Date()),
pageNum: 1,
pageSize: 10,
sort: undefined,
sortType: undefined,
totalNum: 0
},
timeshow: false
timeshow: false,
taskList: [],
show_popup: false,
title: '',
taskList_son: [],
loading: false,
start_point: '',
end_point: '',
fab_go_points: [
{ value: 0, text: '篮球' },
{ value: 1, text: '足球' },
{ value: 2, text: '游泳' }
],
reqCode: ''
};
},
watch: {},
filters: {
formatDate: function (value) {
// Date 使
@ -57,28 +132,128 @@ export default {
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
}
},
mounted() {},
mounted() {
this.getInitList();
},
methods: {
// todo
getInitList() {
getIngredientTask(this.queryParams).then((res) => {});
// 使
let date = new Date(this.queryParams.workerorder_time);
//
let offset = 8 * 60; // UTC+8
//
let shanghaiTime = new Date(date.getTime() + offset * 60 * 1000);
let queryTask = { ...this.queryParams };
queryTask.datetimespan = shanghaiTime;
delete queryTask.workerorder_time;
getIngredientTask(queryTask).then((res) => {
if (res.code == 200) {
res.data.forEach((item, index) => {
item.id = index;
});
this.taskList = res.data;
}
});
},
sectionChange(index) {
this.current = index;
},
scrolltolower() {
this.loadmore();
},
loadmore() {
for (let i = 0; i < 30; i++) {
this.indexList.push({
url: this.urls[uni.$u.random(0, this.urls.length - 1)]
});
}
},
// scrolltolower() {
// this.loadmore();
// },
// loadmore() {
// for (let i = 0; i < 30; i++) {
// this.indexList.push({
// url: this.urls[uni.$u.random(0, this.urls.length - 1)]
// });
// }
// },
//todo
confirm() {
this.timeshow = false;
this.$nextTick(() => {
this.getInitList();
});
},
//todo
detail_item(taskId) {
const query = {
taskId: taskId
};
this.loading = true;
getIngredientTask_son(query).then((res) => {
if (res.code == 200) {
this.loading = false;
this.taskList_son = res.data;
this.show_popup = true;
this.title = '任务号:' + taskId;
}
});
},
//todo
confirm_startpoint(point) {
this.start_point = point;
},
//todo
get_fab_go_points() {
getfabgopoints().then((res) => {
if (res.code == 200) {
let array = [];
res.data.forEach((item) => {
array.push({ value: item, text: item });
});
this.fab_go_points = array;
}
});
},
//todo agv
start_agv() {
if (this.start_point == '' || this.end_point == '') {
this.$refs.uToast.show({
type: 'error',
message: '起点或者终点不能为空'
});
return;
}
const query = {
start_point: this.start_point,
end_point: this.end_point
};
go_workshop(query).then((res) => {
if (res.code == 200) {
this.reqCode = res.data.data;
this.$refs.uToast.show({
type: 'error',
message: 'agv起动成功' + res.data
});
}
});
},
//todo agv
stop_agv() {
if(this.reqCode==""){
this.$refs.uToast.show({
type: 'error',
message: '无任务编号'
});
return
}
const query = {
reqCode: this.reqCode
};
emergency_stop_agv().then(res=>{
if(res.code==200){
this.$refs.uToast.show({
type: 'success',
message: '成功取消'+res.data
});
}
})
}
}
};
@ -86,7 +261,64 @@ export default {
<style scoped>
.area {
height: 500px;
height: 350px;
background-color: white;
overflow: hidden; /* 隐藏超出部分 */
overflow-y: scroll; /* 添加垂直滚动条 */
}
.cartoon-list-item {
background-color: #c8d3db; /* 设置蓝色背景 */
padding: 10px; /* 设置内边距 */
border-radius: 10px; /* 设置圆角边框 */
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
margin-bottom: 10px; /* 设置底部外边距 */
font-family: 'Comic Sans MS', cursive; /* 设置卡通化字体 */
color: white; /* 设置文字颜色为白色 */
}
.cartoon-list-item:hover {
transform: scale(1.05); /* 鼠标悬停时放大 */
}
.tip-box {
width: 100%;
margin-top: 20px;
background-color: #fff; /* 白色背景 */
padding: 20px;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}
.tip-icon {
margin-top: 5px;
width: 50px;
height: 50px;
background-color: #00ff00;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}
.tip-icon2 {
margin-top: 5px;
width: 50px;
height: 50px;
background-color: red;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 24px;
color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}
.tip-text {
margin-top: 10px;
font-size: 16px;
color: #333;
}
</style>

View File

@ -1,3 +1,7 @@
## 1.0.82024-03-28
- 修复 在vue2下:style动态绑定导致编译失败的bug
## 1.0.72024-01-20
- 修复 长文本回显超过容器的bug超过容器部分显示省略号
## 1.0.62023-04-12
- 修复 微信小程序点击时会改变背景颜色的 bug
## 1.0.52023-02-03

View File

@ -4,18 +4,18 @@
<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">{{current}}</view>
<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 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" v-if="showSelector">
<view class="uni-popper__arrow"></view>
<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>
@ -43,6 +43,9 @@
* @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @property {String} placement 弹出位置
* @value top 顶部弹出
* @value bottom 底部弹出default)
* @event {Function} change 选中发生变化触发
*/
@ -93,6 +96,10 @@
type: String,
default: ''
},
placement: {
type: String,
default: 'bottom'
}
},
data() {
return {
@ -125,15 +132,32 @@
common + placeholder :
common
},
valueCom(){
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,
@ -153,10 +177,11 @@
this.initDefVal()
}
}
}
},
},
methods: {
debounce(fn, time = 100){
debounce(fn, time = 100) {
let timer = null
return function(...args) {
if (timer) clearTimeout(timer)
@ -166,11 +191,11 @@
}
},
//
query(){
query() {
this.mixinDatacomEasyGet();
},
//
onMixinDatacomPropsChange(){
onMixinDatacomPropsChange() {
if (this.collection) {
this.debounceGet();
}
@ -193,9 +218,9 @@
}
defValue = defItem
}
if (defValue || defValue === 0) {
this.emit(defValue)
}
if (defValue || defValue === 0) {
this.emit(defValue)
}
}
const def = this.mixinDatacomResData.find(item => item.value === defValue)
this.current = def ? this.formatItemName(def) : ''
@ -258,7 +283,7 @@
let str = "";
str = this.format;
for (let key in item) {
str = str.replace(new RegExp(`{${key}}`,"g"),item[key]);
str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
}
return str;
} else {
@ -272,26 +297,26 @@
}
},
//
getLoadData(){
getLoadData() {
return this.mixinDatacomResData;
},
// key
getCurrentCacheKey(){
getCurrentCacheKey() {
return this.collection;
},
//
getCache(name=this.getCurrentCacheKey()){
getCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
return cacheData[name];
},
//
setCache(value, name=this.getCurrentCacheKey()){
setCache(value, name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
cacheData[name] = value;
uni.setStorageSync(this.cacheKey, cacheData);
},
//
removeCache(name=this.getCurrentCacheKey()){
removeCache(name = this.getCurrentCacheKey()) {
let cacheData = uni.getStorageSync(this.cacheKey) || {};
delete cacheData[name];
uni.setStorageSync(this.cacheKey, cacheData);
@ -306,7 +331,6 @@
$uni-secondary-color: #909399 !default;
$uni-border-3: #e5e5e5;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
.hide-on-phone {
@ -407,7 +431,6 @@
box-sizing: border-box;
/* #endif */
position: absolute;
top: calc(100% + 12px);
left: 0;
width: 100%;
background-color: #FFFFFF;
@ -431,6 +454,7 @@
max-height: 600px;
}
}
/* #endif */
.uni-select__selector-empty,
@ -463,18 +487,21 @@
}
/* picker 弹出层通用的指示小三角 */
.uni-popper__arrow,
.uni-popper__arrow::after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
border-width: 6px;
.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 {
.uni-popper__arrow_bottom {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%;
@ -483,7 +510,7 @@
border-bottom-color: #EBEEF5;
}
.uni-popper__arrow::after {
.uni-popper__arrow_bottom::after {
content: " ";
top: 1px;
margin-left: -6px;
@ -491,6 +518,24 @@
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%;

View File

@ -1,7 +1,7 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "1.0.6",
"version": "1.0.8",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
@ -43,7 +43,8 @@
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
"aliyun": "y",
"alipay": "n"
},
"client": {
"App": {