懒羊羊
2024-03-21 995a733a26dd1856c0dd7286f2dcde5ca1434bca
Merge remote-tracking branch 'origin/master'
已修改5个文件
156 ■■■■ 文件已修改
jcdm-ui/src/components/inspectionPlanArchives/index.vue 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/components/inspectionPlanItems/index.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/em/inspectionPlan/index.vue 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/em/inspectionPlan/subject.vue 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/components/inspectionPlanArchives/index.vue
@@ -91,19 +91,12 @@
      machineryList: [],
      // 弹出层标题
      title: "",
      // 设备类型树选项
      machineryTypeOptions: [],
      //车间选项
      workshopOptions:[],
      // 是否显示弹出层
      open: false,
      //自动生成物料编码标识
      autoGenFlag: false,
      // 表单参数
      form: {},
      defaultProps: {
        children: "children",
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
@@ -145,7 +138,7 @@
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.machineryId);
      this.ids = selection.map(item => item.subjectId);
      this.selectedRows = selection;
      this.single = selection.length != 1;
      this.multiple = !selection.length;
jcdm-ui/src/components/inspectionPlanItems/index.vue
@@ -1,5 +1,5 @@
<template>
  <el-dialog title="设备选择"
  <el-dialog title="项目选择"
             v-if="showFlag"
             :visible.sync="showFlag"
             :modal= false
jcdm-ui/src/views/main/em/inspectionPlan/index.vue
@@ -217,20 +217,20 @@
          <Checkmachinery ref="machinerylist"  @inSelected="onMachineryAdd"></Checkmachinery>
        </el-tab-pane>
        <el-tab-pane label="点检项目">
          <Checksubject ref="subjectlist"></Checksubject>
          <Checksubject ref="subjectlist"      @subSelected="subMachineryAdd"></Checksubject>
            </el-tab-pane>
          </el-tabs>
      <el-divider></el-divider>
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      <el-button @click="checkMachineryAdd">测试</el-button>
    </el-dialog>
  </div>
</template>
<script>
import { listInspectionPlan, getInspectionPlan, delInspectionPlan, addInspectionPlan, updateInspectionPlan } from "@/api/main/em/inspectionPlan/inspectionPlan";
import { listInspectionPlanArchives, delInspectionPlanArchives, addInspectionPlanArchives} from "@/api/main/em/inspectionPlanArchives/inspectionPlanArchives";
import { listInspectionPlanArchives, delInspectionPlanArchives, addInspectionPlanArchives,getInspectionPlanArchives} from "@/api/main/em/inspectionPlanArchives/inspectionPlanArchives";
import {listInspectionPlanItems,delInspectionPlanItems,addInspectionPlanItems,getInspectionPlanItems} from "@/api/main/em/inspectionPlanItems/inspectionPlanItems";
import Checkmachinery from "./machinery.vue"
import Checksubject from "./subject.vue"
@@ -257,6 +257,7 @@
      // 点检保养计划表格数据
      inspectionPlanList: [],
      machineryList: [],
      subjectList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
@@ -391,6 +392,11 @@
        this.machineryList = checkmachineryList
      }
    },
    subMachineryAdd(checksubjectList){
      if(checksubjectList !=null && checksubjectList.length >0){
        this.subjectList = checksubjectList
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
@@ -423,14 +429,20 @@
        this.titleName = "修改点检保养计划";
      });
    },
    /** 设备清单新增 */
    checkMachineryAdd(){
    /** 子表清单新增 */
    checkAdd(){
      for (let i = 0; i < this.machineryList.length; i++) {
        this.machineryList[i].planCode = this.form.planCode
        addInspectionPlanArchives(this.machineryList[i]).then(response =>{
        });
      }
      for (let i = 0; i < this.subjectList.length; i++) {
        this.subjectList[i].planCode = this.form.planCode
        addInspectionPlanItems(this.subjectList[i]).then(response =>{
        });
      }
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
@@ -441,12 +453,14 @@
              this.open = false;
              this.getList();
            });
            this.checkAdd()
          } else {
            addInspectionPlan(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
            this.checkAdd()
          }
        }
      });
jcdm-ui/src/views/main/em/inspectionPlan/machinery.vue
@@ -11,20 +11,9 @@
          v-hasPermi="['mes:dv:checkplan:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['mes:dv:checkplan:remove']"
        >删除</el-button>
      </el-col>
    </el-row>
    <MachinerySelect ref="machinerySelect" @onSelected="onMachineryAdd" ></MachinerySelect>
    <el-table v-loading="loading" :data="checkmachineryList" @selection-change="handleSelectionChange">
    <el-table v-loading="loading" :data="checkmachineryList" >
      <el-table-column label="设备编码" align="center" prop="equipmentCode" />
      <el-table-column label="设备名称" align="center" prop="equipmentName" />
      <el-table-column label="品牌" align="center" prop="equipmentBrand" />
@@ -36,7 +25,7 @@
            size="mini"
            type="danger"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            @click="deleteSelectedColumns(scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
@@ -79,7 +68,7 @@
      total: 0,
      // 点检设备表格数据
      checkmachineryList: [],
      // 弹出层标题
        // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
@@ -102,7 +91,21 @@
    this.getList();
  },
  methods: {
    /** 查询点检设备列表 */
    deleteSelectedColumns(row) {
      const index = this.checkmachineryList.findIndex(item => item.id === row.id);
      if (index !== -1) {
        this.checkmachineryList.splice(index, 1);
      } else {
        this.$message({
          message: '未找到具有该ID的项目',
          type: 'warning'
        });
      }
      this.$emit('inSelected',this.checkmachineryList);
    },
  /** 查询点检设备列表 */
    getList() {
      this.loading = true;
      listInspectionPlanArchives(this.queryParams).then(response => {
@@ -112,12 +115,7 @@
      });
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.recordId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.$refs.machinerySelect.showFlag = true;
@@ -140,16 +138,7 @@
      this.$emit('inSelected',this.checkmachineryList);
      console.log(this.checkmachineryList)
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const recordIds = row.recordId || this.ids;
      this.$modal.confirm('是否确认删除点检设备编号为"' + recordIds + '"的数据项?').then(function() {
        return delInspectionPlanArchives(recordIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    }
  }
};
</script>
jcdm-ui/src/views/main/em/inspectionPlan/subject.vue
@@ -11,21 +11,9 @@
          v-hasPermi="['mes:dv:checkplan:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['mes:dv:checkplan:remove']"
        >删除</el-button>
      </el-col>
    </el-row>
    <DvsubjectSelect ref="subjectSelect"  @onSelected="onSubjectSelected"></DvsubjectSelect>
    <el-table v-loading="loading" :data="checksubjectList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
    <el-table v-loading="loading" :data="checksubjectList" >
      <el-table-column label="项目编码" align="center" prop="itemsCode" />
      <el-table-column label="项目名称" align="center" prop="itemsName" />
      <el-table-column label="项目类型" align="center" prop="itemsType">
@@ -35,6 +23,16 @@
      </el-table-column>
      <el-table-column label="项目内容" align="center" width="300px" prop="itemsContent" />
      <el-table-column label="标准" align="center" width="300px" prop="standard" />
      <el-table-column label="操作" align="center" >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="danger"
            icon="el-icon-delete"
            @click="deleteSelectedColumns(scope.row)"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
@@ -98,45 +96,39 @@
    this.getList();
  },
  methods: {
    deleteSelectedColumns(row) {
      const index = this.checksubjectList.findIndex(item => item.id === row.id);
      if (index !== -1) {
        this.checksubjectList.splice(index, 1);
      } else {
        this.$message({
          message: '未找到具有该ID的项目',
          type: 'warning'
        });
      }
      this.$emit('subSelected',this.checksubjectList);
    },
    /** 查询点检项目列表 */
    getList() {
      this.loading = true;
      listInspectionPlanItems(this.queryParams).then(response => {
        this.checksubjectList = response.rows;
        // this.checksubjectList = response.rows;
        this.total = response.total;
        this.loading = false;
        // console.log(response.rows)
      });
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.recordId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
        this.$refs.subjectSelect.showFlag = true;
    },
    onSubjectSelected(rows){
        if(rows != null && rows.length >0){
            rows.forEach(row => {
                row.planId= this.planId;
              addInspectionPlanItems(row).then(response => {
                    this.getList();
                });
            });
        }
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const recordIds = row.recordId || this.ids;
      this.$modal.confirm('是否确认删除点检项目编号为"' + recordIds + '"的数据项?').then(function() {
        return delInspectionPlanItems(recordIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    onSubjectSelected(selectedRows){
      if(selectedRows !=null && selectedRows.length >0){
        this.checksubjectList = selectedRows
      }
      this.$emit('subSelected',this.checksubjectList);
      console.log(this.checksubjectList)
    },
  }