|
@@ -7,6 +7,22 @@
|
|
|
<template #extra>
|
|
|
<HcTooltip keys="system-service-plan-save-btn">
|
|
|
<el-button
|
|
|
+ v-if="status === 2 "
|
|
|
+ :disabled="!isSendUserAuthorized"
|
|
|
+ class="ml-6"
|
|
|
+ hc-btn
|
|
|
+ keys="system-service-plan-save-btn"
|
|
|
+ type="primary"
|
|
|
+ :loading="saveLoading"
|
|
|
+
|
|
|
+ @click="savePlan"
|
|
|
+ >
|
|
|
+ <HcIcon name="save" />
|
|
|
+ 保存数据
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-else
|
|
|
+
|
|
|
class="ml-6"
|
|
|
hc-btn
|
|
|
keys="system-service-plan-save-btn"
|
|
@@ -34,43 +50,44 @@
|
|
|
</HcTooltip>
|
|
|
<HcTooltip keys="system-service-plan-send-btn">
|
|
|
<el-button
|
|
|
- v-if="status === 1 "
|
|
|
+ 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 "
|
|
|
+ v-if="status === 3"
|
|
|
class="node-card-plan-btn ml-6"
|
|
|
hc-btn
|
|
|
keys="system-service-plan-send-btn"
|
|
|
type="warning"
|
|
|
:loading="sendPlanLoad"
|
|
|
+ :disabled="!isWriteUserAuthorized || dataId.length === 0 "
|
|
|
@click="sendPlan"
|
|
|
>
|
|
|
<HcIcon name="send-plane" />
|
|
|
发送计划
|
|
|
</el-button>
|
|
|
</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)"
|
|
|
+ :loading="backPlanLoad"
|
|
|
+ @click="backPlan"
|
|
|
>
|
|
|
<HcIcon name="arrow-go-back" />
|
|
|
计划回退
|
|
@@ -79,13 +96,13 @@
|
|
|
<HcTooltip keys="system-service-plan-comfirm-btn">
|
|
|
<el-button
|
|
|
v-if="status === 2"
|
|
|
- :loading="sendPlanLoad"
|
|
|
+ :loading="confirmPlanLoad"
|
|
|
class="node-card-plan-btn ml-6"
|
|
|
hc-btn
|
|
|
keys="system-service-plan-comfirm-btn"
|
|
|
type="success"
|
|
|
:disabled="!isSendUserAuthorized"
|
|
|
- @click="sendPlanClick(4)"
|
|
|
+ @click="confirmPlan"
|
|
|
>
|
|
|
<HcIcon name="check" />
|
|
|
确认计划
|
|
@@ -112,12 +129,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { computed, ref, watch } from 'vue'
|
|
|
+import { computed, nextTick, 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: {
|
|
@@ -144,11 +162,11 @@ const isTableForm = ref(false)
|
|
|
const useAppState = useAppStore()
|
|
|
const projectId = ref(useAppState.getProjectId)
|
|
|
const contractId = ref(useAppState.getContractId)
|
|
|
-const { user_id } = ref(useAppState.getUserInfo)
|
|
|
+const user_id = ref(useAppState.getUserInfo.user_id ?? '')
|
|
|
const status = ref()
|
|
|
|
|
|
-watch(isShow, (val) => {
|
|
|
-
|
|
|
+watch(isShow, async (val) => {
|
|
|
+ await nextTick()
|
|
|
|
|
|
if (val) {
|
|
|
if (val) getExcelHtml()
|
|
@@ -156,15 +174,22 @@ watch(isShow, (val) => {
|
|
|
excelHtmlData.value = ''
|
|
|
isTableForm.value = false
|
|
|
|
|
|
- if (dataId.value) {
|
|
|
+
|
|
|
+ if (dataId.value) {
|
|
|
|
|
|
|
|
|
getDetailData()
|
|
|
getAddLogBusinessData()
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ } else {
|
|
|
+ status.value = ''
|
|
|
+ sendUser.value = ''
|
|
|
+ writeUser.value = ''
|
|
|
|
|
|
}
|
|
|
-})
|
|
|
+}, { immediate: true })
|
|
|
//监听
|
|
|
watch(() => [
|
|
|
props.type,
|
|
@@ -178,10 +203,13 @@ watch(() => [
|
|
|
} else {
|
|
|
excelIdVal.value = '1937773223861026822'
|
|
|
}
|
|
|
-
|
|
|
+ if (id) {
|
|
|
+ getAddLogBusinessData()
|
|
|
+ getDetailData()
|
|
|
+ }
|
|
|
|
|
|
|
|
|
-})
|
|
|
+}, { immediate: true })
|
|
|
|
|
|
//获取模板标签数据
|
|
|
|
|
@@ -253,11 +281,24 @@ const sendPlan = ()=>{
|
|
|
}
|
|
|
// 计算属性:判断 writeUser 是否包含 user_id
|
|
|
const isWriteUserAuthorized = computed(() => {
|
|
|
- return writeUser.value.includes(user_id.value)
|
|
|
+
|
|
|
+ const writeUserStr = writeUser.value
|
|
|
+ const writeUserArray = writeUserStr.split(',')
|
|
|
+ const cleanedArray = writeUserArray.filter(item => item.trim() !== '')
|
|
|
+
|
|
|
+ console.log(cleanedArray, 'cleanedArray')
|
|
|
+ console.log(user_id.value, 'user_id.value')
|
|
|
+
|
|
|
+
|
|
|
+ return cleanedArray.includes(user_id.value)
|
|
|
+
|
|
|
})
|
|
|
// 计算属性:判断 sendUser 是否包含 user_id
|
|
|
const isSendUserAuthorized = computed(() => {
|
|
|
- return sendUser.value.includes(user_id.value)
|
|
|
+ const writeUserStr = sendUser.value
|
|
|
+ const writeUserArray = writeUserStr.split(',')
|
|
|
+ const cleanedArray = writeUserArray.filter(item => item.trim() !== '')
|
|
|
+ return cleanedArray.includes(user_id.value)
|
|
|
})
|
|
|
const isUserModalShow = ref(false)
|
|
|
const userData = ref([])
|
|
@@ -283,7 +324,7 @@ const sendPlanClick = async (type)=>{
|
|
|
{
|
|
|
id: dataId.value,
|
|
|
sendUser: userIds.value,
|
|
|
- status:type,
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -300,6 +341,45 @@ const sendPlanClick = async (type)=>{
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+//回退计划
|
|
|
+const backPlanLoad = ref(false)
|
|
|
+const backPlan = async ()=>{
|
|
|
+ backPlanLoad.value = true
|
|
|
+ const { error, code, msg, data } = await dataApi.cancelServicePlan(
|
|
|
+ {
|
|
|
+ id: dataId.value,
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ , false)
|
|
|
+ backPlanLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ getDetailData()
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+//确认计划
|
|
|
+const confirmPlanLoad = ref(false)
|
|
|
+const confirmPlan = async ()=>{
|
|
|
+ confirmPlanLoad.value = true
|
|
|
+ const { error, code, msg, data } = await dataApi.confirmServicePlan(
|
|
|
+ {
|
|
|
+ id: dataId.value,
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ , false)
|
|
|
+ confirmPlanLoad.value = false
|
|
|
+ if (!error && code === 200) {
|
|
|
+
|
|
|
+ window?.$message?.success(msg)
|
|
|
+ getDetailData()
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
//保存数据
|
|
|
const saveLoading = ref(false)
|
|
|
const savePlan = async ()=>{
|
|
@@ -310,7 +390,7 @@ const savePlan = async ()=>{
|
|
|
projectId: projectId.value,
|
|
|
contractId: contractId.value,
|
|
|
pkeyId: excelIdVal.value,
|
|
|
- groupId: dataId.value,
|
|
|
+ group_id: dataId.value,
|
|
|
|
|
|
|
|
|
}
|
|
@@ -367,8 +447,12 @@ const getDetailData = async ()=>{
|
|
|
const res = getObjVal(data)
|
|
|
|
|
|
status.value = res.status
|
|
|
+ console.log( status.value, ' status.value')
|
|
|
+ console.log(user_id, ' user_id.value')
|
|
|
+
|
|
|
+
|
|
|
sendUser.value = res.sendUser
|
|
|
- writeUser.value = res.updateUser
|
|
|
+ writeUser.value = res.writeUser
|
|
|
|
|
|
|
|
|
} else {
|