|
|
@@ -0,0 +1,272 @@
|
|
|
+<template>
|
|
|
+ <div class="main-container">
|
|
|
+ <ibps-crud
|
|
|
+ ref="crud"
|
|
|
+ :display-field="title"
|
|
|
+ :height="height"
|
|
|
+ :data="listData"
|
|
|
+ :toolbars="listConfig.toolbars"
|
|
|
+ :search-form="listConfig.searchForm"
|
|
|
+ :pk-key="pkKey"
|
|
|
+ :columns="listConfig.columns"
|
|
|
+ :row-handle="listConfig.rowHandle"
|
|
|
+ :pagination="pagination"
|
|
|
+ :loading="loading"
|
|
|
+ @action-event="handleAction"
|
|
|
+ @sort-change="handleSortChange"
|
|
|
+ @pagination-change="handlePaginationChange"
|
|
|
+ @row-dblclick="handleRowDblclick">
|
|
|
+ <template slot="dateRange" slot-scope="scope">
|
|
|
+ <span>{{ `${scope.row.startDate} 至 ${scope.row.endDate}` }}</span>
|
|
|
+ </template>
|
|
|
+ </ibps-crud>
|
|
|
+ <adjust-edit
|
|
|
+ v-if = "showAdjustEdit"
|
|
|
+ :visible.sync="showAdjustEdit"
|
|
|
+ :params="params"
|
|
|
+ :readonly="readonly"
|
|
|
+ @refresh="loadData"
|
|
|
+ @close="() => showAdjustEdit = false" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { queryAdjustment, removeAdjustment, saveAdjustment, getAdjustmentDetail, saveAdjustmentDetail } from '@/api/business/schedule'
|
|
|
+import { stateType } from '@/views/constants/schedule'
|
|
|
+import ActionUtils from '@/utils/action'
|
|
|
+import FixHeight from '@/mixins/height'
|
|
|
+import { status } from '@/api/platform/job/scheduler';
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ AdjustEdit: () => import('./components/adjust-edit')
|
|
|
+ },
|
|
|
+ mixins: [FixHeight],
|
|
|
+ data () {
|
|
|
+ const { userList = [] } = this.$store.getters || {}
|
|
|
+ const userOption = userList.map(item => ({ label: item.userName, value: item.userId }))
|
|
|
+ return {
|
|
|
+ userOption,
|
|
|
+ stateType,
|
|
|
+ title: '调班审核记录',
|
|
|
+ pkKey: 'id', // 主键 如果主键不是pk需要传主键
|
|
|
+ loading: true,
|
|
|
+ height: document.clientHeight,
|
|
|
+ listData: [],
|
|
|
+ pagination: {},
|
|
|
+ sorts: {},
|
|
|
+ showAdjustEdit: false,
|
|
|
+ showAgreeBtnList: [],
|
|
|
+ readonly: false,
|
|
|
+ params: {},
|
|
|
+ listConfig: {
|
|
|
+ /* toolbars: [
|
|
|
+ { key: 'search', icon: 'ibps-icon-search', label: '查询', type: 'primary', hidden: false },
|
|
|
+ { key: 'create', icon: 'ibps-icon-plus', label: '申请', type: 'success', hidden: false },
|
|
|
+ { key: 'remove', icon: 'ibps-icon-close', label: '删除', type: 'danger', hidden: false }
|
|
|
+ ],*/
|
|
|
+ toolbars: [
|
|
|
+ { key: 'search', icon: 'ibps-icon-search', label: '查询', type: 'primary', hidden: false },
|
|
|
+ { key: 'massAgree', icon: 'ibps-icon-check', label: '批量同意', type: 'success', hidden: false },
|
|
|
+ { key: 'massDisagree', icon: 'ibps-icon-close', label: '批量不同意', type: 'danger', hidden: false }
|
|
|
+ ],
|
|
|
+ searchForm: {
|
|
|
+ labelWidth: 80,
|
|
|
+ itemWidth: 180,
|
|
|
+ forms: [
|
|
|
+ { prop: 'Q^reason_^SL', label: '调班原因' },
|
|
|
+ { prop: 'Q^status^S', label: '状态', fieldType: 'select', options: stateType.filter(item => item.value !== '草稿') },
|
|
|
+ { prop: ['Q^create_time_^DL', 'Q^create_time_^DG'], label: '申请时间', fieldType: 'daterange', itemWidth: 200 }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ // 表格字段配置
|
|
|
+ columns: [
|
|
|
+ { prop: 'createBy', label: '申请人', tags: userOption, width: 100 },
|
|
|
+ { prop: 'createTime', label: '申请时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
|
|
|
+ { prop: 'executor', label: '审批人', tags: userOption, width: 100 },
|
|
|
+ { prop: 'executeDate', label: '审批时间', dateFormat: 'yyyy-MM-dd HH:mm', sortable: 'custom', width: 140 },
|
|
|
+ { prop: 'reason', label: '调班原因', width: 150 },
|
|
|
+ { prop: 'status', label: '状态', tags: stateType, width: 100 },
|
|
|
+ { prop: 'overview', label: '概览', minWidth: 200 }
|
|
|
+ ],
|
|
|
+ rowHandle: {
|
|
|
+ effect: 'deafult',
|
|
|
+ /* effect: 'display',
|
|
|
+ actions: [
|
|
|
+ { key: 'edit', label: '编辑', type: 'primary', icon: 'ibps-icon-edit' },
|
|
|
+ { key: 'detail', label: '详情', type: 'primary', icon: 'ibps-icon-list-alt' }
|
|
|
+ ]*/
|
|
|
+ actions: [
|
|
|
+ { key: 'agree', label: '同意', type: 'success', icon: 'ibps-icon-check', hidden: function (row) { return row.status !== '待审批' && row.status !== '待审核' } },
|
|
|
+ { key: 'disagree', label: '不同意', type: 'danger', icon: 'ibps-icon-close', hidden: function (row) { return row.status !== '待审批' && row.status !== '待审核' } },
|
|
|
+ { key: 'detail', label: '详情', type: 'primary', icon: 'ibps-icon-list-alt', hidden: function (row) { return false } }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created () {
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 加载数据
|
|
|
+ loadData () {
|
|
|
+ this.loading = true
|
|
|
+ queryAdjustment(this.getSearchFormData()).then(res => {
|
|
|
+ ActionUtils.handleListData(this, res.data)
|
|
|
+ this.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取格式化参数
|
|
|
+ */
|
|
|
+ getSearchFormData () {
|
|
|
+ let paramjson = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
|
|
|
+ paramjson['Q^status^NE'] = '草稿'
|
|
|
+ return ActionUtils.formatParams(
|
|
|
+ // this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
|
|
|
+ paramjson,
|
|
|
+ this.pagination,
|
|
|
+ this.sorts
|
|
|
+ )
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 处理分页事件
|
|
|
+ */
|
|
|
+ handlePaginationChange (page) {
|
|
|
+ ActionUtils.setPagination(this.pagination, page)
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 处理排序
|
|
|
+ */
|
|
|
+ handleSortChange (sort) {
|
|
|
+ ActionUtils.setSorts(this.sorts, sort)
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 查询
|
|
|
+ */
|
|
|
+ search () {
|
|
|
+ this.loadData()
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 处理按钮事件
|
|
|
+ */
|
|
|
+ handleAction (command, position, selection, data) {
|
|
|
+ switch (command) {
|
|
|
+ case 'search':
|
|
|
+ ActionUtils.setFirstPagination(this.pagination)
|
|
|
+ this.search()
|
|
|
+ break
|
|
|
+ /*
|
|
|
+ case 'create':
|
|
|
+ this.handleEdit(command, {})
|
|
|
+ break
|
|
|
+ case 'edit':
|
|
|
+ this.handleEdit(command, data)
|
|
|
+ break
|
|
|
+ */
|
|
|
+ case 'massAgree':
|
|
|
+ this.handleMassAgree(command, data)
|
|
|
+ break
|
|
|
+ case 'massDisagree':
|
|
|
+ this.handleMassAgree(command, data)
|
|
|
+ break
|
|
|
+ case 'agree':
|
|
|
+ this.handleAgree(command, data)
|
|
|
+ break
|
|
|
+ case 'disagree':
|
|
|
+ this.handleAgree(command, data)
|
|
|
+ break
|
|
|
+ case 'detail':
|
|
|
+ this.handleEdit(command, data)
|
|
|
+ break
|
|
|
+ case 'remove':
|
|
|
+ ActionUtils.removeRecord(selection).then((ids) => {
|
|
|
+ this.handleRemove(ids)
|
|
|
+ }).catch((e) => { console.error(e) })
|
|
|
+ break
|
|
|
+ default:
|
|
|
+ break
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 处理编辑\详情
|
|
|
+ */
|
|
|
+ async handleEdit (key, { id, scheduleId }) {
|
|
|
+ debugger
|
|
|
+ this.params = {
|
|
|
+ id,
|
|
|
+ scheduleId
|
|
|
+ }
|
|
|
+ this.readonly = key === 'detail'
|
|
|
+ this.showAdjustEdit = true
|
|
|
+ console.log('readonly', this.readonly)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 处理单条同意/不同意
|
|
|
+ */
|
|
|
+ async handleAgree (key, data) {
|
|
|
+ console.log(data)
|
|
|
+ data.status = (key === 'agree' ? (data.status === '待审核' ? '待审批' : '已通过') : '已拒绝')
|
|
|
+ saveAdjustment(data).then(() => {
|
|
|
+ ActionUtils.successMessage()
|
|
|
+ this.search()
|
|
|
+ }).catch((e) => { console.error(e) })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 批量处理同意/不同意
|
|
|
+ */
|
|
|
+ async handleMassAgree (key, data) {
|
|
|
+ console.log(key, data)
|
|
|
+ if (data.length < 1) {
|
|
|
+ ActionUtils.warning('请选择数据!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const tableName = 't_adjustment'
|
|
|
+ let uparr = []
|
|
|
+ data.forEach((el) => {
|
|
|
+ uparr.push({
|
|
|
+ where: {
|
|
|
+ id_: el.id
|
|
|
+ },
|
|
|
+ param: {
|
|
|
+ status: key === 'massAgree' ? (el.status === '待审核' ? '待审批' : '已通过') : '已拒绝'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ const updateParams = {
|
|
|
+ tableName,
|
|
|
+ updList: uparr
|
|
|
+ }
|
|
|
+ this.$common.request('update', updateParams).then(() => {
|
|
|
+ ActionUtils.successMessage()
|
|
|
+ this.search()
|
|
|
+ }).catch((e) => { console.error(e) })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 处理删除
|
|
|
+ */
|
|
|
+ handleRemove (ids) {
|
|
|
+ // return this.$message.warning('避免误删测试数据,联系开发删除')
|
|
|
+ removeAdjustment({ ids }).then(() => {
|
|
|
+ ActionUtils.removeSuccessMessage()
|
|
|
+ this.search()
|
|
|
+ }).catch((e) => { console.error(e) })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 行双击事件
|
|
|
+ *
|
|
|
+ */
|
|
|
+ handleRowDblclick (row) {
|
|
|
+ debugger
|
|
|
+ this.handleEdit(row, 'detail')
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+<style lang="scss"></style>
|