|
@@ -0,0 +1,220 @@
|
|
|
+<template>
|
|
|
+ <div class="mainContentBox">
|
|
|
+ <avue-crud
|
|
|
+ ref="crudRef"
|
|
|
+ v-model:search="search"
|
|
|
+ v-model="form"
|
|
|
+ :data="data"
|
|
|
+ :option="option"
|
|
|
+ v-model:page="page"
|
|
|
+ @row-save="createRow"
|
|
|
+ @row-update="updateRow"
|
|
|
+ @row-del="deleteRow"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="resetChange"
|
|
|
+ @size-change="dataList"
|
|
|
+ @current-change="dataList"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ >
|
|
|
+ <template #menu-left="{ size }">
|
|
|
+ <el-button
|
|
|
+ :disabled="toDeleteIds.length < 1"
|
|
|
+ type="danger"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ :size="size"
|
|
|
+ @click="multipleDelete"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <template #menu-right="{}">
|
|
|
+ <el-dropdown split-button
|
|
|
+ >导入
|
|
|
+ <template #dropdown>
|
|
|
+ <el-dropdown-menu>
|
|
|
+ <el-dropdown-item
|
|
|
+ @click="downloadTemplate('/api/v1/plan/order/template')"
|
|
|
+ >
|
|
|
+ <i-ep-download />下载模板
|
|
|
+ </el-dropdown-item>
|
|
|
+ <el-dropdown-item @click="importExcelData">
|
|
|
+ <i-ep-top />导入数据
|
|
|
+ </el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </template>
|
|
|
+ </el-dropdown>
|
|
|
+ <el-button class="ml-3" @click="exportData">
|
|
|
+ <template #icon> <i-ep-download /> </template>导出
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+ import { ref, getCurrentInstance } from "vue";
|
|
|
+ import { useCrud } from "@/hooks/userCrud";
|
|
|
+ import dictDataUtil from "@/common/configs/dictDataUtil";
|
|
|
+ import ButtonPermKeys from "@/common/configs/buttonPermission";
|
|
|
+ import { useCommonStoreHook } from "@/store";
|
|
|
+ const { isShowTable, tableType } = toRefs(useCommonStoreHook());
|
|
|
+
|
|
|
+ const test = () => {
|
|
|
+ isShowTable.value = true;
|
|
|
+ tableType.value = tableType.value == 1 ? 2 : 1;
|
|
|
+ };
|
|
|
+
|
|
|
+ // 传入一个url,后面不带/
|
|
|
+ const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
|
|
|
+ useCrud({
|
|
|
+ src: "/api/v1/base/station",
|
|
|
+ });
|
|
|
+ const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
|
|
|
+ Methords; //增删改查
|
|
|
+ const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
|
|
|
+ const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
|
|
|
+ // checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
|
|
|
+ // const permission = reactive({
|
|
|
+ // delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
|
|
|
+ // addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
|
|
|
+ // editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
|
|
|
+ // menu: true,
|
|
|
+ // });
|
|
|
+
|
|
|
+ const crudRef = ref(null); //crudRef.value 获取avue-crud对象
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ // console.log("crudRef", crudRef)
|
|
|
+ dataList();
|
|
|
+ });
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 上传excel相关
|
|
|
+ */
|
|
|
+ const uploadRef = ref(null);
|
|
|
+ const uploadFinished = () => {
|
|
|
+ // 上传完成后的刷新操作
|
|
|
+ page.currentPage = 1;
|
|
|
+ dataList();
|
|
|
+ };
|
|
|
+ const importExcelData = () => {
|
|
|
+ if (uploadRef.value) {
|
|
|
+ uploadRef.value.show("/api/v1/base/station");
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 设置表格列或者其他自定义的option
|
|
|
+ option.value = Object.assign(option.value, {
|
|
|
+ selection: true,
|
|
|
+ column: [
|
|
|
+ {
|
|
|
+ label: "工位编号",
|
|
|
+ prop: "stationCode",
|
|
|
+ search: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请填写工位编号",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位名称",
|
|
|
+ prop: "stationName",
|
|
|
+ search: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请填写工位名称",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位类型",
|
|
|
+ prop: "stationDictValue",
|
|
|
+ search: true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请选择工位类型",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ type: 'select',
|
|
|
+ dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.station_type,
|
|
|
+ searchClearable: false, //可清空的输入框,默认为true
|
|
|
+ filterable: true, //添加filterable属性即可启用搜索功能
|
|
|
+ props: {
|
|
|
+ label: "dictLabel", // 下拉菜单显示的字段
|
|
|
+ value: "dictValue" // 下拉菜单值的字段
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位操作方式",
|
|
|
+ prop: "operateDictValue",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请选择工位方式",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ type: 'select',
|
|
|
+ dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.station_operate_type,
|
|
|
+ props: {
|
|
|
+ label: "dictLabel", // 下拉菜单显示的字段
|
|
|
+ value: "dictValue" // 下拉菜单值的字
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位负责人",
|
|
|
+ prop: "stationManager",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请选择工位负责人",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ type: 'select',
|
|
|
+ dicUrl:import.meta.env.VITE_APP_BASE_API+"/api/v1/sys/user/list",
|
|
|
+ dicMethod:"post",
|
|
|
+ props: {
|
|
|
+ label: "userName", // 下拉菜单显示的字段
|
|
|
+ value: "userName" // 下拉菜单值的字段
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "所属产线",
|
|
|
+ prop: "productionLineName",
|
|
|
+ display:false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位地址",
|
|
|
+ prop: "stationPosition",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请填写工位地址",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位IP地址",
|
|
|
+ prop: "stationIp",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请填写工位IP地址",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "工位描述",
|
|
|
+ prop: "remark",
|
|
|
+ type: 'textarea',
|
|
|
+ span: 24,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "创建人",
|
|
|
+ prop: "creator",
|
|
|
+ display:false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "创建时间",
|
|
|
+ prop: "created",
|
|
|
+ display:false
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ });
|
|
|
+</script>
|
|
|
+
|