qinhb преди 5 месеца
родител
ревизия
ff39f05e9d
променени са 3 файла, в които са добавени 230 реда и са изтрити 12 реда
  1. 14 0
      src/api/craft/process/index.ts
  2. 148 0
      src/views/base/craftManagement/process/component/difference.vue
  3. 68 12
      src/views/base/craftManagement/process/index.vue

+ 14 - 0
src/api/craft/process/index.ts

@@ -74,3 +74,17 @@ export function getRouteMaxVersion(routeId: string) {
     method: "get",
   });
 }
+export function checkSyncList(id: string) {
+  return request({
+    url: "/api/v1/op/routeOperation/checkSyncList/" + id,
+    method: "get",
+  });
+}
+
+export function syncOperation(data: Object) {
+  return request({
+    url: "/api/v1/op/routeOperation/syncOperation",
+    method: "post",
+    data: data,
+  });
+}

+ 148 - 0
src/views/base/craftManagement/process/component/difference.vue

@@ -0,0 +1,148 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+      ref="crudRef"
+      :data="dataList"
+      :option="option"
+      @selectable="selectable"
+      @selection-change="selectionChange1"
+    >
+    </avue-crud>
+  </div>
+</template>
+<script setup>
+import { defineProps, ref } from "vue";
+import { useCommonStoreHook } from "@/store";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+const emit = defineEmits(["syncList"])
+const props = defineProps({
+  diffList: {
+    type: Array,
+    default: () => {
+      return [];
+    },
+  },
+});
+const selectable = (row, index) =>{ // row当前列队数据
+  if (row.use === '1') { // 判断条件
+    return false; // 灰掉 不可选
+  } else {
+    return true // 可选
+  }
+}
+const dataList = ref([])
+const selectionChange1 = (rows) => {
+  let ids = [];
+  rows?.forEach((element) => {
+    ids.push(
+        element["routeId"]
+    );
+  });
+  emit("syncList", ids)
+};
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+watch(
+  () => props.diffList,
+  () => {
+    dataList.value = []
+    dataList.value = props.diffList
+  }
+);
+
+// 设置表格列或者其他自定义的option
+const option = {
+  delBtn: false,
+  selection: true,
+  search: false,
+  filterBtn: false,
+  columnBtn: false,
+  editBtn: false,
+  refreshBtn: false,
+  addBtn: false,
+  selectable: (row, index) =>{ // row当前列队数据
+    if (row.use === '1') { // 判断条件
+      return false; // 灰掉 不可选
+    } else {
+      return true // 可选
+    }
+  },
+  viewBtn: false,
+  menu: false,
+  column: [
+    {
+      label: "工艺路线",
+      prop: "routeName",
+      width: 180,
+      overHidden: true,
+    },
+    {
+      label: "状态",
+      prop: "use",
+      width: 80,
+      type: "select",
+      dicData: [{"dictLabel": "已生产","dictValue": "1"},{"dictLabel": "未生产","dictValue": "0"}],
+      props: {
+        label: "dictLabel",
+        value: "dictValue",
+      },
+    },
+    {
+      label: "更改内容",
+      prop: "diffRecord",
+      overHidden: true,
+    },
+  ],
+}
+onMounted(() => {
+  dataList.value = []
+  dataList.value = props.diffList
+});
+</script>
+
+<style scoped lang="scss">
+@media print {
+  #print {
+    position: absolute; /* 或 absolute, fixed, 根据需要调整 */
+    top: 20px; /* 调整顶部位置 */
+    margin: 0; /* 重置边距 */
+    //width: 1000px;
+  }
+}
+
+table {
+  //width: 800px;
+  margin: 0 auto;
+  //border: 1px solid #000000;
+  border-collapse: collapse;
+}
+
+th,
+td {
+  //border: 1px solid #000000;
+  text-align: center;
+  padding: 3px;
+}
+
+.slider-demo-block {
+  max-width: 600px;
+  display: flex;
+  align-items: center;
+}
+.slider-demo-block .el-slider {
+  margin-top: 0;
+  margin-left: 12px;
+}
+.slider-demo-block .demonstration {
+  font-size: 14px;
+  color: var(--el-text-color-secondary);
+  line-height: 44px;
+  flex: 1;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  margin-bottom: 0;
+}
+.slider-demo-block .demonstration + .el-slider {
+  flex: 0 0 70%;
+}
+</style>

+ 68 - 12
src/views/base/craftManagement/process/index.vue

@@ -24,10 +24,20 @@
           icon="el-icon-delete"
           :size="size"
           @click="multipleDelete"
-          >删除</el-button
+          >删除111</el-button
         >
       </template>
 
+      <template #menu="{ size, row, index }">
+        <el-button
+            icon="el-icon-refresh"
+            text
+            @click="queryDiffList(row.id)"
+            type="primary"
+            :size="size"
+        >同步</el-button>
+      </template>
+
       <template #customFieldName-form="scope">
         <el-select
           v-model="customFieldNameValues"
@@ -73,18 +83,36 @@
       </template>
     </avue-crud>
     <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
+    <el-dialog
+        v-model="dialog.visible"
+        :title="dialog.title"
+        width="950px"
+        @close="dialog.visible = false"
+    >
+      <div style="width:100%;height:10px;color:#fa0303;">已经开始生产的工艺路线,请到工艺路线中进行单个更改!!!</div>
+      <difference :diffList="diffList" @syncList="clickSyncList"/>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="handleSubmit">同 步</el-button>
+          <el-button @click="dialog.visible = false">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+
   </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, useDictionaryStore } from "@/store";
-
+import { syncOperation, checkSyncList} from "@/api/craft/process";
+import difference from "./component/difference.vue";
 // 数据字典相关
 const { dicts } = useDictionaryStore();
-
+const dialog = reactive({
+  title: "差异列表",
+  visible: false,
+});
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
@@ -94,20 +122,35 @@ 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对象
 
+const clickObjId = ref(null)
+
+const clickSyncRouteList = ref([])
 onMounted(() => {
   // console.log("crudRef", crudRef)
   dataList();
 });
+const clickSyncList = (list) => {
+  clickSyncRouteList.value = list;
+}
+const handleSubmit = ()=>{
+  if(clickSyncRouteList.value.length > 0){
+    syncOperation({"baseId": clickObjId.value,"routeIds":clickSyncRouteList.value}).then((data)=>{
+      if(data.code === '200'){
+        clickSyncRouteList.value = []
+        dialog.visible = false;
+        ElMessage.success(data.msg);
+      }else{
+        ElMessage.error(data.msg);
+      }
+    });
+  }else{
+    ElMessage.error("请选择需要同步的数据");
+  }
+}
+const diffList = ref([]);
 
 /**
  * 上传excel相关
@@ -150,6 +193,19 @@ const customFieldChange = (val) => {
 
   form.value.customFieldName = JSON.stringify(result);
 };
+
+const queryDiffList = (id) =>{
+  clickObjId.value = id;
+  checkSyncList(id).then((data)=>{
+    if(data.data){
+      diffList.value = []
+      dialog.visible = true
+      data.data.forEach((item)=>{
+        diffList.value.push(item)
+      })
+    }
+  });
+}
 const beforeOpenDialog = (done, type, loading) => {
   if (
     type === "edit" &&