|
|
@@ -2,55 +2,152 @@
|
|
|
<el-container class="is-vertical">
|
|
|
<sc-page-header @add="table_add"></sc-page-header>
|
|
|
|
|
|
- <scTable ref="xGridTable" :formConfig="formConfig" :columns="columns" :options="options">
|
|
|
- <template #action>
|
|
|
- <el-button type="primary" link>
|
|
|
- <template #icon><sc-iconify icon="ant-design:edit-outlined"></sc-iconify></template>修改
|
|
|
- </el-button>
|
|
|
- <el-button type="primary" link>
|
|
|
- <template #icon><sc-iconify icon="ant-design:delete-outlined"></sc-iconify></template>删除
|
|
|
+ <scTable ref="xGridTable" :apiObj="$API.production.order" :formConfig="formConfig" :paramsColums="paramsColums" :columns="columns">
|
|
|
+ <template #code_link="{ row }">
|
|
|
+ <vxe-text status="primary" @click="table_detail(row)">{{ row.code }}</vxe-text>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-button v-if="row.canDispatch" type="primary" link @click="table_dispatch(row)">
|
|
|
+ <template #icon><sc-iconify icon="mdi:transfer"></sc-iconify></template>派工
|
|
|
</el-button>
|
|
|
+ <template v-if="row.status === 'pending'">
|
|
|
+ <el-button type="primary" link @click="table_edit(row)">
|
|
|
+ <template #icon><sc-iconify icon="ant-design:edit-outlined"></sc-iconify></template>修改
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" link @click="table_del(row)">
|
|
|
+ <template #icon><sc-iconify icon="ant-design:delete-outlined"></sc-iconify></template>删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
</template>
|
|
|
</scTable>
|
|
|
</el-container>
|
|
|
+
|
|
|
+ <order-detail v-if="dialog.detail" ref="orderRef" @success="refreshTable" @closed="dialogClose"></order-detail>
|
|
|
+ <order-desc v-if="dialog.desc" ref="orderDescRef" @closed="dialog.desc = false"></order-desc>
|
|
|
+ <dispatch-detail v-if="dialog.dispatch" ref="dispatchRef" @success="refreshTable" @closed="dialog.dispatch = false"></dispatch-detail>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
+import moment from "moment";
|
|
|
import XEUtils from "xe-utils";
|
|
|
-import { mapFormItemInput } from "@/components/scTable/helper";
|
|
|
+
|
|
|
+import API from "@/api";
|
|
|
+import TOOL from "@/utils/tool";
|
|
|
+import { productionDic } from "@/utils/basicDic";
|
|
|
+import { mapFormItemInput, mapFormItemSelect, mapFormItemDatePicker, mapFormItemTenant } from "@/components/scTable/helper";
|
|
|
+import orderDetail from "./detail";
|
|
|
+import orderDesc from "./desc";
|
|
|
+import dispatchDetail from "./dispatch";
|
|
|
+
|
|
|
+import store from "@/store";
|
|
|
+watch(() => store.state.tenant.tenantId, () => refreshTable());
|
|
|
+
|
|
|
+const selectConfig = reactive({
|
|
|
+ options: productionDic.orderStatus,
|
|
|
+ events: {
|
|
|
+ change: data => XEUtils.merge(formConfig.data, data)
|
|
|
+ }
|
|
|
+});
|
|
|
+
|
|
|
+const daterangeConfig = reactive({
|
|
|
+ resetValue: () => [],
|
|
|
+ props: {
|
|
|
+ type: "daterange",
|
|
|
+ startPlaceholder: "开始日期",
|
|
|
+ endPlaceholder: "结束日期",
|
|
|
+ format: "YYYY-MM-DD"
|
|
|
+ }
|
|
|
+});
|
|
|
|
|
|
const formConfig = reactive({
|
|
|
data: {},
|
|
|
items: [
|
|
|
- mapFormItemInput("name", "Name"),
|
|
|
- mapFormItemInput("role", "Role"),
|
|
|
- mapFormItemInput("sex", "Sex"),
|
|
|
- mapFormItemInput("num", "Num")
|
|
|
+ mapFormItemTenant({ events: { change: data => XEUtils.merge(formConfig.data, data) } }),
|
|
|
+ mapFormItemInput("nameLike", "单据主题"),
|
|
|
+ mapFormItemInput("codeLike", "单据编号"),
|
|
|
+ mapFormItemSelect("status", "单据状态", selectConfig),
|
|
|
+ // mapFormItemDatePicker("orderDate", "单据日期", daterangeConfig)
|
|
|
+ mapFormItemDatePicker("beginDate", "计划开工日期", daterangeConfig),
|
|
|
+ mapFormItemDatePicker("endDate", "计划完工日期", daterangeConfig)
|
|
|
]
|
|
|
});
|
|
|
|
|
|
+const paramsColums = reactive([
|
|
|
+ { column: "orderBy", defaultValue: "createTime_desc" },
|
|
|
+ { column: "tenantId" },
|
|
|
+ { column: "nameLike" },
|
|
|
+ { column: "codeLike" },
|
|
|
+ { column: "status" },
|
|
|
+ { column: "beginDateBegin", field: "beginDate[0]" },
|
|
|
+ { column: "beginDateEnd", field: "beginDate[1]" },
|
|
|
+ { column: "endDateBegin", field: "endDate[0]" },
|
|
|
+ { column: "endDateEnd", field: "endDate[1]" }
|
|
|
+]);
|
|
|
+
|
|
|
const columns = reactive([
|
|
|
{ type: "seq", fixed: "left", width: 60 },
|
|
|
- { type: "html", field: "name", title: "Name", sortable: true },
|
|
|
- { type: "html", field: "role", title: "Role", sortable: true },
|
|
|
- { type: "html", field: "sex", title: "Sex", sortable: true },
|
|
|
- { type: "html", field: "num", title: "Num", sortable: true },
|
|
|
- { type: "html", field: "address", title: "Address", sortable: true },
|
|
|
- { title: "操作", fixed: "right", width: 160, slots: { default: "action" } }
|
|
|
+ { 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") },
|
|
|
+ { type: "html", field: "name", title: "单据主题", fixed: "left", minWidth: 150, sortable: true },
|
|
|
+ { field: "code", title: "单据编号", fixed: "left", minWidth: 150, sortable: true, className: "vxe-table-link-cell", slots: { default: "code_link" } },
|
|
|
+ // { type: "html", field: "orderDate", title: "单据日期", minWidth: 120, sortable: true },
|
|
|
+ { field: "status", title: "单据状态", minWidth: 120, editRender: { name: "$cell-tag", options: productionDic.orderStatus } },
|
|
|
+ { type: "html", field: "beginDate", title: "计划开工日期", minWidth: 120, sortable: true },
|
|
|
+ { type: "html", field: "endDate", title: "计划完工日期", minWidth: 120, sortable: true },
|
|
|
+ { type: "html", field: "finishDate", title: "交货日期", minWidth: 120, sortable: true },
|
|
|
+ { visible: false, type: "html", field: "createTime", title: "创建日期", minWidth: 120, sortable: true, formatter: ({ cellValue }) => TOOL.dateFormat(cellValue, "YYYY-MM-DD") || cellValue },
|
|
|
+ { visible: false, type: "html", field: "remark", title: "概要", minWidth: 300, sortable: true },
|
|
|
+ { title: "操作", fixed: "right", width: 200, slots: { default: "action" } }
|
|
|
]);
|
|
|
|
|
|
-const options = reactive({
|
|
|
- data: [
|
|
|
- { id: '10001', name: 'Test1', role: 'Develop', sex: 'Man', num: '28', address: 'test abc' },
|
|
|
- { id: '10002', name: 'Test2', role: 'Test', sex: 'Women', num: '22', address: 'Guangzhou' },
|
|
|
- { id: '10003', name: 'Test3', role: 'PM', sex: 'Man', num: '32', address: 'Shanghai' },
|
|
|
- { id: '10004', name: 'Test4', role: 'Designer', sex: 'Women', num: '24', address: 'Shanghai' },
|
|
|
- { id: '10005', name: 'Test5', role: 'Develop', sex: 'Man', num: '42', address: 'Guangzhou' },
|
|
|
- { id: '10006', name: 'Test6', role: 'Test', sex: 'Women', num: '39', address: 'Shanghai' },
|
|
|
- { id: '10007', name: 'Test7', role: 'Develop', sex: 'Man', num: '46', address: 'Shanghai' },
|
|
|
- { id: '10008', name: 'Test8', role: 'PM', sex: 'Women', num: '49', address: 'Guangzhou' }
|
|
|
- ]
|
|
|
+// 显示隐藏 筛选表单
|
|
|
+const xGridTable = ref();
|
|
|
+const refreshTable = (mode = "add") => (xGridTable.value.searchData(mode), xGridTable.value.reloadColumn(columns));
|
|
|
+
|
|
|
+const orderRef = ref();
|
|
|
+const orderDescRef = ref();
|
|
|
+const dispatchRef = ref();
|
|
|
+const dialog = reactive({
|
|
|
+ detail: false,
|
|
|
+ desc: false,
|
|
|
+ dispatch: false
|
|
|
});
|
|
|
|
|
|
-const table_add = () => {};
|
|
|
+const table_add = () => {
|
|
|
+ dialog.detail = true;
|
|
|
+ nextTick(() => orderRef.value?.setData());
|
|
|
+}
|
|
|
+
|
|
|
+const table_edit = row => {
|
|
|
+ dialog.detail = true;
|
|
|
+ nextTick(() => orderRef.value?.setData(row, "edit"));
|
|
|
+}
|
|
|
+
|
|
|
+const table_detail = row => {
|
|
|
+ dialog.desc = true;
|
|
|
+ nextTick(() => orderDescRef.value?.setData(row));
|
|
|
+}
|
|
|
+
|
|
|
+const table_dispatch = row => {
|
|
|
+ dialog.dispatch = true;
|
|
|
+ nextTick(() => dispatchRef.value?.setData(row));
|
|
|
+}
|
|
|
+
|
|
|
+const table_del = ({ id }) => {
|
|
|
+ ElMessageBox.confirm("是否确认删除该生产工单?", "删除警告", {
|
|
|
+ type: "warning",
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消"
|
|
|
+ }).then(() => {
|
|
|
+ API.production.order.del({ id }).then(() => {
|
|
|
+ ElMessage.success("操作成功");
|
|
|
+ refreshTable();
|
|
|
+ });
|
|
|
+ }).catch(() => {});
|
|
|
+}
|
|
|
+
|
|
|
+const dialogClose = isDel => {
|
|
|
+ dialog.detail = false;
|
|
|
+ isDel && refreshTable();
|
|
|
+}
|
|
|
</script>
|