Sfoglia il codice sorgente

Merge branch 'dev' of https://e.coding.net/g-pheu9517/grt-iscs/ISCS_Ui_Admin_Base into dev

pm 1 anno fa
parent
commit
182eebfc7b

+ 1 - 3
src/api/mes/sop/sopindex.js

@@ -30,9 +30,8 @@ export function updateIsSop(data) {
 // 删除sop信息 /dev-api/iscs/sop/deleteIsSopBySopIds
 export function deleteIsSopBySopIds(data) {
     return request({
-        url: 'iscs/sop/deleteIsSopBySopIds',
+        url: 'iscs/sop/deleteIsSopBySopIds?sopIds=' + data,
         method: 'post',
-        data: data
     })
 }
 
@@ -41,6 +40,5 @@ export function selectIsSopById(query) {
     return request({
         url: '/iscs/sop/selectIsSopById?sopId='+query,
         method: 'get',
-
     })
 }

+ 86 - 66
src/components/separationPoint/workshop.vue

@@ -2,7 +2,11 @@
   <div class="leftcon">
     <el-form ref="form" :model="form" label-width="100px" :inline="true">
       <el-form-item label="车间">
-        <el-select v-model="form.workShop" placeholder="请选择车间" @change="handleselect">
+        <el-select
+          v-model="form.workShop"
+          placeholder="请选择车间"
+          @change="handleselect"
+        >
           <el-option
             v-for="item in this.workShopOptions"
             :key="item.value"
@@ -11,38 +15,42 @@
           >
           </el-option>
         </el-select>
-<!--        <el-select-->
-<!--          v-model="form.workShop"-->
-<!--          v-bind="$attrs"-->
-<!--          multiple-->
-<!--          style="width: 100%"-->
-<!--          placeholder="请选择线路"-->
-<!--          @change="handleSelect"-->
-<!--        >-->
-<!--          <div style="padding: 0 20px; line-height: 34px">-->
-<!--            <el-checkbox-->
-<!--              v-model="checkAll"-->
-<!--              :indeterminate="isIndeterminate"-->
-<!--              @change="handleCheckAllChange"-->
-<!--            >全选</el-checkbox-->
-<!--            >-->
-<!--          </div>-->
-<!--          <el-checkbox-group v-model="form.workShop">-->
-<!--            <el-option-->
-<!--              v-for="item in this.workShopOptions"-->
-<!--              :key="item.value"-->
-<!--              :label="item.label"-->
-<!--              :value="item.value"-->
-<!--            >-->
-<!--              <el-checkbox style="pointer-events: none" :label="item.value">-->
-<!--                {{ item.label }}-->
-<!--              </el-checkbox>-->
-<!--            </el-option>-->
-<!--          </el-checkbox-group>-->
-<!--        </el-select>-->
+        <!--        <el-select-->
+        <!--          v-model="form.workShop"-->
+        <!--          v-bind="$attrs"-->
+        <!--          multiple-->
+        <!--          style="width: 100%"-->
+        <!--          placeholder="请选择线路"-->
+        <!--          @change="handleSelect"-->
+        <!--        >-->
+        <!--          <div style="padding: 0 20px; line-height: 34px">-->
+        <!--            <el-checkbox-->
+        <!--              v-model="checkAll"-->
+        <!--              :indeterminate="isIndeterminate"-->
+        <!--              @change="handleCheckAllChange"-->
+        <!--            >全选</el-checkbox-->
+        <!--            >-->
+        <!--          </div>-->
+        <!--          <el-checkbox-group v-model="form.workShop">-->
+        <!--            <el-option-->
+        <!--              v-for="item in this.workShopOptions"-->
+        <!--              :key="item.value"-->
+        <!--              :label="item.label"-->
+        <!--              :value="item.value"-->
+        <!--            >-->
+        <!--              <el-checkbox style="pointer-events: none" :label="item.value">-->
+        <!--                {{ item.label }}-->
+        <!--              </el-checkbox>-->
+        <!--            </el-option>-->
+        <!--          </el-checkbox-group>-->
+        <!--        </el-select>-->
       </el-form-item>
       <el-form-item label="生产线">
-        <el-select v-model="form.producLine" placeholder="请选择生产线" @change="handleselectProductLine">
+        <el-select
+          v-model="form.producLine"
+          placeholder="请选择生产线"
+          @change="handleselectProductLine"
+        >
           <el-option
             v-for="item in this.producLineOptions"
             :key="item.value"
@@ -57,17 +65,33 @@
 </template>
 
 <script>
-import { listAllWorkshop } from '@/api/mes/md/workshop'
-import {getIsWorkareaList} from "@/api/mes/wa/workarea"
+import { listAllWorkshop } from "@/api/mes/md/workshop";
+import { getIsWorkareaList } from "@/api/mes/wa/workarea";
 import {selectIsSopById} from "@/api/mes/sop/sopindex"
 
 export default {
-  props:{
+  props: {
+    sopProps: {
+      type: Object,
+      default: function () {
+        return {};
+      },
+    },
     jobProps:{
       type:Array,
       default:()=>[]
     }
   },
+  watch: {
+    // 监听父组件传递的数据
+    sopProps: {
+      handler(newValue) {
+        this.form.workShop = newValue.workshopId;
+        this.form.producLine = newValue.workareaId;
+      },
+    },
+  },
+
   data() {
     return {
       form: {
@@ -82,9 +106,7 @@ export default {
         { label: "士力架包装车间3号", value: "3" },
         { label: "士力架包装车间4号", value: "4" },
       ],
-      producLineOptions: [
-
-      ],
+      producLineOptions: [],
     };
   },
   watch: {
@@ -108,52 +130,50 @@ export default {
     }
   },
   mounted() {
-    this.getworkshopList()
+    this.getworkshopList();
 
   },
   methods: {
     // 获取车间列表
-    getworkshopList(){
-      listAllWorkshop().then(response => {
+    getworkshopList() {
+      listAllWorkshop().then((response) => {
         this.workShopOptions = response.data.map((item) => {
           return {
-            label:item.workshopName,
-            value:item.workshopId,
-            key:item.workshopCode
-          }
+            label: item.workshopName,
+            value: item.workshopId,
+            key: item.workshopCode,
+          };
         });
-      })
+      });
     },
 
     // 单选车间下拉
-    handleselect(value){
+    handleselect(value) {
       // console.log(value,'我触发了车间下拉');
-      getIsWorkareaList(value).then(response => {
+      getIsWorkareaList(value).then((response) => {
         this.producLineOptions = response.data.map((item) => {
           return {
-            label:item.workareaName,
-            value:item.workareaId,
-            key:item.workareaCode,
-            map:item.map
-          }
-        })
-
-      })
+            label: item.workareaName,
+            value: item.workareaId,
+            key: item.workareaCode,
+            map: item.map,
+          };
+        });      });
     },
     // 生产线下拉
-    handleselectProductLine(val){
-      // console.log(val,'生产线下拉')
+    handleselectProductLine(val) {
+      // console.log(val, "生产线下拉");
       //   利用组件逆传递 selectProductLine方法传递数据给兄弟组件
-      const selectedOption=this.producLineOptions.filter((item)=>{
-        return item.value === val
-      })
-      const selectworkShop=this.workShopOptions.filter((item)=>{
-        return item.value === this.form.workShop
-      })
-      // console.log(selectworkShop,selectedOption,'workshop-components')
+      const selectedOption = this.producLineOptions.filter((item) => {
+        return item.value === val;
+      });
+      const selectworkShop = this.workShopOptions.filter((item) => {
+        return item.value === this.form.workShop;
+      });
+      // console.log(selectworkShop, selectedOption, "workshop-components");
       // 触发自定义事件,传递 selectedOption[0] 数据给父组件
-      this.$emit('product-line-selected', selectedOption[0]);
-      this.$emit('work-shop-selected',selectworkShop[0])
+      this.$emit("product-line-selected", selectedOption[0]);
+      this.$emit("work-shop-selected", selectworkShop[0]);
     },
 
     // 多选车间下拉框选择事件

+ 67 - 26
src/views/mes/sop/sopm/NewSop.vue

@@ -2,9 +2,19 @@
   <div class="newOperations">
     <!--    newOperations盒子开始-->
     <div class="left">
-      <!-- <h1>我是左边</h1> -->
-      <SopLeft v-if="this.activeName == 'first'"  @product-line-selected="handleProductLineSelected" @work-shop-selected="handleWorkshopSelected"/>
-      <IsolationLeftVue v-else :points="points"  @selection-changed="handleSelectPoint" />
+      <!-- 车间 -->
+      <SopLeft
+        v-if="this.activeName == 'first'"
+        @product-line-selected="handleProductLineSelected"
+        @work-shop-selected="handleWorkshopSelected"
+        :sopProps="this.form"
+      />
+      <!-- 隔离点 -->
+      <IsolationLeftVue
+        v-else
+        :points="points"
+        @selection-changed="handleSelectPoint"
+      />
     </div>
     <div class="right">
       <div class="right_top">
@@ -159,7 +169,11 @@
 <script>
 import IsolationLeftVue from "@/components/separationPoint/index.vue";
 import SopLeft from "@/components/separationPoint/workshop.vue";
-import {addinsertIsSop} from "@/api/mes/sop/sopindex"
+import {
+  addinsertIsSop,
+  updateIsSop,
+  selectIsSopById,
+} from "@/api/mes/sop/sopindex";
 export default {
   name: "addView",
   dicts: ["power_type", "point_type"],
@@ -213,41 +227,68 @@ export default {
       ],
       // 右侧底部已选隔离点
       tableData: [],
-      points:null,//车间逆向传递拿到的隔离点数据
-      emitWorkShop:null,//车间逆向传递拿到车间相关数据
+      points: null, //车间逆向传递拿到的隔离点数据
+      emitWorkShop: null, //车间逆向传递拿到车间相关数据
     };
   },
+  mounted() {
+    if (this.$route.query.sopId !== "null") {
+      // console.log(this.$route.query.sopId, "接受路由参数");
+      this.getSopInfo();
+    }
+  },
   methods: {
     handleClick(tab, event) {
       // console.log(tab, event);
     },
-    preStep()   {
+    preStep() {
       this.activeName = "first";
     },
     nextStep() {
       this.activeName = "second";
-      console.log("我点击了下一步");
+      // console.log("我点击了下一步");
     },
-    // 新增sop确认按钮
-    submit(){
-      const selectedpointIds=this.form.spoint.join(',')
 
-      const data={
-        pointIds:selectedpointIds,
-        sopContent:this.form.sopContent,
-        sopCode:this.form.sopCode,
+    // 详情数据
+    getSopInfo() {
+      const sopId = this.$route.query.sopId;
+      console.log(this.$route.query.sopId, "接受路由参数");
+
+      selectIsSopById(sopId).then((response) => {
+        console.log(response, "详细内容");
+        this.form = response.data;
+        this.tableData = response.data.pointDetailVOList;
+        // console.log(this.form, "data数据内容");
+        this.title = "修改隔离点信息";
+      });
+    },
+    // 新增sop确认按钮
+    submit() {
+      const selectedpointIds = this.form.spoint.join(",");
+      const data = {
+        pointIds: selectedpointIds,
+        sopContent: this.form.sopContent,
+        sopCode: this.form.sopCode,
         sopName: this.form.sopName,
         sopType: this.form.sopType,
-        workareaId:this.points.value,
-        workshopId:this.emitWorkShop.value,
+        workareaId: this.points.value,
+        workshopId: this.emitWorkShop.value,
+      };
+      if (this.sopId != null) {
+        updateIsSop(this.form).then((res) => {
+          console.log(res, "修改接口");
+          if (res.code == 200) {
+            this.$router.go(-1);
+          }
+        });
+      } else {
+        addinsertIsSop(data).then((res) => {
+          console.log(res, "新增接口");
+          if (res.code == 200) {
+            this.$router.go(-1);
+          }
+        });
       }
-
-      addinsertIsSop(data).then(res => {
-        console.log(res,'新增接口');
-        if(res.code==200){
-           this.$router.go(-1);
-        }
-      });
     },
     // 子组件逆向传递选中的隔离点
     handleSelectPoint(points) {
@@ -270,6 +311,7 @@ export default {
             pointId: point.pointId, // 对应的值
             pointType:point.pointType,
             powerType:point.powerType,
+
           });
           // 将新点值添加到 Set 中
           existingValues.add(point.value);
@@ -278,13 +320,12 @@ export default {
 
       // 更新 form.spoint 为最新选中的隔离点数组
       this.form.spoint = points.map((point) => point.pointId);
-
     },
     // 车间你逆向传递拿到的隔离点数据产线
     handleProductLineSelected(selectedOption) {
       // console.log(selectedOption, '父组件接收到的 selectedOption');
       this.points = selectedOption;
-      this.form.workline=selectedOption.label
+      this.form.workline = selectedOption.label;
     },
     // 车间子组件逆传递车间相关数据车间
     handleWorkshopSelected(selectedOption){

+ 27 - 52
src/views/mes/sop/sopm/index.vue

@@ -143,6 +143,13 @@
       @selection-change="handleSelectionChange"
     >
       <el-table-column type="selection" width="55" align="center" />
+      <!-- 此处sopId为了实现编辑 误删除 -->
+      <el-table-column
+        label="SOPID"
+        align="center"
+        prop="sopId"
+        v-if="(showId = false)"
+      />
       <el-table-column label="SOP编号" align="center" prop="sopCode">
         <!-- <template slot-scope="scope">
           <el-button
@@ -166,6 +173,9 @@
       </el-table-column>
 
       <el-table-column label="SOP类型" align="center" prop="sopType">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.sop_type" :value="scope.row.sopType" />
+        </template>
       </el-table-column>
       <el-table-column label="产线" align="center" prop="workareaName">
       </el-table-column>
@@ -218,13 +228,17 @@
 </template>
 
 <script>
-
 import {
   workshoplistAll,
   getIsWorkareaList,
 } from "@/api/mes/spm/segregationPoint";
-import { getIsSopPage } from "@/api/mes/sop/sopindex";
-
+import {
+  getIsSopPage,
+  updateIsSop,
+  deleteIsSopBySopIds,
+  selectIsSopById,
+} from "@/api/mes/sop/sopindex";
+import { genCode } from "@/api/system/autocode/rule";
 export default {
   name: "Team",
 
@@ -233,7 +247,6 @@ export default {
     return {
       //自动生成编码
       autoGenFlag: false,
-      optType: undefined,
       // 遮罩层
       loading: true,
       // 选中数组
@@ -250,8 +263,8 @@ export default {
       sopList: [],
       // 弹出层标题
       title: "",
-      // 是否显示弹出层
-      open: false,
+      // 新增或修改
+      sopId: null,
       // 车间数据
       workshopList: [],
       // 工作区域数据
@@ -380,7 +393,6 @@ export default {
     },
     // 取消按钮
     cancel() {
-      this.open = false;
       this.reset();
     },
     // 表单重置
@@ -412,67 +424,30 @@ export default {
     },
     // 多选框选中数据
     handleSelectionChange(selection) {
-      this.ids = selection.map((item) => item.teamId);
+      this.ids = selection.map((item) => item.sopId);
       this.single = selection.length !== 1;
       this.multiple = !selection.length;
     },
     /** 新增按钮操作 */
     handleAdd() {
       this.reset();
-      this.open = true;
-      this.$router.push("/mes/sop/sopm/NewSop");
+      this.$router.push("/mes/sop/sopm/NewSop?sopId=null");
       this.title = "添加隔离点";
-      this.optType = "add";
+      // 新增或修改
+      this.sopId = null;
     },
-    // 查询明细按钮操作
-    // handleView(row) {
-    //   this.reset();
-    //   const teamId = row.teamId || this.ids;
-    //   getTeam(teamId).then((response) => {
-    //     this.form = response.data;
-    //     this.open = true;
-    //     this.title = "查看班组";
-    //     this.optType = "view";
-    //   });
-    // },
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
-      const teamId = row.teamId || this.ids;
-      getTeam(teamId).then((response) => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改隔离点信息";
-        this.optType = "edit";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate((valid) => {
-        if (valid) {
-          if (this.form.teamId != null) {
-            updateTeam(this.form).then((response) => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addTeam(this.form).then((response) => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
-        }
-      });
+      this.$router.push(`/mes/sop/sopm/NewSop?sopId=${row.sopId}`);
     },
     /** 删除按钮操作 */
     handleDelete(row) {
-      const teamIds = row.teamId || this.ids;
+      const sopIds = row.sopId || this.ids;
       this.$modal
-        .confirm('是否确认删除班组编号为"' + teamIds + '"的数据项?')
+        .confirm('是否确认删除sop序号为"' + sopIds + '"的数据项?')
         .then(function () {
-          return delTeam(teamIds);
+          return deleteIsSopBySopIds(sopIds);
         })
         .then(() => {
           this.getList();