Parcourir la source

设备车间工位

qinhb il y a 10 mois
Parent
commit
0004ffb9fc

+ 0 - 2
src/views/base/modeling/station/components/station-page.vue

@@ -44,11 +44,9 @@
 <script setup lang="ts">
   import { ref, getCurrentInstance } from "vue";
   import { useCrud } from "@/hooks/userCrud";
-  import ButtonPermKeys from "@/common/configs/buttonPermission";
   import { useCommonStoreHook } from "@/store";
 
   const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-  import { useDictionaryStore } from "@/store";
   import { columns } from "./columns";
   import {
     addStationDevice,

+ 101 - 0
src/views/device/instance/components/choice-station-page.vue

@@ -0,0 +1,101 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+        ref="crudRef"
+        v-model:search="search"
+        v-model="form"
+        :data="data"
+        :option="option"
+        v-model:page="page"
+        @row-click="rowClick"
+        @search-change="searchChange"
+        @search-reset="resetChange"
+        @size-change="dataList"
+        @current-change="dataList"
+    >
+    </avue-crud>
+  </div>
+</template>
+<script setup>
+import { ref } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import dictDataUtil from "@/common/configs/dictDataUtil";
+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 } = Utils; //按钮权限等工具
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+const emit = defineEmits(["stationInfo"])
+const rowClick = (row)=>{
+  emit("stationInfo", row)
+}
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  delBtn: false,
+  selection: false,
+  search: false,
+  editBtn: false,
+  addBtn: false,
+  viewBtn: false,
+  menu: false,
+  column: [
+    {
+      label: "工位编号",
+      prop: "stationCode",
+      overHidden: true,
+      search: true,
+    },
+    {
+      label: "工位名称",
+      prop: "name",
+      search: true,
+      overHidden: true,
+    },
+    {
+      label: "工位类型",
+      prop: "stationDictValue",
+      search: true,
+      overHidden: true,
+      type: "select",
+      dicUrl: dictDataUtil.request_url + "station_type",
+      props: {
+        label: "dictLabel", // 下拉菜单显示的字段
+        value: "dictValue", // 下拉菜单值的字段
+      },
+    },
+    {
+      label: "负责人",
+      prop: "manager",
+      overHidden: true,
+    },
+    {
+      label: "所属产线",
+      prop: "productionLineName",
+      overHidden: true,
+      display: false,
+    },
+    {
+      label: "工位地址",
+      prop: "position",
+      overHidden: true,
+    }
+  ],
+});
+
+onMounted(() => {
+  search.value.enable = "1"
+  dataList();
+});
+</script>

+ 51 - 2
src/views/device/instance/index.vue

@@ -129,6 +129,22 @@
         <el-button @click="dialog.visible = false">取消</el-button>
       </div>
     </el-dialog>
+    <el-dialog
+        v-model="dialog2.visible"
+        :title="dialog2.title"
+        width="70%"
+        @close="dialog2.visible = false"
+    >
+      <choice-workshop-page @workShopInfo="workShopInfo" />
+    </el-dialog>
+    <el-dialog
+        v-model="dialog3.visible"
+        :title="dialog3.title"
+        width="70%"
+        @close="dialog3.visible = false"
+    >
+      <choice-station-page @stationInfo="stationInfo" />
+    </el-dialog>
     <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
   </div>
 </template>
@@ -138,6 +154,8 @@ import { useCrud } from "@/hooks/userCrud";
 import buttonPermission from "@/common/configs/buttonPermission";
 import { configSave, configList, deviceUpdateCollect } from "@/api/device";
 import { useCommonStoreHook } from "@/store";
+import ChoiceWorkshopPage from "../../plan/workOrder/components/choice-workshop-page.vue";
+import ChoiceStationPage from "./components/choice-station-page.vue";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 const test = () => {
@@ -218,7 +236,22 @@ const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
 const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
 const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
-
+const workShopInfo = (value) => {
+  form.value.workshop = value.name;
+  dialog2.visible = false;
+};
+const stationInfo = (value) => {
+  form.value.station = value.name;
+  dialog3.visible = false;
+};
+const dialog2 = reactive({
+  title: "车间选择",
+  visible: false,
+});
+const dialog3 = reactive({
+  title: "工位选择",
+  visible: false,
+});
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
   delBtn: false,
@@ -395,12 +428,29 @@ option.value = Object.assign(option.value, {
       prop: "workshop",
       width: 160,
       overHidden: true,
+      click: ({ value, column }) => {
+        if (column.boxType) {
+          dialog2.visible = true;
+        }
+      },
     },
     {
       label: "所在工位",
       prop: "station",
       width: 160,
       overHidden: true,
+      click: ({ value, column }) => {
+        if (column.boxType) {
+          /*if(!form.value.workshop){
+            ElMessage({
+              message: "请先选择车间",
+              type: "warning",
+            });
+            return;
+          }*/
+          dialog3.visible = true;
+        }
+      },
     },
     {
       label: "设备位置",
@@ -424,7 +474,6 @@ option.value = Object.assign(option.value, {
 });
 
 onMounted(() => {
-  // console.log("crudRef", crudRef)
   dataList();
 });
 /**