zouyu
2023-08-30 ed40d9fbd886c5c0fb0f3b0adeb1be1b3240a1dc
	modified:   src/api/inspection/rawmaterial.js
modified: src/layout/components/Sidebar/SidebarItem.vue
modified: src/router/index.js
modified: src/views/chart/work/index.vue
modified: src/views/inspectionManagement/reportForInspection/index.vue
已修改5个文件
306 ■■■■ 文件已修改
src/api/inspection/rawmaterial.js 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Sidebar/SidebarItem.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/chart/work/index.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/inspectionManagement/reportForInspection/index.vue 239 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/inspection/rawmaterial.js
@@ -9,6 +9,7 @@
  })
}
//新增报检单
export function addInspect(data){
  return request({
    url: '/inspection/addInspect',
@@ -17,10 +18,47 @@
  })
}
//根据检验单id查询检验单详情
export function selectInspectsListById(params){
  return request({
    url: '/inspection/selectInspectsListById',
    method: 'get',
    params
  })
}
//查询所有用户
export function selectUser(params){
  return request({
    url: '/inspection/selectUser',
    method: 'get',
    params
  })
}
//查询所有设备
export function selectEquipment(params){
  return request({
    url: '/inspection/selectEquipment',
    method: 'get',
    params
  })
}
//新增原材料报检
export function addMaterial(data){
  return request({
    url: '/raw-material/add',
    method: 'post',
    data
  })
}
//删除原材料报检
export function deleteMaterial(data){
  return request({
    url: '/raw-material/delete',
    method: 'post',
    data
  })
}
src/layout/components/Sidebar/SidebarItem.vue
@@ -6,6 +6,7 @@
        <el-menu-item v-if="onlyOneChild.meta.show==false ?onlyOneChild.meta.show: true" :index="resolvePath(onlyOneChild.path)" :class="{'submenu-title-noDropdown':!isNest}">
          <item :show="onlyOneChild.meta.show" :icon="onlyOneChild.meta.icon||(item.meta&&item.meta.icon)" :title="onlyOneChild.meta.title" />
          <span v-if="onlyOneChild.meta.title==='主页'">主页</span>
          <span v-if="onlyOneChild.meta.title==='基础数据'">基础数据</span>
        </el-menu-item>
      </app-link>
    </template>
src/router/index.js
@@ -472,13 +472,7 @@
          name: 'BasicDataMessage',
          component: () => import('@/views/basicData/index'),
          meta: { title: '基础数据', icon: 'el-icon-s-tools' }
        },
                {
                  path: 'myBusiness',
                  name: 'MyBusiness',
                  component: () => import('@/views/personal/myBusiness/index'),
                  meta: { title: '我的企业', icon: 'tree', show: false }
                }
        }
      ]
    },
    { path: '*', redirect: '/404', hidden: true }
src/views/chart/work/index.vue
@@ -6,8 +6,7 @@
                <el-card>
                  <el-form :rules="rules" ref="formInline" :inline="true"
                  :model="formInline" class="demo-form-inline">
                    <el-form-item prop="date">
                      <p><span>*</span>检测日期:</p>
                    <el-form-item prop="date" label="检测日期:">
                      <el-date-picker
                        v-model="formInline.date"
                        format="yyyy-MM-dd"
@@ -18,8 +17,7 @@
                        end-placeholder="结束日期">
                      </el-date-picker>
                    </el-form-item>
                    <el-form-item prop="type">
                      <p><span>*</span>检验类型:</p>
                    <el-form-item prop="type" label="检验类型:">
                      <el-select v-model="formInline.type" placeholder="采购入库">
                        <el-option label="原材料" value="0"></el-option>
                        <el-option label="成品" value="1"></el-option>
@@ -501,24 +499,14 @@
      z-index: 10;
      .demo-form-inline{
        margin: 0px 10px;
        p{
          margin: 0;
          font-size: 16px;
          font-weight: bold;
          span{
            font-size: 16px;
            font-weight: bold;
            color: red;
          }
        }
        .buttons{
          margin: 40px 0px 0px 50%;
          margin-left: 10%;
        }
      }
    }
    .work-center{
      margin: 0px 0px 150px 10px;
      padding: 18vh 0px 5px 0px;
      padding: 13vh 0px 5px 0px;
      .el-card{
        margin: 5px 0px;
        height:500px;
src/views/inspectionManagement/reportForInspection/index.vue
@@ -48,18 +48,36 @@
          title="新增原材料报检"
          :visible.sync="addReportVisible"
          width="40%">
          <el-form v-model="insertData" label-position="left" label-width="80px">
            <el-form-item label="标准类型">
              <el-input v-model="insertData.materialName" />
          <el-form v-model="insertData" :inline="true" label-position="right" label-width="80px">
            <el-form-item label="来料日期:">
              <el-date-picker
                v-model="insertData.fromDate"
                type="date"
                value-format="yyyy-MM-dd"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="物料名称">
              <el-input v-model="insertData.materialName" />
            <el-form-item label="供货商名称:">
              <el-input v-model="insertData.supplierName" />
            </el-form-item>
            <el-form-item label="执行标准">
              <el-input v-model="insertData.standardName" />
            <el-form-item label="材料名称:">
              <el-select v-model="insertData.mName" placeholder="请选择材料名称">
                  <el-option v-for="(item,index) in 5" :key="index" :label="item" :value="item"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="规格型号">
              <el-input v-model="insertData.specificationsName" />
            <el-form-item label="材料编码:">
              <el-input disabled v-model="insertData.mCode" />
            </el-form-item>
            <el-form-item label="规格型号:">
              <el-cascader
                v-model="insertData.specificationsNumber"
                :options="childrenOptions"
                @change="handleChange"></el-cascader>
            </el-form-item>
            <el-form-item label="单位:">
              <el-input type="text" v-model="insertData.unit" />
            </el-form-item>
            <el-form-item label="数量:">
              <el-input type="number" v-model="insertData.num" />
            </el-form-item>
          </el-form>
          <span slot="footer" class="dialog-footer">
@@ -77,7 +95,6 @@
            <div class="generateInsp">
              <el-button @click="addReportBtn" type="primary" size="mini" icon="el-icon-document" style="background-color: rgb(1, 102, 226);">生成报检单</el-button>
            </div>
          </div>
          <div class="table-box">
            <el-table
@@ -164,7 +181,7 @@
                label="操作"
                min-width="8%">
                <template slot-scope="scope">
                  <el-button type="text" size="small" @click="removeFun(scope.row)">删除</el-button>
                  <el-button type="text" size="small" @click="removeFun(scope.row,scope.$index)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
@@ -183,12 +200,35 @@
          </div>
        </div>
      </div>
      <el-dialog title="选择日期" :visible.sync="addReportDialog" width="30%">
        <el-form :model="addInspectionForm" :rules="addInspectionFormRules" rule="addInspectionForm">
          <el-form-item label="检验日期" label-width="100px" prop="inspectionDate">
            <el-date-picker
              v-model="addInspectionForm.inspectionDate"
              type="daterange"
              value-format="yyyy-MM-dd"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="版本" label-width="100px" prop="version">
            <el-select v-model="addInspectionForm.version" placeholder="请选择版本">
              <el-option v-for="(item,index) in 5" :key="index" :value="item" :label="item"></el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="resetForm('addInspectionForm')">取 消</el-button>
          <el-button type="primary" @click="confirmBtn('addInspectionForm')">确 定</el-button>
        </div>
      </el-dialog>
    <!-- 生成报检单 -->
      <div class="newPage" v-if="showNewPage">
        <!-- 新增页面 -->
        <div class="inspectionForm">
          <el-form :model="inspectionForm" ref="inspectionForm" label-position="right" label-width="100px" size="mini" >
          <el-form :model="inspectionForm" label-position="right" label-width="100px" size="mini" >
            <div class="formwrapper">
              <el-row>
                <el-col  :span="8">
@@ -264,17 +304,17 @@
            <el-table-column prop="testValue" label="检验值" width="125"></el-table-column>
            <el-table-column prop="userName" label="检验人">
              <template slot-scope="scope">
                <el-select v-model="scope.row.checker" size="small" slot="append" style="width: 260px;">
                    <el-option v-for="(item,index) in checkeroptions" :key="index" :value="item.value" :label="item.label">{{ item.label }}</el-option>
                <el-select @blur="blurOptions(scope.row)" v-model="scope.row.check" size="small" slot="append" style="width: 260px;">
                    <el-option v-for="(item,index) in checkeroptions" :key="index" :value="item.id" :label="item.name"></el-option>
                </el-select>
              </template>
            </el-table-column>
            <el-table-column prop="device" label="试验设备">
                <template slot-scope="scope">
                <el-select v-model="scope.row.device" size="small" slot="append" style="width: 260px;">
                    <el-option v-for="(item,index) in deviceoptions" :key="index" :value="item.value" :label="item.label">{{ item.label }}</el-option>
              <template slot-scope="scope">
                <el-select @blur="blurOptions(scope.row)" v-model="scope.row.device" size="small" slot="append" style="width: 260px;">
                    <el-option v-for="(item,index) in deviceoptions" :key="index" :value="item.id" :label="item.equipmentName"></el-option>
                </el-select>
            </template>
              </template>
            </el-table-column>
          </el-table>
        </div>
@@ -283,13 +323,28 @@
</template>
<script>
import { getRawMaterialList,addInspect,selectInspectsListById } from '@/api/inspection/rawmaterial'
import { getRawMaterialList,
  addInspect,
  selectInspectsListById,
  selectUser,
  selectEquipment,
  deleteMaterial,
  addMaterial
 } from '@/api/inspection/rawmaterial'
export default {
  data() {
    return {
      insertData:{
      userName: "",
      devices: "",
      addInspectionForm: {
        inspectionDate: ['2023-08-01','2023-08-31'],
        version: 5
      },
      addInspectionFormRules: {
        inspectionDate: [{required: true, message: '请选择日期区间', trigger: 'change' }],
      },
      addReportDialog: false,
      insertData:{},
      addReportVisible: false,
      checked: false,
      resultData : {},
@@ -301,15 +356,36 @@
        state: '',
        date: ''
      },
      childrenOptions: [{
        value: 'zhinan',
        label: '指南',
        children: [{
          value: 'shejiyuanze',
          label: '设计原则',
          children: [{
            value: 'yizhi',
            label: '一致'
          }, {
            value: 'fankui',
            label: '反馈'
          }, {
            value: 'xiaolv',
            label: '效率'
          }, {
            value: 'kekong',
            label: '可控'
          }]
        }]
      }],
      options: [{
        value: 0,
        value: null,
        label: '全部'
      }, {
        value: 1,
        label: '已检验'
        label: '已报检'
      }, {
        value: 2,
        label: '待检验'
        value: 0,
        label: '未报检'
      }],
      deviceoptions:[{
        value: 0,
@@ -327,15 +403,15 @@
      }],
      radioOptions:[{
        label: '全部',
        value: 0
        value: null
      },{
        value: 1,
        label: '已检验'
        label: '已报检'
      },{
        value: 2,
        label: '待检验'
        value: 0,
        label: '未报检'
      }],
      radioValue: 0,
      radioValue: null,
      inspectionTable: [{
        createTime: '2023-07-28',
        supplier_name: '国网山东省电力有限公司',
@@ -355,23 +431,60 @@
      data: '',
      showNewPage: false,
      inspectionForm:{},
      inspectionItems:[]
      inspectionItems:[{
        index: 1,
        name: "aaa",
        unit: "KB",
        required: "1",
        internal: "2",
        testValue: "3",
        userName:"",
        device: ""
      }]
    }
  },
  created(){
    this.getRawMaterialList()
  },
  mounted(){
  },
  methods: {
    removeFun(row){
    handleChange(){
    },
    async deleteMaterialFun(row,index){
      let formData=new FormData();
      formData.append("deleteId",row.id)
      await deleteMaterial(formData).then(() => {
        this.inspectionTable.splice(index,1);
        this.$message.success("删除成功");
      }).catch(error => {
        this.$message.error(error.message);
      });
    },
    blurOptions(row){
        console.log("更新",row);
    },
    async initNewSelection(){
        const res = await selectUser();
        const res2 = await selectEquipment();
        this.checkeroptions = res.data;
        this.deviceoptions = res2.data;
    },
    resetForm(formName) {
        // this.addInspectionForm.inspectionDate = [],
        // this.$refs[formName].resetFields();
        // this.addReportDialog = false
    },
    removeFun(row,index){
      this.$confirm('确认删除该数据吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
          console.log(row.id);
          this.deleteMaterialFun(row,index);
        }).catch(() => {});
    },
    checkSelect(row,index){
@@ -383,21 +496,26 @@
    },
    handleSelectionChange(val){
      this.checkData = val;
      console.log(val);
    },
    //生成报检单按钮
    addReportBtn(){
      let arr = this.checkData;
      if(arr.length < 1){
        this.$message.error("请选择一条数据!");
      }else{
        if(arr.length > 1){
          this.$message.error("最多选择一条数据!");
        if(this.checkData.length < 1){
          this.$message.error("请选择一条数据!");
        }else{
          if(this.checkData.length > 1){
            this.$message.error("最多选择一条数据!");
          }else{
            this.addReportDialog = true;
          }
      }
    },
    //生成报检单确认按钮
    confirmBtn(formName){
          let dateArr = this.addInspectionForm.inspectionDate;
          //添加报检单
          let val = arr[0];
          let val = this.checkData[0];
          let obj = {
            "endTime": val.dateSurvey,
            "endTime": dateArr[1],
            "experiment": "",
            "formTime": val.createTime,
            "id": val.id,
@@ -405,21 +523,21 @@
            "name": val.materialName,
            "num": val.quantity,
            "specifications": val.specificationsModels,
            "startTime": val.inspectionDate,
            "startTime": dateArr[0],
            "supplier": val.supplierName,
            "type": val.type,
            "unit": val.unit,
            "version": val.version
          }
          this.createReport(obj);
          // this.createReport(obj);
          this.addReportDialog = false;
          this.initNewSelection();
          this.showNewPage = true;
        }
      }
    },
    //生成报价单
    async createReport(param){
      await addInspect(param);
      const res2 = await selectInspectsListById({ id : 59});
      let res = await addInspect(param);
      const res2 = await selectInspectsListById({ id : res.data});
      this.resultData = res2.data;
      this.inspectionForm = res2.data;
      this.inspectionItems = res2.data.insProducts;
@@ -434,7 +552,7 @@
    },
    async search(){
      this.radioValue = this.searchData.state
      const res = await getRawMaterialList({condition: this.searchData.state,
      const res = await getRawMaterialList({type: this.searchData.state,
        createTime:this.searchData.date,
        materialCoding:this.searchData.code,
        materialName: this.searchData.name,
@@ -455,14 +573,19 @@
      this.getRawMaterialList()
    },
    radioclick(){
      this.searchData.state = this.radioValue
      this.inspectionTable = this.data.filter((item)=>{
        return item.condition === this.radioValue
      })
      console.log(this.inspectionTable);
      if(this.radioValue === 0){
        this.inspectionTable = this.data
      }
      this.total = this.inspectionTable.length
    },
    getAllTableData(){
      this.getRawMaterialList()
    },
    getCheckData(){
    },
    getUnCheckData(){
    },
    // 每页条数改变时触发 选择一页显示多少行
    handleSizeChange(val) {