3b80b925b94db7a0f38976332ac94c6f1c7ea2a4.svn-base 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <a-modal
  3. :width="modalWidth"
  4. :visible="visible"
  5. :footer="null"
  6. @cancel="handleCancel"
  7. cancelText="关闭">
  8. <!--table区 -->
  9. <div class="marginCss">
  10. <a-table
  11. ref="table"
  12. size="small"
  13. bordered
  14. rowKey="id"
  15. :columns="columns"
  16. :dataSource="dataSource"
  17. :rowClassName="setdataCss"
  18. :loading="loading"
  19. :scroll="{ y: 700 }"
  20. :pagination="false">
  21. <span slot="dataVersionTitle1"><a-icon type="smile-o" /> 版本:{{dataVersion1Num}}</span>
  22. <span slot="dataVersionTitle2"><a-icon type="smile-o" /> 版本:{{dataVersion2Num}}</span>
  23. <template slot="avatarslot" slot-scope="text, record">
  24. <div class="anty-img-wrap">
  25. <img :src="getAvatarView(record)"/>
  26. </div>
  27. </template>
  28. </a-table>
  29. </div>
  30. </a-modal>
  31. </template>
  32. <script>
  33. import {getAction} from '@/api/manage'
  34. export default {
  35. name: 'DataLogCompareModal',
  36. data() {
  37. return {
  38. modalWidth: 1000,
  39. modaltoggleFlag: true,
  40. confirmDirty: false,
  41. title: '操作',
  42. visible: false,
  43. model: {},
  44. confirmLoading: false,
  45. headers: {},
  46. //版本号
  47. dataVersion1Num:'',
  48. dataVersion2Num:'',
  49. //表头
  50. columns: [
  51. {
  52. title: '字段名',
  53. align: 'left',
  54. dataIndex: 'code',
  55. width: '30%',
  56. }, {
  57. align: 'left',
  58. dataIndex: 'dataVersion1',
  59. width: '30%',
  60. slots: { title: 'dataVersionTitle1' },
  61. }, {
  62. title: '',
  63. dataIndex: 'imgshow',
  64. align: 'center',
  65. scopedSlots: {customRender: "avatarslot"},
  66. width: '10%',
  67. }, {
  68. align: 'left',
  69. dataIndex: 'dataVersion2',
  70. width: '30%',
  71. slots: { title: 'dataVersionTitle2' },
  72. }
  73. ],
  74. //数据集
  75. dataSource: [],
  76. loading: false,
  77. url: {
  78. queryCompareUrl: "/sys/dataLog/queryCompareList",
  79. },
  80. }
  81. },
  82. created() {
  83. },
  84. methods: {
  85. loadData(dataId1, dataId2) {
  86. this.dataSource = [];
  87. let that = this;
  88. getAction(that.url.queryCompareUrl, {dataId1: dataId1, dataId2: dataId2}).then((res) => {
  89. if (res.success) {
  90. that.dataVersion1Num = res.result[0].dataVersion;
  91. that.dataVersion2Num = res.result[1].dataVersion;
  92. let json1 = JSON.parse(res.result[0].dataContent);
  93. let json2 = JSON.parse(res.result[1].dataContent);
  94. for (var item1 in json1) {
  95. for (var item2 in json2) {
  96. if (item1 == item2) {
  97. this.dataSource.push({
  98. code: item1,
  99. imgshow: '',
  100. dataVersion1: json1[item1],
  101. dataVersion2: json2[item2],
  102. })
  103. }
  104. }
  105. }
  106. } else {
  107. console.log(res.message);
  108. }
  109. })
  110. },
  111. compareModal(dataId1, dataId2) {
  112. this.visible = true
  113. this.loadData(dataId1, dataId2);
  114. },
  115. handleCancel() {
  116. this.close()
  117. },
  118. modalFormOk() {
  119. },
  120. close() {
  121. this.$emit('close');
  122. this.visible = false;
  123. this.disableSubmit = false;
  124. },
  125. setdataCss(record) {
  126. let className = 'trcolor';
  127. const dataVersion1 = record.dataVersion1;
  128. const dataVersion2 = record.dataVersion2;
  129. if (dataVersion1 != dataVersion2) {
  130. return className;
  131. }
  132. },
  133. getAvatarView: function (avatar) {
  134. if (avatar.dataVersion1 != avatar.dataVersion2) {
  135. return "/goright.png";
  136. } else {
  137. return "";
  138. }
  139. },
  140. }
  141. }
  142. </script>
  143. <style scoped>
  144. .anty-img-wrap {
  145. height: 25px;
  146. position: relative;
  147. }
  148. .anty-img-wrap > img {
  149. max-height: 100%;
  150. }
  151. .marginCss {
  152. margin-top: 20px;
  153. }
  154. @import '../../../assets/less/index.less';
  155. </style>