This commit is contained in:
qianhao.xu
2024-05-07 10:50:29 +08:00
parent ed41bd0dca
commit d499301f0b
2 changed files with 73 additions and 64 deletions

View File

@@ -48,13 +48,13 @@
<u-col span="4">
<view>毛坯号</view>
</u-col>
<u-col span="3">
<u-col span="2">
<span>计划上件数</span>
</u-col>
<u-col span="3">
<u-col span="2">
<span>已经上件数</span>
</u-col>
<u-col span="2">
<u-col span="4" offset="1">
<span>选中</span>
</u-col>
</u-row>
@@ -63,19 +63,19 @@
<u-list-item v-for="(item, index) in workerorder_list" :key="index">
<u-row gutter="30">
<u-col span="4">
<u-tag :text="item.blankNumber" plain></u-tag>
</u-col>
<u-col span="3">
<u-tag :text="item.previousNumber" plain></u-tag>
</u-col>
<u-col span="3">
<u-tag type="success" :text="item.previousNumbered" plain></u-tag>
<u-tag :text="item.blankNumber" size="large"></u-tag>
</u-col>
<u-col span="2">
<u-switch v-model="item.selected" size="38" @change="switch_change(index, item.selected)"></u-switch>
<u-tag :text="item.previousNumber"></u-tag>
</u-col>
<u-col span="2">
<u-tag type="success" :text="item.previousNumbered" plain></u-tag>
</u-col>
<u-col span="4" offset="1">
<u-switch v-model="item.selected" size="60" asyncChange @change="switch_change(index, item.selected)"></u-switch>
</u-col>
</u-row>
<u-line></u-line>
<u-line style="margin-top: 10px"></u-line>
</u-list-item>
</u-list>
</view>
@@ -95,7 +95,7 @@
<script>
import { achievestartpoints, getworkorderlist, generatetasklist } from '@/api/materialManagement/MaterialProductionInput.js';
import { printDate } from '@/utils/common';
export default {
data() {
return {
@@ -130,11 +130,7 @@ export default {
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
}
},
watch: {
workerorder_time(newvalue, oldvalue) {
this.get_workorder_list();
}
},
watch: {},
mounted() {
this.get_startpoints();
},
@@ -154,6 +150,7 @@ export default {
//todo 选择时间
confirm() {
this.timeshow = false;
this.get_workorder_list();
},
//todo 根据日期获取工单
get_workorder_list() {
@@ -180,7 +177,7 @@ export default {
this.$refs.uNotify.show({
top: 100,
type: 'success',
message: '获取工单数据成功,共' + res.data.length + '条。时间为' + shanghaiTime,
message: '获取工单数据成功,共' + res.data.length + '条。时间为' + printDate(shanghaiTime),
duration: 1000 * 3,
fontSize: 20,
safeAreaInsetTop: true
@@ -196,6 +193,7 @@ export default {
},
//todo 选中之后 弹窗
switch_change(index, selected) {
selected = !selected;
console.log('selected', selected);
if (selected) {
this.show_model = true;
@@ -203,6 +201,7 @@ export default {
this.selected_index = index;
} else {
this.workerorder_list[index].previousNumbered = 0;
this.workerorder_list[index].selected = false;
// 使用 Vue.set 方法或 this.$set 方法来添加新的属性
// this.$set(this.workerorder_list[index], 'previousNumbered', 0);
// this.$nextTick(() => {
@@ -215,11 +214,11 @@ export default {
ingredient_confirm() {
this.show_model = false;
this.workerorder_list[this.selected_index].previousNumbered = this.ingredient;
this.workerorder_list[this.selected_index].selected = true;
},
// 生成配料任务
generatetask() {
let array1 = this.workerorder_list.filter((it) => it.selected);
console.log(array1);
let array = array1.map((it) => {
return {
workorder: it.clientWorkorder,

View File

@@ -1,55 +1,65 @@
/**
* 显示消息提示框
* @param content 提示的标题
*/
* 显示消息提示框
* @param content 提示的标题
*/
export function toast(content) {
uni.showToast({
icon: 'none',
title: content,
duration:5000
})
uni.showToast({
icon: 'none',
title: content,
duration: 5000
})
}
/**
* 显示模态弹窗
* @param content 提示的标题
*/
* 显示模态弹窗
* @param content 提示的标题
*/
export function showConfirm(content) {
return new Promise((resolve, reject) => {
uni.showModal({
title: '提示',
content: content,
cancelText: '取消',
confirmText: '确定',
success: function(res) {
resolve(res)
}
})
})
return new Promise((resolve, reject) => {
uni.showModal({
title: '提示',
content: content,
cancelText: '取消',
confirmText: '确定',
success: function(res) {
resolve(res)
}
})
})
}
/**
* 参数处理
* @param params 参数
*/
* 参数处理
* @param params 参数
*/
export function tansParams(params) {
let result = ''
for (const propName of Object.keys(params)) {
const value = params[propName]
var part = encodeURIComponent(propName) + "="
if (value !== null && value !== "" && typeof (value) !== "undefined") {
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
let params = propName + '[' + key + ']'
var subPart = encodeURIComponent(params) + "="
result += subPart + encodeURIComponent(value[key]) + "&"
}
}
} else {
result += part + encodeURIComponent(value) + "&"
}
}
}
return result
let result = ''
for (const propName of Object.keys(params)) {
const value = params[propName]
var part = encodeURIComponent(propName) + "="
if (value !== null && value !== "" && typeof(value) !== "undefined") {
if (typeof value === 'object') {
for (const key of Object.keys(value)) {
if (value[key] !== null && value[key] !== "" && typeof(value[key]) !== 'undefined') {
let params = propName + '[' + key + ']'
var subPart = encodeURIComponent(params) + "="
result += subPart + encodeURIComponent(value[key]) + "&"
}
}
} else {
result += part + encodeURIComponent(value) + "&"
}
}
}
return result
}
/*
打印日期 传入 date 返回string
*/
export function printDate(date) {
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份从 0 开始,所以要加 1
const day = date.getDate();
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
}