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

305 lines
9.8 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year 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 { FetchIsAuthByLookType } from '@/api/archivesManage/library'
  53. import UploadFile from '../uploadFile/index'
  54. import FourTestInfo from '../fourTestInfo/index'
  55. import HandleInfo from '../handleInfo/index'
  56. export default {
  57. name: 'ArchivesInfo',
  58. components: { UploadFile, FourTestInfo, HandleInfo },
  59. mixins: [
  60. form({})
  61. ],
  62. props: {
  63. selectedCategory: {
  64. type: Object,
  65. default: function() {
  66. return {}
  67. }
  68. },
  69. arcId: {
  70. type: String,
  71. default: function() {
  72. return ''
  73. }
  74. },
  75. isTitleType: {
  76. type: Number,
  77. default: 2
  78. },
  79. isCollect: {
  80. type: Boolean,
  81. default: true
  82. }
  83. },
  84. data() {
  85. return {
  86. detailTitle: '',
  87. isHasFile: false, // 卷内/文件才有附件
  88. isFourTest: false,
  89. isDetailsInfo: false, // 项目不显示最下面5行基本信息
  90. archivesInfoVisible: false,
  91. archivesTabIndex: 0,
  92. archivesDetailsData: [],
  93. archivesDetailsMetadata: [],
  94. xml_show: null,
  95. authArcId: null
  96. }
  97. },
  98. computed: {
  99. filteredArray() {
  100. const lastIndex = this.archivesDetailsData.length - 1
  101. return this.archivesDetailsData
  102. .filter((item, index) => index !== lastIndex || item.fieldName !== 'is_entity')
  103. }
  104. },
  105. created() {
  106. },
  107. mounted() {
  108. },
  109. methods: {
  110. getDetial(collectLevel, rowId) {
  111. this.authArcId = rowId
  112. const params = {
  113. 'categoryId': this.selectedCategory.id,
  114. 'categoryLevel': collectLevel,
  115. 'id': rowId
  116. }
  117. FetchDetailsById(params).then(data => {
  118. this.archivesDetailsData = data.showFiled
  119. .filter(field => field.fieldName in data.echo)
  120. .map(field => ({
  121. editLength: field.editLength,
  122. isLine: field.isLine,
  123. fieldCnName: field.fieldCnName,
  124. fieldName: field.fieldName,
  125. context: data.echo[field.fieldName]
  126. }))
  127. })
  128. const metaDataParams = {
  129. 'categoryId': this.selectedCategory.id,
  130. 'categoryLevel': collectLevel,
  131. 'archivesId': rowId
  132. }
  133. FetchArchivesMetadata(metaDataParams).then(data => {
  134. this.archivesDetailsMetadata = data
  135. })
  136. },
  137. getIsAuthByLookType() {
  138. const params = {
  139. 'archivesId': this.authArcId
  140. }
  141. FetchIsAuthByLookType(params).then(res => {
  142. this.$refs.uploadFile.authUtilize = res
  143. })
  144. },
  145. setXml() {
  146. const xmlstr = this.archivesDetailsMetadata
  147. this.xml_show = this.showXml(xmlstr)
  148. },
  149. changeActiveTab(index) {
  150. this.archivesTabIndex = index
  151. if (this.archivesTabIndex === 2) {
  152. this.setXml()
  153. } else if (this.archivesTabIndex === 5) {
  154. if (this.isTitleType === 2) {
  155. this.$refs.archivesListModuleRef.detailLevel = 2
  156. } else if (this.isTitleType === 3) {
  157. this.$refs.archivesListModuleRef.detailLevel = 3
  158. } else {
  159. this.$refs.archivesListModuleRef.detailLevel = 4
  160. }
  161. this.$refs.archivesListModuleRef.parentId = this.arcId
  162. this.$refs.archivesListModuleRef.isDetail = true
  163. this.$refs.archivesListModuleRef.getViewTable()
  164. }
  165. this.$nextTick(() => {
  166. if (this.$refs.uploadFile) {
  167. this.getIsAuthByLookType()
  168. this.$refs.uploadFile.parentInfo = this.archivesDetailsData
  169. this.$refs.uploadFile.tableData = []
  170. this.$refs.uploadFile.getFileList()
  171. }
  172. })
  173. },
  174. // 删除 - 关闭
  175. handleClose(done) {
  176. this.archivesInfoVisible = false
  177. localStorage.removeItem('collectLevelList')
  178. done()
  179. },
  180. // xml格式化
  181. showXml(str) {
  182. var that = this
  183. var text = str
  184. // 去掉多余的空格
  185. text =
  186. '\n' +
  187. text
  188. .replace(/(<\w+)(\s.*?>)/g, function($0, name, props) {
  189. return name + ' ' + props.replace(/\s+(\w+=)/g, ' $1')
  190. })
  191. .replace(/>\s*?</g, '>\n<')
  192. // 把注释编码
  193. text = text
  194. .replace(/\n/g, '\r')
  195. .replace(/<!--(.+?)-->/g, function($0, text) {
  196. var ret = '<!--' + escape(text) + '-->'
  197. return ret
  198. })
  199. .replace(/\r/g, '\n')
  200. // 调整格式
  201. var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/gm
  202. var nodeStack = []
  203. var output = text.replace(rgx, function(
  204. $0,
  205. all,
  206. name,
  207. isBegin,
  208. isCloseFull1,
  209. isCloseFull2,
  210. isFull1,
  211. isFull2
  212. ) {
  213. var isClosed =
  214. isCloseFull1 === '/' ||
  215. isCloseFull2 === '/' ||
  216. isFull1 === '/' ||
  217. isFull2 === '/'
  218. var prefix = ''
  219. if (isBegin === '!') {
  220. prefix = that.getPrefix(nodeStack.length)
  221. } else {
  222. if (isBegin !== '/') {
  223. prefix = that.getPrefix(nodeStack.length)
  224. if (!isClosed) {
  225. nodeStack.push(name)
  226. }
  227. } else {
  228. nodeStack.pop()
  229. prefix = that.getPrefix(nodeStack.length)
  230. }
  231. }
  232. var ret = '\n' + prefix + all
  233. return ret
  234. })
  235. var outputText = output.substring(1)
  236. // 把注释还原并解码,调格式
  237. outputText = outputText
  238. .replace(/\n/g, '\r')
  239. .replace(/(\s*)<!--(.+?)-->/g, function($0, prefix, text) {
  240. if (prefix.charAt(0) === '\r') prefix = prefix.substring(1)
  241. text = unescape(text).replace(/\r/g, '\n')
  242. var ret =
  243. '\n' + prefix + '<!--' + text.replace(/^\s*/gm, prefix) + '-->'
  244. return ret
  245. })
  246. outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
  247. return outputText
  248. },
  249. getPrefix(prefixIndex) {
  250. var span = ' '
  251. var output = []
  252. for (var i = 0; i < prefixIndex; ++i) {
  253. output.push(span)
  254. }
  255. return output.join('')
  256. }
  257. }
  258. }
  259. </script>
  260. <style lang="scss" scoped>
  261. .base-info,
  262. .metadata-cont{
  263. background-color: #F6F8FC;
  264. }
  265. // 档案详情
  266. .base-info{
  267. padding: 20px 0;
  268. overflow: hidden;
  269. overflow-y: scroll;
  270. .base-info-item{
  271. display: flex;
  272. flex-direction: row;
  273. margin-bottom: 20px;
  274. color: #545B65;
  275. span{
  276. display: block;
  277. width: 120px;
  278. margin-right: 5px;
  279. text-align: right;
  280. color: #0C0E1E;
  281. }
  282. }
  283. }
  284. code.hljs {
  285. font-size: 12px;
  286. color: #0C0E1E !important;
  287. height: 530px !important;
  288. }
  289. ::v-deep .hljs-name{
  290. color: #0C0E1E !important;
  291. }
  292. .base-info .base-info-item span.el-tag{
  293. width: auto;
  294. color: #fff;
  295. }
  296. .detail-tab .tab-nav{
  297. margin: 15px 0 18px 0;
  298. }
  299. </style>