Selaa lähdekoodia

Merge branch 'master' into Branch_qinhb

qinhb 1 vuosi sitten
vanhempi
commit
019dc4c1a1

+ 13 - 3
src/api/craft/route/index.ts

@@ -3,9 +3,8 @@ import request from "@/utils/request";
 // 复制工艺路线
 // 复制工艺路线
 export function copyRoute(id: string) {
 export function copyRoute(id: string) {
   return request({
   return request({
-    url: "/api/v1/op/route/copyAdd",
-    method: "post",
-    data: { id: id },
+    url: `/api/v1/op/route/copyAdd/${id}`,
+    method: "get",
   });
   });
 }
 }
 
 
@@ -25,3 +24,14 @@ export function saveProcessInRoute(data: object) {
     data: data,
     data: data,
   });
   });
 }
 }
+
+// 保存xx关系表中的工序
+export function updateProcess(data: object) {
+  return request({
+    url: `/api/v1/op/operation/update`,
+    method: "post",
+    data: data,
+  });
+}
+
+

+ 5 - 0
src/plugins/permission.ts

@@ -1,6 +1,8 @@
 import router from "@/router";
 import router from "@/router";
 import { useUserStore } from "@/store/modules/user";
 import { useUserStore } from "@/store/modules/user";
 import { usePermissionStore } from "@/store/modules/permission";
 import { usePermissionStore } from "@/store/modules/permission";
+import { useDictionaryStore } from "@/store/modules/dictionary";
+
 import NProgress from "@/utils/nprogress";
 import NProgress from "@/utils/nprogress";
 
 
 export function setupPermission() {
 export function setupPermission() {
@@ -16,6 +18,9 @@ export function setupPermission() {
         next({ path: "/" });
         next({ path: "/" });
         NProgress.done();
         NProgress.done();
       } else {
       } else {
+        const dictStore = useDictionaryStore();
+        dictStore.checkDicts();
+
         const userStore = useUserStore();
         const userStore = useUserStore();
         // const hasRoles =
         // const hasRoles =
         //   userStore.user.roles && userStore.user.roles.length > 0;
         //   userStore.user.roles && userStore.user.roles.length > 0;

+ 39 - 38
src/store/modules/dictionary.ts

@@ -1,44 +1,45 @@
 import { store } from "@/store";
 import { store } from "@/store";
 import { defineStore } from "pinia";
 import { defineStore } from "pinia";
+import { getUserDicts } from "@/api/auth";
 
 
-export const useDictionaryStore = defineStore("dictionaryStore", {
-  state: () => ({
-    /**
-     * 需要后端返回的type
-     */
-    types: [
-      "station_type",
-      "station_operate_type",
-      "applicable_platforms",
-      "material_properties",
-      "quality_testing_plan",
-      "material_level",
-      "packaging_method",
-      "quality_grade",
-      "selection_type",
-      "device_type",
-      "stage",
-      "danwei_type",
-      "process_type",
-      "workshop_section",
-      "skill_requirements",
-      "station_type",
-      "danwei_type",
-      "trace_type",
-      "skill_type",
-    ],
-    dicts: [],
-  }),
-  persist: {
-    enabled: true,
-    strategies: [
-      {
-        key: "dicts",
-        storage: localStorage,
-        paths: ["dicts"],
-      },
-    ],
-  },
+export const useDictionaryStore = defineStore("dictionaryStore", () => {
+  const types = [
+    "station_type",
+    "station_operate_type",
+    "applicable_platforms",
+    "material_properties",
+    "quality_testing_plan",
+    "material_level",
+    "packaging_method",
+    "quality_grade",
+    "selection_type",
+    "device_type",
+    "stage",
+    "danwei_type",
+    "process_type",
+    "workshop_section",
+    "skill_requirements",
+    "station_type",
+    "danwei_type",
+    "trace_type",
+    "skill_type",
+  ];
+  const dicts = ref<{ string?: any[] }>({});
+  function checkDicts() {
+    if (JSON.stringify(dicts.value) === "{}") {
+      getUserDicts(types).then((res) => {
+        if (res.data) {
+          dicts.value = res?.data ?? [];
+        }
+      });
+    }
+  }
+
+  return {
+    types,
+    dicts,
+    checkDicts,
+  };
 });
 });
 
 
 export function useDictionaryStoreHook() {
 export function useDictionaryStoreHook() {

+ 176 - 3
src/views/base/craftManagement/defectMana/index.vue

@@ -1,7 +1,180 @@
 <template>
 <template>
-  <div>缺陷</div>
+  <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('/api/v1/plan/order/export')"
+        >
+          <template #icon> <i-ep-download /> </template>导出
+        </el-button>
+      </template> -->
+    </avue-crud>
+    <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
+  </div>
 </template>
 </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, useDictionaryStoreHook } from "@/store";
 
 
-<script setup lang="ts"></script>
+// 数据字典相关
+const { dicts } = useDictionaryStoreHook();
 
 
-<style lang="less" scoped></style>
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/op/baseBug",
+  });
+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/plan/order/import");
+  }
+};
+
+// 设置表格列或者其他自定义的option
+const switchOp = [
+  {
+    label: "",
+    value: 0,
+  },
+  {
+    label: "",
+    value: 1,
+  },
+];
+option.value = Object.assign(option.value, {
+  selection: true,
+  column: [
+	{
+	  label: "缺陷类型",
+	  prop: "bugType",
+	  minWidth: 200,
+	  search: true,
+	  overHidden: true,
+	  rules: [
+	    {
+	      required: true,
+	      message: "缺陷类型不能为空",
+	      trigger: "change",
+	    },
+	  ],
+	  type: "select",
+	  dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.defect_mana,
+	  props: {
+	    label: "dictLabel",
+	    value: "dictValue",
+	  },
+	},
+    {
+      label: "缺陷编码",
+      prop: "bugCode",
+      span: 12,
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: "缺陷编码不能为空",
+          trigger: "blur",
+        },
+      ],
+    },
+    {
+      label: "缺陷名称",
+      prop: "bugName",
+      span: 12,
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: "缺陷名称不能为空",
+          trigger: "blur",
+        },
+      ],
+    },
+	{
+      label: "备注",
+      prop: "remark",
+      span: 12,
+      search: true,
+      rules: [
+        {
+          required: false,
+          message: "备注不能为空",
+          trigger: "blur",
+        },
+      ],
+    }
+  ],
+});
+</script>

+ 48 - 18
src/views/base/craftManagement/route/bindProcess.vue

@@ -6,10 +6,10 @@
     <div class="header">
     <div class="header">
       <div class="title">绑定工序</div>
       <div class="title">绑定工序</div>
       <el-space>
       <el-space>
-        <el-button :icon="Back" size="small">返回</el-button>
-        <el-button type="primary" :icon="Download" size="small">下载</el-button>
+        <el-button :icon="Back" size="small" @click="back">返回</el-button>
+        <!--        <el-button type="primary" :icon="Download" size="small">下载</el-button>-->
         <el-button
         <el-button
-          type="primary"
+          :type="isChanged ? 'danger' : 'primary'"
           :icon="Document"
           :icon="Document"
           size="small"
           size="small"
           @click="saveFlow"
           @click="saveFlow"
@@ -55,7 +55,9 @@
           v-model="list2"
           v-model="list2"
           :animation="150"
           :animation="150"
           group="people"
           group="people"
+          @update="onUpdate"
           style="min-width: 400px"
           style="min-width: 400px"
+          @add="onClone"
         >
         >
           <div
           <div
             v-for="(item, index) in list2"
             v-for="(item, index) in list2"
@@ -65,10 +67,7 @@
           >
           >
             <div class="indexLabel">工序 {{ index + 1 }}</div>
             <div class="indexLabel">工序 {{ index + 1 }}</div>
             <div :class="getFlowNameClass(index)">
             <div :class="getFlowNameClass(index)">
-              {{ item?.operationVO?.operationName }} 当前id:{{
-                item?.operationId
-              }}
-              下id:{{ item?.nextOperationId }}
+              {{ item?.operationVO?.operationName }}
             </div>
             </div>
             <div>
             <div>
               <Delete class="flowDelete" @click.stop="clickDelete(index)" />
               <Delete class="flowDelete" @click.stop="clickDelete(index)" />
@@ -78,12 +77,11 @@
         </VueDraggable>
         </VueDraggable>
       </div>
       </div>
       <div class="detailInfo">
       <div class="detailInfo">
-        <div v-show="selectIndex > -1">
+        <div v-if="selectIndex > -1 && !isChanged">
           <avue-form
           <avue-form
             ref="formRef"
             ref="formRef"
             :option="formOption"
             :option="formOption"
             v-model="currentProcess"
             v-model="currentProcess"
-            @submit="handleSubmit"
             style="padding: 10px; background-color: white"
             style="padding: 10px; background-color: white"
           />
           />
           <div class="editProcces">
           <div class="editProcces">
@@ -92,6 +90,7 @@
             >
             >
           </div>
           </div>
         </div>
         </div>
+        <div v-else class="tipContent">{{ tipContent }}</div>
       </div>
       </div>
     </div>
     </div>
   </div>
   </div>
@@ -111,9 +110,12 @@ import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
 import {
 import {
   processesByRouteId,
   processesByRouteId,
   saveProcessInRoute,
   saveProcessInRoute,
+  updateProcess,
 } from "@/api/craft/route/index";
 } from "@/api/craft/route/index";
 import { v4 as uuidv4 } from "uuid";
 import { v4 as uuidv4 } from "uuid";
 import { formOption } from "./bindConfig";
 import { formOption } from "./bindConfig";
+import { ElMessage } from "element-plus";
+
 const router = useRouter();
 const router = useRouter();
 const route = useRoute();
 const route = useRoute();
 
 
@@ -121,12 +123,12 @@ const route = useRoute();
 const { dicts } = useDictionaryStoreHook();
 const { dicts } = useDictionaryStoreHook();
 
 
 // 顶部====================
 // 顶部====================
-const back = () => {};
+const back = () => {
+  router.back();
+};
 
 
 const download = () => {};
 const download = () => {};
 
 
-const save = () => {};
-
 // 左侧工序树====================
 // 左侧工序树====================
 const activeNames = ref([0]);
 const activeNames = ref([0]);
 const handleChange = (val) => {};
 const handleChange = (val) => {};
@@ -155,6 +157,7 @@ const clone = (origin) => {
   };
   };
 };
 };
 
 
+// 保存中间的工序列表
 const saveFlow = async () => {
 const saveFlow = async () => {
   for (let i = 0; i < list2.value.length; i++) {
   for (let i = 0; i < list2.value.length; i++) {
     list2.value[i].operationSort = i;
     list2.value[i].operationSort = i;
@@ -184,15 +187,32 @@ const loadTreeData = () => {
 // 中间列表====================
 // 中间列表====================
 const list2 = ref([]);
 const list2 = ref([]);
 const selectIndex = ref(-1);
 const selectIndex = ref(-1);
-
+const isChanged = ref(true); //如果中间列表发生了改变则不显示右侧信息
+// 点击中间列表事件,需要设置index和值
 const clickFlowItem = (item, index) => {
 const clickFlowItem = (item, index) => {
+  if (isChanged.value) {
+    ElMessage.warning("请先保存工序列表");
+    return;
+  }
   selectIndex.value = index;
   selectIndex.value = index;
-  console.log("clickFlowItem", item);
+  currentProcess.value = item.operationVO;
 };
 };
 
 
 const clickDelete = (index) => {
 const clickDelete = (index) => {
   list2.value.splice(index, 1);
   list2.value.splice(index, 1);
+  onUpdate();
+};
+
+const onClone = () => {
+  isChanged.value = true;
+  tipContent.value = "请先保存工序列表,再选择工序进行编辑";
+};
+
+const onUpdate = () => {
+  //   中间发生了改变调用
   selectIndex.value = -1;
   selectIndex.value = -1;
+  isChanged.value = true;
+  tipContent.value = "请先保存工序列表,再选择工序进行编辑";
 };
 };
 
 
 const getFlowNameClass = (index) => {
 const getFlowNameClass = (index) => {
@@ -201,19 +221,23 @@ const getFlowNameClass = (index) => {
 
 
 const loadProcessesFlow = async () => {
 const loadProcessesFlow = async () => {
   const res = await processesByRouteId(route.params.id);
   const res = await processesByRouteId(route.params.id);
-  console.log("processesByRouteId", res);
+
   list2.value = res.data ?? [];
   list2.value = res.data ?? [];
-  if (selectIndex.value >= 0) {
-  }
+  isChanged.value = false;
+  tipContent.value = "请选择需要编辑的工序";
 };
 };
 
 
 // 右侧具体信息====================
 // 右侧具体信息====================
 const formRef = ref(null);
 const formRef = ref(null);
 const currentProcess = ref({});
 const currentProcess = ref({});
+const tipContent = ref("");
 const handleSubmit = () => {};
 const handleSubmit = () => {};
 
 
 const editProComponent = async () => {
 const editProComponent = async () => {
-  saveFlow();
+  // saveFlow();
+  let res = await updateProcess(currentProcess.value);
+  ElMessage.success("保存成功");
+  router.push(`/base/craftManagement/processCom/${currentProcess.value.id}`);
 };
 };
 
 
 // 全局=======
 // 全局=======
@@ -362,6 +386,12 @@ const getNameByDictType = (dictValue) => {
   text-align: left;
   text-align: left;
   margin-left: 19px;
   margin-left: 19px;
 }
 }
+.tipContent {
+  width: 100%;
+  text-align: center;
+  margin-top: 20px;
+  color: #e6a23c;
+}
 </style>
 </style>
 
 
 <style>
 <style>

+ 1 - 0
src/views/base/craftManagement/route/components/bottomTable.vue

@@ -113,6 +113,7 @@ const imgUrlClick = (itemValue) => {
 };
 };
 
 
 onMounted(() => {
 onMounted(() => {
+  search.value.operationId = route.params.id;
   url.value = tableConfig[props.tableType].url;
   url.value = tableConfig[props.tableType].url;
   option.value = Object.assign(option.value, {
   option.value = Object.assign(option.value, {
     addBtn: false,
     addBtn: false,

+ 2 - 1
src/views/base/craftManagement/route/components/configs.ts

@@ -128,7 +128,8 @@ export const getTableConfig = (id: string) => {
           hide: true,
           hide: true,
           value: id,
           value: id,
         },
         },
-        { label: "所需数量", prop: "num" },
+		{ label: "精度要求", prop: "accuracy" },
+        { label: "所需数量", prop: "num",display: false,hide: true },
         {
         {
           label: "设备类型",
           label: "设备类型",
           prop: "equitType",
           prop: "equitType",

+ 26 - 17
src/views/base/craftManagement/route/components/processComponent.vue

@@ -7,7 +7,11 @@
       <div class="title">绑定工序</div>
       <div class="title">绑定工序</div>
       <el-space>
       <el-space>
         <el-button :icon="Back" size="small" @click="back">返回</el-button>
         <el-button :icon="Back" size="small" @click="back">返回</el-button>
-        <el-button type="primary" :icon="Document" size="small" @click="save"
+        <el-button
+          :type="isChanged ? 'danger' : 'primary'"
+          :icon="Document"
+          size="small"
+          @click="save"
           >保存</el-button
           >保存</el-button
         >
         >
       </el-space>
       </el-space>
@@ -52,7 +56,7 @@
       </VueDraggable>
       </VueDraggable>
     </div>
     </div>
     <div class="binContainer">
     <div class="binContainer">
-      <div v-if="isChanged || selectIndex === -1">
+      <div v-if="isChanged || selectIndex === -1 || isNoneedEdit">
         <el-empty :image-size="200" :description="getTipContent()" />
         <el-empty :image-size="200" :description="getTipContent()" />
       </div>
       </div>
       <div v-else>
       <div v-else>
@@ -80,6 +84,7 @@ import { VueDraggable } from "vue-draggable-plus";
 import BottomTable from "@/views/base/craftManagement/route/components/bottomTable.vue";
 import BottomTable from "@/views/base/craftManagement/route/components/bottomTable.vue";
 import { comTypes } from "@/views/base/craftManagement/route/components/configs";
 import { comTypes } from "@/views/base/craftManagement/route/components/configs";
 import { saveCompoents, getCompoentsList } from "@/api/craft/process/index";
 import { saveCompoents, getCompoentsList } from "@/api/craft/process/index";
+
 import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
 import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
 import {
 import {
   processesByRouteId,
   processesByRouteId,
@@ -91,7 +96,7 @@ const route = useRoute();
 
 
 //组件是否已经改变,如果改变了需要点击保存,才能展示下面的table
 //组件是否已经改变,如果改变了需要点击保存,才能展示下面的table
 const isChanged = ref(true);
 const isChanged = ref(true);
-
+const isNoneedEdit = ref(false); //有些组件是不需要编辑的,所以下面也不展示table
 const loadTopList = () => {
 const loadTopList = () => {
   getCompoentsList(route.params.id).then((res) => {
   getCompoentsList(route.params.id).then((res) => {
     selectProComs.value = res.data || [];
     selectProComs.value = res.data || [];
@@ -105,7 +110,9 @@ onMounted(async () => {
 });
 });
 
 
 // 顶部====================
 // 顶部====================
-const back = () => {};
+const back = () => {
+  router.back();
+};
 
 
 const save = async () => {
 const save = async () => {
   for (let i = 0; i < selectProComs.value.length; i++) {
   for (let i = 0; i < selectProComs.value.length; i++) {
@@ -127,20 +134,25 @@ const selectProComs = ref([]);
 const selectIndex = ref(-1);
 const selectIndex = ref(-1);
 const currentCom = ref({});
 const currentCom = ref({});
 const handleCommand = (itme) => {
 const handleCommand = (itme) => {
-  console.log(itme);
   selectProComs.value.push(itme);
   selectProComs.value.push(itme);
   isChanged.value = true;
   isChanged.value = true;
+  selectIndex.value = -1;
 };
 };
 
 
 // 点击某一个改变下面的table
 // 点击某一个改变下面的table
 const clickToolCom = (com, index) => {
 const clickToolCom = (com, index) => {
+  // 如果上方组件更改了,提示先保存组件再操作
+  if (isChanged.value) {
+    ElMessage.warning("请先保存组件!!!");
+    return;
+  }
   selectIndex.value = index;
   selectIndex.value = index;
   currentCom.value = com;
   currentCom.value = com;
   if (com.compentType === "mingpai" || com.compentType === "duomeiticaiji") {
   if (com.compentType === "mingpai" || com.compentType === "duomeiticaiji") {
-    isChanged.value = true;
+    isNoneedEdit.value = true;
   } else {
   } else {
     tableType.value = com.compentType;
     tableType.value = com.compentType;
-    isChanged.value = false;
+    isNoneedEdit.value = false;
   }
   }
 };
 };
 
 
@@ -174,17 +186,14 @@ const saveSortData = () => {
 };
 };
 
 
 const getTipContent = (itemValue) => {
 const getTipContent = (itemValue) => {
-  let str = "";
-  if (isChanged.value) {
-    if (selectIndex.value === -1) {
-      str = "请先保存组件,然后再进行操作";
-    } else {
-      str = "标准组件无需编辑";
-    }
-  } else {
-    str = "请先选择组件";
+  if (isNoneedEdit.value) {
+    return "标准组件无需编辑";
+  }
+  if (selectIndex.value === -1 && isChanged.value) {
+    return "请先保存组件,然后再进行操作";
   }
   }
-  return str;
+
+  return "请先选择组件";
 };
 };
 </script>
 </script>
 
 

+ 10 - 2
src/views/base/craftManagement/route/index.vue

@@ -21,11 +21,12 @@
         <el-tag v-else type="info">未绑定</el-tag>
         <el-tag v-else type="info">未绑定</el-tag>
       </template>
       </template>
 
 
+	  <!-- :disabled="row.usable == '1' ? false : true" -->
       <template #menu="{ row }">
       <template #menu="{ row }">
         <el-button
         <el-button
           link
           link
           icon="el-icon-copy-document"
           icon="el-icon-copy-document"
-          :disabled="row.usable == '1' ? false : true"
+          :disabled="false"
           @click="copyRow(row)"
           @click="copyRow(row)"
           >复制</el-button
           >复制</el-button
         >
         >
@@ -137,9 +138,16 @@ option.value = Object.assign(option.value, {
       prop: "processRouteCode",
       prop: "processRouteCode",
       search: true,
       search: true,
       width: 150,
       width: 150,
-      addDisplay: false,
+      addDisplay: true,
       editDisabled: true,
       editDisabled: true,
       overHidden: true,
       overHidden: true,
+	  rules: [
+	    {
+	      required: true,
+	      message: "工艺路线名称不能为空",
+	      trigger: "blur",
+	    },
+	  ],
     },
     },
     {
     {
       label: "工艺路线名称",
       label: "工艺路线名称",