index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. <template>
  2. <el-container>
  3. <el-header height="30px" class="content-header">
  4. <div class="header-container">
  5. <div class="header-title">昨天天交换量</div>
  6. <!-- <el-form :model="searchformModel" ref="searchForm" label-position="left" class="header-form-detail-inline"
  7. inline>
  8. <el-form-item label="表名" prop="name">
  9. <el-input v-model="searchformModel.name" placeholder="请输入表名"></el-input>
  10. </el-form-item>
  11. <el-form-item label="更新方式" prop="name">
  12. <el-radio-group v-model="searchformModel.radio4" size="mini">
  13. <el-radio-button label="全部"></el-radio-button>
  14. <el-radio-button label="增量更新"></el-radio-button>
  15. <el-radio-button label="全文对比更新"></el-radio-button>
  16. </el-radio-group>
  17. </el-form-item>
  18. <el-form-item label="六统一接口" prop="name">
  19. <el-input v-model="searchformModel.name" placeholder="请输入六统一接口"></el-input>
  20. </el-form-item>
  21. <el-form-item label="数据源(系统名称)" prop="name">
  22. <el-input v-model="searchformModel.name" placeholder="请输入数据源(系统名称)"></el-input>
  23. </el-form-item>
  24. <el-form-item label="数据源IP" prop="name">
  25. <el-input v-model="searchformModel.name" placeholder="请输入数据源IP"></el-input>
  26. </el-form-item>
  27. <el-form-item label="数据源接收方(系统名称)" prop="name">
  28. <el-input v-model="searchformModel.name" placeholder="请输入数据源接收方(系统名称)"></el-input>
  29. </el-form-item>
  30. <el-form-item label="数据源接收方IP" prop="name">
  31. <el-input v-model="searchformModel.name" placeholder="请输入数据源接收方IP"></el-input>
  32. </el-form-item>
  33. <el-form-item label="时间" prop="name">
  34. <div style="display: flex; align-items: center; width: 100%">
  35. <el-date-picker v-model="searchformModel.value2" type="datetimerange" :picker-options="pickerOptions"
  36. range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" align="right">
  37. </el-date-picker>
  38. <el-radio-group v-model="searchformModel.radio4" size="mini"
  39. style="display: flex; width: 100%; margin-left: 10px">
  40. <el-radio-button label="当天"></el-radio-button>
  41. <el-radio-button label="当周"></el-radio-button>
  42. <el-radio-button label="当月"></el-radio-button>
  43. <el-radio-button label="当年"></el-radio-button>
  44. </el-radio-group>
  45. </div>
  46. </el-form-item>
  47. <el-form-item label="" prop="">
  48. <el-button type="primary" size="mini" @click="handleSubmit">搜索</el-button>
  49. <el-button size="mini" @click="handleReset">重置</el-button>
  50. </el-form-item>
  51. </el-form> -->
  52. </div>
  53. </el-header>
  54. <el-container>
  55. <el-main>
  56. <MyTableHeader
  57. :title="tableHeaderTitle"
  58. :tabs="tabs"
  59. :buttons="buttons"
  60. @tabClick="handleTabClick"
  61. @buttonClick="handleButtonClick"
  62. ></MyTableHeader>
  63. <MyTable
  64. :tableData="tableData"
  65. :formData="formData"
  66. :minWidth="340"
  67. ref="myTableRef"
  68. @selection-change="handleSelectionChange"
  69. :isOperate="isOperate"
  70. >
  71. </MyTable>
  72. <MyPagination
  73. :total="tableTotal"
  74. :page-size="pageSize"
  75. :current-page="currentPage"
  76. @pageChange="pagi_changePage"
  77. @sizeChange="pagi_changeSize"
  78. ></MyPagination>
  79. </el-main>
  80. </el-container>
  81. </el-container>
  82. </template>
  83. <script>
  84. import { getExchangeCount } from "@/api/unified-access/access-statistical-analysis.js";
  85. import MyHeader from "@/components/MyHeader";
  86. import MyTable from "@/components/MyTable";
  87. import MyPagination from "@/components/MyPagination";
  88. import MyTableHeader from "@/components/MyTableHeader";
  89. export default {
  90. name: "access-config",
  91. components: {
  92. MyHeader,
  93. MyTableHeader,
  94. MyTable,
  95. MyPagination,
  96. },
  97. data() {
  98. return {
  99. searchformModel: {},
  100. pickerOptions: {
  101. shortcuts: [
  102. {
  103. text: "最近一周",
  104. onClick(picker) {
  105. const end = new Date();
  106. const start = new Date();
  107. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  108. picker.$emit("pick", [start, end]);
  109. },
  110. },
  111. {
  112. text: "最近一个月",
  113. onClick(picker) {
  114. const end = new Date();
  115. const start = new Date();
  116. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  117. picker.$emit("pick", [start, end]);
  118. },
  119. },
  120. {
  121. text: "最近三个月",
  122. onClick(picker) {
  123. const end = new Date();
  124. const start = new Date();
  125. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  126. picker.$emit("pick", [start, end]);
  127. },
  128. },
  129. ],
  130. },
  131. showDialog: false,
  132. title: "新增",
  133. rowObj: {},
  134. type: "add",
  135. isOperate: false,
  136. yesterday:'',
  137. tableData: [],
  138. formData: [
  139. {
  140. label: "操作表",
  141. fieldName: "tableName",
  142. type: "input",
  143. showInTable: true,
  144. value: "",
  145. width: "",
  146. },
  147. {
  148. label: "inx",
  149. fieldName: "inx",
  150. type: "input",
  151. showInTable: true,
  152. value: "",
  153. width: "",
  154. },
  155. {
  156. label: "表当日实际Insert数量",
  157. fieldName: "insertCount",
  158. type: "input",
  159. showInTable: true,
  160. value: "",
  161. width: "",
  162. },
  163. {
  164. label: "日志_Update数量",
  165. fieldName: "updateCountLog",
  166. type: "input",
  167. showInTable: true,
  168. value: "",
  169. width: "",
  170. },
  171. {
  172. label: "表当日实际update数量",
  173. fieldName: "updateCount",
  174. type: "input",
  175. showInTable: true,
  176. value: "",
  177. width: "",
  178. },
  179. {
  180. label: "日志_Delete数量",
  181. fieldName: "deleteCountLog",
  182. type: "input",
  183. showInTable: true,
  184. value: "",
  185. width: "",
  186. },
  187. {
  188. label: "表当日实际Delete数量",
  189. fieldName: "deleteCount",
  190. type: "input",
  191. showInTable: true,
  192. value: "",
  193. width: "",
  194. },
  195. {
  196. label: "插入失败",
  197. fieldName: "insertError",
  198. type: "input",
  199. showInTable: true,
  200. value: "",
  201. width: "",
  202. },
  203. {
  204. label: "更新失败",
  205. fieldName: "updateError",
  206. type: "input",
  207. showInTable: true,
  208. value: "",
  209. width: "",
  210. },
  211. {
  212. label: "删除失败",
  213. fieldName: "deleteError",
  214. type: "input",
  215. showInTable: true,
  216. value: "",
  217. width: "",
  218. },
  219. {
  220. label: "操作时间",
  221. fieldName: "time",
  222. type: "input",
  223. showInTable: true,
  224. value: "",
  225. width: "",
  226. },
  227. {
  228. label: "插入_更新_删除总量",
  229. fieldName: "allCount",
  230. type: "input",
  231. showInTable: true,
  232. value: "",
  233. width: "",
  234. },
  235. {
  236. label: "jkcloud实际入库数量",
  237. fieldName: "runTime",
  238. type: "input",
  239. showInTable: true,
  240. value: "",
  241. width: "",
  242. },
  243. {
  244. label: "数量对比差值",
  245. fieldName: "runTime",
  246. type: "input",
  247. showInTable: true,
  248. value: "",
  249. width: "",
  250. },
  251. ],
  252. tableTotal: 0,
  253. pageSize: 10,
  254. currentPage: 1,
  255. selectedRows: [], // 存储选中的行数据
  256. searchForm: {},
  257. treeSearchVal: "",
  258. tableHeaderTitle: "项目列表",
  259. tabs: [],
  260. buttons: [
  261. // {
  262. // label: "导出",
  263. // type: "primary",
  264. // methodName: "action1",
  265. // icon: "el-icon-upload",
  266. // },
  267. // {
  268. // label: "对账",
  269. // type: "primary",
  270. // methodName: "action2",
  271. // icon: "el-icon-download",
  272. // },
  273. ],
  274. headerFormData: [
  275. {
  276. label: "接入方式",
  277. fieldName: "dataManner",
  278. type: "input",
  279. value: "",
  280. placeholder: "请输入接入方式",
  281. // isRequired: true,
  282. },
  283. {
  284. fieldName: "status",
  285. label: "状态",
  286. type: "select",
  287. trigger: "change",
  288. value: "",
  289. isRequired: false,
  290. options: [
  291. { value: 1, label: "正常" },
  292. { value: 0, label: "停用" },
  293. ],
  294. },
  295. // {
  296. // label: "用户状态",
  297. // fieldName: "gender",
  298. // type: "select",
  299. // value: "",
  300. // placeholder: "请选择用户状态",
  301. // isRequired: true,
  302. // options: [
  303. // { label: "男", value: "male" },
  304. // { label: "女", value: "female" },
  305. // ],
  306. // },
  307. // {
  308. // label: "生日",
  309. // fieldName: "birthdate",
  310. // type: "date",
  311. // value: "",
  312. // placeholder: "请选择生日",
  313. // isRequired: false,
  314. // },
  315. ],
  316. };
  317. },
  318. methods: {
  319. // 头部搜索框
  320. handleHeaderFormSubmit(form) {
  321. this.searchForm = form;
  322. this.getList();
  323. },
  324. // 树结构点击
  325. handleNodeClick() {},
  326. // 列表头部
  327. handleTabClick(tab) {
  328. this.tabs.forEach((item) => {
  329. if (item.label === tab.label) {
  330. item.active = true;
  331. } else {
  332. item.active = false;
  333. }
  334. });
  335. },
  336. // 列表头部功能按钮
  337. handleButtonClick(methodName) {
  338. console.log(methodName, "methodName");
  339. switch (methodName) {
  340. case "action1":
  341. // 新增
  342. this.rowObj = {};
  343. this.title = "新增";
  344. this.showDialog = true;
  345. break;
  346. case "action2":
  347. // 导出
  348. if (this.selectedRows.length > 0) {
  349. // exportTabAccessConfig().then((res) => {
  350. // if (+res.code === 200) {
  351. // }
  352. // });
  353. let ids = [];
  354. ids = this.selectedRows.map((item) => item.id);
  355. this.download(
  356. "/web/tab-access-config/export",
  357. {
  358. ids,
  359. },
  360. `统一接入配置_${new Date().getTime()}.xlsx`
  361. );
  362. } else {
  363. this.$confirm("请选择列表项?", "提示", {
  364. confirmButtonText: "关闭",
  365. cancelButtonText: "取消",
  366. showCancelButton: false,
  367. showConfirmButton: false,
  368. type: "warning",
  369. center: true,
  370. })
  371. .then(() => {})
  372. .catch(() => {});
  373. }
  374. break;
  375. default:
  376. break;
  377. }
  378. },
  379. // 处理选中项变化
  380. handleSelectionChange(selectedRows) {
  381. this.selectedRows = selectedRows; // 获取选中的行
  382. },
  383. getList() {
  384. const todayDate = new Date()
  385. // 获取昨天的日期
  386. const yesterdayDate = new Date(todayDate);
  387. yesterdayDate.setDate(todayDate.getDate() - 1);
  388. this.yesterday = this.formatDate(yesterdayDate);
  389. getExchangeCount({
  390. pageNum: this.currentPage,
  391. pageSize: this.pageSize,
  392. dateTime: this.yesterday,
  393. ...this.searchForm,
  394. }).then((res) => {
  395. if (+res.code === 200) {
  396. this.tableData = res.rows;
  397. this.tableTotal = +res.total;
  398. }
  399. });
  400. },
  401. formatDate(date) {
  402. const year = date.getFullYear();
  403. const month = String(date.getMonth() + 1).padStart(2, "0");
  404. const day = String(date.getDate()).padStart(2, "0");
  405. return `${year}-${month}-${day}`;
  406. },
  407. // 列表分页
  408. pagi_changePage(page) {
  409. this.currentPage = page;
  410. this.getList();
  411. },
  412. pagi_changeSize(size) {
  413. this.pageSize = size;
  414. this.getList();
  415. },
  416. // 弹窗
  417. handleConfirm() {
  418. this.dialogVisible = true;
  419. },
  420. handleClose() {
  421. this.dialogVisible = false;
  422. },
  423. // 编辑
  424. handleView(row) {
  425. this.rowObj = row;
  426. this.title = "查看";
  427. this.showDialog = true;
  428. },
  429. handleEdit(row) {
  430. console.log(row, "row");
  431. this.rowObj = row;
  432. console.log(this.rowObj, "this.rowObj");
  433. this.title = "编辑";
  434. this.showDialog = true;
  435. },
  436. beforeClose() {
  437. this.showDialog = false;
  438. },
  439. handleStart(row) {
  440. let pForm = {};
  441. pForm = { ...row };
  442. pForm.status = 1;
  443. updateTabAccessConfigById({ ...pForm }).then((res) => {
  444. if (+res.code === 200) {
  445. this.$message({
  446. message: res.msg,
  447. type: "success",
  448. });
  449. this.getList();
  450. } else {
  451. this.$message.error(res.msg);
  452. }
  453. });
  454. },
  455. handleStop(row) {
  456. let pForm = {};
  457. pForm = { ...row };
  458. pForm.status = 0;
  459. updateTabAccessConfigById({ ...pForm }).then((res) => {
  460. if (+res.code === 200) {
  461. this.$message({
  462. message: res.msg,
  463. type: "success",
  464. });
  465. this.getList();
  466. } else {
  467. this.$message.error(res.msg);
  468. }
  469. });
  470. },
  471. handleDelete(row) {
  472. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  473. confirmButtonText: "确定",
  474. cancelButtonText: "取消",
  475. center: true,
  476. type: "warning",
  477. })
  478. .then(() => {
  479. delTabAccessConfigById(row.id).then((res) => {
  480. if (+res.code === 200) {
  481. this.$message({
  482. message: res.msg,
  483. type: "success",
  484. });
  485. this.getList();
  486. } else {
  487. this.$message.error(res.msg);
  488. }
  489. });
  490. })
  491. .catch(() => {
  492. this.$message({
  493. type: "info",
  494. message: "已取消删除",
  495. });
  496. });
  497. },
  498. },
  499. created() {},
  500. mounted() {
  501. this.getList();
  502. },
  503. };
  504. </script>
  505. <style lang="scss" scoped>
  506. .el-main {
  507. padding: 0 20px;
  508. }
  509. .el-icon-search {
  510. font-size: 16px;
  511. font-weight: 700;
  512. color: #1e80e0;
  513. }
  514. .header-container {
  515. padding: 20px 20px 0 0;
  516. width: 100%;
  517. display: flex;
  518. // align-items: center;
  519. line-height: 1;
  520. }
  521. .header-title {
  522. font-size: 20px;
  523. width: 360px;
  524. // margin-right: 40px;
  525. }
  526. .btn-box {
  527. display: inline-block;
  528. }
  529. </style>