阅行客电子档案
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.

275 lines
8.7 KiB

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