zhangqing hai 1 ano
pai
achega
4b64afd057

+ 5 - 6
src/views/inspectionWork/components/sampleListDialog.vue

@@ -18,15 +18,15 @@
                             <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
                             <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
                             <el-table-column label="工艺参数" prop="defaultValue" align="center">
                             <el-table-column label="工艺参数" prop="defaultValue" align="center">
                             </el-table-column>
                             </el-table-column>
-                            <!-- <el-table-column label="质检工具" prop="" align="center">
+                            <el-table-column label="质检工具" prop="" align="center">
                                 <template slot-scope="scope">
                                 <template slot-scope="scope">
                                     <toolButtom
                                     <toolButtom
-                                    v-model="scope.row.toolList"
-                                    :type="'view'"
-                                    :sList="sList"
+                                    v-model="scope.row.useTools"
+                                    :type="type"
+                                    :sList="scope.row.toolList"
                                     />
                                     />
                                 </template>
                                 </template>
-                            </el-table-column> -->
+                            </el-table-column>
                             <el-table-column label="质检内容" prop="qualityResultContent" align="center" fixed="right"
                             <el-table-column label="质检内容" prop="qualityResultContent" align="center" fixed="right"
                                 width="360">
                                 width="360">
                                 <template slot-scope="scope">
                                 <template slot-scope="scope">
@@ -161,7 +161,6 @@ export default {
             }
             }
             this.tableData = list;
             this.tableData = list;
             this.visible = true
             this.visible = true
-            this.sList = sList;
         },
         },
         handleClose() {
         handleClose() {
             this.visible = false;
             this.visible = false;

+ 2 - 5
src/views/inspectionWork/components/toolButtom.vue

@@ -3,7 +3,7 @@
     <el-badge :value="value.length" class="item">
     <el-badge :value="value.length" class="item">
       <el-button
       <el-button
         icon="el-icon-plus"
         icon="el-icon-plus"
-        v-if="type != 'view'"
+        v-if="type != 'detail'"
         type="primary"
         type="primary"
         @click="handleUpload"
         @click="handleUpload"
       >
       >
@@ -47,9 +47,6 @@
       
       
       sList:{
       sList:{
         type: Array,
         type: Array,
-        default: () => {
-          return []
-        }
       }
       }
     },
     },
     data() {
     data() {
@@ -70,7 +67,7 @@
     methods: {
     methods: {
       handleUpload() {
       handleUpload() {
         console.log(this.sList, '选择质检工具列表======');
         console.log(this.sList, '选择质检工具列表======');
-        this.$refs.toolListRef.open(this.selectVal, this.type, this.sList);
+        this.$refs.toolListRef.open(this.selectVal,this.type,this.sList);
       },
       },
       getFiles(val = []) {
       getFiles(val = []) {
         this.$emit('updateVal', val);
         this.$emit('updateVal', val);

+ 108 - 65
src/views/inspectionWork/components/toolList.vue

@@ -1,17 +1,10 @@
 <template>
 <template>
-<ele-modal
-    width="80%"
-    :visible.sync="visible"
-    :close-on-click-modal="false"
-    custom-class="ele-dialog-form"
-    append-to-body
-    :maxable="true"
-    :resizable="true"
-    >
+    <ele-modal width="60%" :visible.sync="visible" :close-on-click-modal="false" custom-class="ele-dialog-form"
+        append-to-body :maxable="true" :resizable="true">
 
 
-    <div class="ele-body" style="height:60vh;overflow: auto;">
-    <el-card shadow="never" v-loading="loading">
-      <ele-split-layout
+        <!-- <div class="ele-body" style="height:60vh;overflow: auto;"> -->
+        <!-- <el-card shadow="never" v-loading="loading"> -->
+        <!-- <ele-split-layout
         width="210px"
         width="210px"
         allow-collapse
         allow-collapse
         :right-style="{ overflow: 'hidden' }"
         :right-style="{ overflow: 'hidden' }"
@@ -28,40 +21,62 @@
               @node-click="onNodeClick"
               @node-click="onNodeClick"
             >
             >
             </el-tree>
             </el-tree>
-          </div>
-        <template v-slot:content>
-            <ele-pro-table
-                ref="table"
-                :columns="columns"
-                :datasource="datasource"
-                tool-class="ele-toolbar-form"
-                :needPage="false"
-                row-key="id"
-                :selection.sync="selection"
-                :toolbar="false"
-                >
-            </ele-pro-table>
+          </div> -->
+        <!-- <template v-slot:content> -->
+        <ele-pro-table ref="table" :columns="columns" :datasource="useList" tool-class="ele-toolbar-form"
+            :needPage="false" row-key="id" :selection.sync="selection" >
+            <template v-slot:toolbar v-if="type != 'detail'">
+                <el-button type="primary" @click="fileShow = true">选择质检工具</el-button>
+            </template>
+            <template v-slot:action="{ row }">
+            <el-popconfirm
+            class="ele-action"
+            title="确定要删除吗?"
+            @confirm="remove(row)"
+            >
+            <template v-slot:reference v-if="type != 'detail'">
+                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+                </el-link>
+            </template>
+            </el-popconfirm>
+      </template>
+        </ele-pro-table>
+        <!-- </template> -->
+        <!-- </ele-split-layout> -->
+        <!-- </el-card> -->
+
+        <!-- </div> -->
+        <template v-slot:footer>
+            <el-button @click="visible = false">取消</el-button>
+            <el-button type="primary" @click="addUserToolList"> 确认 </el-button>
         </template>
         </template>
-      </ele-split-layout>
-    </el-card>
 
 
-  </div>
-      <template v-slot:footer>
-        <el-button @click="fileShow = false">取消</el-button>
-        <el-button type="primary" @click="addTemplate"> 确认 </el-button>
-      </template>
+
+        <ele-modal width="60%" :visible.sync="fileShow" :close-on-click-modal="false" custom-class="ele-dialog-form"
+            append-to-body :maxable="true" :resizable="true">
+            <ele-pro-table ref="table" :columns="columns" :datasource="datasource" tool-class="ele-toolbar-form"
+                :needPage="false" row-key="id" :selection.sync="selection" :toolbar="false">
+            </ele-pro-table>
+            <template v-slot:footer>
+                <el-button @click="fileShow = false">取消</el-button>
+                <el-button type="primary" @click="addTemplate"> 确认 </el-button>
+            </template>
+        </ele-modal>
     </ele-modal>
     </ele-modal>
-    </template>
+</template>
 
 
 <script>
 <script>
 export default {
 export default {
     data() {
     data() {
         return {
         return {
+            selection: [],
             loading: false,
             loading: false,
-
+            fileShow: false,
             visible: false,
             visible: false,
-            datasource:[],
-            columns:[
+            datasource: [],
+            useList: [],
+            columns: [
                 {
                 {
                     width: 45,
                     width: 45,
                     type: 'selection',
                     type: 'selection',
@@ -78,14 +93,14 @@ export default {
                     fixed: 'left'
                     fixed: 'left'
                 },
                 },
                 {
                 {
-                    prop: 'categoryCode',
+                    prop: 'code',
                     label: '物品编码',
                     label: '物品编码',
                     align: 'center',
                     align: 'center',
                     showOverflowTooltip: true
                     showOverflowTooltip: true
                 },
                 },
                 {
                 {
-                    slot: 'categoryName',
-                    prop: 'categoryName',
+                    slot: 'name',
+                    prop: 'name',
                     label: '物品名称',
                     label: '物品名称',
                     align: 'center',
                     align: 'center',
                     showOverflowTooltip: true,
                     showOverflowTooltip: true,
@@ -110,42 +125,70 @@ export default {
                     showOverflowTooltip: true
                     showOverflowTooltip: true
                 },
                 },
                 {
                 {
-                    prop: 'measureQuantity',
-                    label: '计量数量',
-                    sortable: 'custom',
-                    showOverflowTooltip: true,
-                    width: 130,
-                    align: 'center'
-                },
-                {
-                    prop: 'measureUnit',
-                    label: '计量单位',
-                    align: 'center'
-                },
-                {
-                    prop: 'weight',
-                    label: '重量',
-                    showOverflowTooltip: true
-                },
-                {
-                    prop: 'weightUnit',
-                    label: '重量单位',
+                    columnKey: 'action',
+                    label: '操作',
+                    width: 200,
+                    align: 'center',
+                    resizable: false,
+                    slot: 'action',
                     showOverflowTooltip: true
                     showOverflowTooltip: true
-                },
+                }
+                // {
+                //     prop: 'measureQuantity',
+                //     label: '计量数量',
+                //     sortable: 'custom',
+                //     showOverflowTooltip: true,
+                //     width: 130,
+                //     align: 'center'
+                // },
+                // {
+                //     prop: 'measureUnit',
+                //     label: '计量单位',
+                //     align: 'center'
+                // },
+                // {
+                //     prop: 'weight',
+                //     label: '重量',
+                //     showOverflowTooltip: true
+                // },
+                // {
+                //     prop: 'weightUnit',
+                //     label: '重量单位',
+                //     showOverflowTooltip: true
+                // },
             ],
             ],
             data: [],
             data: [],
-
         }
         }
     },
     },
     methods: {
     methods: {
         open(val, type, sList) {
         open(val, type, sList) {
-            debugger;
             this.visible = true;
             this.visible = true;
             this.type = type;
             this.type = type;
-            this.sList = sList;
+            this.useList = val;
+            this.datasource = sList;
         },
         },
-        onNodeClick() {
-
+        addUserToolList() {
+            if (this.selection.some((item) => 
+                this.useList.some((i) => i.code == item.code))) {
+                return this.$message.error('选择的物品已经存在列表了');
+            }
+            
+            this.$emit(
+                'success',
+                this.useList
+            );
+            this.visible = false;
+            this.init();
+        },
+        addTemplate() {
+            this.useList = this.selection;
+            this.fileShow = false;
+        },
+        remove(row) {
+            this.useList = this.useList.filter((item) => item.code != row.code);
+        },
+        init() {
+            this.selection = [];
         }
         }
     },
     },
 }
 }