123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- <template>
- <hc-new-dialog v-model="isShow" is-table widths="96%" title="任务审核" @close="cancelClick">
- <template #header="{ titleId, titleClass }">
- <div class="hc-card-header flex items-center">
- <div :id="titleId" :class="titleClass">任务审核 【已开启电签】</div>
- </div>
- </template>
- <div v-loading="isLoading" class="relative h-full">
- <div class="hc-task-name relative">{{ rowInfo.taskName }} 审批信息</div>
- <div class="hc-task-body relative flex">
- <div class="hc-task-time">
- <hc-body class="hc-task-body-card" padding="10px" scrollbar>
- <el-timeline v-if="rowInfo.fixedFlowId == null" class="hc-time-line">
- <template v-for="(item, index) in flowList" :key="index">
- <el-timeline-item :class="item.status === '2' ? 'success' : 'primary'" size="large">
- <div class="timeline-item-icon">
- <hc-icon v-if="item.status === '2'" class="check-icon" name="check" />
- </div>
- <div class="reply-name">{{ item.name }}</div>
- <div class="reply-time">{{ item.date }}</div>
- <div class="reply-content" v-html="item.flowValue" />
- </el-timeline-item>
- </template>
- </el-timeline>
- <el-timeline v-else class="hc-time-line">
- <template v-for="(item, index) in flowListTask" :key="index">
- <el-timeline-item :class="item.status == '2' ? 'success' : 'primary'" size="large">
- <div class="timeline-item-icon">
- <hc-icon v-if="item.status == '2'" class="check-icon" name="check" />
- </div>
- <div v-if="!item.isTask" class="reply-name">
- {{ item.name }}
- </div>
- <div v-if="item.isTask">
- <div class="reply-name">
- {{ item.name }}
- <HcIcon v-if="item.type == 2" name="links" class="ml-2" />
- <HcIcon v-if="item.type == 1" name="exchange-2" class="ml-2" />
- <br>
- <el-tooltip placement="right" effect="light" :visible="item.taskDetailvisible">
- <template #content>
- <el-timeline class="hc-time-line">
- <template v-for="(item1, index1) in item.userList" :key="index1">
- <el-timeline-item :class="item1.status === '2' ? 'success' : 'primary'" size="large">
- <div class="timeline-item-icon">
- <hc-icon v-if="item1.status === '2'" class="check-icon" name="check" />
- </div>
- <div class="reply-name">{{ item1.name }}</div>
- <div class="reply-time">{{ item1.date }}</div>
- <div class="reply-content" v-html="item1.flowValue" />
- </el-timeline-item>
- </template>
- </el-timeline>
- </template>
- <el-link @click="getTaskDetail" @mouseenter="item.taskDetailvisible = true" @mouseleave="item.taskDetailvisible = false">点击查看详情</el-link>
- </el-tooltip>
- </div>
- </div>
-
- <div class="reply-time">{{ item.date }}</div>
- <div class="reply-content" v-html="item.flowValue" />
- </el-timeline-item>
- </template>
- </el-timeline>
- </hc-body>
- </div>
- <div :id="`hc_task_table_${uuid}`" class="hc-task-table">
- <hc-body class="hc-task-body-card" padding="10px">
- <hc-table
- ref="tableRef" :column="tableColumn" :datas="tableData" :is-stripe="false"
- is-new :index-style="{ width: 60 }" is-current-row @row-click="tableRowClick"
- >
- <template #action="{ row }">
- <div class="hc-task-table-action" :class="row.isComment === 1 ? 'is-cur' : ''" @click="rowRemarkClick(row)">
- <i class="i-iconoir-star-solid" />
- </div>
- </template>
- <template #state="{ row }">
- <div class="hc-task-table-state">
- <i v-if="row.status === 1" class="i-iconoir-check-circle-solid is-success" />
- <i v-else-if="row.status === 2" class="i-iconoir-xmark-circle-solid is-danger" />
- <span v-else-if="row.status === 3">审批结束</span>
- <i v-else class="i-iconoir-help-circle-solid" />
- </div>
- </template>
- </hc-table>
- </hc-body>
- </div>
- <div :id="`hc_task_form_${uuid}`" class="hc-task-form">
- <hc-body class="hc-task-body-card" padding="10px" scrollbar>
- <HcTaskForm :table="tableInfo" :info="rowInfo" :is-edit="tabsKey === 1" @finish="taskFormFinish" />
- </hc-body>
- </div>
- </div>
- </div>
- <template #footer>
- <div class="hc-task-dialog-footer">
- <el-button :disabled="tabsKey !== 1" @click="rejectionClick">驳回审批</el-button>
- <el-button type="primary" :loading="confirmLoading" :disabled="tabsKey !== 1" @click="confirmClick">同意审批</el-button>
- </div>
- </template>
- </hc-new-dialog>
-
- <HcTaskNotes v-model="isNotesShow" :table="tableNoteInfo" :info="rowInfo" :is-edit="tabsKey === 1" @finish="taskNotesFinish" />
-
- <HcRepealForm v-model="isRepealShow" :info="rowInfo" @finish="taskRepealFinish" />
- </template>
- <script setup>
- import { nextTick, ref, watch } from 'vue'
- import { arrUnion, getArrValue, getObjValue, getRandom } from 'js-fast-way'
- import { useAppStore } from '~src/store'
- import HcTaskForm from './task-form.vue'
- import HcTaskNotes from './task-notes.vue'
- import HcRepealForm from './repeal-form.vue'
- import mainApi from '~api/tasks/hc-data'
- const props = defineProps({
- tabs: {
- type: [String, Number],
- default: '',
- },
- row: {
- type: Object,
- default: () => ({}),
- },
- })
- const emit = defineEmits(['finish', 'close'])
- const uuid = getRandom(4)
- const useAppState = useAppStore()
- const projectId = ref(useAppState.getProjectId || '')
- const contractId = ref(useAppState.getContractId || '')
- const isShow = defineModel('modelValue', {
- default: false,
- })
- const tableRef = ref(null)
- const tabsKey = ref(Number(props.tabs))
- const rowInfo = ref(props.row)
- watch(() => [
- props.tabs,
- props.row,
- ], ([key, row]) => {
- tabsKey.value = Number(key)
- rowInfo.value = row
- console.log(rowInfo.value.fixedFlowId == null)
-
- }, {
- immediate: true,
- deep: true,
- })
- watch(isShow, (val) => {
- if (val) {
- setTaskInfo()
- setSplitRef()
- }
- })
- const setSplitRef = () => {
-
- nextTick(() => {
- window.$split(['#hc_task_table_' + uuid, '#hc_task_form_' + uuid], {
- sizes: [50, 50],
- snapOffset: 0,
- minSize: [50, 500],
- })
- })
- }
- const setTaskInfo = () => {
-
- const { meterType } = rowInfo.value
- if (meterType === 1) {
- tableColumn.value = middlepayTableColumn.value
- } else if (meterType === 2) {
- tableColumn.value = materialTableColumn.value
- } else if (meterType === 3) {
- tableColumn.value = startWorkTableColumn.value
- } else if (meterType === 4) {
- tableColumn.value = alterTableColumn.value
- } else {
- tableColumn.value = []
- }
- getTableDetail()
- }
- const isLoading = ref(false)
- const getTableDetail = async () => {
- isLoading.value = true
- confirmLoading.value = true
-
- const { data } = await mainApi.getDetail(rowInfo.value.id)
- const { taskProcessInfo, taskCenterDataInfo } = getObjValue(data)
- tableData.value = getArrValue(taskCenterDataInfo)
- flowList.value = getArrValue(taskProcessInfo)
- if (rowInfo.value?.fixedFlowId) {
- const list = [...flowList.value]
- let firstarr = list.slice(0, 1)
- let taskList = list.slice(1, list.length)
- taskList.forEach((ele)=>{
- ele.name = ele.taskBranchName
- ele.status = ele.taskBranchStatus
- ele.type = ele.taskBranchType
- ele.isTask = true
- })
- flowListTask.value = arrUnion(firstarr, taskList)
- }
-
-
- let info = {}
- if (tableData.value.length > 0) {
- info = tableData.value[0]
- }
- await nextTick(() => {
- tableInfo.value = info
- tableRef.value?.tableRef?.setCurrentRow(info)
- })
-
- isLoading.value = false
- confirmLoading.value = false
- }
- const flowList = ref([])
- const flowListTask = ref([
- { name: 'PCT', date: '2024-03-01 09:27:17', status: '2', flowValue: '上报', isTask:false },
- { name: '"222"', date: '', status: '2', flowValue: '', type:1, isTask:true },
- { name: '"111"', date: '', status: '1', flowValue: '', type:2, isTask:true },
- ])
- const taskDetailList = ref([])
- const middlepayTableColumn = ref([
- { key: 'action', name: '批注', width: 45, align: 'center' },
- { key: 'meterNumber', name: '计量单编号' },
- { key: 'meterMoney', name: '计量金额', width: 100 },
- { key: 'engineerDivide', name: '工程划分' },
- { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
- ])
- const startWorkTableColumn = ref([
- { key: 'action', name: '批注', width: 45, align: 'center' },
- { key: 'periodName', name: '计量期', minWidth: 100, align: 'center' },
- { key: 'businessDate', name: '业务日期', width: 160, align: 'center' },
- { key: 'meterMoney', name: '计量金额', width: 100, align: 'center' },
- { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
- ])
- const alterTableColumn = ref([
- { key: 'action', name: '批注', width: 45, align: 'center' },
- { key: 'changeNumber', name: '变更编号', minWidth: 120, align: 'center' },
- { key: 'changeName', name: '变更名称', minWidth: 120, align: 'center' },
- { key: 'changeMoney', name: '变更金额', width: 100, align: 'center' },
- { key: 'changeApprovalDate', name: '变更批复日期', width: 160, align: 'center' },
- { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
- ])
- const materialTableColumn = ref([
- { key: 'action', name: '批注', width: 45, align: 'center' },
- { key: 'periodName', name: '计量期', minWidth: 100, align: 'center' },
- { key: 'contractMaterialName', name: '合同材料', minWidth: 120, align: 'center' },
- { key: 'materialArriveNumber', name: '材料到场编号', width: 120, align: 'center' },
- { key: 'meterMoney', name: '计量金额', width: 100, align: 'center' },
- { key: 'state', name: '审批状态', fixed: 'right', width: 70, align: 'center' },
- ])
- const tableColumn = ref([])
- const tableData = ref([])
- const tableInfo = ref({})
- const tableRowClick = ({ row }) => {
- tableInfo.value = row
- }
- const isNotesShow = ref(false)
- const tableNoteInfo = ref({})
- const rowRemarkClick = (row) => {
- tableNoteInfo.value = row
- nextTick(() => {
- isNotesShow.value = true
- })
- }
- const taskNotesFinish = () => {
- getTableDetail()
- }
- const taskFormFinish = () => {
- getTableDetail()
- }
- const confirmLoading = ref(false)
- const confirmClick = async () => {
- confirmLoading.value = true
- const { error, code, msg } = await mainApi.taskApprove({
- taskId: rowInfo.value.id,
- projectId: projectId.value,
- contractId: contractId.value,
- })
- confirmLoading.value = false
- if (!error && code === 200) {
- window.$message.success('审批成功')
- emit('finish')
- cancelClick()
- } else {
- window.$message.error(msg ?? '审批失败')
- }
- }
- const isRepealShow = ref(false)
- const rejectionClick = async () => {
- isRepealShow.value = true
- }
- const taskRepealFinish = () => {
- emit('finish')
- cancelClick()
- }
- const cancelClick = () => {
- isShow.value = false
- isLoading.value = false
- confirmLoading.value = false
- tableColumn.value = []
- tableData.value = []
- tableInfo.value = {}
- emit('close')
- }
- const taskDetailvisible = ref(false)
- const getTaskDetail = ()=>{
- taskDetailvisible.value = true
- }
- </script>
- <style lang="scss" scoped>
- .hc-task-name {
- font-weight: bold;
- color: #1A1a1a;
- padding-bottom: 10px;
- border-bottom: 1px solid #f5f5f5;
- }
- .hc-task-body {
- height: calc(100% - 27px);
- .hc-task-time {
- position: relative;
- height: 100%;
- flex-shrink: 0;
- width: 170px;
- }
- .hc-task-table, .hc-task-form {
- position: relative;
- height: 100%;
- flex: 1;
- flex-basis: auto;
- }
- .hc-task-table {
- border-left: 1px solid #e5e5e5;
- }
- }
- //表格图标
- .hc-task-table-action, .hc-task-table-state {
- position: relative;
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- font-size: 20px;
- color: #929293;
- i {
- display: inline-flex;
- }
- }
- //表格批注
- .hc-task-table-action.is-cur {
- color: #F2B90B;
- }
- //表格状态
- .hc-task-table-state {
- .is-success {
- color: #25a62d;
- }
- .is-danger {
- color: #F5221D;
- }
- span {
- color: #1A1a1a;
- }
- }
- //弹窗底部
- .hc-task-dialog-footer {
- position: relative;
- text-align: center;
- }
- </style>
- <style lang="scss">
- .hc-task-body-card {
- background: #f7f7f7;
- .el-scrollbar__bar.is-vertical {
- right: -8px;
- }
- }
- </style>
|