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

309 lines
10 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-show="archivesTabIndex===3" ref="fourTestInfoRefs" />
  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 === 3) {
  154. console.log(this.$refs.fourTestInfoRefs)
  155. this.$refs.fourTestInfoRefs.currentArcId = this.arcId
  156. this.$refs.fourTestInfoRefs.getFourCheckRecord(this.arcId)
  157. } else if (this.archivesTabIndex === 5) {
  158. if (this.isTitleType === 2) {
  159. this.$refs.archivesListModuleRef.detailLevel = 2
  160. } else if (this.isTitleType === 3) {
  161. this.$refs.archivesListModuleRef.detailLevel = 3
  162. } else {
  163. this.$refs.archivesListModuleRef.detailLevel = 4
  164. }
  165. this.$refs.archivesListModuleRef.parentId = this.arcId
  166. this.$refs.archivesListModuleRef.isDetail = true
  167. this.$refs.archivesListModuleRef.getViewTable()
  168. }
  169. this.$nextTick(() => {
  170. if (this.$refs.uploadFile) {
  171. this.getIsAuthByLookType()
  172. this.$refs.uploadFile.parentInfo = this.archivesDetailsData
  173. this.$refs.uploadFile.tableData = []
  174. this.$refs.uploadFile.getFileList()
  175. }
  176. })
  177. },
  178. // 删除 - 关闭
  179. handleClose(done) {
  180. this.archivesInfoVisible = false
  181. localStorage.removeItem('collectLevelList')
  182. done()
  183. },
  184. // xml格式化
  185. showXml(str) {
  186. var that = this
  187. var text = str
  188. // 去掉多余的空格
  189. text =
  190. '\n' +
  191. text
  192. .replace(/(<\w+)(\s.*?>)/g, function($0, name, props) {
  193. return name + ' ' + props.replace(/\s+(\w+=)/g, ' $1')
  194. })
  195. .replace(/>\s*?</g, '>\n<')
  196. // 把注释编码
  197. text = text
  198. .replace(/\n/g, '\r')
  199. .replace(/<!--(.+?)-->/g, function($0, text) {
  200. var ret = '<!--' + escape(text) + '-->'
  201. return ret
  202. })
  203. .replace(/\r/g, '\n')
  204. // 调整格式
  205. var rgx = /\n(<(([^\?]).+?)(?:\s|\s*?>|\s*?(\/)>)(?:.*?(?:(?:(\/)>)|(?:<(\/)\2>)))?)/gm
  206. var nodeStack = []
  207. var output = text.replace(rgx, function(
  208. $0,
  209. all,
  210. name,
  211. isBegin,
  212. isCloseFull1,
  213. isCloseFull2,
  214. isFull1,
  215. isFull2
  216. ) {
  217. var isClosed =
  218. isCloseFull1 === '/' ||
  219. isCloseFull2 === '/' ||
  220. isFull1 === '/' ||
  221. isFull2 === '/'
  222. var prefix = ''
  223. if (isBegin === '!') {
  224. prefix = that.getPrefix(nodeStack.length)
  225. } else {
  226. if (isBegin !== '/') {
  227. prefix = that.getPrefix(nodeStack.length)
  228. if (!isClosed) {
  229. nodeStack.push(name)
  230. }
  231. } else {
  232. nodeStack.pop()
  233. prefix = that.getPrefix(nodeStack.length)
  234. }
  235. }
  236. var ret = '\n' + prefix + all
  237. return ret
  238. })
  239. var outputText = output.substring(1)
  240. // 把注释还原并解码,调格式
  241. outputText = outputText
  242. .replace(/\n/g, '\r')
  243. .replace(/(\s*)<!--(.+?)-->/g, function($0, prefix, text) {
  244. if (prefix.charAt(0) === '\r') prefix = prefix.substring(1)
  245. text = unescape(text).replace(/\r/g, '\n')
  246. var ret =
  247. '\n' + prefix + '<!--' + text.replace(/^\s*/gm, prefix) + '-->'
  248. return ret
  249. })
  250. outputText = outputText.replace(/\s+$/g, '').replace(/\r/g, '\r\n')
  251. return outputText
  252. },
  253. getPrefix(prefixIndex) {
  254. var span = ' '
  255. var output = []
  256. for (var i = 0; i < prefixIndex; ++i) {
  257. output.push(span)
  258. }
  259. return output.join('')
  260. }
  261. }
  262. }
  263. </script>
  264. <style lang="scss" scoped>
  265. .base-info,
  266. .metadata-cont{
  267. background-color: #F6F8FC;
  268. }
  269. // 档案详情
  270. .base-info{
  271. padding: 20px 0;
  272. overflow: hidden;
  273. overflow-y: scroll;
  274. .base-info-item{
  275. display: flex;
  276. flex-direction: row;
  277. margin-bottom: 20px;
  278. color: #545B65;
  279. span{
  280. display: block;
  281. width: 120px;
  282. margin-right: 5px;
  283. text-align: right;
  284. color: #0C0E1E;
  285. }
  286. }
  287. }
  288. code.hljs {
  289. font-size: 12px;
  290. color: #0C0E1E !important;
  291. height: 530px !important;
  292. }
  293. ::v-deep .hljs-name{
  294. color: #0C0E1E !important;
  295. }
  296. .base-info .base-info-item span.el-tag{
  297. width: auto;
  298. color: #fff;
  299. }
  300. .detail-tab .tab-nav{
  301. margin: 15px 0 18px 0;
  302. }
  303. </style>