add person work report

main
chenshuichuan 2 years ago
parent 17f92a186e
commit 6446210c93

@ -0,0 +1,41 @@
import request from '@/utils/request'
// 查询本人工位列表
export function getOrgList(data) {
return request({
url: '/admin-api/mes/app/org-worker/getOrgList',
method: 'get',
params:data
})
}
// 查询他人工位列表
export function getOtherOrgList(data) {
return request({
url: '/admin-api/mes/app/org-worker/getOtherOrgList',
method: 'get',
params:data
})
}
// 查询工人列表
export function getOtherPersonalUser(data) {
return request({
url: '/admin-api/mes/app/org-worker/getOtherPersonalUser',
method: 'get',
params:data
})
}
// 查询产品列表
export function getProductList() {
return request({
url: '/admin-api/mes/app/org-worker/getProductList',
method: 'get'
})
}
// 创建生产报工单
export function createReport(data) {
return request({
url: '/admin-api/mes/app/org-worker/createReport',
method: 'post',
data: data
})
}

@ -50,3 +50,16 @@ export function delData(dictCode) {
method: 'delete'
})
}
//{text: '制浆', value: 'zhijiang'},
export const processTypes = [
{text: '成型', value: 'chengxing'},
{text: '烘干', value: 'honggan'}, {text: '转移', value: 'zhuanyi'},
{text: '加湿', value: 'jiashi'}, {text: '热压', value: 'reya'},
{text: '切边', value: 'qiebian'}, {text: '品检', value: 'pinjian'},
{text: '打包', value: 'dabao'}, {text: '贴标', value: 'tiebiao'},
{text: '塑封', value: 'sufeng'}, {text: '品印', value: 'pinyin'}
]
export const groupTypes = [
{text: '白班', value: 1}, {text: '夜班', value: 2},
{text: '长白班', value: 3}
]

@ -1,178 +1,336 @@
<template>
<view class="normal-login-container">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-row>
<el-col :span="8">
<el-form-item label="工人">
{{userStore.name}}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报工日期" prop="reportDate">
<el-date-picker
:disabled="isDisableUpdate"
v-model="formData.reportDate"
type="date"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择报工日期"
@change="changeDate"
/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班别" prop="groupType">
<!-- <el-radio-group v-model="formData.groupType">-->
<!-- <el-radio-->
<!-- :disabled="isDisableUpdate"-->
<!-- v-for="dict in getIntDictOptions(DICT_TYPE.MES_GROUP_TYPE)"-->
<!-- :key="dict.value"-->
<!-- :label="dict.value"-->
<!-- @change="changeDate"-->
<!-- >-->
<!-- {{ dict.label }}-->
<!-- </el-radio>-->
<!-- </el-radio-group>-->
</el-form-item>
</el-col>
</el-row>
<el-row v-if="formData.groupType && formData.reportDate">
<el-col :span="8">
<el-form-item label="工位" prop="orgId">
<!-- <el-select-->
<!-- :disabled="isDisableUpdate"-->
<!-- v-model="formData.orgId"-->
<!-- clearable-->
<!-- filterable-->
<!-- placeholder="请选择工位"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="item in orgWorkerList"-->
<!-- :key="item.orgId"-->
<!-- :label="item.orgName"-->
<!-- :value="item.orgId"-->
<!-- />-->
<!-- </el-select>-->
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="工序" prop="orgType">
<!-- <el-select-->
<!-- disabled-->
<!-- v-model="formData.orgType"-->
<!-- placeholder=""-->
<!-- clearable-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="dict in getStrDictOptions(DICT_TYPE.MES_ORG_TYPE)"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
</el-form-item>
</el-col>
<el-col :span="8" >
<el-text v-if="warningInfo" class="mx-1" type="warning">{{warningInfo}}</el-text>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="计件时段" prop="reportTime">
<el-input v-model="formData.reportTime" placeholder="请输入计件时段" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计件时长" prop="totalTime">
<el-input-number v-model="formData.totalTime" :min="0" :precision="2" placeholder="请输入时长" class="!w-260px"/>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="备注" prop="remark">
<el-input v-model="formData.remark" placeholder="请输入备注"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<view class="container">
<uni-card :is-shadow="false" is-full>
<text class="uni-h6">uni-forms 组件一般由输入框选择器单选框多选框等控件组成用以收集校验提交数据</text>
</uni-card>
<uni-section title="基本用法" type="line">
<view class="example">
<!-- 基础用法不包含校验规则 -->
<uni-forms ref="baseForm" :model="baseFormData" labelWidth="80px">
<uni-forms-item label="姓名" required>
<uni-easyinput v-model="baseFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="年龄" required>
<uni-easyinput v-model="baseFormData.age" placeholder="请输入年龄" />
</uni-forms-item>
<uni-forms-item label="性别" required>
<uni-data-checkbox v-model="baseFormData.sex" :localdata="sexs" />
</uni-forms-item>
<uni-forms-item label="兴趣爱好" required>
<uni-data-checkbox v-model="baseFormData.hobby" multiple :localdata="hobbys" />
</uni-forms-item>
<uni-forms-item label="自我介绍">
<uni-easyinput type="textarea" v-model="baseFormData.introduction" placeholder="请输入自我介绍" />
</uni-forms-item>
<uni-forms-item label="日期时间">
<uni-datetime-picker type="datetime" return-type="timestamp"
v-model="baseFormData.datetimesingle" />
</uni-forms-item>
<uni-forms-item label="选择城市">
<uni-data-picker v-model="baseFormData.city" :localdata="cityData" popup-title="选择城市">
</uni-data-picker>
</uni-forms-item>
<uni-forms-item label="选择技能">
<uni-data-select v-model="baseFormData.skills" :localdata="skillsRange" >
</uni-data-select>
</uni-forms-item>
</uni-forms>
</view>
</template>
<script setup lang="ts">
import modal from '@/plugins/modal'
import { ref } from "vue";
import config from '@/config.js'
import useUserStore from '@/store/modules/user'
</uni-section>
<uni-section title="表单校验" type="line">
<view class="example">
<!-- 基础表单校验 -->
<uni-forms ref="valiForm" :rules="rules" :model="valiFormData" labelWidth="80px">
<uni-forms-item label="姓名" required name="name">
<uni-easyinput v-model="valiFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="年龄" required name="age">
<uni-easyinput v-model="valiFormData.age" placeholder="请输入年龄" />
</uni-forms-item>
<uni-forms-item label="自我介绍">
<uni-easyinput type="textarea" v-model="valiFormData.introduction" placeholder="请输入自我介绍" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="submit('valiForm')"></button>
</view>
</uni-section>
const userStore = useUserStore()
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
processInstanceId: undefined,
reportCode: undefined,
userId: undefined,
orgId: undefined,
orgType: undefined,
reportTime: undefined,
totalTime: undefined,
reportStatus: undefined,
remark: undefined,
groupType: undefined,
reportType: undefined,
reportDateString: undefined,
reportDate: undefined
})
const formRules = ({
reportDate: [{ required: true, message: '日期不能为空', trigger: 'blur' }],
groupType: [{ required: true, message: '班别不能为空', trigger: 'blur' }],
productId: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
userId: [{ required: true, message: '工人不能为空', trigger: 'blur' }],
orgId: [{ required: true, message: '工位不能为空', trigger: 'blur' }],
orgType: [{ required: true, message: '工序不能为空', trigger: 'blur' }],
})
<uni-section title="自定义校验规则" type="line">
<view class="example">
<!-- 自定义表单校验 -->
<uni-forms ref="customForm" :rules="customRules" labelWidth="80px" :modelValue="customFormData">
<uni-forms-item label="姓名" required name="name">
<uni-easyinput v-model="customFormData.name" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item label="年龄" required name="age">
<uni-easyinput v-model="customFormData.age" placeholder="请输入年龄" />
</uni-forms-item>
<uni-forms-item label="兴趣爱好" required name="hobby">
<uni-data-checkbox v-model="customFormData.hobby" multiple :localdata="hobbys" />
</uni-forms-item>
</uni-forms>
<button type="primary" @click="submit('customForm')"></button>
</view>
</uni-section>
const isDisableUpdate = ref(false)
const warningInfo = ref()
const orgWorkerList = ref<[]>([]) //
//
const changeDate = async () =>{
warningInfo.value = '该条件下未查询到工位安排信息!'
modal.msgError(warningInfo.value)
// if(formData.value.reportDate && formData.value.groupType ){
// orgWorkerList.value = await OrgWorkerApi.getOrgWorkerList1(formData.value)
// if(orgWorkerList.value && orgWorkerList.value.length>0){
// formData.value.orgId = orgWorkerList.value[0].orgId
// formData.value.orgType = orgWorkerList.value[0].orgType
// warningInfo.value=''
// }
// else{
// formData.value.orgId = undefined
// warningInfo.value = ''
// modal.msgError(warningInfo.value)
// }
// }
}
const getCurrentDate = () =>{
let result = ''
let now = new Date()
result += now.getFullYear()
let month = now.getMonth() + 1
if(month<10)result += '-0'+month
else result += '-'+month
let day = now.getDate()
if(day<10) result += '-0'+day
else result += day
return result +" 00:00:00";
}
<uni-section title="动态表单" type="line">
<view class="example">
<!-- 动态表单校验 -->
<uni-forms ref="dynamicForm" :rules="dynamicRules" :model="dynamicFormData" labelWidth="80px">
<uni-forms-item label="邮箱" required name="email">
<uni-easyinput v-model="dynamicFormData.email" placeholder="请输入姓名" />
</uni-forms-item>
<uni-forms-item v-for="(item,index) in dynamicFormData.domains" :key="item.id"
:label="item.label+' '+index" required :rules="item.rules" :name="['domains',index,'value']">
<view class="form-item">
<uni-easyinput v-model="dynamicFormData.domains[index].value" placeholder="请输入域名" />
<button class="button" size="mini" type="default" @click="del(item.id)"></button>
</view>
</uni-forms-item>
</uni-forms>
<view class="button-group">
<button type="primary" size="mini" @click="add"></button>
<button type="primary" size="mini" @click="submit('dynamicForm')"></button>
</view>
</view>
</uni-section>
</view>
</template>
<script>
export default {
data() {
return {
//
baseFormData: {
name: '',
age: '',
introduction: '',
sex: 2,
hobby: [5],
datetimesingle: 1627529992399,
city: '',
skills: 0
},
//
cityData: [{
text: "北京",
value: "10001",
}, {
text: "上海",
value: "10002",
}, {
text: "深圳",
value: "10004",
}],
skillsRange: [{
value: 0,
text: "编程"
},
{
value: 1,
text: "绘画"
},
{
value: 2,
text: "运动"
},
],
//
alignmentFormData: {
name: '',
age: '',
},
//
sexs: [{
text: '男',
value: 0
}, {
text: '女',
value: 1
}, {
text: '保密',
value: 2
}],
//
hobbys: [{
text: '跑步',
value: 0
}, {
text: '游泳',
value: 1
}, {
text: '绘画',
value: 2
}, {
text: '足球',
value: 3
}, {
text: '篮球',
value: 4
}, {
text: '其他',
value: 5
}],
//
current: 0,
items: ['左对齐', '顶部对齐'],
//
valiFormData: {
name: '',
age: '',
introduction: '',
},
//
rules: {
name: {
rules: [{
required: true,
errorMessage: '姓名不能为空'
}]
},
age: {
rules: [{
required: true,
errorMessage: '年龄不能为空'
}, {
format: 'number',
errorMessage: '年龄只能输入数字'
}]
}
},
//
customFormData: {
name: '',
age: '',
hobby: []
},
//
customRules: {
name: {
rules: [{
required: true,
errorMessage: '姓名不能为空'
}]
},
age: {
rules: [{
required: true,
errorMessage: '年龄不能为空'
}]
},
hobby: {
rules: [{
format: 'array'
},
{
validateFunction: function(rule, value, data, callback) {
if (value.length < 2) {
callback('请至少勾选两个兴趣爱好')
}
return true
}
}
]
}
},
dynamicFormData: {
email: '',
domains: []
},
dynamicLists: [],
dynamicRules: {
email: {
rules: [{
required: true,
errorMessage: '域名不能为空'
}, {
format: 'email',
errorMessage: '域名格式错误'
}]
}
}
}
},
computed: {
//
alignment() {
if (this.current === 0) return 'left'
if (this.current === 1) return 'top'
return 'left'
}
},
onLoad() {},
onReady() {
//
this.$refs.customForm.setRules(this.customRules)
},
methods: {
onClickItem(e) {
console.log(e);
this.current = e.currentIndex
},
add() {
this.dynamicFormData.domains.push({
label: '域名',
value: '',
rules: [{
'required': true,
errorMessage: '域名项必填'
}],
id: Date.now()
})
},
del(id) {
let index = this.dynamicLists.findIndex(v => v.id === id)
this.dynamicLists.splice(index, 1)
},
submit(ref) {
console.log(this.baseFormData);
this.$refs[ref].validate().then(res => {
console.log('success', res);
uni.showToast({
title: `校验通过`
})
}).catch(err => {
console.log('err', err);
})
},
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.segmented-control {
margin-bottom: 15px;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.form-item {
display: flex;
align-items: center;
flex: 1;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
</style>

@ -0,0 +1,297 @@
<template>
<view class="container">
<uni-card :is-shadow="false" is-full>
<text class="uni-h6">如个人无法填报请寻找主管或组长代为报工</text>
</uni-card>
<view class="example">
<!-- 自定义表单校验 -->
<uni-forms ref="customForm" :rules="customRules" labelWidth="60px" :modelValue="customFormData">
<uni-forms-item label="工序" required name="orgType">
<uni-data-checkbox v-model="customFormData.orgType" :localdata="processTypes()" />
</uni-forms-item>
<uni-forms-item label="班别" required name="groupType">
<uni-data-checkbox v-model="customFormData.groupType" :localdata="groupTypes()" />
</uni-forms-item>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="日期" required name="reportDateString">
<uni-datetime-picker v-model="customFormData.reportDateString" type="date" :clear-icon="true" @change="maskClick" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="工位" required name="orgId">
<uni-data-select v-model="customFormData.orgId" :localdata="orgIdList"></uni-data-select>
</uni-forms-item>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="计件时段" name="reportTime">
<uni-easyinput type="text" v-model="customFormData.reportTime" placeholder="如:8:00-12:00" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="计件时间/h" required name="totalTime">
<uni-easyinput type="number" v-model="customFormData.totalTime" placeholder="" />
</uni-forms-item>
</uni-col>
</uni-row>
<uni-group title="card 模式" mode="card" v-for="(item,index) in customFormData.productList" :key="item.id"
:name="['productList',index,'value']">
<template v-slot:title>
<view class="uni-group-title">
<uni-row>
<uni-col :span="12">
<uni-forms-item label="产品" required name="productId">
<uni-data-select v-model="customFormData.productList[index].productId" :localdata="planProductList"></uni-data-select>
</uni-forms-item>
</uni-col>
<uni-col :span="12" align="center">
<!-- <button class="button" size="mini" type="warn" @click="del(item.id)"></button>-->
<uni-icons type="trash" size="25" color="red" @click="del(item.id)"></uni-icons>
</uni-col>
</uni-row>
</view>
</template>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="成品数" required name="qualityNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].qualityNumber" @change="changeNumber(item.id)"/>
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="废品数" name="wasteNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].wasteNumber" @change="changeNumber(item.id)"/>
</uni-forms-item>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="总数" name="totalNumber">
<uni-easyinput disabled v-model="customFormData.productList[index].totalNumber" placeholder="" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="成品率%" required name="qualityRate">
<uni-easyinput disabled type="number" v-model="customFormData.productList[index].qualityRate" />
</uni-forms-item>
</uni-col>
</uni-row>
<uni-row>
<uni-col :span="12">
<uni-forms-item label="打包数" name="packageNumber">
<uni-easyinput type="number" v-model="customFormData.productList[index].packageNumber" />
</uni-forms-item>
</uni-col>
<uni-col :span="12">
<uni-forms-item label="备注" name="remark">
<uni-easyinput type="text" v-model="customFormData.productList[index].remark" />
</uni-forms-item>
</uni-col>
</uni-row>
</uni-group>
</uni-forms>
<view class="button-group">
<button type="primary" size="mini" @click="add">
<uni-icons type="plus" size="15"></uni-icons>
新增产品
</button>
<button type="primary" size="mini" @click="submit('customForm')"></button>
</view>
</view>
</view>
</template>
<script>
import useUserStore from "@/store/modules/user";
import {processTypes, groupTypes} from "@/api/system/dict/data";
import {getOrgList, getProductList,createReport} from "@/api/mes/organization"
import {getCurrentDate} from "@/utils/dateUtil"
import {View} from "@element-plus/icons-vue";
import {showConfirm} from "@/utils/common";
import tab from "@/plugins/tab";
import modal from "@/plugins/modal";
const userStore = useUserStore()
export default {
components: {View},
data() {
return {
//
customFormData: {
id: undefined,
name: userStore.name,
userId: userStore.userId,
orgId: undefined,
orgType: undefined,
reportTime: undefined,
totalTime: 0,
reportStatus: undefined,
remark: undefined,
groupType: undefined,
reportType: undefined,
reportDateString: getCurrentDate(),
reportDate: undefined,
productList: []
},
//
customRules: {
userId: {rules: [{required: true, errorMessage: '姓名不能为空'}]},
orgId: {rules: [{required: true, errorMessage: '工位不能为空'}]},
orgType: {rules: [{required: true, errorMessage: '工序不能为空'}]},
reportDateString: {rules: [{required: true, errorMessage: '报工日期不能为空'}]},
totalTime: {rules: [{required: true, errorMessage: '计件时间不能为空'},
{format: 'number', errorMessage: '计件时间格式错误,应填计件小时数'}]},
groupType: {rules: [{required: true, errorMessage: '班别不能为空'}]},
productList: {rules: [
{format: 'array', errorMessage: '产品列表格式错误'},
{validateFunction: function(rule, value, data, callback) {
console.log('value:'+value)
console.log('data:'+data)
if (value.length < 2) {
callback('产品信息不能为空')
}
return true
}
}]
}
},
orgIdList:[],
planProductList:[]
}
},
computed: {
},
onLoad() {
this.getOrgIdList()
this.getPlanProductList()
},
onReady() {
//
this.$refs.customForm.setRules(this.customRules)
},
methods: {
processTypes() {
return processTypes
},
groupTypes() {
return groupTypes
},
submit(ref) {
if(this.customFormData.reportDateString.length<11)this.customFormData.reportDateString+=' 00:00:00';
this.customFormData.reportType = '个人';
console.log(this.customFormData);
this.$refs[ref].validate().then(res => {
var ok = 1;
if(this.customFormData.productList && this.customFormData.productList.length > 0) {
for (let i = 0; i < this.customFormData.productList.length; i++) {
if(!this.customFormData.productList[i].productId || this.customFormData.productList[i].productId===''
|| !this.customFormData.productList[i].qualityNumber|| this.customFormData.productList[i].qualityNumber <= 0) {
ok = 0;
uni.showToast({
title: `产品信息不能为空!`
})
break;
}
}
}
if(ok===1){
showConfirm("提交后将不能修改,确认提交生产报工单吗?").then(res => {
if (res.confirm) {
createReport(this.customFormData).then(response => {
modal.msgSuccess("提交成功")
tab.switchTab('/pages/report')
})
}
})
}
}).catch(err => {
console.log('err', err);
})
},
maskClick(e){
this.customFormData.reportDateString =e
this.getOrgIdList()
},
getOrgIdList() {
let data = {
'orgType': this.customFormData.orgType,
'reportDate': this.customFormData.reportDateString+" 00:00:00",
'groupType': this.customFormData.groupType
}
getOrgList(data).then(response => {
this.orgIdList = response.data;
if(!this.orgIdList || this.orgIdList.length===0){
uni.showToast({
title: '日期:'+this.customFormData.reportDateString+`未查询到工位安排!`
})
}
else if(this.orgIdList.length===1){
this.customFormData.orgId = this.orgIdList[0].value
}
})
},
getPlanProductList() {
getProductList().then(response => {
this.planProductList = response.data;
if(!this.planProductList || this.orgIdList.planProductList===0){}
})
},
add() {
this.customFormData.productList.push({
id: Date.now(),
productId: undefined,
qualityNumber: 0,
wasteNumber: 0,
totalNumber: 0,
qualityRate:0,
packageNumber: 0,
remark: ''
})
},
del(id) {
let index = this.customFormData.productList.findIndex(v => v.id === id)
this.customFormData.productList.splice(index, 1)
},
changeNumber(id){
let index = this.customFormData.productList.findIndex(v => v.id === id)
if(!this.customFormData.productList[index].qualityNumber)
this.customFormData.productList[index].qualityNumber=0;
if(!this.customFormData.productList[index].wasteNumber)
this.customFormData.productList[index].wasteNumber=0;
this.customFormData.productList[index].totalNumber =
Number(this.customFormData.productList[index].qualityNumber) + Number(this.customFormData.productList[index].wasteNumber);
this.customFormData.productList[index].qualityRate =
(Number(this.customFormData.productList[index].qualityNumber)*100/Number(this.customFormData.productList[index].totalNumber)).toFixed(2);
}
}
}
</script>
<style lang="scss">
.example {
padding: 15px;
background-color: #fff;
}
.button-group {
margin-top: 15px;
display: flex;
justify-content: space-around;
}
.button {
display: flex;
align-items: center;
height: 35px;
line-height: 35px;
margin-left: 10px;
}
.uni-group-title{
padding-top: 5px;
background-color: #f4c7c7;
}
</style>

@ -63,10 +63,13 @@
],
"subPackages": [
{
"root": "page_record",
"root": "page_report",
"pages": [
{
"path": "reportForm"
"path": "reportForm",
"style": {
"navigationBarTitleText": "生产报工"
}
}
]
},

@ -1,5 +1,7 @@
<template>
<view >
<uni-notice-bar show-icon scrollable
text="安全生产!有序生产!高效生产!" />
<!-- 开工中-->
<uni-section title="开工中" type="line" title-color="#18bc37"></uni-section>
<el-collapse accordion>

@ -1,5 +1,7 @@
<template>
<view>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleTabClick">
<el-tab-pane label="个人报工" name="first">
<uni-list :border="true">
<uni-list-item v-for="(item, index) in reportList">
<!-- 自定义 header -->
@ -23,14 +25,22 @@
</template>
</uni-list-item>
</uni-list>
<uni-fab ref="fab" @fabClick="editOrAddReport" />
</el-tab-pane>
<el-tab-pane label="代报工" name="second" v-if="auth.hasPermi('mes:produce-report-detail:replace')">
<uni-fab :pattern="pattern" ref="fabReplace" @fabClick="addReplaceReport" />
</el-tab-pane>
<el-tab-pane label="报工审核" name="third" v-if="auth.hasPermi('mes:produce-report-detail:replace')">
</el-tab-pane>
<el-tab-pane label="报工报表" name="four">报工报表</el-tab-pane>
</el-tabs>
</view>
</template>
<script>
import {getMyList, getOtherList, getById, updateStatus,deleteByReportId } from "@/api/mes/report";
import {Check, Delete, Edit, Message, Search, Star} from '@element-plus/icons-vue'
import {Check, Delete, Edit} from '@element-plus/icons-vue'
import tab from "@/plugins/tab";
import modal from "@/plugins/modal";
import auth from "@/plugins/auth";
@ -38,25 +48,42 @@ import {showConfirm} from "@/utils/common";
import {timestampToTime} from "@/utils/dateUtil";
export default {
computed: {
Delete() {
return Delete
auth() {
return auth
},
Edit() {
return Edit
},
Check() {
return Check
}
Delete() {return Delete},
Edit() {return Edit},
Check() {return Check}
},
data() {
return {
reportList: []
reportList: [],
pattern: {
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#e66126',
iconColor: '#fff'
},
activeName: 'first'
};
},
onLoad() {
this.getList();
},
methods: {
handleTabClick(tab) {
console.log(tab.paneName)
if(tab.paneName==='third'){
}
//
else if(tab.paneName==='second'){
this.getList();
}
else {
this.getList();
}
},
timestampToTime,
getList() {
getMyList().then(response => {
@ -68,6 +95,7 @@ export default {
if (res.confirm) {
deleteByReportId(id).then(response => {
modal.msgSuccess("操作成功")
this.getList()
})
}
})
@ -77,19 +105,18 @@ export default {
if (res.confirm) {
updateStatus(id,1).then(response => {
modal.msgSuccess("操作成功")
this.getList()
})
}
})
},
editOrAddReport(id){
if(id===null || id===undefined){
uni.navigateTo({
url: '/pages_template/pages/address/addSite'
});
}
else{
tab.navigateTo("",id)
}
if(id===null || id===undefined)tab.navigateTo('/page_report/reportForm')
else tab.navigateTo("",id)
},
addReplaceReport(id){
if(id===null || id===undefined)tab.navigateTo('/page_report/reportForm')
else tab.navigateTo("",id)
}
}
};

@ -12,3 +12,17 @@ export function timestampToTime(timestamp: number | null): string {
// let s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D;
}
export function getCurrentDate(){
let result = '';
let now = new Date();
let year = now.getFullYear();
let month = now.getMonth() + 1;
result+=year;
if(month<10){result += '-0'+month}
else result += '-'+month;
let day = now.getDate();
if(day<10)result += '-0'+day;
else result += '-'+day;
return result;
}
Loading…
Cancel
Save