1
lzhe
2024-05-24 c9ce5e7f9a9ef52c66baf4f8a6e8d9e48b7cb251
src/views/console/product-process/process-route/workmanship.vue
@@ -11,45 +11,51 @@
      <div class="main-content-left">
         <div class="info-top-title">工艺路线</div>
         <div style="margin-bottom: 12px;">
            <el-button type="primary">新增</el-button>
            <el-button type="primary" v-if="isCustomization">定版</el-button>
            <el-button type="primary" @click="table_open">新增</el-button>
            <el-button type="primary" v-if="isCustomization" @click="determineVersion">定版</el-button>
            <el-button disabled>并序</el-button>
         </div>
         <el-table ref="multipleTableRef0" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="HandleSelectionChange">
         <el-table ref="multipleTableRef0" :data="tableData" border style="width: 100%" class="multipleTableRef" @selection-change="HandleSelectionChange" @row-click="rowClick">
            <el-table-column type="selection" width="55" />
            <el-table-column prop="name" label="工序顺序"></el-table-column>
            <el-table-column prop="index" label="工序顺序"></el-table-column>
            <el-table-column prop="code" label="工序编号"></el-table-column>
            <el-table-column prop="typeName" label="工序名称"></el-table-column>
            <el-table-column prop="name" label="工序名称"></el-table-column>
            <el-table-column fixed="right" label="操作" width="200px">
               <template #default="scope">
                  <!-- <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                  <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">刷新</el-button>
                  <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">删除</el-button> -->
                  <el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)">删除</el-button>
               </template>
            </el-table-column>
         </el-table>
      </div>
      <div class="main-content-right">
         <div class="main-info-title">工序信息</div>
         <div class="addWorking" @click="table_open">添加工序</div>
         <!-- <ul>
         <div class="addWorking" @click="table_open" v-if="!isCustomization">添加工序</div>
         <ul v-if="isCustomization">
            <li>工序编号<span></span></li>
            <li>工序名称<span></span></li>
            <li>工序顺序<span></span></li>
         </ul> -->
         </ul>
      </div>
   </div>
   <save-dialog v-if="dialog.save" ref="saveDialog" @success="addRouteSuccess" @closed="dialog.save=false"></save-dialog>
   <el-drawer v-model="drawer" title="添加工序" direction="rtl" :before-close="handleClose" size="60%" modal-class="viewData">
      <!-- 新增路线 -->
      <div class="addworkmanship">
         <add-workmanship></add-workmanship>
      </div>
   </el-drawer>
</template>
<script>
   import addWorkmanship from './addWorkmanship'
   import saveDialog from './addWorking'
   export default {
      name: 'workmanship',
      components: {saveDialog},
      components: {saveDialog,addWorkmanship},
      props: ["isCustomization"],
      data() {
         return {
            drawer: false,
            tableData: [],
            selection: [],
            dialog: {
@@ -61,14 +67,56 @@
         
      },
      methods: {
         handleClose() {
         },
         determineVersion() {
            var that = this;
            this.$confirm(`工艺路线定版后,不支持编辑、删除、添加工序,请确认是否定版?`, '', {
               type: 'warning'
            }).then(() => {
               // this.$HTTP.delete("/api/blade-cps/production-craft-version/remove/"+that.delIconId).then(res=> {
               //    if(res.code == 200) {
               //       that.$message.success("操作成功");
               //       that.getDetail();
               //    }
               // })
            }).catch(() => {
            })
         },
         rowClick(row, column, event) {
            // this.id = row.id;
            // this.getWorkDetail();
            // this.getPage1();
         },
         table_edit(row,index) {
            this.$confirm(`确认要删除此工序吗?`, '', {
               type: 'warning'
            }).then(() => {
               this.tableData.splice(index,1);
            }).catch(() => {
            })
         },
         addRouteSuccess(selection) {
            selection.forEach((item,i)=> {
               item.index = i+1;
            })
            this.tableData = selection;
         },
         HandleSelectionChange(selection) {
            this.selection = selection;
         },
         table_open() {
            this.dialog.save = true
            this.$nextTick(() => {
               this.$refs.saveDialog.open();
            })
            if(this.isCustomization) {  //首页的新建
               this.drawer = true;
            }else {  //版本步骤中的新建
               this.dialog.save = true
               this.$nextTick(() => {
                  this.$refs.saveDialog.open();
               })
            }
         }
      }
   }
@@ -89,7 +137,7 @@
    color: #333;
}
.main-content-left {
   width: 70%;
   width: 60%;
}
.main-content-right {
   flex: 1;
@@ -120,4 +168,7 @@
   font-size: 14px;
   cursor: pointer;
}
.addworkmanship {
   padding: 0 20px;
}
</style>