scdTree.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <div>
  3. <div class="btnBox">
  4. <div @click="checkNow">
  5. <img :src="addPng" alt="" />
  6. <span>新的比对</span>
  7. </div>
  8. <div @click="reloadCheck">
  9. <img :src="againPng" alt="" />
  10. <span>重新比对</span>
  11. </div>
  12. <div @click="excelPort">
  13. <img :src="dervicePng" alt="" />
  14. <span>导出所有结果</span>
  15. </div>
  16. </div>
  17. <div class="tableBox">
  18. <el-table
  19. ref="multipleTableRef"
  20. :data="tableList"
  21. style="width: 100%; height: calc(100vh - 320px)"
  22. stripe
  23. @selection-change="handleSelectionChange"
  24. @select-all="chooseAll"
  25. :header-cell-style="{
  26. background: '#F7F8FB !important',
  27. color: '#7484AB',
  28. borderBottom: '1px solid #A3ADE0 !important',
  29. fontWeight: '400',
  30. }"
  31. >
  32. <el-table-column type="selection" width="55" />
  33. <el-table-column
  34. label="对比scd"
  35. width="190"
  36. :show-overflow-tooltip="true"
  37. >
  38. <template #default="scope">{{ scope.row.name }}</template>
  39. </el-table-column>
  40. <el-table-column
  41. property="CREATED_TIME"
  42. label="时间"
  43. width="auto"
  44. :show-overflow-tooltip="true"
  45. />
  46. <el-table-column fixed="right" label="操作" width="120">
  47. <template #default="scope">
  48. <el-button
  49. link
  50. type="primary"
  51. size="small"
  52. @click="searchScdCheck(scope.row)"
  53. ><el-icon> <View /> </el-icon>查看</el-button
  54. >
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. </div>
  59. <!-- <div>新的对比
  60. <LookScd
  61. v-if="lookScdModal"
  62. :lookScdModal="lookScdModal"
  63. :aktType="aktType"
  64. @lookScdBack="lookScdBack"
  65. >
  66. </LookScd>
  67. </div> -->
  68. <!-- 新的对比弹窗 -->
  69. <el-dialog
  70. @close="cancelClick"
  71. v-model="lookScdModal"
  72. width="40vw"
  73. style="height: 400px"
  74. append-to-body
  75. draggable
  76. >
  77. <template #header>
  78. <div class="my-header">
  79. <div class="title">请选择对比的SCD文件</div>
  80. </div>
  81. </template>
  82. <div class="uploda-file">
  83. 请选择:
  84. <el-upload
  85. v-model:file-list="fileList"
  86. :limit="1"
  87. class="upload-demo"
  88. :http-request="uploadFile"
  89. :on-change="fileSuccess"
  90. :on-remove="handleRemove"
  91. >
  92. <template #trigger>
  93. <div class="upload-title">
  94. <img :src="dervicePng" alt="" />
  95. <span>上传文件</span>
  96. </div>
  97. </template>
  98. </el-upload>
  99. </div>
  100. <div class="sures sureUpload">确认上传</div>
  101. <div class="sures startContrast">开始对比</div>
  102. </el-dialog>
  103. </div>
  104. </template>
  105. <script setup>
  106. import { ref, onMounted, toRefs, watch, nextTick, defineEmits } from "vue";
  107. import scdCheck from "@/api/scdCheck/scdCheck";
  108. import { uploadfile } from "@/api/scdCheck/scdCheck2";
  109. import scd from "@/api/scd";
  110. import systemRow from "@/api/systemRow";
  111. import { ElMessage, ElLoading } from "element-plus";
  112. import LookScd from "../modalCom/LookScd.vue";
  113. import dervicePng from "@/assets/image/scdcheck/derive.png";
  114. import againPng from "@/assets/image/scdcheck/again.png";
  115. import addPng from "@/assets/image/scdcheck/add.png";
  116. import { useRoute } from "vue-router";
  117. const route = useRoute();
  118. const emit = defineEmits(["scdTreeBack"]);
  119. let tableList = ref([]);
  120. let multipleTableRef = ref();
  121. let alreadyTriggered = ref(false);
  122. let scdid = ref([]);
  123. const loading = ref(false);
  124. let lookScdArr = ref([]);
  125. let lookScdModal = ref(false);
  126. const fileList = ref([]); //上传的文件
  127. const handleSelectionChange = (e) => {
  128. //复选
  129. };
  130. const chooseAll = (e) => {
  131. //全选
  132. };
  133. const checkNow = (e) => {
  134. //scd比对
  135. lookScdModal.value = true;
  136. };
  137. const excelPort = () => {
  138. //导出excel
  139. systemRow
  140. .portExcel({
  141. code: "scd-comp-result",
  142. })
  143. .then((res) => {
  144. console.log(res, "port");
  145. if (res.data) {
  146. return;
  147. } else {
  148. ElMessage({
  149. message: res.msg,
  150. type: "info",
  151. });
  152. }
  153. });
  154. };
  155. const reloadCheck = () => {
  156. //重新比对
  157. checkNow();
  158. };
  159. const uploadFile = async (e) => {
  160. console.log("e", e);
  161. const fileRes = await uploadfile({
  162. file: e.file,
  163. station_id: route.query.stationId,
  164. is_checkin: 0,
  165. data_type: "a_scd",
  166. });
  167. if (fileRes.code == 0) {
  168. ElMessage({
  169. type: "success",
  170. message: "上传成功!",
  171. });
  172. }else{
  173. ElMessage({
  174. type: "error",
  175. message: "上传失败!",
  176. });
  177. }
  178. };
  179. const searchScdCheck = (row) => {
  180. //查看scd对比
  181. const loading = ElLoading.service({
  182. lock: true,
  183. text: "正在查询数据",
  184. background: "rgba(0, 0, 0, 0.7)",
  185. });
  186. scdCheck.scdResult({ comp_id: row.id }).then((res) => {
  187. console.log(res, "对比详细");
  188. if (res.code == 0) {
  189. loading.close();
  190. }
  191. });
  192. // scdCheck.scdAll({ comp_id: row.id }).then(res => {
  193. // console.log(res, '阿拉蕾');
  194. // })
  195. };
  196. const lookScdBack = (data, row) => {
  197. //选择scd文件模态框返回数据
  198. lookScdModal.value = data;
  199. lookScdArr.value = row;
  200. emit("scdTreeBack", lookScdArr.value);
  201. };
  202. const aktType = () => {
  203. //初始化数据
  204. scdCheck.flashStationDui({ station_id: route.query.stationId }).then((res) => {
  205. //获取差异纪录列表
  206. tableList.value = res.data;
  207. });
  208. };
  209. onMounted(() => {
  210. aktType();
  211. });
  212. </script>
  213. <style scoped lang="scss">
  214. .btnBox > div,
  215. .upload-title {
  216. height: 45px;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. margin-right: 8px;
  221. cursor: pointer;
  222. background: url("~@/assets/image/scdcheck/bgscd.png") no-repeat center;
  223. border-radius: 2px;
  224. font-size: 14px;
  225. color: #255ce7;
  226. img {
  227. width: 20px;
  228. height: 20px;
  229. margin: 0 4px 0 0;
  230. }
  231. }
  232. .upload-title {
  233. width: 102px;
  234. background-size: 102px 45px;
  235. }
  236. .btnBox {
  237. display: flex;
  238. margin-bottom: 12px;
  239. & > div:first-child,
  240. & > div:nth-child(2) {
  241. width: 102px;
  242. background-size: 102px 45px;
  243. }
  244. & > div:last-child {
  245. width: 128px;
  246. background-size: 128px 45px;
  247. }
  248. }
  249. .my-header {
  250. border-bottom: 1px solid #a3ade0;
  251. font-size: 16px;
  252. color: #1a2447;
  253. .title {
  254. padding-bottom: 15px;
  255. }
  256. }
  257. .uploda-file {
  258. display: flex;
  259. align-items: center;
  260. }
  261. .upload-demo {
  262. display: flex;
  263. }
  264. .sures{
  265. background: #a4b0cf;
  266. margin-left: 60px;
  267. color: #fff;
  268. width: 124px;
  269. height: 32px;
  270. margin-top: 18px;
  271. line-height: 32px;
  272. text-align: center;
  273. cursor: pointer;
  274. }
  275. </style>