index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :selectConfig="selectConfig"
  10. highlight-current-row
  11. :action-list="[]"
  12. @get-list="getList"
  13. >
  14. <template #amount="{ item }">
  15. <div>
  16. <span style="padding-right: 4px">{{ item.currency }}</span>
  17. <span>{{ moneyFormat(item.amount, 2) }}</span>
  18. </div>
  19. </template>
  20. <template #refundMoney="{ item }">
  21. <div>
  22. <span style="padding-right: 4px">{{ item.currency }}</span>
  23. <span>{{ moneyFormat(item.sumClaimMoney, 2) }}</span>
  24. </div>
  25. </template>
  26. <template #advanceRatio="{ item }">
  27. <div>
  28. <span>{{ item.advanceRatio }}%</span>
  29. </div>
  30. </template>
  31. </byTable>
  32. </div>
  33. </div>
  34. </template>
  35. <script setup>
  36. import { computed, ref } from "vue";
  37. import byTable from "@/components/byTable/index";
  38. import useUserStore from "@/store/modules/user";
  39. import { ElMessage, ElMessageBox } from "element-plus";
  40. const { proxy } = getCurrentInstance();
  41. const contractType = ref([]);
  42. const corporationList = ref([]);
  43. const customerList = ref([]);
  44. const status = ref([
  45. {
  46. label: "草稿",
  47. value: 0,
  48. },
  49. {
  50. label: "审批中",
  51. value: 10,
  52. },
  53. {
  54. label: "驳回",
  55. value: 20,
  56. },
  57. {
  58. label: "审批通过",
  59. value: 30,
  60. },
  61. {
  62. label: "终止",
  63. value: 99,
  64. },
  65. ]);
  66. const refundStatus = ref([
  67. {
  68. label: "未到款",
  69. value: 0,
  70. },
  71. {
  72. label: "部分到款",
  73. value: 10,
  74. },
  75. {
  76. label: "已到款",
  77. value: 20,
  78. },
  79. ]);
  80. const sourceList = ref({
  81. data: [],
  82. pagination: {
  83. total: 0,
  84. pageNum: 1,
  85. pageSize: 10,
  86. keyword: "",
  87. status: "30",
  88. sellCorporationId: "",
  89. },
  90. });
  91. const loading = ref(false);
  92. const selectConfig = computed(() => {
  93. return [
  94. // {
  95. // label: "审批状态",
  96. // prop: "status",
  97. // data: status.value,
  98. // },
  99. {
  100. label: "到款状态",
  101. prop: "refundStatusNew",
  102. data: refundStatus.value,
  103. },
  104. // {
  105. // label: "归属公司",
  106. // prop: "sellCorporationId",
  107. // data: corporationList.value,
  108. // },
  109. ];
  110. });
  111. const config = computed(() => {
  112. return [
  113. {
  114. attrs: {
  115. label: "归属公司",
  116. prop: "sellCorporationId",
  117. "min-width": 220,
  118. },
  119. render(type) {
  120. let text = "";
  121. if (corporationList.value && corporationList.value.length > 0) {
  122. let data = corporationList.value.filter((item) => item.value == type);
  123. if (data && data.length > 0) {
  124. text = data[0].label;
  125. }
  126. }
  127. return text;
  128. },
  129. },
  130. {
  131. attrs: {
  132. label: "合同类型",
  133. prop: "contractType",
  134. width: 120,
  135. },
  136. render(type) {
  137. let text = "";
  138. if (contractType.value && contractType.value.length > 0) {
  139. let data = contractType.value.filter((item) => item.value == type);
  140. if (data && data.length > 0) {
  141. text = data[0].label;
  142. }
  143. }
  144. return text;
  145. },
  146. },
  147. {
  148. attrs: {
  149. label: "合同编码",
  150. prop: "code",
  151. width: 180,
  152. },
  153. },
  154. {
  155. attrs: {
  156. label: "客户",
  157. prop: "buyCorporationId",
  158. "min-width": 220,
  159. },
  160. render(type) {
  161. let text = "";
  162. if (customerList.value && customerList.value.length > 0) {
  163. let data = customerList.value.filter((item) => item.value == type);
  164. if (data && data.length > 0) {
  165. text = data[0].label;
  166. }
  167. }
  168. return text;
  169. },
  170. },
  171. {
  172. attrs: {
  173. label: "版本号",
  174. prop: "version",
  175. width: 120,
  176. },
  177. },
  178. {
  179. attrs: {
  180. label: "合同金额",
  181. slot: "amount",
  182. width: 140,
  183. },
  184. },
  185. {
  186. attrs: {
  187. label: "已到账金额",
  188. slot: "refundMoney",
  189. width: 140,
  190. },
  191. },
  192. {
  193. attrs: {
  194. label: "业务员",
  195. prop: "userName",
  196. width: 140,
  197. },
  198. },
  199. {
  200. attrs: {
  201. label: "创建时间",
  202. prop: "createTime",
  203. width: 160,
  204. },
  205. },
  206. {
  207. attrs: {
  208. label: "到款状态",
  209. prop: "refundStatusNew",
  210. width: 80,
  211. },
  212. render(refundStatusNew) {
  213. return proxy.dictValueLabel(refundStatusNew, refundStatus.value);
  214. },
  215. },
  216. {
  217. attrs: {
  218. label: "审批状态",
  219. prop: "status",
  220. width: 140,
  221. },
  222. render(type) {
  223. let text = "";
  224. if (status.value && status.value.length > 0) {
  225. let data = status.value.filter((item) => item.value == type);
  226. if (data && data.length > 0) {
  227. text = data[0].label;
  228. }
  229. }
  230. return text;
  231. },
  232. },
  233. {
  234. attrs: {
  235. label: "操作",
  236. width: "120",
  237. align: "center",
  238. fixed: "right",
  239. },
  240. renderHTML(row) {
  241. return [
  242. {
  243. attrs: {
  244. label: "选择",
  245. type: "primary",
  246. text: true,
  247. },
  248. el: "button",
  249. click() {
  250. handleSelect(row);
  251. },
  252. },
  253. ];
  254. },
  255. },
  256. ];
  257. });
  258. const getDict = () => {
  259. proxy
  260. .post("/dictTenantData/page", {
  261. pageNum: 1,
  262. pageSize: 999,
  263. dictCode: "contract_type",
  264. tenantId: useUserStore().user.tenantId,
  265. })
  266. .then((res) => {
  267. if (res.rows && res.rows.length > 0) {
  268. contractType.value = res.rows.map((item) => {
  269. return {
  270. label: item.dictValue,
  271. value: item.dictKey,
  272. };
  273. });
  274. }
  275. });
  276. proxy.post("/corporation/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  277. corporationList.value = res.rows.map((item) => {
  278. return {
  279. ...item,
  280. label: item.name,
  281. value: item.id,
  282. };
  283. });
  284. });
  285. proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  286. customerList.value = res.rows.map((item) => {
  287. return {
  288. ...item,
  289. label: item.name,
  290. value: item.id,
  291. };
  292. });
  293. });
  294. };
  295. const getList = async (req) => {
  296. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  297. loading.value = true;
  298. proxy.post("/contract/page", sourceList.value.pagination).then((res) => {
  299. sourceList.value.data = res.rows;
  300. sourceList.value.pagination.total = res.total;
  301. setTimeout(() => {
  302. loading.value = false;
  303. }, 200);
  304. });
  305. };
  306. getDict();
  307. getList();
  308. const newContract = () => {
  309. proxy.$router.replace({
  310. path: "/platform_manage/process/processApproval",
  311. query: {
  312. flowKey: "contract_flow",
  313. flowName: "销售合同审批流程",
  314. },
  315. });
  316. };
  317. const handleSelect = (row) => {
  318. proxy.$emit("handleSelectContrct", row);
  319. };
  320. </script>
  321. <style lang="scss" scoped>
  322. .tenant {
  323. padding: 20px;
  324. }
  325. ::v-deep(.el-input-number .el-input__inner) {
  326. text-align: left;
  327. }
  328. </style>