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

293 lines
9.5 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
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 filteredArray" :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. <el-row v-for="(item,index) in archivesDetailsData" :key="index">
  26. <el-col v-if="item.fieldName === 'is_entity'" :span="24" class="base-info-item">
  27. <span>有无实体</span>
  28. <p style="flex:1">{{ item.context === 1 ? '有' : '无' }}</p>
  29. </el-col>
  30. </el-row>
  31. </div>
  32. <!-- 附件 -->
  33. <UploadFile v-if="archivesTabIndex==1" ref="uploadFile" class="item-content" :is-upload-detail="false" :selected-category="selectedCategory" :arc-id="arcId" />
  34. <!-- 元数据 -->
  35. <div v-if="archivesTabIndex==2" class="metadata-cont item-content">
  36. <pre v-highlightjs="xml_show">
  37. <code class="highlight_s">
  38. {[xml_show]}
  39. </code>
  40. </pre>
  41. </div>
  42. <FourTestInfo v-if="archivesTabIndex===3" />
  43. <HandleInfo v-if="archivesTabIndex===4" />
  44. <ArchivesListModule v-show="archivesTabIndex===5" ref="archivesListModuleRef" :selected-category="selectedCategory" :is-title-type="isTitleType" :is-collect="isCollect" />
  45. </div>
  46. </div>
  47. </el-dialog>
  48. </template>
  49. <script>
  50. import { form } from '@crud/crud'
  51. import { FetchDetailsById, FetchArchivesMetadata } from '@/api/collect/collect'
  52. import UploadFile from '../uploadFile/index'
  53. import FourTestInfo from '../fourTestInfo/index'
  54. import HandleInfo from '../handleInfo/index'
  55. export default {
  56. name: 'ArchivesInfo',
  57. components: { UploadFile, FourTestInfo, HandleInfo },
  58. mixins: [
  59. form({})
  60. ],
  61. props: {
  62. selectedCategory: {
  63. type: Object,
  64. default: function() {
  65. return {}
  66. }
  67. },
  68. arcId: {
  69. type: String,
  70. default: function() {
  71. return ''
  72. }
  73. },
  74. isTitleType: {
  75. type: Number,
  76. default: 2
  77. },
  78. isCollect: {
  79. type: Boolean,
  80. default: true
  81. }
  82. },
  83. data() {
  84. return {
  85. detailTitle: '',
  86. isHasFile: false, // 卷内/文件才有附件
  87. isFourTest: false,
  88. isDetailsInfo: false, // 项目不显示最下面5行基本信息
  89. archivesInfoVisible: false,
  90. archivesTabIndex: 0,
  91. archivesDetailsData: [],
  92. archivesDetailsMetadata: [],
  93. xml_show: null
  94. }
  95. },
  96. computed: {
  97. filteredArray() {
  98. const lastIndex = this.archivesDetailsData.length - 1
  99. return this.archivesDetailsData
  100. .filter((item, index) => index !== lastIndex || item.fieldName !== 'is_entity')
  101. }
  102. },
  103. created() {
  104. },
  105. mounted() {
  106. },
  107. methods: {
  108. getDetial(collectLevel, rowId) {
  109. const params = {
  110. 'categoryId': this.selectedCategory.id,
  111. 'categoryLevel': collectLevel,
  112. 'id': rowId
  113. }
  114. FetchDetailsById(params).then(data => {
  115. this.archivesDetailsData = data.showFiled
  116. .filter(field => field.fieldName in data.echo)
  117. .map(field => ({
  118. editLength: field.editLength,
  119. isLine: field.isLine,
  120. fieldCnName: field.fieldCnName,
  121. fieldName: field.fieldName,
  122. context: data.echo[field.fieldName]
  123. }))
  124. })
  125. const metaDataParams = {
  126. 'categoryId': this.selectedCategory.id,
  127. 'categoryLevel': collectLevel,
  128. 'archivesId': rowId
  129. }
  130. FetchArchivesMetadata(metaDataParams).then(data => {
  131. this.archivesDetailsMetadata = data
  132. })
  133. },
  134. setXml() {
  135. const xmlstr = this.archivesDetailsMetadata
  136. this.xml_show = this.showXml(xmlstr)
  137. },
  138. changeActiveTab(index) {
  139. this.archivesTabIndex = index
  140. if (this.archivesTabIndex === 2) {
  141. this.setXml()
  142. } else if (this.archivesTabIndex === 5) {
  143. if (this.isTitleType === 2) {
  144. this.$refs.archivesListModuleRef.detailLevel = 2
  145. } else if (this.isTitleType === 3) {
  146. this.$refs.archivesListModuleRef.detailLevel = 3
  147. } else {
  148. this.$refs.archivesListModuleRef.detailLevel = 4
  149. }
  150. this.$refs.archivesListModuleRef.parentId = this.arcId
  151. this.$refs.archivesListModuleRef.isDetail = true
  152. this.$refs.archivesListModuleRef.getViewTable()
  153. }
  154. this.$nextTick(() => {
  155. if (this.$refs.uploadFile) {
  156. this.$refs.uploadFile.parentInfo = this.archivesDetailsData
  157. this.$refs.uploadFile.tableData = []
  158. this.$refs.uploadFile.getFileList()
  159. }
  160. })
  161. },
  162. // 删除 - 关闭
  163. handleClose(done) {
  164. this.archivesInfoVisible = false
  165. localStorage.removeItem('collectLevelList')
  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. .detail-tab .tab-nav{
  285. margin: 10px 0 18px 0;
  286. }
  287. </style>