Fixiaobai
2023-09-24 49f3321fa839e0ff5fb4d2de75756096a6db7b92
src/components/view/finishedProductInspectionUp.vue
@@ -24,14 +24,14 @@
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="客户名称:">
                                <el-input disabled style="width: 180px;" v-model="processInspectVo.prname"
                                    placeholder="请输入客户名称" autocomplete="off" />
                        <el-input disabled style="width: 180px;" v-model="processInspectVo.prname" placeholder="请输入客户名称"
                           autocomplete="off" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="工程名称:">
                                <el-input disabled style="width: 180px;" v-model="processInspectVo.sname"
                                    placeholder="请输入工程名称" autocomplete="off" />
                        <el-input disabled style="width: 180px;" v-model="processInspectVo.sname" placeholder="请输入工程名称"
                           autocomplete="off" />
                            </el-form-item>
                        </el-col>
                    </el-row>
@@ -54,8 +54,8 @@
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="产品编码:">
                                <el-input disabled style="width: 180px;" v-model="processInspectVo.mcode"
                                    placeholder="请输入产品编码" autocomplete="off" />
                        <el-input disabled style="width: 180px;" v-model="processInspectVo.mcode" placeholder="请输入产品编码"
                           autocomplete="off" />
                            </el-form-item>
                        </el-col>
                    </el-row>
@@ -68,14 +68,14 @@
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="单位:">
                                <el-input disabled style="width: 180px;" v-model="processInspectVo.unit"
                                    placeholder="请输入产品编码" autocomplete="off" />
                        <el-input disabled style="width: 180px;" v-model="processInspectVo.unit" placeholder="请输入产品编码"
                           autocomplete="off" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="7">
                            <el-form-item label="数量:">
                                <el-input disabled style="width: 180px;" v-model="processInspectVo.quantity"
                                    placeholder="请输入数量" autocomplete="off" />
                        <el-input disabled style="width: 180px;" v-model="processInspectVo.quantity" placeholder="请输入数量"
                           autocomplete="off" />
                            </el-form-item>
                        </el-col>
                        <el-col :span="3" style="display: flex;justify-content: end;">
@@ -88,11 +88,9 @@
        <div class="inspectionProject">
            <el-row>
                <el-col :span="12" class="inspectionProject_span">检验项目</el-col>
                <el-col v-if="!isUpBtn" :span="12" class="inspectionProject_span"
                    style="display: flex;justify-content: end;">
            <el-col v-if="!isUpBtn" :span="12" class="inspectionProject_span" style="display: flex;justify-content: end;">
                    <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;"
@@ -121,13 +119,9 @@
                </el-table-column>
                <el-table-column prop="dname" label="试验设备" min-width="100">
                    <template slot-scope="scope">
                        <el-button v-if="!scope.row.isSelectDevice" type="text" @click="clickTableSelect(scope)">{{
                  <el-button type="text" @click="clickTableSelect(scope)">{{
                            scope.row.dname == null ? "请选择" : scope.row.dname
                        }}</el-button>
                        <el-select v-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>
                    </template>
                </el-table-column>
                <el-table-column label="结论">
@@ -168,11 +162,20 @@
        </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>
            </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>
        </el-dialog>
    </div>
</template>
@@ -223,8 +226,7 @@
                technologyId: null
            },
            InspectioniD: null,
            addInspectionform: [
                {
            addInspectionform: [{
                    number: "",
                    username: "",
                    projectname: "",
@@ -237,18 +239,15 @@
                    group: "",
                    worker: "",
                    machine: ""
                }]
            ,
            }],
            inspectionItems: [], // 新增检验项目表格
            inspectionResultForm: [
                {
            inspectionResultForm: [{
                    id: "",
                    name: "",
                    inspecter: "",
                    conclusion: "",
                    operation: ""
                }
            ],
            }],
            options: [],
            value: "",
            rowList: [],
@@ -404,44 +403,33 @@
                    return
                }
                row.isSelectDevice = true
                this.filterText = row.did
            });
        },
        // 点击表格选择触发
        clickTableSelect(scope) {
            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) {
            let select = this.materialOptions.filter(item => {
                return item.id === this.filterText
            })[0]
            this.nodeData.id = select.id
            this.nodeData.name = select.device
            if (this.detailId == null) {
                this.inspectionItems[
                    this.clickSelectDevice.index
                ].did = this.nodeData.id;
                this.inspectionItems[
                    this.clickSelectDevice.index
                ].dname = this.nodeData.name;
               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, {
               this.$axios.post(this.$api.url.inspectionItemUpdateDevByInsId, {
                        id: this.clickSelectDevice.rpId,
                        type: 2,
                        devId: this.nodeData.id
                    })
                    .then(res => {
                        this.getTableData()
                  devId: this.nodeData.id,
                  type: 2
               }).then(res => {
                        this.centerDialogVisible = false;
                        row.isSelectDevice=false
                  this.inspectionItems.forEach(a=>{
                     if(a.id == this.clickSelectDevice.rpId){
                        a.dname = this.nodeData.name
                     }
                  })
                    });
            }
        },
@@ -472,7 +460,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
@@ -489,7 +479,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;
@@ -540,7 +535,9 @@
            val.material = this.processInspectVo.material.split("-")[1]
            val.id = this.processInspectVo.material.split("-")[0]
            this.$axios.post(this.$api.url.finishedInspectAddFinish, val, {
                headers: { "Content-Type": "application/json" }
               headers: {
                  "Content-Type": "application/json"
               }
            }).then(res => {
                if (res.code == 201) {
                    this.$message({
@@ -688,8 +685,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 => {