فهرست منبع

fix:工艺录下修改

lupeng 5 ماه پیش
والد
کامیت
a17050d350
3فایلهای تغییر یافته به همراه169 افزوده شده و 20 حذف شده
  1. 26 0
      src/api/craft/route/index.ts
  2. 140 14
      src/views/base/craftManagement/route/index.vue
  3. 3 6
      src/views/base/craftManagement/routeCommon/index.vue

+ 26 - 0
src/api/craft/route/index.ts

@@ -43,3 +43,29 @@ export function editRouteWith(data: object) {
     data: data,
   });
 }
+
+
+// 编辑工艺 针对产品负责人的修改
+export function copyList(data: object) {
+  return request({
+    url: `/api/v1/op/route/copyList`,
+    method: "post",
+    data: data,
+  });
+}
+
+// 复制工艺路线子项
+export function copyProductRoute(data: object) {
+  return request({
+    url: `/api/v1/op/route/copyProductRoute`,
+    method: "post",
+    data: data,
+  });
+}
+export function updateMain(data: object) {
+  return request({
+    url: `/api/v1/op/route/updateMain`,
+    method: "post",
+    data: data,
+  });
+}

+ 140 - 14
src/views/base/craftManagement/route/index.vue

@@ -80,6 +80,8 @@
         >
         <el-button link type="primary" v-if="row.upgradeVersion==='1'" icon="el-icon-notification" @click="changeLog(row)"
         >修改记录</el-button>
+          <el-button link type="primary" v-if="row.isMain==='0'" icon="el-icon-setting" @click="setMain(row)"
+          >主路线</el-button>
         <el-button
           link
           icon="el-icon-copy-document"
@@ -87,7 +89,7 @@
           @click="copyRow(row)"
           >复制</el-button
         >
-        <el-button link icon="el-icon-copy-document" @click="bindProcess(row)"
+        <el-button link icon="el-icon-copy-document" @click="bindProcessPop(row)"
           >绑定</el-button
         >
       </template>
@@ -178,6 +180,31 @@
     >
       <RouteChangeLog :targetRouteId="routeDeatil.id" />
     </el-dialog>
+    <el-dialog
+        v-model="dialog2.visible"
+        :title="dialog2.title"
+        width="900px"
+        @close="dialog2.visible=false"
+        :destroy-on-close="true"
+    >
+
+        <el-table :data="tableData" style="width: 100%" ref="singleTableRef" highlight-current-row @current-change="handleCurrentChange">
+          <el-table-column type="index" width="50" />
+          <el-table-column prop="id" label="id" width="180" v-if="false" />
+          <el-table-column prop="processRouteName" label="工艺路线名称" width="180" />
+          <el-table-column prop="processRouteCode" label="工艺路线编码" width="180" />
+          <el-table-column prop="processRouteVersion" label="版本" />
+          <el-table-column prop="prodtName" label="产品名称"  />
+          <el-table-column prop="prodtModel" label="产品规格" width="180" />
+        </el-table>
+      <template #footer>
+        <div class="footer">
+          <el-button type="primary" @click="copyProcess()" :loading="isLoading">复制</el-button>
+          <el-button type="primary" @click="bindProcess(rowDetail)" :loading="loading">自定义</el-button>
+          <el-button @click="dialog2.visible=false">取消</el-button>
+        </div>
+      </template>
+    </el-dialog>
   </div>
 </template>
 <script setup>
@@ -185,9 +212,12 @@ import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 import { useDictionaryStore } from "@/store";
-import { copyRoute, editRouteWith } from "@/api/craft/route/index";
+import {copyList, copyProductRoute, copyRoute, editRouteWith, updateMain} from "@/api/craft/route/index";
 import { getUserList } from "@/api/system/user/index";
 import RouteChangeLog from "@/views/base/craftManagement/route/components/routeChangeLog.vue";
+import {ElMessageBox} from "element-plus";
+const isLoading=ref(false);
+const loading=ref(false);
 // 数据字典相关
 const { dicts } = useDictionaryStore();
 const sureCancelProductManager = () => {
@@ -195,10 +225,36 @@ const sureCancelProductManager = () => {
   dataList();
   form.value = {};
 };
+const tableData = ref([]);
+const currentRow = ref();
+const singleTableRef = ref(null);
+const handleCurrentChange = (val) => {
+  currentRow.value = val
+}
+const setMain = (row) =>{
+  ElMessageBox.confirm("是否将该工艺路线设置为主路线?", "提示", {
+    confirmButtonText: "确定",
+    cancelButtonText: "取消",
+    type: "warning",}).then(async()=>{
+    updateMain(row).then(
+        (data)=>{
+          ElMessage.success(data.msg);
+          dataList();
+        }
+    )
+
+   }
+
+  )
+}
 const dialog1 = ref({
   title: "修改记录",
   visible: false,
 });
+const dialog2 = ref({
+  title: "绑定",
+  visible: false,
+});
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
@@ -215,6 +271,7 @@ const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等
 //   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
 //   menu: true,
 // });
+const rowDetail = ref({});
 let centerDialogVisible = ref(false);
 const crudRef = ref(null); //crudRef.value 获取avue-crud对象
 const tmpForm = ref({});
@@ -241,6 +298,36 @@ const sureToEditProductManager = () => {
   });
 };
 
+const copyProductProject =ref({});
+const copyProcess = () =>{
+  if(!currentRow.value){
+    ElMessage.error("未选择要复制工艺路线!");
+    return;
+  }
+  isLoading.value = true;
+  loading.value = true;
+  copyProductProject.value.sourceId = currentRow.value.id;
+  copyProductProject.value.targetId = rowDetail.value.id;
+  copyProductRoute(copyProductProject.value).then(
+    (data)=>{
+      if(data.code==='200'){
+        isLoading.value = false;
+        loading.value = false;
+        dialog2.value.visible = false;
+        dataList();
+        ElMessage.success(data.msg);
+      }
+    }
+  ).finally(()=>{
+    isLoading.value = false;
+    loading.value = false;
+
+
+  })
+
+
+
+}
 onMounted(() => {
   // console.log("crudRef", crudRef)
   dataList();
@@ -260,9 +347,7 @@ const uploadFinished = () => {
 };
 const routeDeatil = ref({});
 const changeLog = (row) => {
-  console.log(row);
   routeDeatil.value = row;
-  console.log(routeDeatil.value);
   dialog1.value.visible = true;
 }
 const doEdit = (row, index) => {
@@ -337,6 +422,31 @@ const bindProcess = (row) => {
   });
 };
 
+const bindProcessPop = (row) => {
+  if(row.routeData){
+    router.push({
+      path: `/base/craftManagement/bindProcess/${row.id}/${row.prodtCode}`,
+    });
+    return;
+  }
+  copyList(row).then(
+    (data)=>{
+      tableData.value = data.data;
+      console.log(tableData.value);
+      if(!tableData.value||tableData.value.length==0){
+        router.push({
+          path: `/base/craftManagement/bindProcess/${row.id}/${row.prodtCode}`,
+        });
+        return;
+      }
+      rowDetail.value = row;
+      dialog2.value.visible = true;
+    }
+  )
+
+
+
+};
 // 设置表格列或者其他自定义的option
 option.value = Object.assign(option.value, {
   searchEnter: true,
@@ -346,18 +456,9 @@ option.value = Object.assign(option.value, {
   delBtn: false,
   searchLabelWidth: 110,
   editBtn: false,
+  rowParentKey: "mainCode",
   column: [
     {
-      label: "工艺路线编号",
-      prop: "processRouteCode",
-      search: true,
-      width: 150,
-      addDisplay: true,
-      editDisabled: true,
-      overHidden: true,
-      display: false,
-    },
-    {
       label: "工艺路线名称",
       prop: "processRouteName",
       width: 150,
@@ -372,6 +473,17 @@ option.value = Object.assign(option.value, {
       ],
     },
     {
+      label: "工艺路线编号",
+      prop: "processRouteCode",
+      search: true,
+      width: 150,
+      addDisplay: true,
+      editDisabled: true,
+      overHidden: true,
+      display: false,
+    },
+
+    {
       label: "工艺路线类型",
       prop: "processRouteType",
       minWidth: 120,
@@ -606,6 +718,12 @@ option.value = Object.assign(option.value, {
       ],
       precision: 1,
     },
+
+    {
+      label: "来源版本",
+      prop: "sourceVersion",
+      display: false,
+    },
     {
       label: "创建人",
       prop: "creator",
@@ -621,6 +739,14 @@ option.value = Object.assign(option.value, {
       width: 150,
       overHidden: true,
     },
+    {
+      label: "主分支编码",
+      prop: "mainCode",
+      search: true,
+      width: 150,
+      hide: true,
+      display: false,
+    },
   ],
 });
 </script>

+ 3 - 6
src/views/base/craftManagement/routeCommon/index.vue

@@ -55,13 +55,14 @@
         </el-dropdown>
       </template>
       <template #menu="{ row }">
-        <!--<el-button
+        <el-button
           link
           icon="el-icon-copy-document"
           :disabled="false"
           @click="copyRow(row)"
+          v-if="row.routeData!=null&&row.routeData!=''"
           >复制</el-button
-        >-->
+        >
         <el-button link type="primary" v-if="row.upgradeVersion==='1'" icon="el-icon-notification" @click="changeLog(row)"
         >修改记录</el-button>
         <el-button link icon="el-icon-copy-document" @click="bindProcess(row)"
@@ -203,10 +204,6 @@ const startChooseProduct = () => {
 };
 // 已经绑定了工序的可以复制,跟后端HT商量只传id即可。
 const copyRow = (row) => {
-  if (row.usable == 0) {
-    ElMessage.error("该路线未被绑定!");
-    return;
-  }
   form.value = Object.assign(form.value, row);
   form.value.processRouteVersion = "";
   crudRef.value.rowAdd();