duplicatesCustomer.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" @click="queryRule">{{
  4. $t("查看重复")
  5. }}</el-button>
  6. <el-dialog
  7. :title="$t('重复客户')"
  8. :visible.sync="dialogTableVisible"
  9. append-to-body
  10. width="1000px"
  11. @close="onClose"
  12. >
  13. <tableLayout
  14. :layout="tablecols"
  15. :data="list"
  16. :opwidth="200"
  17. height="calc(100vh - 550px)"
  18. :width="true"
  19. :custom="true"
  20. >
  21. <template v-slot:customcol="scope">
  22. <div v-if="scope.column.columnname === 'tag'">
  23. <div
  24. v-for="item in scope.column.data.tag_sys"
  25. :key="item.index"
  26. style="float: left; margin-left: 5px; margin-bottom: 5px"
  27. >
  28. <el-tag color="#3874F6" size="mini" type="primary" effect="dark">
  29. <span>{{ $t(item) }}</span>
  30. </el-tag>
  31. </div>
  32. <div
  33. v-for="item in scope.column.data.tag"
  34. :key="item.index"
  35. style="float: left; margin-left: 5px; margin-bottom: 5px"
  36. >
  37. <el-tag color="#FA8C16" size="mini" type="warning" effect="dark">
  38. <span>{{ $t(item) }}</span>
  39. </el-tag>
  40. </div>
  41. </div>
  42. <div v-else-if="scope.column.columnname === 'leader'">
  43. <span>{{
  44. scope.column.data.leader
  45. ? scope.column.data.leader.length !== 0
  46. ? scope.column.data.leader[0].name
  47. : "--"
  48. : "--"
  49. }}</span>
  50. </div>
  51. <p v-else>
  52. {{
  53. scope.column.data[scope.column.columnname]
  54. ? scope.column.data[scope.column.columnname]
  55. : "--"
  56. }}
  57. </p>
  58. </template>
  59. </tableLayout>
  60. <div class="container normal-panel" style="text-align: right">
  61. <el-pagination
  62. background
  63. @size-change="handleSizeChange"
  64. @current-change="handleCurrentChange"
  65. :current-page="currentPage"
  66. :page-sizes="[20, 50, 100, 200]"
  67. :page-size="20"
  68. layout="total,sizes, prev, pager, next, jumper"
  69. :total="total"
  70. ></el-pagination>
  71. </div>
  72. </el-dialog>
  73. </div>
  74. </template>
  75. <script>
  76. export default {
  77. name: "duplicatesCustomer",
  78. props: ["data"],
  79. data() {
  80. return {
  81. dialogTableVisible: false,
  82. list: [],
  83. tablecols: [],
  84. total: 0,
  85. currentPage: 0,
  86. param: {
  87. id: 20221208172002,
  88. pageNumber: 1,
  89. pageSize: 999,
  90. content: {
  91. sa_customersid: "",
  92. enterprisename: "",
  93. taxno: "",
  94. address: "",
  95. },
  96. },
  97. fields1: [],
  98. fields2: [],
  99. fields3: [],
  100. };
  101. },
  102. methods: {
  103. async queryData() {
  104. this.fields1.forEach((item) => {
  105. this.param.content[item] = this.data[item] || "";
  106. });
  107. this.fields2.forEach((item) => {
  108. this.param.content[item] = this.data[item] || "";
  109. });
  110. this.fields3.forEach((item) => {
  111. this.param.content[item] = this.data[item] || "";
  112. });
  113. this.param.content.sa_customersid = this.data.sa_customersid;
  114. // this.param.content.enterprisename = this.data.enterprisename
  115. // this.param.content.taxno = this.data.taxno
  116. // this.param.content.address = this.data.address
  117. const res = await this.$api.requested(this.param);
  118. this.list = res.data;
  119. this.total = res.total;
  120. this.currentPage = res.pageNumber;
  121. this.dialogTableVisible = true;
  122. if (res.data.length !== 0) {
  123. this.tagData(this.$route.query.id);
  124. }
  125. },
  126. handleSizeChange(val) {
  127. // console.log(`每页 ${val} 条`);
  128. this.param.content.pageSize = val;
  129. this.queryData();
  130. },
  131. handleCurrentChange(val) {
  132. // console.log(`当前页: ${val}`);
  133. this.param.content.pageNumber = val;
  134. this.queryData();
  135. },
  136. /*查询规则*/
  137. async queryRule() {
  138. const res = await this.$api.requested({
  139. id: "20230410090502",
  140. content: {},
  141. });
  142. this.fields1 = res.data.custcheckrule.fields1;
  143. this.fields2 = res.data.custcheckrule.fields2;
  144. this.fields3 = res.data.custcheckrule.fields3;
  145. this.queryData();
  146. },
  147. // 获取标签数据
  148. async tagData(id) {
  149. const res = await this.$api.requested({
  150. content: {
  151. ownertable: "sa_customers",
  152. ownerid: this.$route.query.id,
  153. },
  154. id: 20220929085401,
  155. });
  156. var resTagData = [];
  157. resTagData = res.data.datatag;
  158. let flag = 0;
  159. for (var i = 0; i < res.data.datatag.length; i++) {
  160. if (res.data.datatag[i] === "疑似重复") {
  161. flag = 1;
  162. break;
  163. }
  164. }
  165. if (flag === 1) {
  166. this.setTag(id, resTagData);
  167. } else {
  168. resTagData.push("疑似重复");
  169. this.setTag(id, resTagData);
  170. }
  171. },
  172. async setTag(id, data) {
  173. const res = await this.$api.requested({
  174. id: 20220929090901,
  175. content: {
  176. ownertable: "sa_customers",
  177. ownerid: id,
  178. datatag: data,
  179. },
  180. });
  181. },
  182. onClose() {
  183. this.dialogTableVisible = false;
  184. this.$emit("onSuccessTag");
  185. },
  186. },
  187. mounted() {},
  188. created() {
  189. this.tablecols = this.tool.tabelCol(
  190. this.$route.name
  191. ).duplicatesCustomerTable.tablecols;
  192. },
  193. };
  194. </script>
  195. <style scoped>
  196. /deep/.el-dialog__title {
  197. line-height: 20px;
  198. font-size: 16px;
  199. color: #303133;
  200. }
  201. </style>