index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <el-container class="is-vertical">
  3. <sc-page-header @add="table_add"></sc-page-header>
  4. <scTable ref="xGridTable" v-bind="xGridOptions">
  5. <template #code_link="{ row }">
  6. <vxe-text status="primary" @click="table_detail(row)">{{ row.code }}</vxe-text>
  7. </template>
  8. <template #action>
  9. <!-- 入库申请/返工(派工后) -->
  10. <el-button type="primary" link @click="table_edit(row)">
  11. <template #icon><sc-iconify icon="ant-design:edit-outlined"></sc-iconify></template>质检
  12. </el-button>
  13. <el-button type="primary" link @click="table_edit(row)">
  14. <template #icon><sc-iconify icon="ant-design:edit-outlined"></sc-iconify></template>指派
  15. </el-button>
  16. <el-button type="primary" link @click="table_del(row)">
  17. <template #icon><sc-iconify icon="ant-design:delete-outlined"></sc-iconify></template>删除
  18. </el-button>
  19. </template>
  20. </scTable>
  21. </el-container>
  22. </template>
  23. <script setup>
  24. import moment from "moment";
  25. import XEUtils from "xe-utils";
  26. import API from "@/api";
  27. import TOOL from "@/utils/tool";
  28. import { salesDic } from "@/utils/basicDic";
  29. import { mapFormItemInput, mapFormItemSelect, mapFormItemDatePicker, mapFormItemTenant } from "@/components/scTable/helper";
  30. import store from "@/store";
  31. watch(() => store.state.tenant.tenantId, () => refreshTable());
  32. const daterangeConfig = reactive({
  33. resetValue: () => [],
  34. props: {
  35. type: "daterange",
  36. startPlaceholder: "开始日期",
  37. endPlaceholder: "结束日期",
  38. format: "YYYY-MM-DD"
  39. }
  40. });
  41. const xGridOptions = reactive({
  42. // apiObj: API.production.prePlan,
  43. toolbarConfig: { export: false },
  44. formConfig: {
  45. data: {},
  46. items: [
  47. mapFormItemInput("nameLike", "质检任务主题"),
  48. mapFormItemInput("codeLike", "质检任务编号"),
  49. mapFormItemDatePicker("createTime", "计划周期", daterangeConfig)
  50. ]
  51. },
  52. paramsColums: [
  53. { column: "orderBy", defaultValue: "createTime_desc" },
  54. { column: "status", defaultValue: "pending" },
  55. { column: "tenantId" },
  56. { column: "nameLike" },
  57. { column: "codeLike" },
  58. { column: "createTimeBegin", field: "createTime[0]" },
  59. { column: "createTimeEnd", field: "createTime[1]" }
  60. ],
  61. columns: [
  62. { type: "seq", fixed: "left", width: 60 },
  63. { visible: computed(() => store.state.tenant.tenantId === "0"), type: "html", field: "tenantName", title: "所属租户", fixed: "left", minWidth: 200, sortable: true, formatter: ({ cellValue, row }) => cellValue || XEUtils.get(XEUtils.find(store.state.tenant.tenants, item => item.id == row.tenantId), "name") },
  64. { type: "html", field: "name", title: "质检任务主题", fixed: "left", minWidth: 150, sortable: true },
  65. { field: "code", title: "质检任务编号", fixed: "left", minWidth: 150, sortable: true, className: "vxe-table-link-cell", slots: { default: "code_link" } },
  66. { type: "html", field: "product", title: "质检产品", minWidth: 150, sortable: true },
  67. { type: "html", field: "num", title: "数量", minWidth: 150, sortable: true },
  68. { field: "status", title: "质检状态", minWidth: 120, editRender: { name: "$cell-tag", options: salesDic.planStatus } },
  69. { visible: false, type: "html", field: "createTime", title: "创建日期", minWidth: 120, sortable: true, formatter: ({ cellValue }) => TOOL.dateFormat(cellValue, "YYYY-MM-DD") || cellValue },
  70. { title: "操作", fixed: "right", width: 220, slots: { default: "action" } }
  71. ]
  72. });
  73. // 显示隐藏 筛选表单
  74. const xGridTable = ref();
  75. const refreshTable = (mode = "add") => (xGridTable.value.searchData(mode), xGridTable.value.reloadColumn(columns));
  76. const dispatchRef = ref();
  77. const dispatchDescRef = ref();
  78. const dialog = reactive({
  79. detail: false,
  80. desc: false
  81. });
  82. const table_add = () => {
  83. dialog.detail = true;
  84. nextTick(() => dispatchRef.value?.open());
  85. }
  86. const table_edit = row => {
  87. dialog.detail = true;
  88. nextTick(() => dispatchRef.value?.setData(row));
  89. }
  90. const table_detail = row => {
  91. dialog.desc = true;
  92. nextTick(() => dispatchDescRef.value?.setData(row));
  93. }
  94. const table_del = ({ id }) => {
  95. ElMessageBox.confirm("是否确认删除该派工单?", "删除警告", {
  96. type: "warning",
  97. confirmButtonText: "确定",
  98. cancelButtonText: "取消"
  99. }).then(() => {
  100. // API.production.plan.del({ id }).then(() => {
  101. // ElMessage.success("操作成功");
  102. // refreshTable();
  103. // });
  104. }).catch(() => {});
  105. }
  106. </script>