fromDrawer.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <hc-drawer v-model="isShow" to-id="node-card-plan" is-close>
  3. <hc-card>
  4. <template #header>
  5. <el-link type="primary" @click="goBack">返回</el-link>
  6. </template>
  7. <template #extra>
  8. <HcTooltip keys="system-service-plan-save-btn">
  9. <el-button
  10. class="ml-6"
  11. hc-btn
  12. keys="system-service-plan-save-btn"
  13. type="primary"
  14. >
  15. <HcIcon name="save" />
  16. 保存数据
  17. </el-button>
  18. </HcTooltip>
  19. <HcTooltip keys="system-service-plan-preview-btn">
  20. <el-button
  21. class="node-card-plan-btn ml-6"
  22. hc-btn
  23. keys="system-service-plan-preview-btn"
  24. color="#3F9EFF"
  25. >
  26. <HcIcon name="eye" />
  27. 预览
  28. </el-button>
  29. </HcTooltip>
  30. <HcTooltip keys="system-service-plan-send-btn">
  31. <el-button
  32. class="node-card-plan-btn ml-6"
  33. hc-btn
  34. keys="system-service-plan-send-btn"
  35. type="warning"
  36. @click="sendPlan"
  37. >
  38. <HcIcon name="send-plane" />
  39. 发送计划
  40. </el-button>
  41. </HcTooltip>
  42. <HcTooltip keys="system-service-plan-back-btn">
  43. <el-button
  44. class="node-card-plan-btn ml-6"
  45. hc-btn
  46. keys="system-service-plan-back-btn"
  47. type="warning"
  48. >
  49. <HcIcon name="arrow-go-back" />
  50. 计划回退
  51. </el-button>
  52. </HcTooltip>
  53. <HcTooltip keys="system-service-plan-comfirm-btn">
  54. <el-button
  55. class="node-card-plan-btn ml-6"
  56. hc-btn
  57. keys="system-service-plan-comfirm-btn"
  58. type="success"
  59. >
  60. <HcIcon name="check" />
  61. 确认计划
  62. </el-button>
  63. </HcTooltip>
  64. </template>
  65. <div class="hc-table-form-box">
  66. <HcTableForm
  67. ref="tableFormRef"
  68. :form="tableFormData"
  69. :html="excelHtmlData"
  70. :loading="loading"
  71. :pkey="excelIdVal"
  72. @render="tableFormRender"
  73. />
  74. </div>
  75. </hc-card>
  76. <!-- 选择任务人 -->
  77. <HcUserModal v-model="isUserModalShow" :data="userData" :datas="dataInfo" @finish="fixedUserFinish" />
  78. </hc-drawer>
  79. </template>
  80. <script setup>
  81. import { ref, watch } from 'vue'
  82. import { arrToKey, deepClone, isString } from 'js-fast-way'
  83. import HcUserModal from './hc-tasks-user/user-modal.vue'
  84. import { useAppStore } from '~src/store'
  85. import dataApi from '~api/systemService/service'
  86. const isShow = defineModel('modelValue', {
  87. default: false,
  88. })
  89. const tableFormRef = ref(null)
  90. const tableFormData = ref({})
  91. const excelHtmlData = ref('')
  92. const loading = ref(false)
  93. const excelIdVal = ref('')
  94. const isTableForm = ref(false)
  95. const useAppState = useAppStore()
  96. const projectId = ref(useAppState.getProjectId)
  97. const contractId = ref(useAppState.getContractId)
  98. watch(isShow, (val) => {
  99. if (val) getExcelHtml()
  100. })
  101. //获取模板标签数据
  102. const getExcelHtml = async () => {
  103. //获取数据
  104. const { error, code, data } = await dataApi.getServiceHtml({
  105. contractId: contractId.value || '',
  106. type:1,
  107. projectId: projectId.value || '',
  108. }, false)
  109. //处理数据
  110. const resData = isString(data) ? data || '' : ''
  111. if (!error && code === 200 && resData) {
  112. excelHtmlData.value = resData
  113. } else {
  114. excelHtmlData.value = ''
  115. isTableForm.value = false
  116. }
  117. }
  118. //渲染表单完成
  119. const tableFormRender = (form) => {
  120. isTableForm.value = form.isRenderForm
  121. }
  122. const goBack = () => {
  123. isShow.value = false
  124. }
  125. const sendPlan = ()=>{
  126. isUserModalShow.value = true
  127. }
  128. const isUserModalShow = ref(false)
  129. const userData = ref([])
  130. const dataInfo = ref({
  131. projectId:projectId.value,
  132. contractId:contractId.value,
  133. })
  134. const fixedUserFinish = (data) => {
  135. const res = deepClone(data)
  136. console.log(res, 'res')
  137. userData.value = res
  138. const userIds = arrToKey(res, 'userId', ',')
  139. let userIdsArr = userIds.split(',')
  140. }
  141. </script>
  142. <style scoped lang="scss">
  143. .node-card-plan-btn{
  144. color:white;
  145. }
  146. </style>