zouyu
2023-09-06 af75159618b6b090710b9515bc789fa9accdc3bd
	modified:   src/api/standardLibrary.js
modified: src/views/basicData/index.vue
modified: src/views/experiment/inspectionApplication/index.vue
modified: src/views/laboratory/ledger/index.vue
modified: src/views/standardLibrary/index.vue
已修改5个文件
247 ■■■■■ 文件已修改
src/api/standardLibrary.js 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/index.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/experiment/inspectionApplication/index.vue 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/laboratory/ledger/index.vue 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/standardLibrary/index.vue 133 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/standardLibrary.js
@@ -1,5 +1,13 @@
import request from '@/utils/request'
export function addProduct(data) {
  return request({
    url: '/product/addProduct',
    method: 'post',
    data
  })
}
export function getMaterialList() {
  return request({
    url: '/material/list',
src/views/basicData/index.vue
@@ -247,7 +247,6 @@
                    this.selectProductModelTable();
                });
            },
            // 表格树全部选中配置
            // 全选/取消选操作
            selectAll(val) {
src/views/experiment/inspectionApplication/index.vue
@@ -105,14 +105,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="来料日期:">
                                            <!-- <el-input style="width: 300px" type="text" :value="infoForm.startTime" placeholder="请输入来料日期" autocomplete="off" /> -->
                                            <el-date-picker style="width: 300px" v-model="infoForm.formTime" type="date" placeholder="选择日期">
                                            <el-date-picker style="width: 300px" disabled v-model="infoForm.formTime" type="date" placeholder="选择日期">
                                            </el-date-picker>
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="供应商名称:">
                                            <el-input style="width: 300px" type="text" :value="infoForm.supplier" placeholder="请输入供应商名称"
                                            <el-input style="width: 300px" type="text" disabled :value="infoForm.supplier" placeholder="请输入供应商名称"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -120,13 +119,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="原材料编码:">
                                            <el-input style="width: 300px" type="text" :value="infoForm.mcode" placeholder="请输入原材料编码"
                                            <el-input style="width: 300px" type="text" disabled :value="infoForm.mcode" placeholder="请输入原材料编码"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="原材料名称:">
                                            <el-input style="width: 300px" type="text" :value="infoForm.name" placeholder="请输入原材料名称"
                                            <el-input style="width: 300px" type="text" disabled :value="infoForm.name" placeholder="请输入原材料名称"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -134,13 +133,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="规格型号:">
                                            <el-input style="width: 300px" type="text" :value="infoForm.specifications" placeholder="请输入规格型号"
                                            <el-input style="width: 300px" type="text" disabled :value="infoForm.specifications" placeholder="请输入规格型号"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="单位:">
                                            <el-input style="width: 300px" type="text" :value="infoForm.unit" placeholder="请输入单位"
                                            <el-input style="width: 300px" type="text" disabled :value="infoForm.unit" placeholder="请输入单位"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -148,7 +147,7 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="数量:">
                                            <el-input style="width: 300px" type="text" :value="infoForm.num" placeholder="请输入数量"
                                            <el-input style="width: 300px" type="text" disabled :value="infoForm.num" placeholder="请输入数量"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -168,13 +167,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="委托编号">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.entrust_coding"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.entrust_coding"
                                                placeholder="请输入来料日期" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="委托单位">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.supplier"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.supplier"
                                                placeholder="请输入委托单位" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -182,13 +181,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="样品编号">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.mcode" placeholder="请输入样品编号"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.mcode" placeholder="请输入样品编号"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="样品名称">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.name" placeholder="请输入样品名称"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.name" placeholder="请输入样品名称"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -196,13 +195,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="规格型号:">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.specifications"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.specifications"
                                                placeholder="请输入型号规格" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="送达时间">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.supplier"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.supplier"
                                                placeholder="请输入单位" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -210,7 +209,7 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="完成期限">
                                            <el-input style="width: 300px" type="text" :value="commisionSelection.completionDeadline"
                                            <el-input style="width: 300px" type="text" disabled :value="commisionSelection.completionDeadline"
                                                placeholder="请输入数量" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -230,27 +229,27 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="来料日期:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.deliverydate"
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.deliverydate"
                                                placeholder="请输入来料日期" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="供应商名称:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.supplier" placeholder="请输入供应商名称"
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.supplier" placeholder="请输入供应商名称"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                </el-row>
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="原材料编码:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.code" placeholder="请输入原材料编码"
                                        <el-form-item label="成品编码:">
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.code" placeholder="请输入成品编码"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="原材料名称:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.name" placeholder="请输入原材料名称"
                                        <el-form-item label="成品名称:">
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.name" placeholder="请输入成品名称"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -258,13 +257,13 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="规格型号:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.modelandspecification"
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.modelandspecification"
                                                placeholder="请输入规格型号" autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
                                    <el-col :span="10">
                                        <el-form-item label="单位:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.unit" placeholder="请输入单位"
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.unit" placeholder="请输入单位"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -272,7 +271,7 @@
                                <el-row :gutter="100">
                                    <el-col :span="10">
                                        <el-form-item label="数量:">
                                            <el-input style="width: 300px" type="text" v-model="finishedTable.amount" placeholder="请输入数量"
                                            <el-input style="width: 300px" type="text" disabled v-model="finishedTable.amount" placeholder="请输入数量"
                                                autocomplete="off" />
                                        </el-form-item>
                                    </el-col>
@@ -299,7 +298,7 @@
                    <template slot-scope="scope">
                        <span>版本选择:</span>
                        <el-select @change="getProductVerison" v-model="version" size="small" slot="append" style="width: 220px;">
                            <el-option v-for="item in BANben" :key="item" :label="item" :value="item"></el-option>
                            <el-option v-for="(item,index) in BANben" :key="index" :label="item.label" :value="item.value"></el-option>
                        </el-select>
                    </template>
                </el-card>
@@ -471,7 +470,7 @@
                pageSize: 10, // 每页的数据条数
                radioValue: '全部',
                checkTypeVisible: false,
                type: 0, // 默认不选中的状态
                type: 2, // 默认不选中的状态
                rawmaterialVisible: false,
                commisionVisible: false,
                tmp: {},
@@ -524,28 +523,31 @@
                const res = await chooseVer({
                    mcode: this.tmp.mcode,
                    name: this.tmp.name,
                    specifications: this.tmp.specifications
                    specifications: this.tmp.specificationsId
                })
                this.BANben = []
                res.data.forEach(a => {
                    this.BANben.push('V ' + a)
                    this.BANben.push({
                        label: "V" + a,
                        value: a
                    })
                })
                this.version = this.BANben[0]
                this.lookProByVer()
                this.version = this.BANben[0].value;
                this.lookProByVerFun()
            },
            //标准库
            async lookProByVer() {
            async lookProByVerFun() {
                const res = await lookProByVer({
                    mcode: this.tmp.mcode,
                    name: this.tmp.name,
                    specifications: this.tmp.specifications,
                    version: this.version.replace('V ', '')
                    specifications: this.tmp.specificationsId,
                    version: this.version
                })
                this.tableData = res.data
            },
            getProductVerison(val) {
                this.version = val
                this.lookProByVer()
                this.lookProByVerFun()
            },
            async selectInspectsList() {
                // 获取分页列表
@@ -679,17 +681,20 @@
                        name: this.infoForm.name,
                        num: this.infoForm.num,
                        specifications: this.infoForm.specifications,
                        specificationId: this.infoForm.specificationsId,
                        startTime: this.infoForm.checkdate[0],
                        supplier: this.infoForm.supplier,
                        type: this.type,
                        unit: this.infoForm.unit,
                        version: this.version.replace('V ', '')
                        version: this.version
                    }).then(res => {
                        this.$message({
                            message: '添加成功!',
                            type: 'success'
                        });
                        this.$router.push(`Viewdetails/${res.data}`)
                    }).catch(error=>{
                        this.$message.error(error.message);
                    })
                }
                if (this.type === 1) {
src/views/laboratory/ledger/index.vue
@@ -606,7 +606,7 @@
    },
    measureFormVisible(newVal){
      if(newVal === false){
        this.resetForm("addmeasureForm");
        this.cancelAddMeasure();
      }
    }
  },
@@ -639,7 +639,6 @@
    // 获取分类数据
    async getThreeData() {
      const { data } = await getClassifyList()
      // console.log(data)
      this.classTree = data.map(item => {
        if (item.children) {
          item.children = item.children.map(childrenItem => {
@@ -672,17 +671,14 @@
      const { data } = await getInstrumentDetail({ InstrumentId: row.id })
      this.equipmentDetail = data
      this.equipmentform = data
      console.log(this.equipmentform)
      const { data: pointList } = await getEquipmentPointList({ InstrumentId: this.equipmentDetail.id })
      this.codePointsTable = pointList
      const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id })
      this.measureTable = informationList
      console.log(informationList)
    },
    // 节点点击处理
    nodeClickHandler(data, node, element) {
      this.nodeclicked = data
      console.log(data)
      // 只有数据中携带id才能发送查询请求
      if (data.id) {
        this.getEquipmentTable({ classifyId: data.id, pageSize: this.pageSize, pageNo: this.currentPage, whetherWhether: this.isOut })
@@ -690,7 +686,6 @@
    },
    // 获取仪器列表数据
    async getEquipmentTable(ages) {
      // console.log('条件对象', ages)
      const { data } = await getInstrumentList(ages)
      this.equipmentTable = data.row
      this.total = data.total
@@ -709,14 +704,8 @@
    handleCurrentChange() {
      // 当前页更改
    },
    // 显示设备码点
    addCodePoints() {
      // 添加新码点,清空原数组
      this.codePointesTableStatus = true
    },
    // 新增设备码点
    addNewCodePoints() {
      console.log(this.equipmentDetail.id);
      this.codePointesTableStatus = true;
      const newObj = {}
      newObj.isInput = true,
@@ -814,10 +803,10 @@
      this.$refs[formName].resetFields();
    },
    cancelAddMeasure() {
      this.$refs['upload'].clearFiles();
      this.measureForm.file = null;
      this.measureFormVisible = false
      this.resetForm('addmeasureForm');
      this.$refs['upload'].clearFiles();
    },
    // 添加计量信息
    async addMeasure() {
@@ -829,7 +818,6 @@
            this.measureForm.beginDate = parseTime(this.measureForm.date[0], '{y}-{m}-{d}')
            this.measureForm.endDate = parseTime(this.measureForm.date[1], '{y}-{m}-{d}')
          }
          console.log(this.measureForm)
          const formData = new FormData()
          if(this.measureForm.file == null || this.measureForm.file == ""){
            this.$message.warning("请选择要上传的文件!");
@@ -837,16 +825,11 @@
          }else{
            formData.append('file', this.measureForm.file?.raw, this.measureForm.file?.name)
          }
          console.log(this.measureForm)
          for (const key in this.measureForm) {
            console.log(key)
            // if (key === 'file') return
            formData.append(key, this.measureForm[key])
          }
          console.log(formData)
          try {
            const { data } = await addMetricalInformation(formData)
            console.log(data)
            await addMetricalInformation(formData)
            this.$message.success('添加成功')
            const { data: informationList } = await getMetricalInformationList({ InstrumentId: this.equipmentDetail.id })
            this.measureTable = informationList
@@ -857,8 +840,6 @@
          }
          this.measureForm.file = null;
          this.$refs['upload'].clearFiles();
        }else{
          console.log(32);
        }
      });
    },
@@ -868,7 +849,6 @@
      this.codePointsTable = []
      this.measureTable = []
      this.measureForm.file = null;
      this.$refs['upload'].clearFiles();
    },
    // 关闭添加修改设备抽屉
    closeAddOrChangeDrawer() {
@@ -878,7 +858,6 @@
    },
    // 文件上传
    handleUpload(file, fileList) {
      console.log(file, fileList)
      this.measureForm.file = file
    },
    // 根据输入的设备编号,设备名称或者型号规格关键字进行过滤列表
@@ -896,7 +875,6 @@
      this.equipmentTable = this.oldtableData
    },
    getConditionTable() {
      // console.log(this.radioValue)
      let filteredTable = this.oldtableData.filter(item => {
        return item.conditions === this.radioValue
      })
@@ -939,12 +917,10 @@
            let expireItem
            for (expireItem of this.expireData) {
              this.equipmentTable = this.oldtableData.filter(item => {
                console.log(this.radioValue)
                console.log('item', item)
                console.log('expireItem', expireItem)
                return item.conditions === this.radioValue && item.equipment_code === expireItem.equipment_code
              })
              console.log(this.equipmentTable)
            }
          } else {
            this.equipmentTable = this.expireData
src/views/standardLibrary/index.vue
@@ -2,7 +2,14 @@
    <div class="standard-library-main">
        <div class="content-main">
            <div class="library-bom" style="width: 300px">
                <el-input clearable v-model="filterText" placeholder="输入关键字进行过滤"></el-input>
                <el-row :gutter="10">
                    <el-col :span="19">
                    <el-input clearable v-model="filterText" placeholder="输入关键字进行过滤"></el-input>
                    </el-col>
                    <el-col :span="5">
                        <el-button type="primary" icon="el-icon-plus" @click="addTreeFormVisible = true"></el-button>
                    </el-col>
                </el-row>
                <el-button type="text">全部</el-button>
                <el-tree ref="tree" style="width: 100%" class="filter-tree" :data="standardTree" :props="defaultProps"
                    node-key="id" :highlight-current="true" :default-expand-all="true" :filter-node-method="filterNode"
@@ -17,7 +24,7 @@
                            </el-option>
                        </el-select>
                        <el-button type="primary" @click="addVersionFun">新增版本号</el-button>
                        <el-button type="primary" icon="el-icon-plus" @click="addTreeFormVisible = true">新增</el-button>
                        <el-button type="primary" @click="centerDialogVisible = true">新增项目</el-button>
                        <el-button class="top_div_button" icon="el-icon-delete-solid" style="color: #00a5ff"
                            @click="deleteListClick">删除</el-button>
                    </div>
@@ -83,6 +90,33 @@
                <el-button @click="clear">取 消</el-button>
            </div>
        </el-dialog>
        <el-dialog :visible.sync="centerDialogVisible" width="30%" title="新增" :hide-required-asterisk="false">
            <el-form :model="form" :rules="rules" ref="ruleForm" class="addForm">
                <el-form-item prop="father">
                    <span>项目分组:</span>
                    <el-autocomplete class="inline-input" v-model="form.father" :fetch-suggestions="querySearch"
                        placeholder="请输入样品分组" style="width: calc(100% - 70px);"></el-autocomplete>
                </el-form-item>
                <el-row :gutter="24">
                    <el-col :span="12">
                        <el-form-item prop="name">
                            <span>项目名称:</span>
                            <el-input style="width: calc(100% - 70px);" v-model="form.name" placeholder="请输入项目名称"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item prop="unit">
                            <span v-html="'单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;位:'"></span>
                            <el-input style="width: calc(100% - 70px);" v-model="form.unit" placeholder="请输入单位"></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <span slot="footer" class="dialog-footer">
                <el-button @click="centerDialogVisible = false" size="small ">取 消</el-button>
                <el-button type="primary" @click="submitAdd" size="small ">确认</el-button>
            </span>
        </el-dialog>
    </div>
</template>
@@ -97,17 +131,32 @@
        blurUpdateApi,
        getVersion,
        addVersion,
        addProduct
    } from "@/api/standardLibrary";
    import {
        selectproductModelApi
        addStandardProjectGroupApi,
    } from "@/api/basicData/index";
    import {
        Tree
    } from "element-ui";
    export default {
        data() {
            return {
                projectGroupingOptions:[],
                form: {
                    father: "", // 项目分组
                    name: "", // 项目名称
                    unit: "", // 单位
                },
                rules: {
                    fater:[{required:true,message:"请选择项目名称",trigger:"blur"}],
                    name: [
                        {required: true,message: "请输入项目名称",trigger: "blur"},
                        {min: 2,max: 25,message: "长度在 2 到 25 个字符",trigger: "blur",},
                    ],
                    unit: [
                        {required: true,message: "请输入单位",trigger: "blur"},
                        {min: 1,max: 25,message: "长度在 1 到 25 个字符",trigger: "blur"}
                    ],
                },
                centerDialogVisible : false,
                filterNodeData: [],
                options: [],
                versionValue: "",
@@ -144,13 +193,45 @@
                if(newVal === false){
                    this.clear();
                }
            }
            },
            centerDialogVisible: {
                handler(newVal, oldVal) {
                    if (newVal == true) {
                        addStandardProjectGroupApi().then((res) => {
                            this.projectGroupingOptions = res.data;
                        });
                    } else {
                        // 请求成功清除数据
                        this.form = {};
                        // 提交成功清除检验
                        this.$refs.ruleForm.resetFields();
                    }
                },
            },
        },
        created() {
            this.getStandardTree();
        },
        mounted() {},
        mounted() {
        },
        methods: {
            querySearch(queryString, cb) {
                var restaurants = []
                this.projectGroupingOptions.forEach(a => {
                    restaurants.push({
                        value: a
                    })
                })
                var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            createFilter(queryString) {
                return (restaurant) => {
                    return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
                };
            },
            clear(){
                this.addTreeFormVisible = false;
                this.addTreeForm.addTypeArr=[];
@@ -159,9 +240,6 @@
                this.addTreeForm.standardName=''
            },
            changeSample(){
                // console.log(this.standardTree);
                // console.log(this.addTreeForm);
                // console.log(this.addTreeForm.addTypeArr.length);
                let selectType=this.standardTree.filter(item=>{
                    return item.id===this.addTreeForm.addTypeArr[0]
                })[0];
@@ -206,6 +284,22 @@
            changeSelect() {
                this.tableData = [];
                this.getTableByClick(this.selectData, this.versionValue);
            },
            async submitAdd(){
                await addProduct({
                    father : this.form.father,
                    name : this.form.name,
                    specificationId: this.selectData.id,
                    unit : this.form.unit,
                    version : this.versionValue
                }).then(res=>{
                    console.log(res);
                    this.$message.success(res.message);
                    this.centerDialogVisible = false;
                    this.getTableByClick(this.selectData, this.versionValue);
                }).catch(error=>{
                    this.$message.error(error.message);
                })
            },
            async insertVersion() {
                const resp = await addVersion({
@@ -406,21 +500,6 @@
            },
            changeCascader(data) {
                this.addTreeForm.addTypeArr = data;
            },
            selectProductModelTable() {
                selectproductModelApi(this.params).then((res) => {
                    res.data.forEach((i) => {
                        if (i.name === undefined) {
                            i.name = i.children[0].name;
                            i.unit = i.children[0].unit;
                            i.id = i.children[0].id;
                            i.edit = true;
                            delete i.children;
                        }
                    });
                    this.tableData = res.data;
                    this.selectDataList();
                });
            },
            selectDataList() {
                let i=0