Fixiaobai
2023-09-24 49f3321fa839e0ff5fb4d2de75756096a6db7b92
src/components/view/processInspectionUpdate.vue
@@ -6,8 +6,6 @@
                <el-col :span="12">编辑过程检验单</el-col>
                <el-col :span="12" style="text-align: right;">
                    <!-- 点击返回,当前页面值为false -->
                    <!-- <el-button type="primary" size="mini" style="background: #004EA2; "
              icon="el-icon-circle-plus-outline">新增</el-button> -->
                    <el-button @click="combackFather" type="primary" size="mini" icon="el-icon-back"
                        style="background: #004EA2; ">返回</el-button>
                </el-col>
@@ -26,31 +24,29 @@
                            <el-form-item label="产品名称:">
                                <el-select style="width: 210px;" size="small" disabled @change="selectSample"
                                    v-model="processInspectVo.material" placeholder="请选择产品">
                                    <el-option v-for="item in optionsSamplename" :key="item.value" :label="item.name"
                                        :value="item.name">
                           <el-option v-for="item in optionsSamplename" :key="item.value" :label="item.name" :value="item.name">
                                    </el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="产品编码:">
                                <el-input style="width: 210px;" size="small" disabled
                                    v-model="processInspectVo.materialCode" placeholder="请输入产品编码" />
                        <el-input style="width: 210px;" size="small" disabled v-model="processInspectVo.materialCode"
                           placeholder="请输入产品编码" />
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row :gutter="230">
                        <el-col :span="7">
                            <el-form-item label="规格型号:">
                                <el-input style="width: 210px;" size="small" disabled
                                    v-model="processInspectVo.specificationsModel" placeholder="请输入规格型号" />
                        <el-input style="width: 210px;" size="small" disabled v-model="processInspectVo.specificationsModel"
                           placeholder="请输入规格型号" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="工序名称:">
                                <el-select @change="changeOptionSoptionSprocesses" disabled
                                    v-model="processInspectVo.techfather" placeholder="请选择" style="width: 210px;"
                                    size="small">
                        <el-select @change="changeOptionSoptionSprocesses" disabled v-model="processInspectVo.techfather"
                           placeholder="请选择" style="width: 210px;" size="small">
                                    <el-option v-for="item in optionSoptionSprocesses" :key="item.name" :label="item.name"
                                        :value="item.name">
                                    </el-option>
@@ -59,8 +55,8 @@
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="工艺名称:">
                                <el-select v-model="processInspectVo.techname" disabled placeholder="请选择"
                                    style="width: 210px;" size="small">
                        <el-select v-model="processInspectVo.techname" disabled placeholder="请选择" style="width: 210px;"
                           size="small">
                                    <el-option v-for="item in optionTechnology" :key="item.id" :label="item.name"
                                        :value="item.id + '-' + item.name">
                                    </el-option>
@@ -93,8 +89,7 @@
                <el-col :span="12" class="inspectionProject_span">检验项目</el-col>
                <el-col v-if="!isUpBtn" :span="12" class="inspectionProject_span">
                    <el-button size="mini" @click="clickDeleteInspectionColumn()">删除检验值列</el-button>
                    <el-button style="margin-right: 30px;" size="mini"
                        @click="clickAddInspectionColumn()">添加检验值列</el-button>
               <el-button style="margin-right: 30px;" size="mini" @click="clickAddInspectionColumn()">添加检验值列</el-button>
                    <!-- <el-button
              size="mini"
              style="margin-right: 30px;"
@@ -124,15 +119,9 @@
                <el-table-column prop="dname" label="试验设备" min-width="100">
                    <template slot-scope="scope">
                        <el-col>
                            <el-button v-if="!scope.row.isSelectDevice" type="text" @click="clickTableSelect(scope)">{{
                                scope.row.dname == null ? "请选择" : scope.row.dname
                            }}</el-button>
                            <el-select @blur="blurNode(scope)" v-else-if="scope.row.isSelectDevice" style="width: 100%;"
                                @change="clickNodeSure(scope.row)" v-model="filterText" placeholder="请选择">
                                <el-option v-for="item in materialOptions" :key="item.id" :label="item.device"
                                    :value="item.id">
                                </el-option>
                            </el-select>
                     <el-button type="text" @click="clickTableSelect(scope)">
                        {{scope.row.dname == null ? "请选择" : scope.row.dname}}
                     </el-button>
                        </el-col>
                    </template>
                </el-table-column>
@@ -140,7 +129,7 @@
                    <template slot-scope="scope">
                        <span style="color: #34BD66;" v-if="scope.row.result === 1">合格</span>
                        <span style="color: #E84738;" v-else-if="scope.row.result === 0">不合格</span>
                        <span v-show="scope.row.result === null">暂未结论</span>
                  <span v-show="scope.row.result === null">{{null}}</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column v-if="detailId == null" label="操作" width="100">
@@ -174,15 +163,19 @@
        </div>
        <el-dialog title="请选择设备" :visible.sync="centerDialogVisible" width="20%">
            <div class="div_device_dialog">
                <!-- <el-select style="width: 100%;" @change="clickNodeSure()" v-model="filterText" placeholder="请选择">
                    <el-option v-for="item in materialOptions" :key="item.id" :label="item.device" :value="item.id">
                    </el-option>
                </el-select> -->
            <el-input placeholder="输入关键字进行过滤" v-model="filterText" style="margin-bottom: 6px;">
            </el-input>
            <el-tree class="filter-tree" :data="materialOptions" :props="defaultProps" default-expand-all highlight-current
               @node-click="nodeClick" :filter-node-method="filterNode" ref="tree">
               <div class="custom-tree-node" slot-scope="{ data }">
                  <span><i :class="`node_i ${data.children ? 'el-icon-folder-opened' : 'el-icon-tickets'}`"></i>{{ data.name }}</span>
            </div>
            <!-- <span slot="footer" class="dialog-footer">
            </el-tree>
         </div>
         <span slot="footer" class="dialog-footer">
                <el-button @click="centerDialogVisible = false">取 消</el-button>
                <el-button type="primary" @click="clickNodeSure()">确 定</el-button>
            </span> -->
         </span>
        </el-dialog>
    </div>
</template>
@@ -228,8 +221,7 @@
                unit: null
            },
            InspectioniD: null,
            addInspectionform: [
                {
            addInspectionform: [{
                    number: "",
                    username: "",
                    projectname: "",
@@ -242,18 +234,15 @@
                    group: "",
                    worker: "",
                    machine: ""
                }]
            ,
            }],
            inspectionItems: [], // 新增检验项目表格
            inspectionResultForm: [
                {
            inspectionResultForm: [{
                    id: "",
                    name: "",
                    inspecter: "",
                    conclusion: "",
                    operation: ""
                }
            ],
            }],
            options: [],
            value: "",
            rowList: [],
@@ -355,7 +344,6 @@
        },
        handleClick() { },
        updateInsInfo(row) {
            console.log(row);
            this.row = row
            this.showUp = true
        },
@@ -370,7 +358,6 @@
        },
        // 获取设备树内容
        getOptions(row) {
            this.filterText = 0
            this.$axios.get(this.$api.url.inspectionItemChooseDev, {
                params: {
                    father: row.father,
@@ -387,7 +374,6 @@
                    return
                }
                row.isSelectDevice = true
                this.filterText = row.did
            });
        },
        //返回
@@ -396,52 +382,34 @@
        },
        // 点击表格选择触发
        clickTableSelect(scope) {
            // return scope;
            // this.centerDialogVisible = true;
            if (this.clickSelectDevice.index != null) {
                this.$set(this.inspectionItems[this.clickSelectDevice.index], 'isSelectDevice', false)
            }
            this.centerDialogVisible = true;
            this.clickSelectDevice.index = scope.$index;
            this.clickSelectDevice.rpId = scope.row.id;
            this.getOptions(scope.row);
        },
        // 点击树里面的确定
        clickNodeSure(row) {
            console.log(row);
            let select = this.materialOptions.filter(item => {
                return item.id === this.filterText
            })[0]
            this.nodeData.id = select.id
            this.nodeData.name = select.device
            this.$axios
                .post(this.$api.url.inspectionItemUpdateDevByInsId, {
                    id: this.clickSelectDevice.rpId,
                    type: 1,
                    devId: this.nodeData.id
                })
                .then(res => {
                    row.isSelectDevice = false
                    console.log("row", row);
                    this.filterText = 0
                    this.getTableData()
         clickNodeSure() {
            if (this.detailId == null) {
               this.projectTable[this.clickSelectDevice.index].deviceId = this.nodeData.id;
               this.projectTable[this.clickSelectDevice.index].deviceName = this.nodeData.name;
                    this.centerDialogVisible = false;
            } else {
               this.$axios.post(this.$api.url.inspectionItemUpdateDevByInsId, {
                  id: this.clickSelectDevice.rpId,
                  devId: this.nodeData.id,
                  type: 1
               }).then(res => {
                  this.centerDialogVisible = false;
                  this.inspectionItems.forEach(a=>{
                     if(a.id == this.clickSelectDevice.rpId){
                        a.dname = this.nodeData.name
                     }
                  })
                });
            }
        },
        changeState(row, index) {
            if (row.did != null && row.did != '') {
                // let val = row.empiricalValueAddss.filter(item => {
                //     return item != '' && item != null
                // })
                // let eq = val.filter(item => {
                //     return /^[^><=]/.test(item)
                // })
                // if (eq.length > 0) {
                //     this.$message({
                //         message: "检测值[" + eq + "]格式首位应包含>,<或者=",
                //         type: 'warning'
                //     });
                //     return
                // }
                let str = ""
                row.empiricalValueAddss.forEach(e => {
                    str += e + ","
@@ -454,7 +422,9 @@
                    inspectionItemId: row.id,
                    inspectionValue: str.slice(0, -1)
                }, {
                    headers: { "Content-Type": "application/json" }
                  headers: {
                     "Content-Type": "application/json"
                  }
                }).then(res => {
                    row.result = res.data.result
                    row.username = res.data.username
@@ -471,7 +441,12 @@
            this.search.countSize = val;
            this.defaultInitializationTable();
        },
        handleSpanMethod({ row, column, rowIndex, columnIndex }) {
         handleSpanMethod({
            row,
            column,
            rowIndex,
            columnIndex
         }) {
            if (columnIndex === 0) {
                const _row = this.spanArr[rowIndex];
                const _col = _row > 0 ? 1 : 0;
@@ -532,7 +507,9 @@
                technologyId: val.technologyId,
                unit: val.unit
            }, {
                headers: { "Content-Type": "application/json" }
               headers: {
                  "Content-Type": "application/json"
               }
            }).then(res => {
                if (res.code === 201) {
                    this.$message({
@@ -583,7 +560,6 @@
                        }
                        uName.push(c['username'])
                        c.isSelectDevice = false
                        this.filterText = 0
                        arr.push(c)
                    })
                })
@@ -680,8 +656,7 @@
        },
        // 删除检验值列
        clickDeleteInspectionColumn() {
            if (this.empiricalValueAdd - 1 === 0) {
            } else {
            if (this.empiricalValueAdd - 1 === 0) {} else {
                if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
                    this.empiricalValueAdd = this.empiricalValueAdd - 1;
                    this.inspectionItems.forEach(i => {