preliminary-examination.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338
  1. <template>
  2. <div id="carry-spot-checks-layout-target" class="hc-page-layout-box">
  3. <div v-show="!isCarrySpotChecksDrawer" :style="`width:${leftWidth}px;`" class="hc-layout-left-box">
  4. <div class="hc-project-box">
  5. <div class="hc-project-icon-box">
  6. <HcIcon name="stack" />
  7. </div>
  8. <div class="ml-2 project-name-box">
  9. <span class="text-xl text-cut project-alias">{{ projectInfo.projectAlias }}</span>
  10. <div class="text-xs text-cut project-name">{{ projectInfo.name }}</div>
  11. </div>
  12. </div>
  13. <div class="hc-tree-new-switch">
  14. <HcNewSwitch :datas="tabData" :keys="tabKey" size="small" :round="false" @change="tabChange" />
  15. </div>
  16. <div v-if="tabKey === 'tab1'" v-loading="treeLoading" class="hc-tree-box" element-loading-text="加载中...">
  17. <el-scrollbar>
  18. <HcTree :contract-id="contractId" :project-id="projectId" :is-own="false" :is-show-number="false" :is-show-menu="false" @node-tap="projectTreeClick" @node-loading="treeNodeLoading" />
  19. </el-scrollbar>
  20. </div>
  21. <div v-else v-loading="treeLoading" element-loading-text="加载中..." class="hc-tree-box">
  22. <el-scrollbar>
  23. <HcTree :contract-id="contractId" :project-id="projectId" :is-own="true" :is-show-number="false" :is-show-menu="false" @node-tap="projectTreeClick" @node-loading="treeNodeLoading" />
  24. </el-scrollbar>
  25. </div>
  26. <!-- 左右拖动 -->
  27. <div class="horizontal-drag-line" @mousedown="onmousedown" />
  28. </div>
  29. <div v-show="!isCarrySpotChecksDrawer" class="hc-page-content-box">
  30. <hc-new-card padding>
  31. <template #header>
  32. <HcIcon name="volume-up" />
  33. <span class="ml-2">您本次验收抽检案卷共</span>
  34. <span class="text-orange mx-2">{{ stats?.total }}</span>
  35. <span>卷,目前已抽检</span>
  36. <span class="text-green mx-2">{{ stats?.reviewed }}</span>
  37. <span>卷,抽检率为</span>
  38. <span class="text-blue mx-2">{{ stats?.ratio }}</span>
  39. </template>
  40. <template #extra>
  41. <el-button hc-btn type="primary" @click="writingConclusion">编写结论</el-button>
  42. <el-button hc-btn type="warning" @click="toBackHomeClick">返回主页</el-button>
  43. </template>
  44. <div class="hc-card-diy-search-box">
  45. <div class="text-gray text-sm mr-4 hc-card-diy-tip-view">
  46. <span class="mr-4">通过关键词、题名、桩号等相关信息进行搜索:</span>
  47. <el-radio-group v-model="checkList" class="ml-4" @change="getTableData">
  48. <el-radio label="1" size="large">案卷</el-radio>
  49. <el-radio label="2" size="large">文件</el-radio>
  50. </el-radio-group>
  51. </div>
  52. <div class="autocomplete-box">
  53. <el-input
  54. v-model="state1" class="w-full" clearable
  55. placeholder="搜索"
  56. @change="getTableData"
  57. />
  58. <el-button class="ml-10" type="primary" @click="logShowClick">抽检记录</el-button>
  59. </div>
  60. </div>
  61. <div class="hc-card-diy-table-box">
  62. <HcTable
  63. :column="tableColumn" :datas="tableData" :loading="tableLoading"
  64. is-new :index-style="{ width: 60 }"
  65. >
  66. <template #key4="{ row, index }">
  67. <span :style="row.key4_1 === '1' ? 'color: #81b337' : ''">{{ row.key4 }}</span>
  68. </template>
  69. <template #key5="{ row, index }">
  70. <span :style="row.key5_1 === '1' ? 'color: #81b337' : 'color: #bd3124'">{{ row.key5 }}</span>
  71. </template>
  72. <template #action="{ row, index }">
  73. <el-button size="small" type="primary" @click="tableClick(row)">查看</el-button>
  74. </template>
  75. </HcTable>
  76. </div>
  77. <template #action>
  78. <HcPages :pages="searchForm" @change="pageChange" />
  79. </template>
  80. </hc-new-card>
  81. </div>
  82. <!-- 展开抽查 -->
  83. <CarrySpotChecks
  84. :show="isCarrySpotChecksDrawer" close-text="关闭案卷" check-text="保存抽检意见" :file-id="fileId" :file-info="fileInfo" :project-id="projectId" :is-opinion="isOpinion" @check="onCarrySpotChecksClose"
  85. @close="onCarrySpotChecksClose"
  86. />
  87. <!-- 抽检记录 -->
  88. <hc-new-dialog v-model="isLogModal" is-slot-footer is-table widths="70%" title="抽检记录" @close="isLogModalClose">
  89. <TableOpinion :contract-id="contractId" :project-id="projectId" :search-log-form="searchLogForm" @change-file="changeFile" />
  90. <template #footer>
  91. <HcPages :pages="searchLogForm" @change="pageLogChange" />
  92. </template>
  93. </hc-new-dialog>
  94. </div>
  95. </template>
  96. <script setup>
  97. import { onMounted, ref, watch } from 'vue'
  98. import { useAppStore } from '~src/store'
  99. import { useRouter } from 'vue-router'
  100. import HcTree from '~src/components/tree/hc-tree.vue'
  101. import CarrySpotChecks from './components/carry-spot-checks.vue'
  102. import TableOpinion from './components/examination/table-opinion.vue'
  103. import initialgApi from '~api/initial/initial'
  104. import { getArrValue, getObjValue } from 'js-fast-way'
  105. //变量
  106. const router = useRouter()
  107. const useAppState = useAppStore()
  108. const projectId = ref(useAppState.getProjectId)
  109. const contractId = ref(useAppState.getContractId)
  110. const projectInfo = ref(useAppState.getProjectInfo)
  111. const isCollapse = ref(useAppState.getCollapse)
  112. const isBubble = ref(useAppState.getBubble)
  113. //监听
  114. watch(() => [
  115. useAppState.getCollapse,
  116. useAppState.getBubble,
  117. ], ([Collapse, bubble]) => {
  118. isCollapse.value = Collapse
  119. isBubble.value = bubble
  120. })
  121. //渲染完成
  122. onMounted(() => {
  123. })
  124. //树加载
  125. const treeLoading = ref(true)
  126. const treeNodeLoading = () => {
  127. treeLoading.value = false
  128. }
  129. //tab数据和相关处理
  130. const tabKey = ref('tab1')
  131. const tabData = ref([
  132. { key: 'tab1', name: '所有树' },
  133. { key: 'tab2', name: '分配树' },
  134. ])
  135. const tabChange = (item) => {
  136. tabKey.value = item?.key
  137. }
  138. //项目树被点击
  139. const projectTreeClick = ({ data }) => {
  140. console.log(data, 'data')
  141. searchForm.value.nodeId = data.id
  142. getTableData()
  143. getUserInspectStats()
  144. }
  145. const checkList = ref('1')
  146. const state1 = ref('')
  147. const tableColumn = ref([
  148. { key: 'fileNumber', name: '档号', width: 180 },
  149. { key: 'name', name: '案卷题名' },
  150. { key: 'unit', name: '立卷单位' },
  151. { key: 'inspectStatusName', name: '抽检状态' },
  152. { key: 'updateStatusName', name: '抽检意见' },
  153. { key: 'action', name: '操作', width: 100 },
  154. ])
  155. const tableData = ref([])
  156. //获取数据
  157. const tableLoading = ref(false)
  158. //搜索表单
  159. const searchForm = ref({
  160. current: 1, size: 20, total: 0,
  161. })
  162. //分页被点击
  163. const pageChange = ({ current, size }) => {
  164. searchForm.value.current = current
  165. searchForm.value.size = size
  166. getTableData()
  167. }
  168. const getTableData = async () => {
  169. if (searchForm.value.nodeId) {
  170. tableLoading.value = true
  171. const { error, code, data } = await initialgApi.getNodeArchives({
  172. ...searchForm.value,
  173. projectId: projectId.value,
  174. type:tabKey.value === 'tab1' ? 1 : 2,
  175. searchValue:state1.value,
  176. searchType:checkList.value,
  177. })
  178. tableLoading.value = false
  179. if (!error && code === 200) {
  180. tableData.value = getArrValue(data['records'])
  181. searchForm.value.total = data['total'] || 0
  182. } else {
  183. tableData.value = []
  184. searchForm.value.total = 0
  185. }
  186. } else {
  187. window.$message.warning('请先选择左侧节点')
  188. }
  189. }
  190. //获取抽检统计
  191. const stats = ref({})
  192. const getUserInspectStats = async ()=>{
  193. const { error, code, data } = await initialgApi.userInspectStats({
  194. projectId: projectId.value,
  195. })
  196. if (!error && code === 200) {
  197. console.log(data, 'DATA')
  198. stats.value = getObjValue(data)
  199. } else {
  200. stats.value = {}
  201. }
  202. }
  203. const isCarrySpotChecksDrawer = ref(false)
  204. const isOpinion = ref(false)
  205. const fileId = ref('')//案卷ID
  206. const fileInfo = ref({})//案卷信息
  207. const tableClick = (row) => {
  208. console.log(row, 'row11111')
  209. isCarrySpotChecksDrawer.value = true
  210. fileId.value = row.id
  211. fileInfo.value = row
  212. isOpinion.value = false
  213. console.log( fileInfo.value, ' fileInfo.value')
  214. }
  215. const changeFile = (row)=>{
  216. fileId.value = row.archiveId
  217. isOpinion.value = true
  218. fileInfo.value = row
  219. isCarrySpotChecksDrawer.value = true
  220. }
  221. //关闭抽查
  222. const onCarrySpotChecksClose = () => {
  223. isCarrySpotChecksDrawer.value = false
  224. }
  225. //编写结论
  226. const writingConclusion = () => {
  227. router.push({
  228. name: 'transfer-writing-conclusion',
  229. })
  230. }
  231. //返回主页
  232. const toBackHomeClick = () => {
  233. router.push({
  234. name: 'transfer-initial-expert',
  235. })
  236. }
  237. const isLogModal = ref(false)
  238. //搜索表单
  239. const searchLogForm = ref({
  240. current: 1, size: 20, total: 0,
  241. })
  242. //分页被点击
  243. const pageLogChange = ({ current, size }) => {
  244. searchLogForm.value.current = current
  245. searchLogForm.value.size = size
  246. }
  247. const logShowClick = () => {
  248. isLogModal.value = true
  249. }
  250. const isLogModalClose = () => {
  251. isLogModal.value = false
  252. }
  253. //左右拖动,改变树形结构宽度
  254. const leftWidth = ref(382)
  255. const onmousedown = () => {
  256. const leftNum = isCollapse.value ? 142 : 272
  257. document.onmousemove = (ve) => {
  258. let diffVal = ve.clientX - leftNum
  259. if (diffVal >= 310 && diffVal <= 900) {
  260. leftWidth.value = diffVal
  261. }
  262. }
  263. document.onmouseup = () => {
  264. document.onmousemove = null
  265. document.onmouseup = null
  266. }
  267. }
  268. </script>
  269. <style lang="scss" scoped>
  270. .hc-card-diy-search-box {
  271. position: relative;
  272. width: 100%;
  273. .autocomplete-box {
  274. position: relative;
  275. width: 100%;
  276. margin-top: 10px;
  277. display: flex;
  278. align-items: center;
  279. }
  280. }
  281. .hc-card-diy-table-box {
  282. position: relative;
  283. margin-top: 20px;
  284. width: 100%;
  285. height: calc(100% - 90px);
  286. }
  287. .hc-card-diy-tip-view {
  288. display: flex;
  289. align-items: center;
  290. }
  291. .hc-tree-new-switch {
  292. position: relative;
  293. text-align: center;
  294. padding: 12px 0;
  295. }
  296. .hc-tree-box {
  297. height: calc(100% - 145px);
  298. }
  299. </style>
  300. <style lang="scss">
  301. .hc-csc-action-box .btn-box {
  302. .el-button + .el-button {
  303. margin-left: 50px;
  304. }
  305. }
  306. </style>