|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <hc-drawer v-model="isShow" to-id="node-card-plan" is-close>
|
|
|
+ <hc-drawer v-model="isShow" to-id="node-card-plan" is-close @close="goBack">
|
|
|
<hc-card>
|
|
|
<template #header>
|
|
|
<el-link type="primary" @click="goBack">返回</el-link>
|
|
@@ -24,6 +24,9 @@
|
|
|
hc-btn
|
|
|
keys="system-service-plan-preview-btn"
|
|
|
color="#3F9EFF"
|
|
|
+ :loading="preViewLoad"
|
|
|
+ :disabled="dataId.length === 0 "
|
|
|
+ @click="previewPlan"
|
|
|
>
|
|
|
<HcIcon name="eye" />
|
|
|
预览
|
|
@@ -31,10 +34,27 @@
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="system-service-plan-send-btn">
|
|
|
<el-button
|
|
|
+ v-if="status === 1 "
|
|
|
class="node-card-plan-btn ml-6"
|
|
|
hc-btn
|
|
|
keys="system-service-plan-send-btn"
|
|
|
type="warning"
|
|
|
+ :loading="sendPlanLoad"
|
|
|
+ :disabled="!isWriteUserAuthorized"
|
|
|
+ @click="sendPlan"
|
|
|
+ >
|
|
|
+ <HcIcon name="send-plane" />
|
|
|
+ 发送计划
|
|
|
+ </el-button>
|
|
|
+ </HcTooltip>
|
|
|
+ <HcTooltip keys="system-service-plan-send-btn">
|
|
|
+ <el-button
|
|
|
+ v-if="status === 3 "
|
|
|
+ class="node-card-plan-btn ml-6"
|
|
|
+ hc-btn
|
|
|
+ keys="system-service-plan-send-btn"
|
|
|
+ type="warning"
|
|
|
+ :loading="sendPlanLoad"
|
|
|
@click="sendPlan"
|
|
|
>
|
|
|
<HcIcon name="send-plane" />
|
|
@@ -43,11 +63,14 @@
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="system-service-plan-back-btn">
|
|
|
<el-button
|
|
|
+ v-if="status === 2"
|
|
|
class="node-card-plan-btn ml-6"
|
|
|
hc-btn
|
|
|
keys="system-service-plan-back-btn"
|
|
|
-
|
|
|
+ :loading="sendPlanLoad"
|
|
|
type="warning"
|
|
|
+ :disabled="!isSendUserAuthorized"
|
|
|
+ @click="sendPlanClick(3)"
|
|
|
>
|
|
|
<HcIcon name="arrow-go-back" />
|
|
|
计划回退
|
|
@@ -55,11 +78,14 @@
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="system-service-plan-comfirm-btn">
|
|
|
<el-button
|
|
|
+ v-if="status === 2"
|
|
|
+ :loading="sendPlanLoad"
|
|
|
class="node-card-plan-btn ml-6"
|
|
|
hc-btn
|
|
|
keys="system-service-plan-comfirm-btn"
|
|
|
-
|
|
|
type="success"
|
|
|
+ :disabled="!isSendUserAuthorized"
|
|
|
+ @click="sendPlanClick(4)"
|
|
|
>
|
|
|
<HcIcon name="check" />
|
|
|
确认计划
|
|
@@ -86,11 +112,12 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, watch } from 'vue'
|
|
|
+import { computed, ref, watch } from 'vue'
|
|
|
import { arrToKey, deepClone, getObjVal, isString } from 'js-fast-way'
|
|
|
import HcUserModal from './hc-tasks-user/user-modal.vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import dataApi from '~api/systemService/service'
|
|
|
+import { toPdfPage } from '~uti/btn-auth'
|
|
|
//参数
|
|
|
const props = defineProps({
|
|
|
type: {
|
|
@@ -102,6 +129,7 @@ const props = defineProps({
|
|
|
default:'',
|
|
|
},
|
|
|
})
|
|
|
+const emit = defineEmits(['close'])
|
|
|
const type = ref(props.type)
|
|
|
const dataId = ref(props.dataId)
|
|
|
const isShow = defineModel('modelValue', {
|
|
@@ -116,10 +144,25 @@ const isTableForm = ref(false)
|
|
|
const useAppState = useAppStore()
|
|
|
const projectId = ref(useAppState.getProjectId)
|
|
|
const contractId = ref(useAppState.getContractId)
|
|
|
+const { user_id } = ref(useAppState.getUserInfo)
|
|
|
+const status = ref()
|
|
|
|
|
|
watch(isShow, (val) => {
|
|
|
+
|
|
|
+
|
|
|
if (val) {
|
|
|
- if (dataId.value) getAddLogBusinessData()
|
|
|
+ if (val) getExcelHtml()
|
|
|
+ tableFormData.value = {}
|
|
|
+ excelHtmlData.value = ''
|
|
|
+ isTableForm.value = false
|
|
|
+
|
|
|
+ if (dataId.value) {
|
|
|
+
|
|
|
+
|
|
|
+ getDetailData()
|
|
|
+ getAddLogBusinessData()
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
//监听
|
|
@@ -136,7 +179,7 @@ watch(() => [
|
|
|
excelIdVal.value = '1937773223861026822'
|
|
|
}
|
|
|
|
|
|
- if (val) getExcelHtml()
|
|
|
+
|
|
|
|
|
|
})
|
|
|
|
|
@@ -200,24 +243,62 @@ const tableFormRender = (form) => {
|
|
|
}
|
|
|
const goBack = () => {
|
|
|
isShow.value = false
|
|
|
+ emit('close')
|
|
|
}
|
|
|
const sendPlan = ()=>{
|
|
|
+ userData.value = []
|
|
|
+
|
|
|
isUserModalShow.value = true
|
|
|
|
|
|
}
|
|
|
+// 计算属性:判断 writeUser 是否包含 user_id
|
|
|
+const isWriteUserAuthorized = computed(() => {
|
|
|
+ return writeUser.value.includes(user_id.value)
|
|
|
+})
|
|
|
+// 计算属性:判断 sendUser 是否包含 user_id
|
|
|
+const isSendUserAuthorized = computed(() => {
|
|
|
+ return sendUser.value.includes(user_id.value)
|
|
|
+})
|
|
|
const isUserModalShow = ref(false)
|
|
|
const userData = ref([])
|
|
|
const dataInfo = ref({
|
|
|
projectId:projectId.value,
|
|
|
contractId:contractId.value,
|
|
|
})
|
|
|
-const fixedUserFinish = (data) => {
|
|
|
+const userIds = ref('')
|
|
|
+const fixedUserFinish = async (data) => {
|
|
|
const res = deepClone(data)
|
|
|
- console.log(res, 'res')
|
|
|
userData.value = res
|
|
|
- const userIds = arrToKey(res, 'userId', ',')
|
|
|
- let userIdsArr = userIds.split(',')
|
|
|
-
|
|
|
+ userIds.value = arrToKey(res, 'userId', ',')
|
|
|
+
|
|
|
+ console.log(userIds, 'userIds')
|
|
|
+ sendPlanClick(2)
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+const sendPlanLoad = ref(false)
|
|
|
+const sendPlanClick = async (type)=>{
|
|
|
+ sendPlanLoad.value = true
|
|
|
+ const { error, code, msg, data } = await dataApi.sendServicePlan(
|
|
|
+ {
|
|
|
+ id: dataId.value,
|
|
|
+ sendUser: userIds.value,
|
|
|
+ status:type,
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ , false)
|
|
|
+ sendPlanLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ getDetailData()
|
|
|
+
|
|
|
+ } else {
|
|
|
+ sendPlanLoad.value = false
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
//保存数据
|
|
|
const saveLoading = ref(false)
|
|
@@ -229,6 +310,8 @@ const savePlan = async ()=>{
|
|
|
projectId: projectId.value,
|
|
|
contractId: contractId.value,
|
|
|
pkeyId: excelIdVal.value,
|
|
|
+ groupId: dataId.value,
|
|
|
+
|
|
|
|
|
|
}
|
|
|
saveLoading.value = true
|
|
@@ -238,8 +321,10 @@ const savePlan = async ()=>{
|
|
|
, false)
|
|
|
saveLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
|
-
|
|
|
+ dataId.value = data
|
|
|
+
|
|
|
window?.$message?.success(msg)
|
|
|
+ getDetailData()
|
|
|
|
|
|
} else {
|
|
|
saveLoading.value = false
|
|
@@ -247,6 +332,52 @@ const savePlan = async ()=>{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+//预览
|
|
|
+const preViewLoad = ref(false)
|
|
|
+const previewPlan = async ()=>{
|
|
|
+ preViewLoad.value = true
|
|
|
+ const { error, code, data } = await dataApi.getDetail({
|
|
|
+ id: dataId.value,
|
|
|
+
|
|
|
+ }, false)
|
|
|
+ preViewLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+ const res = getObjVal(data)
|
|
|
+ const { pdfUrl } = res
|
|
|
+ if (pdfUrl) {
|
|
|
+ toPdfPage(pdfUrl)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ window?.$message?.error('暂无预览文件')
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ window?.$message?.error('暂无预览文件')
|
|
|
+ }
|
|
|
+}
|
|
|
+const sendUser = ref('')
|
|
|
+const writeUser = ref('')
|
|
|
+const getDetailData = async ()=>{
|
|
|
+ const { error, code, data } = await dataApi.getDetail({
|
|
|
+ id: dataId.value,
|
|
|
+
|
|
|
+ }, false)
|
|
|
+ if (!error && code === 200) {
|
|
|
+ const res = getObjVal(data)
|
|
|
+
|
|
|
+ status.value = res.status
|
|
|
+ sendUser.value = res.sendUser
|
|
|
+ writeUser.value = res.updateUser
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ status.value = ''
|
|
|
+ sendUser.value = ''
|
|
|
+ writeUser.value = ''
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|