From a022fa78a6f1ec591187c0c3e032036c15761779 Mon Sep 17 00:00:00 2001
From: zhuzhuanzhuan
Date: 星期五, 26 一月 2024 10:11:36 +0800
Subject: [PATCH] 加班管理页面维度由班次班制调整为日期与设备,删除班制班次有关字段
---
src/views/eam/modules/predictiveWorkOrder/ActualWorkHoursEditTable.vue | 329 ++++++++++++++++++++++++++++++------------------------
1 files changed, 185 insertions(+), 144 deletions(-)
diff --git a/src/views/eam/modules/predictiveWorkOrder/ActualWorkHoursEditTable.vue b/src/views/eam/modules/predictiveWorkOrder/ActualWorkHoursEditTable.vue
index 8fe8162..0bf4755 100644
--- a/src/views/eam/modules/predictiveWorkOrder/ActualWorkHoursEditTable.vue
+++ b/src/views/eam/modules/predictiveWorkOrder/ActualWorkHoursEditTable.vue
@@ -1,80 +1,92 @@
<template>
- <a-card :bordered="false" :class="'cust-erp-sub-tab'">
- <a-table
- ref="table"
- bordered
- rowKey="id"
- :columns="columns"
- :dataSource="dataSource"
- :pagination="ipagination"
- @change="handleTableChange"
- >
- <template
- v-for="col in columns"
- :slot="col.dataIndex"
- slot-scope='text, record, index'
- >
- <div :key="col.dataIndex">
- <a-input-search
- v-if="col.dataIndex == 'username'"
- enter-button
- @search="onSearchUser(index)"
- :value="text"
- :read-only="true"
- @change="(e) => handleChange(e, record.key, col, index)"
- />
- <a-input-number
- :value="text"
- v-if="col.dataIndex == 'actualHour'"
- :min="1"
- :max="99999"
- @change="(e)=>handleChange(e, record.key, col, index)"
- :disabled="record.disabled"
- />
-
- </div>
- </template>
- <span slot='action' slot-scope='text, record,index'>
- <a @click="handleDeleteFake(index)">鍒犻櫎</a>
- </span>
- </a-table>
- <a-button
- style="width: 100%; margin-top: 16px; margin-bottom: 8px"
- type="dashed"
- icon="plus"
- @click="addHour"
- :disabled="repairOrderStatus!='3'"
- >娣诲姞瀹為檯宸ユ椂
- </a-button>
- <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
- <a-row :style="{textAlign:'right'}">
- <a-button
- :style="{marginRight: '8px'}"
- @click="handleCancel"
- :disabled="repairOrderStatus!='3'"
- >
- 娓呯┖
- </a-button>
- <a-button
- @click="handleOk(1)"
- type="primary"
- :style="{marginRight: '8px'}"
- :disabled="repairOrderStatus!='3'"
- >鏆傚瓨</a-button>
- <a-button
+ <a-card
+ :bordered="false"
+ :class="'cust-erp-sub-tab'"
+ >
+ <a-table
+ ref="table"
+ bordered
+ rowKey="id"
+ :columns="columns"
+ :dataSource="dataSource"
+ :pagination="ipagination"
+ @change="handleTableChange"
+ >
+ <template
+ v-for="col in columns"
+ :slot="col.dataIndex"
+ slot-scope='text, record, index'
+ >
+ <div :key="col.dataIndex">
+ <a-input-search
+ v-if="col.dataIndex == 'username'"
+ enter-button
+ @search="onSearchUser(index)"
+ :value="text"
+ :read-only="true"
+ :disabled="orderStatus!='4'"
+ @change="(e) => handleChange(e, record.key, col, index)"
+ />
+ <a-input-number
+ :value="text"
+ v-if="col.dataIndex == 'actualWorkingHourQuota'"
+ :min="0"
+ :max="99999"
+ @change="(e)=>handleChange(e, record.key, col, index)"
+ :disabled="record.disabled||orderStatus!='4'"
+ />
+
+ </div>
+ </template>
+ <span
+ slot='action'
+ slot-scope='text, record,index'
+ >
+ <a
+ v-has="'specialtyMaintenanceOrder:actualWorkHoursDelete'"
+ v-if="orderStatus=='4'"
+ @click="handleDelete(index)"
+ >鍒犻櫎</a>
+ </span>
+ </a-table>
+ <a-button
+ style="width: 100%; margin-top: 16px; margin-bottom: 8px"
+ type="dashed"
+ icon="plus"
+ @click="addHour"
+ :disabled="orderStatus!='4'"
+ >娣诲姞瀹為檯宸ユ椂
+ </a-button>
+ <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}">
+ <a-row :style="{textAlign:'right'}">
+ <a-button
+ :style="{marginRight: '8px'}"
+ @click="handleCancel"
+ >
+ 鍙栨秷
+ </a-button>
+ <a-button
+ @click="handleOk(1)"
+ type="primary"
+ :style="{marginRight: '8px'}"
+ :disabled="orderStatus!='4'"
+ v-has="'specialtyMaintenanceOrder:actualWorkHoursTS'"
+ >鏆傚瓨</a-button>
+ <a-button
@click="handleOk(0)"
type="primary"
- :disabled="repairOrderStatus!='3'"
- >淇濆瓨</a-button>
- </a-row>
- <!-- :disabled="false" -->
- </div>
- <actual-hour-user-select
- ref="actualUserSelect"
- @sendUserRecord="sendUserRecord"
- >
- </actual-hour-user-select>
- </a-card>
+ :disabled="orderStatus!='4'"
+ v-has="'specialtyMaintenanceOrder:actualWorkHoursSave'"
+ >淇濆瓨</a-button>
+ </a-row>
+ <!-- :disabled="false" -->
+ </div>
+ <actual-hour-user-select
+ ref="actualUserSelect"
+ @sendUserRecord="sendUserRecord"
+ >
+ </actual-hour-user-select>
+ </a-card>
</template>
<script>
import { postAction, getAction } from '@/api/manage'
@@ -83,27 +95,37 @@
import JEllipsis from '@/components/jeecg/JEllipsis'
import ActualHourUserSelect from './select/ActualHourUserSelect.vue'
export default {
- name: 'ActualWorkHoursEditTable',
- mixins: [JeecgListMixin],
+ name: 'ActualWorkHoursEditTable',
+ mixins: [JeecgListMixin],
components: {
JEllipsis,
ActualHourUserSelect
},
- props:{
- repairOrderId:{
- type:String,
- required:false,
- default:''
+ props: {
+ orderId: {
+ type: String,
+ required: false,
+ default: ''
},
- repairOrderStatus:{
- type:String,
- required:false,
- default:''
- }
+ orderStatus: {
+ type: String,
+ required: false,
+ default: ''
+ },
+ equipmentId: {
+ type: String,
+ required: false,
+ default: ''
+ },
+ teamId: {
+ type: String,
+ required: false,
+ default: ''
+ },
},
data() {
return {
- title: "宸ヨ壓纭",
+ title: "瀹為檯宸ユ椂",
flag: false,//涓婚〉闈㈢殑鏍囪浣� 鐢ㄤ簬鍖哄垎鏄惁纭杩囧伐鍗曞伐鑹� 鏉ュ尯鍒唗able椤靛睍绀� 宸ュ崟宸ュ簭 杩樻槸浜у搧宸ュ簭
visible: false,
model: {},
@@ -131,7 +153,7 @@
},
actual_hour: {
rules: [
- { required: false, message: '璇峰~鍐欏伐鏃�!'},
+ { required: false, message: '璇峰~鍐欏伐鏃�!' },
]
},
},
@@ -150,53 +172,65 @@
loading: false,
dataSource: [],
columns: [
- {
- title: '*浜哄憳缂栫爜',
- dataIndex: 'username',
- align: "center",
- scopedSlots: { customRender: 'username' },
- className: 'red',
- width: 250,
- },
- {
- title: '浜哄憳鍚嶇О',
- dataIndex: 'realname',
- align: "center",
- width: 250,
- },
- {
- title: '*瀹為檯宸ユ椂',
- dataIndex: 'actualHour',
- align: "center",
- className: 'red',
- scopedSlots: { customRender: 'actualHour' },
- width: 250,
- },
- {
+ {
+ title: '*浜哄憳缂栫爜',
+ dataIndex: 'username',
+ align: "center",
+ scopedSlots: { customRender: 'username' },
+ className: 'red',
+ width: 250,
+ },
+ {
+ title: '浜哄憳鍚嶇О',
+ dataIndex: 'realname',
+ align: "center",
+ width: 250,
+ },
+ {
+ title: '*瀹為檯宸ユ椂',
+ dataIndex: 'actualWorkingHourQuota',
+ align: "center",
+ className: 'red',
+ scopedSlots: { customRender: 'actualWorkingHourQuota' },
+ width: 250,
+ },
+ {
title: '鎿嶄綔',
dataIndex: 'action',
align: 'center',
width: 250,
scopedSlots: { customRender: 'action' }
- }
- ],
+ }
+ ],
url: {
- list: "/eam/repairOrder/listRepairOrderActualWorkHoursByMainId",
- confirmHour:"/eam/repairOrder/addRepairOrderActualWorkHours"
+ list: "/eam/maintenanceOrderActualWorkingHour/getMaintenanceOrderActualWorkingHourList",
+ confirmHour: "/eam/maintenanceOrderActualWorkingHour/add"
},
changeIndex: 0
}
},
- created(){
- this.queryParam['repairOrderId'] = this.repairOrderId;
+ created() {
+ this.queryParam['maintenanceOrderId'] = this.orderId;
+ this.queryParam['equipmentId'] = this.equipmentId
this.loadData(1);
+ },
+ watch: {
+ orderId: {
+ immediate: true,
+ handler(val) {
+ this.clearList();
+ this.queryParam['maintenanceOrderId'] = val
+ this.queryParam['equipmentId'] = this.equipmentId
+ this.loadData(1);
+ }
+ },
},
methods: {
addHour() {
- this.dataSource.push({userId:'',repairOrderId:this.repairOrderId,actualHour:0,username:'',realname:''})
+ this.dataSource.push({ id: this.getUuiD(16), userId: '', maintenanceOrderId: this.dailyMaintenanceOrderId, actualWorkingHourQuota: 0, username: '', realname: '' })
},
handleCancel() {
- this.close()
+ this.$bus.$emit('closeDrawer');
},
close() {
this.$emit('close');
@@ -204,30 +238,39 @@
this.disableSubmit = false;
this.visible = false;
},
- handleDeleteFake(index){
- this.dataSource.pop(index);
+ // handleDeleteFake(index) {
+ // this.dataSource.splice(index,1);
+ // },
+ handleDelete(text, record, index) {
+ this.dataSource.splice(index, 1);
},
+
handleOk(saveStatus) {
const that = this
- if(saveStatus==0){
+ if (saveStatus == 0) {
let workHoursDataSource = that.dataSource;
for (let i = 0; i < workHoursDataSource.length; i++) {
if (workHoursDataSource[i].userId == undefined || workHoursDataSource[i].userId == null || workHoursDataSource[i].userId == '') {
- that.$message.warning("璇烽�夋嫨绗�"+(i+1)+"琛岀淮淇汉鍛橈紒");
+ that.$message.warning("璇烽�夋嫨绗�" + (i + 1) + "琛岀淮淇汉鍛橈紒");
return false;
}
- if(workHoursDataSource[i].actualHour == undefined || workHoursDataSource[i].actualHour == null||workHoursDataSource[i].actualHour==''){
- that.$message.warning("璇峰~鍐欑"+(i+1)+"琛屽疄闄呭伐鏃讹紒");
+ if (workHoursDataSource[i].actualWorkingHourQuota == undefined || workHoursDataSource[i].actualWorkingHourQuota == null || workHoursDataSource[i].actualWorkingHourQuota == '') {
+ that.$message.warning("璇峰~鍐欑" + (i + 1) + "琛屽疄闄呭伐鏃讹紒");
return false;
}
}
+ }
+ if (that.dataSource.length === 0) {
+ that.$message.warning("璇烽�夋嫨浜哄憳锛�")
+ return
}
this.form.validateFields((err, values) => {
if (!err) {
that.confirmLoading = true
let formData = {}
- formData.repairOrderId = that.repairOrderId;
- formData.actualHourList = that.dataSource;
+ formData.maintenanceOrderId = that.orderId;
+ formData.maintenanceOrderActualWorkingHourList = that.dataSource;
+ formData.equipmentId = that.equipmentId;
let obj = obj = postAction(this.url.confirmHour, formData)
obj.then((res) => {
if (res.success) {
@@ -253,15 +296,15 @@
if ('userId' == column.dataIndex) {
target['userId'] = value;
}
- if ('actualHour' == column.dataIndex) {
- target['actualHour'] = value;
+ if ('actualWorkingHourQuota' == column.dataIndex) {
+ target['actualWorkingHourQuota'] = value;
}
that.dataSource = temp;
}
},
onSearchUser(index) {
this.recordIndex = index
- this.$refs.actualUserSelect.list()
+ this.$refs.actualUserSelect.list(this.teamId)
this.$refs.actualUserSelect.title = '浜哄憳閫夋嫨'
},
sendUserRecord(data, val) {
@@ -276,21 +319,19 @@
this.dataSource = temp
}
},
- clearList(){
- this.dataSource=[];
- this.ipagination.current = 1
- }
+ clearList() {
+ this.dataSource = [];
+ this.ipagination.current = 1
+ },
+ getUuiD(randomLength) {
+ return Number(
+ Math.random()
+ .toString()
+ .substr(2, randomLength) + Date.now()
+ ).toString(36)
+ },
},
- watch:{
- repairOrderId:{
- immediate: true,
- handler(val) {
- this.clearList();
- this.queryParam['repairOrderId'] = val
- this.loadData(1);
- }
- }
- }
+
}
</script>
--
Gitblit v1.9.3