| | |
| | | <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> |
| | | <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 |
| | | @click="handleOk(0)" |
| | | type="primary" |
| | | </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-row> |
| | | <!-- :disabled="false" --> |
| | | </div> |
| | | <actual-hour-user-select |
| | | ref="actualUserSelect" |
| | | @sendUserRecord="sendUserRecord" |
| | | > |
| | | </actual-hour-user-select> |
| | | </a-card> |
| | | > |
| | | 清空 |
| | | </a-button> |
| | | <a-button |
| | | @click='handleOk(1)' |
| | | type='primary' |
| | | :style="{marginRight: '8px'}" |
| | | :disabled="repairOrderStatus!='3'" |
| | | >暂存 |
| | | </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> |
| | | </template> |
| | | <script> |
| | | import { postAction, getAction } from '@/api/manage' |
| | |
| | | import pick from 'lodash.pick' |
| | | 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: { |
| | | repairOrderId: { |
| | | type: String, |
| | | required: false, |
| | | default: '' |
| | | }, |
| | | repairOrderStatus:{ |
| | | type:String, |
| | | required:false, |
| | | default:'' |
| | | repairOrderStatus: { |
| | | type: String, |
| | | required: false, |
| | | default: '' |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | title: "工艺确认", |
| | | title: '维修工单-实际工时', |
| | | flag: false,//主页面的标记位 用于区分是否确认过工单工艺 来区分table页展示 工单工序 还是产品工序 |
| | | visible: false, |
| | | model: {}, |
| | | obj: {}, |
| | | maskClosable: true, |
| | |
| | | pageSize: 99, |
| | | pageSizeOptions: ['99', '199'], |
| | | showTotal: (total, range) => { |
| | | return range[0] + "-" + range[1] + " 共" + total + "条" |
| | | return range[0] + '-' + range[1] + ' 共' + total + '条' |
| | | }, |
| | | showQuickJumper: true, |
| | | showSizeChanger: true, |
| | |
| | | validatorRules: { |
| | | userId: { |
| | | rules: [ |
| | | { required: true, message: '请选择人员!' }, |
| | | { required: true, message: '请选择人员!' } |
| | | ] |
| | | }, |
| | | actual_hour: { |
| | | rules: [ |
| | | { required: false, message: '请填写工时!'}, |
| | | { required: false, message: '请填写工时!' } |
| | | ] |
| | | }, |
| | | } |
| | | }, |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 7 }, |
| | | sm: { span: 7 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 16 }, |
| | | sm: { span: 16 } |
| | | }, |
| | | drawerWidth: "100%", |
| | | drawerWidth: '100%', |
| | | visible: false, |
| | | disableSubmit: false, |
| | | disableSelect: false, |
| | | 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: 'actualHour', |
| | | align: 'center', |
| | | className: 'red', |
| | | scopedSlots: { customRender: 'actualHour' }, |
| | | width: 250 |
| | | }, |
| | | |
| | | { |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | align: 'center', |
| | | width: 250, |
| | | scopedSlots: { customRender: 'action' } |
| | | } |
| | | ], |
| | | } |
| | | ], |
| | | url: { |
| | | list: "/eam/repairOrder/listRepairOrderActualWorkHoursByMainId", |
| | | confirmHour:"/eam/repairOrder/addRepairOrderActualWorkHours" |
| | | list: '/eam/repairOrder/listRepairOrderActualWorkHoursByMainId', |
| | | confirmHour: '/eam/repairOrder/addRepairOrderActualWorkHours' |
| | | }, |
| | | changeIndex: 0 |
| | | } |
| | | }, |
| | | created(){ |
| | | this.queryParam['repairOrderId'] = this.repairOrderId; |
| | | this.loadData(1); |
| | | created() { |
| | | this.queryParam['repairOrderId'] = this.repairOrderId |
| | | this.loadData(1) |
| | | }, |
| | | methods: { |
| | | addHour() { |
| | | this.dataSource.push({userId:'',repairOrderId:this.repairOrderId,actualHour:0,username:'',realname:''}) |
| | | this.dataSource.push({ userId: '', repairOrderId: this.repairOrderId, actualHour: 0, username: '', realname: '' }) |
| | | }, |
| | | handleCancel() { |
| | | this.close() |
| | | }, |
| | | close() { |
| | | this.$emit('close'); |
| | | this.$emit('close') |
| | | this.dataSource = [] |
| | | this.disableSubmit = false; |
| | | this.visible = false; |
| | | this.disableSubmit = false |
| | | this.visible = false |
| | | }, |
| | | handleDeleteFake(index){ |
| | | this.dataSource.pop(index); |
| | | handleDeleteFake(index) { |
| | | this.dataSource.pop(index) |
| | | }, |
| | | handleOk(saveStatus) { |
| | | const that = this |
| | | if(saveStatus==0){ |
| | | let workHoursDataSource = that.dataSource; |
| | | 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)+"行维修人员!"); |
| | | return false; |
| | | that.$message.warning('请选择第' + (i + 1) + '行维修人员!') |
| | | return false |
| | | } |
| | | if(workHoursDataSource[i].actualHour == undefined || workHoursDataSource[i].actualHour == null||workHoursDataSource[i].actualHour==''){ |
| | | that.$message.warning("请填写第"+(i+1)+"行实际工时!"); |
| | | return false; |
| | | if (workHoursDataSource[i].actualHour == undefined || workHoursDataSource[i].actualHour == null || workHoursDataSource[i].actualHour == '') { |
| | | that.$message.warning('请填写第' + (i + 1) + '行实际工时!') |
| | | return false |
| | | } |
| | | } |
| | | } |
| | |
| | | if (!err) { |
| | | that.confirmLoading = true |
| | | let formData = {} |
| | | formData.repairOrderId = that.repairOrderId; |
| | | formData.actualHourList = that.dataSource; |
| | | formData.repairOrderId = that.repairOrderId |
| | | formData.actualHourList = that.dataSource |
| | | let obj = obj = postAction(this.url.confirmHour, formData) |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | that.close() |
| | | that.loadData(1); |
| | | that.loadData(1) |
| | | }) |
| | | } |
| | | }) |
| | | }, |
| | | handleChange(value, key, column, index) { |
| | | let that = this; |
| | | const temp = [...that.dataSource]; |
| | | const target = temp[index]; |
| | | let that = this |
| | | const temp = [...that.dataSource] |
| | | const target = temp[index] |
| | | if (target) { |
| | | target[column.dataIndex] = value; |
| | | target[column.dataIndex] = value |
| | | if ('userId' == column.dataIndex) { |
| | | target['userId'] = value; |
| | | target['userId'] = value |
| | | } |
| | | if ('actualHour' == column.dataIndex) { |
| | | target['actualHour'] = value; |
| | | target['actualHour'] = value |
| | | } |
| | | that.dataSource = temp; |
| | | that.dataSource = temp |
| | | } |
| | | }, |
| | | onSearchUser(index) { |
| | |
| | | const target = temp[this.recordIndex] |
| | | if (target) { |
| | | console.log(record) |
| | | target.userId = record.id; |
| | | target.username = record.username; |
| | | target.realname = record.realname; |
| | | target.userId = record.id |
| | | target.username = record.username |
| | | target.realname = record.realname |
| | | this.dataSource = temp |
| | | } |
| | | }, |
| | | clearList(){ |
| | | this.dataSource=[]; |
| | | this.ipagination.current = 1 |
| | | clearList() { |
| | | this.dataSource = [] |
| | | this.ipagination.current = 1 |
| | | } |
| | | }, |
| | | watch:{ |
| | | repairOrderId:{ |
| | | watch: { |
| | | repairOrderId: { |
| | | immediate: true, |
| | | handler(val) { |
| | | this.clearList(); |
| | | this.queryParam['repairOrderId'] = val |
| | | this.loadData(1); |
| | | } |
| | | handler(val) { |
| | | this.clearList() |
| | | this.queryParam['repairOrderId'] = val |
| | | this.loadData(1) |
| | | } |
| | | } |
| | | } |
| | | } |