entry-sampling.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div class="hc-page-layout-box">
  3. <div :class="isCard ? '' : 'is-action'" class="hc-layout-left-box" style="width: 400px;">
  4. <div class="hc-project-box">
  5. <div class="hc-project-icon-box">
  6. <HcIcon name="book-read" />
  7. </div>
  8. <div class="ml-2 project-name-box">
  9. <span class="text-xl text-cut project-alias">调卷抽检范围配置</span>
  10. <div class="text-xs text-cut project-name text-orange">请勾选您所擅长或侧重想要查看的验收类别</div>
  11. </div>
  12. </div>
  13. <div class="hc-type-choose-content">
  14. <el-scrollbar>
  15. <el-checkbox-group v-model="checkList" size="large" :disabled="!isNull">
  16. <div v-for="item in checkData" :key="item.key" class="hc-type-choose-checkbox">
  17. <el-checkbox :label="item.key">{{ item.name }}</el-checkbox>
  18. </div>
  19. </el-checkbox-group>
  20. </el-scrollbar>
  21. </div>
  22. <div class="hc-type-choose-tip text-orange">
  23. <div>提示:</div>
  24. <div class="text-2">1、勾选抽检侧重偏好,系统会自动根据您的偏好及案卷数量分配抽检范围</div>
  25. <div class="text-3">
  26. 2、若您勾选的侧重偏好与其他专家一致,系统会根据登录的先后顺序,优先分配;若系统检测您设置的偏好范围,未有可抽检的案卷,则系统会随机给您分配其他未抽检的案卷范围
  27. </div>
  28. </div>
  29. <div class="hc-type-choose-action">
  30. <el-button :disabled="checkList.length <= 0" hc-btn @click="emptyTypeClick">
  31. <HcIcon name="close" />
  32. <span>清空重置</span>
  33. </el-button>
  34. <el-button :disabled="checkList.length <= 0" hc-btn type="primary" @click="confirmAllocationClick">
  35. <HcIcon name="check" />
  36. <span>确认分配</span>
  37. </el-button>
  38. </div>
  39. </div>
  40. <div class="hc-page-content-box">
  41. <div v-if="isCard" class="arrow-right-icon-box">
  42. <HcIcon class="icon" name="arrow-right-circle" />
  43. </div>
  44. <div v-if="isNull" class="hc-type-choose-null">
  45. <div class="null-flex-view">
  46. <HcIcon class="icon" fill name="spam-2" />
  47. <div class="mt-4">请在左侧勾选您验收侧重范围</div>
  48. </div>
  49. </div>
  50. <hc-new-card v-if="isCard" scrollbar>
  51. <template #header>
  52. <div class="title text-lg hc-card-header-title">
  53. <HcIcon name="book-2" />
  54. <span class="ml-2">抽检目录范围</span>
  55. </div>
  56. </template>
  57. <template #extra>
  58. <span class="text-orange text-sm">为您分配抽检范围,若有异动,可手动勾选想要验收的部分</span>
  59. </template>
  60. <HcTree ref="treeRef" style="margin-bottom: 10px;" :tree-data="ElTreeData" @getCheckKeys="getCheckKeys" />
  61. <template #action>
  62. <div class="hc-card-action-diy">
  63. <el-button hc-btn @click="clearResetClick">
  64. <HcIcon name="refresh" />
  65. <span>清空重置</span>
  66. </el-button>
  67. <el-button hc-btn type="primary" :loading="inspectionLoaing" @click="ToInspection">
  68. <HcIcon name="check" />
  69. <span>确认并进入抽检</span>
  70. </el-button>
  71. </div>
  72. </template>
  73. </hc-new-card>
  74. </div>
  75. <HcLoading v-if="isLoading" num="76" />
  76. </div>
  77. </template>
  78. <script setup>
  79. import { ref } from 'vue'
  80. import { useAppStore } from '~src/store'
  81. import { useRouter } from 'vue-router'
  82. import HcTree from './components/entry-sampling/hc-tree.vue'
  83. import initialgApi from '~api/initial/initial'
  84. import { getArrValue } from 'js-fast-way'
  85. //变量
  86. const router = useRouter()
  87. const useAppState = useAppStore()
  88. const projectId = ref(useAppState.getProjectId)
  89. const contractId = ref(useAppState.getContractId)
  90. const projectInfo = ref(useAppState.getProjectInfo)
  91. //角色组
  92. const checkList = ref([])
  93. const checkData = ref([
  94. { name: '业主', key: '1' }, { name: '监理', key: '2' }, { name: '施工', key: '3' },
  95. { name: '影像', key: '4' }, { name: '竣工图', key: '5' },
  96. ])
  97. //清空重置
  98. const emptyTypeClick = () => {
  99. checkList.value = []
  100. }
  101. //是否显示
  102. const isNull = ref(true)
  103. const isCard = ref(false)
  104. const isLoading = ref(false)
  105. const treeLoaing = ref(false)
  106. const getElTreeData = async ()=>{
  107. treeLoaing.value = true
  108. const { error, code, data } = await initialgApi.getUnitAllNode({
  109. projectId: projectId.value,
  110. types:checkList.value.join(','),
  111. })
  112. treeLoaing.value = false
  113. if (!error && code === 200) {
  114. console.log(data, 'data')
  115. ElTreeData.value = getArrValue(data)
  116. } else {
  117. ElTreeData.value = []
  118. }
  119. }
  120. const ElTreeData = ref( [])
  121. const treeRef = ref(null)
  122. const checkKeys = ref([])
  123. const getCheckKeys = (val)=>{
  124. checkKeys.value = val
  125. }
  126. //确认分配
  127. const confirmAllocationClick = async () => {
  128. isNull.value = false
  129. isLoading.value = true
  130. await getElTreeData()
  131. isCard.value = true
  132. isLoading.value = false
  133. }
  134. //确认并进入抽检
  135. const ToInspection = () => {
  136. console.log( checkKeys.value, ' checkKeys.value')
  137. const ids = checkKeys.value.join(',')
  138. if (checkKeys.value.length > 0) {
  139. goInspection(ids)
  140. } else {
  141. window.$message.warning('请您勾选想要验收的目录')
  142. }
  143. // router.push({
  144. // name: 'transfer-preliminary-examination',
  145. // })
  146. }
  147. //抽检
  148. const inspectionLoaing = ref(false)
  149. const goInspection = async (ids)=>{
  150. inspectionLoaing.value = true
  151. const { error, code, data, msg } = await initialgApi.saveAllSelectNodes({
  152. ids: ids,
  153. })
  154. inspectionLoaing.value = false
  155. if (!error && code === 200) {
  156. window.$message.success(msg)
  157. router.push({
  158. name: 'transfer-preliminary-examination',
  159. })
  160. }
  161. }
  162. //清空重置
  163. const clearResetClick = () => {
  164. isNull.value = true
  165. isLoading.value = false
  166. isCard.value = false
  167. checkList.value = []
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. @import '~style/transfer/scoped/entry-sampling.scss';
  172. .hc-page-content-box {
  173. padding-left: 34px;
  174. .arrow-right-icon-box {
  175. position: absolute;
  176. left: -10px;
  177. z-index: 9;
  178. font-size: 30px;
  179. top: 10px;
  180. .icon {
  181. color: #e99d42;
  182. }
  183. }
  184. }
  185. </style>
  186. <style lang="scss">
  187. @import '~style/transfer/entry-sampling.scss';
  188. </style>