orderAccount.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <!-- 模板区域 -->
  2. <template>
  3. <div>
  4. <el-dialog v-model="props.orderAccount" title="选择出单账号" width="50%" @close="close">
  5. <div class="flex a-c j-s ">
  6. <div class="flex a-c">
  7. <el-input v-model="searchValue" style="width: 240px;margin-right: 10px;" clearable
  8. placeholder="输入用户名,简称,保险公司查找" />
  9. <el-button type="primary" @click="refresh">查询</el-button>
  10. </div>
  11. <div>
  12. <el-button type="default" @click="addAccount">添加账号
  13. <template #icon>
  14. <el-icon>
  15. <Plus />
  16. </el-icon>
  17. </template>
  18. </el-button>
  19. <el-button type="default" @click="refresh">刷新</el-button>
  20. </div>
  21. </div>
  22. <ComplexTable :tableData="tableData" :columns="columns" :showIndex="false" :columnwidth="200" :showSelect="false"
  23. :showOperation="false" :pageInfo="pageInfo" :maxHeight="400" @getList="getList" :highlightCurrentRow="true"
  24. :loading="loding" @currentChange="currentChange">
  25. </ComplexTable>
  26. <template #footer>
  27. <div class="dialog-footer">
  28. <el-button @click="cancel">取消</el-button>
  29. <el-button type="primary" @click="save" :disabled="!activeInfo">
  30. 确定
  31. </el-button>
  32. </div>
  33. </template>
  34. </el-dialog>
  35. </div>
  36. </template>
  37. <!-- 行为区域 -->
  38. <script lang='ts' setup>
  39. import { ref, } from 'vue'
  40. import api from '@/api'
  41. import { useRouter } from "vue-router";
  42. import { defineProps, defineEmits } from "vue";
  43. interface PageInfo {
  44. pageNum: number;
  45. pageSize: number;
  46. sizes: number[];
  47. total: number;
  48. }
  49. const pageInfo = ref({
  50. pageNum: 1,
  51. pageSize: 20,
  52. sizes: [10, 20, 30, 40, 50],
  53. total: 100,
  54. });
  55. const router = useRouter();
  56. const props = defineProps<{
  57. orderAccount: boolean,
  58. }>();
  59. const emits = defineEmits(["cancel", 'save']);
  60. const searchValue = ref();
  61. const activeInfo = ref();//选中对象
  62. const tableData = ref([
  63. ]);
  64. const loding = ref(false);
  65. const columns = [
  66. {
  67. prop: "createTime", label: "创建时间", align: 'left',
  68. },
  69. {
  70. prop: "username", label: "账号信息", align: 'left', formatter: (row: any) => {
  71. return `用户名:${row.username}\n简称:${row.userAbbr}`
  72. }
  73. },
  74. {
  75. prop: "insCompanyName", label: "保险公司",
  76. },
  77. { prop: "url", label: "系统", },
  78. { prop: "deptName", label: "归属", },
  79. ];
  80. //分页事件
  81. function getList(item: PageInfo) {
  82. pageInfo.value.pageNum = item.pageNum;
  83. pageInfo.value.pageSize = item.pageSize;
  84. findpage();
  85. };
  86. onMounted(() => {
  87. findpage();
  88. })
  89. //数据查询
  90. function findpage() {
  91. api.insuranceApi.getAgreementAttributionList({ pages: pageInfo.value.pageNum, size: pageInfo.value.pageSize, username: searchValue.value }).then((res: any) => {
  92. if (res.code == '200') {
  93. tableData.value = res.data.records;
  94. pageInfo.value.pageNum = res.data.current;
  95. pageInfo.value.pageSize = res.data.size;
  96. pageInfo.value.total = res.data.total;
  97. } else {
  98. }
  99. });
  100. }
  101. const currentChange = (info: object) => {
  102. console.log(info)
  103. activeInfo.value = info;
  104. }
  105. const cancel = () => {
  106. emits("cancel")
  107. }
  108. const close = () => {
  109. emits('cancel')
  110. }
  111. const save = () => {
  112. emits('save', activeInfo.value.id, activeInfo.value.username, activeInfo.value.userAbbr)
  113. }
  114. //打开新标签页
  115. const addAccount = () => {
  116. const url = router.resolve({
  117. name: 'InsuranceAccountAdd',
  118. }).href; // 获取目标路由的完整 URL
  119. window.open(url, '_blank'); // 在新标签页中打开
  120. }
  121. const refresh = () => {
  122. loding.value = true;
  123. api.insuranceApi.getAgreementAttributionList({ pages: 1, size: 20, username: searchValue.value }).then((res: any) => {
  124. if (res.code == '200') {
  125. tableData.value = res.data.records;
  126. pageInfo.value.pageNum = res.data.current;
  127. pageInfo.value.pageSize = res.data.size;
  128. pageInfo.value.total = res.data.total;
  129. loding.value = false;
  130. }
  131. });
  132. }
  133. </script>