阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

289 lines
9.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
4 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
4 months ago
1 year ago
1 year ago
  1. <template>
  2. <el-dialog class="detail-dialog" :title="detailTitle" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :visible.sync="archivesInfoVisible" :before-close="handleClose">
  3. <!-- <span class="dialog-right-top" />
  4. <span class="dialog-left-bottom" /> -->
  5. <div class="setting-dialog">
  6. <div class="detail-tab tab-content">
  7. <!-- tab -->
  8. <ul class="tab-nav">
  9. <li :class="{'active-tab-nav': archivesTabIndex === 0}" @click="changeActiveTab(0)">基本信息</li>
  10. <li v-if="isHasFile" :class="{'active-tab-nav': archivesTabIndex === 1}" @click="changeActiveTab(1)">电子原文</li>
  11. <li v-if="!isHasFile" :class="{'active-tab-nav': archivesTabIndex === 5}" @click="changeActiveTab(5)">文件列表</li>
  12. <li :class="{'active-tab-nav': archivesTabIndex === 2}" @click="changeActiveTab(2)">元数据</li>
  13. <li v-if="isFourTest" :class="{'active-tab-nav': archivesTabIndex === 3}" @click="changeActiveTab(3)">四性检测</li>
  14. <li v-if="isFourTest && isHasFile" :class="{'active-tab-nav': archivesTabIndex === 4}" @click="changeActiveTab(4)">操作记录</li>
  15. </ul>
  16. <!-- 基本信息 -->
  17. <div v-if="archivesTabIndex===0" class="base-info item-content">
  18. <el-row>
  19. <el-col v-for="(item,index) in filteredArray" :key="index" :span="item.isLine ? 24 : 12" class="base-info-item">
  20. <span>{{ item.fieldCnName }}</span>
  21. <p :style="{ width: ( item.editLength ? item.editLength+'px' : '' ), flex: ( !item.editLength ? 1 : '' )}">{{ item.context }}</p>
  22. </el-col>
  23. </el-row>
  24. <el-row v-for="(item,index) in archivesDetailsData" :key="index">
  25. <el-col v-if="item.fieldName === 'is_entity'" :span="24" class="base-info-item">
  26. <span>有无实体</span>
  27. <p style="flex:1">{{ item.context === 1 ? '有' : '无' }}</p>
  28. </el-col>
  29. </el-row>
  30. </div>
  31. <!-- 附件 -->
  32. <UploadFile v-if="archivesTabIndex===1" ref="uploadFile" class="item-content" :is-upload-detail="false" :selected-category="selectedCategory" :arc-id="arcId" :category-id="categoryId" :is-show-utilize-handle-btn="isShowUtilizeHandleBtn" :archives-details-data="archivesDetailsData" />
  33. <!-- 元数据 -->
  34. <div v-if="archivesTabIndex===2" class="metadata-cont item-content">
  35. <pre v-highlightjs="xml_show">
  36. <code class="highlight_s">
  37. {[xml_show]}
  38. </code>
  39. </pre>
  40. </div>
  41. <FourTestInfo v-show="archivesTabIndex===3" ref="fourTestInfoRefs" />
  42. <HandleInfo v-if="archivesTabIndex===4" />
  43. <ArchivesListModule v-show="archivesTabIndex===5" ref="archivesListModuleRef" :selected-category="selectedCategory" :category-id="categoryId" :is-title-type="isTitleType" :is-collect="false" />
  44. </div>
  45. </div>
  46. </el-dialog>
  47. </template>
  48. <script>
  49. import { FetchDetailsById, FetchArchivesMetadata } from '@/api/collect/collect'
  50. import UploadFile from './uploadFile/index'
  51. import FourTestInfo from './fourTestInfo/index'
  52. import HandleInfo from './handleInfo/index'
  53. export default {
  54. name: 'ArchivesInfo',
  55. components: { UploadFile, FourTestInfo, HandleInfo },
  56. props: {
  57. selectedCategory: {
  58. type: Object,
  59. default: function() {
  60. return {}
  61. }
  62. },
  63. arcId: {
  64. type: String,
  65. default: function() {
  66. return ''
  67. }
  68. },
  69. categoryId: {
  70. type: String,
  71. default: function() {
  72. return ''
  73. }
  74. },
  75. isTitleType: {
  76. type: Number,
  77. default: 3
  78. }
  79. },
  80. data() {
  81. return {
  82. detailTitle: '',
  83. isHasFile: false, // 卷内/文件才有附件
  84. isFourTest: false,
  85. isDetailsInfo: false, // 项目不显示最下面5行基本信息
  86. archivesInfoVisible: false,
  87. archivesTabIndex: 0,
  88. archivesDetailsData: [],
  89. archivesDetailsMetadata: [],
  90. xml_show: null,
  91. isShowUtilizeHandleBtn: false
  92. }
  93. },
  94. computed: {
  95. filteredArray() {
  96. const lastIndex = this.archivesDetailsData.length - 1
  97. return this.archivesDetailsData
  98. .filter((item, index) => index !== lastIndex || item.fieldName !== 'is_entity')
  99. }
  100. },
  101. created() {
  102. },
  103. mounted() {
  104. },
  105. methods: {
  106. getDetial(collectLevel, rowId) {
  107. const params = {
  108. 'categoryId': this.categoryId !== '' ? this.categoryId : this.selectedCategory.id,
  109. 'categoryLevel': collectLevel,
  110. 'id': rowId
  111. }
  112. FetchDetailsById(params).then(data => {
  113. this.archivesDetailsData = data.showFiled
  114. .filter(field => field.fieldName in data.echo)
  115. .map(field => ({
  116. editLength: field.editLength,
  117. isLine: field.isLine,
  118. fieldCnName: field.fieldCnName,
  119. fieldName: field.fieldName,
  120. context: data.echo[field.fieldName]
  121. }))
  122. })
  123. const metaDataParams = {
  124. 'categoryId': this.categoryId !== '' ? this.categoryId : this.selectedCategory.id,
  125. 'categoryLevel': collectLevel,
  126. 'archivesId': rowId
  127. }
  128. FetchArchivesMetadata(metaDataParams).then(data => {
  129. this.archivesDetailsMetadata = data
  130. })
  131. },
  132. setXml() {
  133. const xmlstr = this.archivesDetailsMetadata
  134. this.xml_show = this.showXml(xmlstr)
  135. },
  136. changeActiveTab(index) {
  137. this.archivesTabIndex = index
  138. if (this.archivesTabIndex === 2) {
  139. this.setXml()
  140. } else if (this.archivesTabIndex === 3) {
  141. console.log(this.$refs.fourTestInfoRefs)
  142. this.$refs.fourTestInfoRefs.currentArcId = this.arcId
  143. this.$refs.fourTestInfoRefs.getFourCheckRecord(this.arcId)
  144. } else if (this.archivesTabIndex === 5) {
  145. if (this.isTitleType === 2) {
  146. this.$refs.archivesListModuleRef.detailLevel = 2
  147. } else if (this.isTitleType === 3) {
  148. this.$refs.archivesListModuleRef.detailLevel = 3
  149. } else {
  150. this.$refs.archivesListModuleRef.detailLevel = 4
  151. }
  152. this.$refs.archivesListModuleRef.parentId = this.arcId
  153. this.$refs.archivesListModuleRef.isDetail = true
  154. this.$refs.archivesListModuleRef.getViewTable()
  155. }
  156. this.$nextTick(() => {
  157. if (this.$refs.uploadFile) {
  158. this.$refs.uploadFile.tableData = []
  159. this.$refs.uploadFile.getFileList()
  160. }
  161. })
  162. },
  163. // 删除 - 关闭
  164. handleClose(done) {
  165. this.archivesInfoVisible = false
  166. done()
  167. },
  168. // xml格式化
  169. showXml(str) {
  170. var that = this
  171. var text = str
  172. // 去掉多余的空格
  173. text =
  174. '\n' +
  175. text
  176. .replace(/(<\w+)(\s.*?>)/g, function($0, name, props) {
  177. return name + ' ' + props.replace(/\s+(\w+=)/g, ' $1')
  178. })
  179. .replace(/>\s*?</g, '>\n<')
  180. // 把注释编码
  181. text = text
  182. .replace(/\n/g, '\r')
  183. .replace(/<!--(.+?)-->/g, function($0, text) {
  184. var ret = '<!--' + escape(text) + '-->'
  185. return ret
  186. })
  187. .replace(/\r/g, '\n')
  188. // 调整格式
  189. var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/gm
  190. var nodeStack = []
  191. var output = text.replace(rgx, function(
  192. $0,
  193. all,
  194. name,
  195. isBegin,
  196. isCloseFull1,
  197. isCloseFull2,
  198. isFull1,
  199. isFull2
  200. ) {
  201. var isClosed =
  202. isCloseFull1 === '/' ||
  203. isCloseFull2 === '/' ||
  204. isFull1 === '/' ||
  205. isFull2 === '/'
  206. var prefix = ''
  207. if (isBegin === '!') {
  208. prefix = that.getPrefix(nodeStack.length)
  209. } else {
  210. if (isBegin !== '/') {
  211. prefix = that.getPrefix(nodeStack.length)
  212. if (!isClosed) {
  213. nodeStack.push(name)
  214. }
  215. } else {
  216. nodeStack.pop()
  217. prefix = that.getPrefix(nodeStack.length)
  218. }
  219. }
  220. var ret = '\n' + prefix + all
  221. return ret
  222. })
  223. var outputText = output.substring(1)
  224. // 把注释还原并解码,调格式
  225. outputText = outputText
  226. .replace(/\n/g, '\r')
  227. .replace(/(\s*)<!--(.+?)-->/g, function($0, prefix, text) {
  228. if (prefix.charAt(0) === '\r') prefix = prefix.substring(1)
  229. text = unescape(text).replace(/\r/g, '\n')
  230. var ret =
  231. '\n' + prefix + '<!--' + text.replace(/^\s*/gm, prefix) + '-->'
  232. return ret
  233. })
  234. outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
  235. return outputText
  236. },
  237. getPrefix(prefixIndex) {
  238. var span = ' '
  239. var output = []
  240. for (var i = 0; i < prefixIndex; ++i) {
  241. output.push(span)
  242. }
  243. return output.join('')
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped>
  249. .base-info,
  250. .metadata-cont{
  251. background-color: #F6F8FC;
  252. }
  253. // 档案详情
  254. .base-info{
  255. padding: 20px 0;
  256. overflow: hidden;
  257. overflow-y: scroll;
  258. .base-info-item{
  259. display: flex;
  260. flex-direction: row;
  261. margin-bottom: 20px;
  262. color: #545B65;
  263. span{
  264. display: block;
  265. width: 120px;
  266. margin-right: 5px;
  267. text-align: right;
  268. color: #0C0E1E;
  269. }
  270. }
  271. }
  272. code.hljs {
  273. font-size: 12px;
  274. color: #0C0E1E !important;
  275. height: 530px !important;
  276. }
  277. ::v-deep .hljs-name{
  278. color: #0C0E1E !important;
  279. }
  280. .base-info .base-info-item span.el-tag{
  281. width: auto;
  282. color: #fff;
  283. }
  284. </style>