index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <div>
  3. <el-card class="box-card">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :searchConfig="searchConfig"
  10. highlight-current-row
  11. @get-list="getList"
  12. @clickReset="clickReset">
  13. <template #code="{ item }">
  14. <div>
  15. <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
  16. </div>
  17. </template>
  18. <template #exceptionTypeDetail="{ item }">
  19. <div>{{ item.exceptionTypeDetail }}</div>
  20. </template>
  21. </byTable>
  22. </el-card>
  23. </div>
  24. </template>
  25. <script setup>
  26. import byTable from "/src/components/byTable/index";
  27. import { ElMessage, ElMessageBox } from "element-plus";
  28. const { proxy } = getCurrentInstance();
  29. const departmentList = ref([]);
  30. const exceptionTypeList = ref([]);
  31. const sourceList = ref({
  32. data: [],
  33. pagination: {
  34. total: 0,
  35. pageNum: 1,
  36. pageSize: 10,
  37. departmentId: "",
  38. code: "",
  39. wlnCode: "",
  40. exception: "1",
  41. exceptionType: "",
  42. },
  43. });
  44. const loading = ref(false);
  45. const searchConfig = computed(() => {
  46. return [
  47. {
  48. type: "input",
  49. prop: "code",
  50. label: "订单号",
  51. },
  52. {
  53. type: "input",
  54. prop: "wlnCode",
  55. label: "E10单号",
  56. },
  57. {
  58. type: "select",
  59. prop: "departmentId",
  60. data: departmentList.value,
  61. label: "事业部",
  62. },
  63. {
  64. type: "select",
  65. prop: "exceptionType",
  66. data: exceptionTypeList.value,
  67. label: "异常类型",
  68. },
  69. ];
  70. });
  71. const config = computed(() => {
  72. return [
  73. {
  74. attrs: {
  75. label: "事业部",
  76. prop: "departmentName",
  77. width: 140,
  78. },
  79. },
  80. {
  81. attrs: {
  82. label: "订单号",
  83. slot: "code",
  84. width: 220,
  85. },
  86. },
  87. {
  88. attrs: {
  89. label: "E10单号",
  90. prop: "wlnCode",
  91. width: 180,
  92. },
  93. },
  94. {
  95. attrs: {
  96. label: "订单状态",
  97. prop: "status",
  98. width: 140,
  99. },
  100. render(val) {
  101. return proxy.dictKeyValue(val, proxy.useUserStore().allDict["order_status"]);
  102. },
  103. },
  104. {
  105. attrs: {
  106. label: "异常明细",
  107. slot: "exceptionTypeDetail",
  108. "min-width": 240,
  109. },
  110. },
  111. {
  112. attrs: {
  113. label: "异常时间",
  114. prop: "exceptionTime",
  115. width: 160,
  116. },
  117. },
  118. {
  119. attrs: {
  120. label: "操作",
  121. width: 200,
  122. align: "center",
  123. fixed: "right",
  124. },
  125. renderHTML(row) {
  126. return [
  127. ["1", "2", "3"].includes(row.exceptionType)
  128. ? {
  129. attrs: {
  130. label: "转为正常",
  131. type: "primary",
  132. text: true,
  133. },
  134. el: "button",
  135. click() {
  136. clickNormalize(row);
  137. },
  138. }
  139. : {},
  140. // row.status == 0 || row.status == 10 || row.status == 20
  141. {
  142. attrs: {
  143. label: "删除",
  144. type: "danger",
  145. text: true,
  146. },
  147. el: "button",
  148. click() {
  149. clickDelete(row);
  150. },
  151. },
  152. {
  153. attrs: {
  154. label: "重新同步",
  155. type: "primary",
  156. text: true,
  157. },
  158. el: "button",
  159. click() {
  160. clickResynchronization(row);
  161. },
  162. },
  163. ];
  164. },
  165. },
  166. ];
  167. });
  168. const getDemandData = () => {
  169. proxy.post("/department/page", { pageNum: 1, pageSize: 999 }).then((res) => {
  170. if (res.rows && res.rows.length > 0) {
  171. departmentList.value = res.rows.map((item) => {
  172. return {
  173. dictKey: item.id,
  174. dictValue: item.name,
  175. };
  176. });
  177. }
  178. });
  179. proxy.post("/orderInfo/getExceptionTypeList", {}).then((res) => {
  180. if (res && res.length > 0) {
  181. exceptionTypeList.value = res.map((item) => {
  182. return {
  183. dictKey: item.key,
  184. dictValue: item.value,
  185. };
  186. });
  187. }
  188. });
  189. };
  190. getDemandData();
  191. const getList = async (req, status) => {
  192. if (status) {
  193. sourceList.value.pagination = {
  194. pageNum: sourceList.value.pagination.pageNum,
  195. pageSize: sourceList.value.pagination.pageSize,
  196. exception: "1",
  197. };
  198. } else {
  199. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  200. }
  201. loading.value = true;
  202. proxy.post("/orderInfo/page", sourceList.value.pagination).then((res) => {
  203. sourceList.value.data = res.rows;
  204. sourceList.value.pagination.total = res.total;
  205. setTimeout(() => {
  206. loading.value = false;
  207. }, 200);
  208. });
  209. };
  210. getList();
  211. const clickReset = () => {
  212. getList("", true);
  213. };
  214. const clickCode = (row) => {
  215. proxy.$router.replace({
  216. path: "/order-detail",
  217. query: {
  218. detailId: row.id,
  219. text: "订单详情",
  220. random: proxy.random(),
  221. },
  222. });
  223. };
  224. const clickDelete = (row) => {
  225. ElMessageBox.confirm("你是否确认此操作", "提示", {
  226. confirmButtonText: "确定",
  227. cancelButtonText: "取消",
  228. type: "warning",
  229. })
  230. .then(() => {
  231. proxy.post("/orderInfo/deleteAndStore", { id: row.id }).then(() => {
  232. ElMessage({ message: "删除成功", type: "success" });
  233. getList();
  234. });
  235. })
  236. .catch(() => {});
  237. };
  238. const clickResynchronization = (row) => {
  239. ElMessageBox.confirm("你是否确认此操作", "提示", {
  240. confirmButtonText: "确定",
  241. cancelButtonText: "取消",
  242. type: "warning",
  243. })
  244. .then(() => {
  245. proxy.post("/orderInfo/deleteAndStore", { id: row.id }).then(() => {
  246. proxy.post("/orderHandle/resynchronization", { wlnCode: row.wlnCode }).then(() => {
  247. ElMessage({ message: "万里牛订单同步完成", type: "success" });
  248. getList();
  249. });
  250. });
  251. })
  252. .catch(() => {});
  253. };
  254. const clickNormalize = (row) => {
  255. proxy.post("/orderInfo/turnToRegularOrder", { id: row.id }).then(() => {
  256. ElMessage({ message: "操作成功", type: "success" });
  257. getList();
  258. });
  259. };
  260. </script>
  261. <style lang="scss" scoped>
  262. ::v-deep(.el-input-number .el-input__inner) {
  263. text-align: left;
  264. }
  265. :deep(.el-dialog) {
  266. margin-top: 10px !important;
  267. margin-bottom: 10px !important;
  268. }
  269. .select-card {
  270. height: calc(100vh - 184px);
  271. overflow-y: auto;
  272. overflow-x: hidden;
  273. }
  274. </style>