ysy 2 лет назад
Родитель
Сommit
922fda8b02

+ 1 - 0
src/views/system/menu/index.vue

@@ -184,6 +184,7 @@ export default {
     },
     /* 数据转为树形结构 */
     parseData(data) {
+ 
       // data.map(item=>{
       //    item.id = parseInt(item.id)
       // })

+ 8 - 5
src/views/technology/productParam/components/ParamModal.vue

@@ -1,6 +1,6 @@
 <template>
     <el-dialog :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
-        :close-on-press-escape="false" append-to-body width="80%">
+        :close-on-press-escape="false" append-to-body width="70%">
 
         <el-card shadow="never">
             <user-search @search="reload" />
@@ -127,7 +127,8 @@ export default {
             // 表格选中数据
             selection: [],
 
-            tableData: []
+            tableData: [],
+            current: null
 
         }
     },
@@ -158,10 +159,12 @@ export default {
         reload(where) {
             this.$refs.table.reload({ page: 1, where: where });
         },
-        open(item) {
+        open(item, current) {
             if (item) {
                 this.tableData = item
-
+            }
+            if(current) {
+                this.current = current
             }
             this.visible = true
         },
@@ -182,7 +185,7 @@ export default {
                 this.$message.error('请至少选择一条数据');
                 return;
             }
-            this.$emit('chooseModal', this.selection)
+            this.$emit('chooseModal', this.selection, this.current)
             this.handleClose()
         },
     }

+ 102 - 118
src/views/technology/productParam/components/ProductModal.vue

@@ -1,37 +1,16 @@
 <template>
-  <el-dialog
-    :title="title"
-    :visible.sync="visible"
-    :before-close="handleClose"
-    :close-on-click-modal="false"
-    :close-on-press-escape="false"
-    append-to-body
-    width="80%"
-  >
+  <el-dialog :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+    :close-on-press-escape="false" append-to-body width="70%">
     <el-card shadow="never">
       <ProductSearch @search="reload" />
-      <ele-split-layout
-        width="244px"
-        allow-collapse
-        :right-style="{ overflow: 'hidden' }"
-      >
+      <ele-split-layout width="244px" allow-collapse :right-style="{ overflow: 'hidden' }">
         <div class="ele-border-lighter split-layout-right-content">
-          <AssetTree
-            ref="assetTreeRef"
-            :id="categoryLevelId"
-            @handleNodeClick="handleNodeClick"
-          />
+          <AssetTree ref="assetTreeRef" :id="categoryLevelId" @handleNodeClick="handleNodeClick" />
         </div>
         <!-- 表格 -->
         <template v-slot:content>
-          <ele-pro-table
-            ref="table"
-            :columns="columns"
-            :datasource="datasource"
-            height="calc(100vh - 350px)"
-            class="dict-table"
-            @cell-click="cellClick"
-          >
+          <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
+            class="dict-table" @cell-click="cellClick">
             <!-- 表头工具栏 -->
             <template v-slot:action="{ row }">
               <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
@@ -48,15 +27,15 @@
 </template>
 
 <script>
- import AssetTree from '@/components/AssetTree';
- import ProductSearch from './product-search.vue'
- import { getMaterialList } from '@/api/material/manage.js';
+import AssetTree from '@/components/AssetTree';
+import ProductSearch from './product-search.vue'
+import { getMaterialList } from '@/api/material/manage.js';
 export default {
-   components: { AssetTree, ProductSearch },
-  data () {
+  components: { AssetTree, ProductSearch },
+  data() {
     return {
       visible: false,
-     
+
       // 表格列配置
       columns: [
         {
@@ -81,59 +60,59 @@ export default {
         },
 
         {
-            prop: 'modelType',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'measuringUnit',
-            label: '计量单位',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-          {
-            prop: 'weightUnit',
-            label: '重量单位',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-          {
-            prop: 'roughWeight',
-            label: '毛重',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-          {
-            prop: 'netWeight',
-            label: '净重',
-            showOverflowTooltip: true,
-            minWidth: 90
-          },
-
-
-          {
-            prop: 'packingUnit',
-            align: 'center',
-            label: '包装单位',
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'categoryLevelPath',
-            label: '分类',
-            align: 'center',
-            showOverflowTooltip: true
-          },
-     
+          prop: 'modelType',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'measuringUnit',
+          label: '计量单位',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'weightUnit',
+          label: '重量单位',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'roughWeight',
+          label: '毛重',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+        {
+          prop: 'netWeight',
+          label: '净重',
+          showOverflowTooltip: true,
+          minWidth: 90
+        },
+
+
+        {
+          prop: 'packingUnit',
+          align: 'center',
+          label: '包装单位',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'categoryLevelPath',
+          label: '分类',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+
         {
           action: 'action',
           slot: 'action',
@@ -143,7 +122,7 @@ export default {
       ],
       title: null,
       categoryLevelId: null,
-      radio:null
+      radio: null
     }
   },
 
@@ -152,7 +131,7 @@ export default {
   },
   methods: {
     /* 表格数据源 */
-    datasource ({ page, where, limit }) {
+    datasource({ page, where, limit }) {
       return getMaterialList({
         ...where,
         pageNum: page,
@@ -161,60 +140,60 @@ export default {
 
       });
     },
-    handleNodeClick (data) {
+    handleNodeClick(data) {
       this.categoryLevelId = data.id;
       this.reload();
     },
     /* 刷新表格 */
-    reload () {
+    reload() {
       this.$refs.table.reload();
     },
-    open(item, title, categoryLevelId){
-      if(item){
+    open(item, title, categoryLevelId) {
+      if (item) {
         this.title = title
         this.categoryLevelId = categoryLevelId
 
-        if(title == '选择产品') {
+        if (title == '选择产品') {
           this.current = {
-          id:item.categoryId,
-          name: item.categoryName,
-          code:item.categoryCode
-        }
-        this.radio = item.categoryId
-      
-        } else if(title == '选择舟皿') {
+            id: item.categoryId,
+            name: item.categoryName,
+            code: item.categoryCode
+          }
+          this.radio = item.categoryId
+
+        } else if (title == '选择舟皿') {
           this.current = {
-          id:item.categoryId,
-          name: item.categoryName,
-          code:item.categoryCode
-        }
-        this.radio = item.categoryId
+            id: item.categoryId,
+            name: item.categoryName,
+            code: item.categoryCode
+          }
+          this.radio = item.categoryId
         }
 
       }
       this.visible = true
     },
 
-  
+
 
 
 
     // 单击获取id
-    cellClick (row) {
-        this.current = row
-        this.radio = row.id
+    cellClick(row) {
+      this.current = row
+      this.radio = row.id
     },
-    handleClose () {
+    handleClose() {
       this.visible = false
       this.current = null
       this.radio = ''
     },
-    selected(){
-       if(!this.current){
-         return this.$message.warning('请选择工作中心')
-       }
-       this.$emit('changeProduct', this.title, this.current)
-       this.handleClose()
+    selected() {
+      if (!this.current) {
+        return this.$message.warning('请选择工作中心')
+      }
+      this.$emit('changeProduct', this.title, this.current)
+      this.handleClose()
     },
   }
 }
@@ -228,21 +207,26 @@ export default {
   height: 500px;
   overflow: auto;
 }
+
 .table_col {
   padding-left: 10px;
+
   ::v-deep .el-table th.el-table__cell {
     background: #f2f2f2;
   }
 }
+
 .pagination {
   text-align: right;
   padding: 10px 0;
 }
+
 .btns {
   text-align: center;
   padding: 10px 0;
 }
-.topsearch{
-	margin-bottom:15px;
+
+.topsearch {
+  margin-bottom: 15px;
 }
 </style>

+ 287 - 0
src/views/technology/productParam/components/process.vue

@@ -0,0 +1,287 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+
+
+      <!-- 数据表格 -->
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" row-key="id">
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar>
+          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit()">
+            添加工序
+          </el-button>
+
+        </template>
+
+
+        <!-- 展开内容 -->
+        <template v-slot:expand="{ row }">
+          <div style="width:100%; height: 200px">
+            <ele-pro-table ref="table" :datasource="row.produceList" :columns="columns">
+            <!-- 表头工具栏 -->
+            <template v-slot:toolbar>
+
+              <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
+                @click.native="openParam">添加参数</el-button>
+
+            </template>
+
+            <!-- 默认值 -->
+            <template v-slot:defaultValue="{ row }">
+              <el-input v-if="row.textType == 1 || row.textType == 4" v-model="row.defaultValue"
+                placeholder="请输入"></el-input>
+              <el-select v-if="row.textType == 2" v-model="row.defaultValue" placeholder="请选择">
+                <el-option label="TRUE" :value="'TRUE'" />
+                <el-option label="FALSE" :value="'FALSE'" />
+              </el-select>
+
+            </template>
+
+            <!-- 上限 -->
+            <template v-slot:maxValue="{ row }">
+              <el-input v-if="row.textType == 3" v-model="row.maxValue" placeholder="请输入"></el-input>
+            </template>
+            <!-- 下限 -->
+            <template v-slot:minValue="{ row }">
+              <el-input v-if="row.textType == 3" v-model="row.minValue" placeholder="请输入"></el-input>
+            </template>
+
+            <!-- 单位 -->
+            <template v-slot:unitName="{ row }">
+              <DictSelection v-if="row.textType != 2" dictName="工艺参数单位" clearable filterable v-model="row.unitName">
+              </DictSelection>
+            </template>
+
+
+
+            <!-- 操作列 -->
+            <template v-slot:action="{ row }">
+              <el-popconfirm class="ele-action" title="确定要删除当前参数吗?" @confirm="remove(row)">
+                <template v-slot:reference>
+                  <el-link type="danger" :underline="false" icon="el-icon-delete">
+                    删除
+                  </el-link>
+                </template>
+              </el-popconfirm>
+            </template>
+          </ele-pro-table>    
+          </div>
+        </template>
+
+
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link type="primary" :underline="false" icon="el-icon-setting" @click="openSetting(row)">
+            配置参数
+          </el-link>
+
+
+
+
+          <el-popconfirm class="ele-action" title="确定要删除当前工序吗?" @confirm="remove(row)">
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+    <ProcessModal ref="processModalRef" @chooseProcess="chooseProcess"></ProcessModal>
+
+    <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
+  </div>
+</template>
+  
+<script>
+
+
+
+import ProcessModal from './processModal.vue'
+import ParamModal from './ParamModal.vue'
+
+export default {
+  name: 'process',
+  components: {
+    ProcessModal,
+    ParamModal
+  },
+  data() {
+    return {
+      // 表格列配置
+      columns: [
+        {
+          width: 45,
+          type: 'expand',
+          columnKey: 'produceList',
+          align: 'center',
+          slot: 'expand'
+        },
+        {
+
+          prop: 'code',
+          label: '工序编码',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '工序名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          align: 'center',
+          prop: 'controlName',
+          label: '工序控制码',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'workCenterName',
+          label: '所属工作中心',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 260,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ],
+
+      // 表格列配置
+      columns2: [
+        {
+          prop: 'code',
+          label: '参数编码',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '参数名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+        {
+          align: 'center',
+          prop: 'description',
+          label: '文本描述',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          prop: 'maxValue',
+          slot: 'maxValue',
+          label: '参数上限',
+          align: 'center',
+
+        },
+        {
+          prop: 'minValue',
+          slot: 'minValue',
+          label: '参数下限',
+          align: 'center',
+
+        },
+        {
+          prop: 'defaultValue',
+          slot: 'defaultValue',
+          label: '默认值',
+          align: 'center',
+
+        },
+
+        {
+          prop: 'unitName',
+          slot: 'unitName',
+          label: '参数单位',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+
+
+        {
+          columnKey: 'action',
+          label: '操作',
+
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          showOverflowTooltip: true
+        }
+      ],
+
+      processData: [],
+
+      removeList: [],
+
+
+    };
+  },
+  methods: {
+    /*配置工艺参数 */
+    openSetting(row) {
+      this.current = row;
+      this.$refs.paramRefs.open(this.tableData, this.current)
+    },
+
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      return []
+    },
+
+
+    openEdit() {
+      let tableList = []
+      tableList = this.$refs.table.getData()
+      this.$refs.processModalRef.open(tableList)
+    },
+
+    chooseProcess(data) {
+      this.$refs.table.setData([...data, ...this.$refs.table.getData()]);
+    },
+
+    chooseModal(data, current) {
+      let tableList = []
+      tableList = this.$refs.table.getData()
+
+
+      tableList.map((m) => {
+        if (m.id = current.id) {
+          m.produceList = data
+        }
+      })
+
+      console.log(tableList)
+    },
+
+
+    /* 删除 */
+    remove(row) {
+      const data = this.$refs.table.getData() ?? [];
+
+      if (row.id) {
+        this.removeList.push(row.id);
+        this.$refs.table.setData(data.filter((d) => d.id !== row.id));
+      }
+    },
+
+  }
+};
+</script>
+  

+ 160 - 0
src/views/technology/productParam/components/processModal.vue

@@ -0,0 +1,160 @@
+<template>
+    <el-dialog :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+        :close-on-press-escape="false" append-to-body width="70%">
+
+        <el-card shadow="never">
+
+
+            <!-- 数据表格 -->
+            <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
+
+
+            </ele-pro-table>
+
+
+        </el-card>
+
+        <div class="btns">
+            <el-button type="primary" size="small" @click="selected">选择</el-button>
+            <el-button size="small" @click="handleClose">关闭</el-button>
+        </div>
+    </el-dialog>
+</template>
+  
+<script>
+
+
+import producetask from '@/api/technology/production';
+export default {
+    components: {},
+    data() {
+        return {
+            visible: false,
+            title: '选择工序',
+
+            // 表格列配置
+            columns: [
+                {
+                    columnKey: 'selection',
+                    type: 'selection',
+                    width: 45,
+                    align: 'center',
+                    selectable: (row, index) => {
+                        return !this.processData.some((it) => it.id == row.id);
+                    },
+                    reserveSelection: true,
+                    fixed: 'left'
+                },
+
+                {
+                    prop: 'code',
+                    label: '工序编码',
+                    // sortable: 'custom',
+                    showOverflowTooltip: true,
+                    align: 'center',
+                    minWidth: 110
+                },
+                {
+                    prop: 'name',
+                    label: '工序名称',
+                    showOverflowTooltip: true,
+                    align: 'center',
+                    minWidth: 110
+                },
+                {
+                    align: 'center',
+                    prop: 'controlName',
+                    label: '工序控制码',
+                    showOverflowTooltip: true,
+                    minWidth: 110
+                },
+                {
+                    prop: 'workCenterName',
+                    label: '所属工作中心',
+                    align: 'center',
+                    showOverflowTooltip: true,
+                    minWidth: 110
+                },
+
+
+
+
+
+            ],
+
+            // 表格选中数据
+            selection: [],
+
+            processData: []
+
+        }
+    },
+
+    watch: {
+
+    },
+    methods: {
+
+
+        /* 表格数据源 */
+        async datasource({ page, limit, where, order }) {
+            const res = await parameter.list({
+                ...where,
+                ...order,
+                pageNum: page,
+                size: limit
+            });
+            return res;
+        },
+
+        open(item) {
+            if (item) {
+                this.processData = item
+
+            }
+            this.visible = true
+        },
+
+        /* 表格数据源 */
+        async datasource({ page, limit, where, order }) {
+            const res = await producetask.list({
+                ...where,
+                ...order,
+                pageNum: page,
+                size: limit
+            });
+            return res;
+        },
+
+        /* 刷新表格 */
+        reload(where) {
+            this.$refs.table.reload({ page: 1, where: where });
+        },
+
+
+
+        handleClose() {
+            this.visible = false
+            this.$refs.table.setSelectedRows([]);
+            this.selection = []
+
+        },
+        selected() {
+            if (!this.selection.length) {
+                this.$message.error('请至少选择一条数据');
+                return;
+            }
+            this.$emit('chooseProcess', this.selection)
+            this.handleClose()
+        },
+    }
+}
+</script>
+  
+<style lang="scss" scoped>
+.btns {
+    text-align: center;
+    padding: 10px 0;
+}
+</style>
+  

+ 32 - 27
src/views/technology/productParam/components/user-edit.vue

@@ -1,6 +1,6 @@
 <!-- 用户编辑弹窗 -->
 <template>
-  <ele-modal width="1060px" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
+  <ele-modal width="1160px" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
     custom-class="ele-dialog-form" :title="isUpdate ? '修改参数' : '添加参数'" @update:visible="updateVisible">
     <header-title title="基本信息"></header-title>
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
@@ -100,13 +100,12 @@
 
       <el-row>
 
-
         <div class="ele-body">
-          <ele-pro-table ref="table" :datasource="datasource" :needPage="false" :columns="columns">
+          <ele-pro-table ref="table" :datasource="datasource" :columns="columns">
             <!-- 表头工具栏 -->
             <template v-slot:toolbar>
 
-              <el-button ize="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
+              <el-button size="small" icon="el-icon-plus" class="ele-btn-icon" type="primary"
                 @click.native="openParam">添加参数</el-button>
 
             </template>
@@ -124,7 +123,7 @@
 
             <!-- 上限 -->
             <template v-slot:maxValue="{ row }">
-              <el-input v-if="row.textType == 3"  v-model="row.maxValue" placeholder="请输入"></el-input>
+              <el-input v-if="row.textType == 3" v-model="row.maxValue" placeholder="请输入"></el-input>
             </template>
             <!-- 下限 -->
             <template v-slot:minValue="{ row }">
@@ -138,15 +137,6 @@
             </template>
 
 
-            <!-- 默认值 -->
-            <!-- <template v-slot:notNull="{ row }">
-              <el-select v-model="row.notNull" placeholder="请选择">
-                <el-option v-for="item in timeType" :key="item.value" :label="item.label" :value="item.value">
-                </el-option>
-              </el-select>
-            </template> -->
-
-            <!-- 状态列 -->
 
             <!-- 操作列 -->
             <template v-slot:action="{ row }">
@@ -163,6 +153,12 @@
 
       </el-row>
 
+
+      <header-title title="添加工序"></header-title>
+
+
+
+
     </el-form>
 
 
@@ -182,20 +178,24 @@
     <!-- 选择产品参数 -->
     <ParamModal ref="paramRefs" @chooseModal="chooseModal"></ParamModal>
 
+    <!-- 选择工序 -->
+    <Process></Process>
+
   </ele-modal>
 </template>
 
 <script>
 import parameter from '@/api/technology/parameter';
-
 import ProductModal from './ProductModal.vue';
+import Process from './process.vue'
 import ParamModal from './ParamModal.vue'
 import { deepClone } from '@/components/FormGenerator/utils/index';
 
 export default {
   components: {
     ProductModal,
-    ParamModal
+    ParamModal,
+    Process
   },
   props: {
     // 弹窗是否打开
@@ -312,7 +312,7 @@ export default {
           showOverflowTooltip: true
         }
       ],
-  
+
     };
   },
   computed: {
@@ -364,18 +364,23 @@ export default {
       this.$refs.table.setData([...arr, ...this.$refs.table.getData()]);
     },
 
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+     return []
+    },
+
     remove(row) {
-        const data = this.$refs.table.getData() ?? [];
+      const data = this.$refs.table.getData() ?? [];
 
-        if (row.id) {
-          this.removeList.push(row.id);
-          this.$refs.table.setData(data.filter((d) => d.id !== row.id));
-        } else {
-          this.$refs.table.setData(
-            data.filter((d) => d.paramId !== row.paramId)
-          );
-        }
-      },
+      if (row.id) {
+        this.removeList.push(row.id);
+        this.$refs.table.setData(data.filter((d) => d.id !== row.id));
+      } else {
+        this.$refs.table.setData(
+          data.filter((d) => d.paramId !== row.paramId)
+        );
+      }
+    },
 
     /* 保存编辑 */
     save() {