From a5b8938f2be523d3f0a4dfc3acef42aab8c77191 Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期四, 19 九月 2024 10:24:25 +0800
Subject: [PATCH] 1
---
src/views/console/product-process/process-route/workmanship.vue | 224 +++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 196 insertions(+), 28 deletions(-)
diff --git a/src/views/console/product-process/process-route/workmanship.vue b/src/views/console/product-process/process-route/workmanship.vue
index 227212b..c34c8a8 100644
--- a/src/views/console/product-process/process-route/workmanship.vue
+++ b/src/views/console/product-process/process-route/workmanship.vue
@@ -2,7 +2,7 @@
* @Author: lzhe lzhe@example.com
* @Date: 2024-05-24 11:25:26
* @LastEditors: lzhe lzhe@example.com
- * @LastEditTime: 2024-05-24 15:05:44
+ * @LastEditTime: 2024-05-28 11:09:17
* @FilePath: /src/views/console/product-process/process-route/workmanship.vue
* @Description: 杩欐槸榛樿璁剧疆,璇疯缃甡customMade`, 鎵撳紑koroFileHeader鏌ョ湅閰嶇疆 杩涜璁剧疆: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -13,16 +13,22 @@
<div style="margin-bottom: 12px;">
<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>
+ <el-button :disabled="mergeDisabled" @click="mergeBtn">骞跺簭</el-button>
</div>
- <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="index" label="宸ュ簭椤哄簭"></el-table-column>
- <el-table-column prop="code" label="宸ュ簭缂栧彿"></el-table-column>
- <el-table-column prop="name" label="宸ュ簭鍚嶇О"></el-table-column>
+ <el-table ref="multipleTableRef0" :data="tableData" row-key="id" border :tree-props="{ children: 'children', hasChildren: 'has' }" style="width: 100%" class="multipleTableRef" @selection-change="HandleSelectionChange" @row-click="rowClick" default-expand-all>
+ <el-table-column type="selection" :selectable="setSelectable" width="55" />
+ <el-table-column prop="index" label="宸ュ簭椤哄簭">
+ <template #default="scope">
+ <span>{{scope.row.index || "-"}}</span>
+ </template>
+ </el-table-column>
+ <el-table-column prop="processCode" label="宸ュ簭缂栧彿"></el-table-column>
+ <el-table-column prop="processName" 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_del(scope.row, scope.$index)" v-if="scope.row.index">鍒犻櫎</el-button>
+ <el-button text type="primary" size="small" @click="table_remove(scope.row, scope.$index)" v-if="!scope.row.index">绉婚櫎</el-button>
</template>
</el-table-column>
</el-table>
@@ -41,9 +47,30 @@
<el-drawer v-model="drawer" title="娣诲姞宸ュ簭" direction="rtl" :before-close="handleClose" size="60%" modal-class="viewData">
<!-- 鏂板璺嚎 -->
<div class="addworkmanship">
- <add-workmanship></add-workmanship>
+ <add-workmanship ref="addworkmanship" @success="handleSuccess" :isClear="isClear" :craftId="craftId"></add-workmanship>
</div>
</el-drawer>
+ <!-- 骞跺簭寮圭獥 -->
+ <el-dialog title="骞跺簭" v-model="mergeVisible" :width="500" destroy-on-close>
+ <el-form :inline="true" ref="mergeVisibleData" :model="mergeVisibleData" :rules="mergeVisibleRules" label-width="80px">
+ <el-row>
+ <el-col :span="24">
+ <el-form-item label="宸ュ簭缂栧彿" prop="processCode" style="width: 100%">
+ <el-input v-model="mergeVisibleData.processCode" placeholder="璇疯緭鍏ュ伐搴忕紪鍙�" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <el-form-item label="宸ュ簭鍚嶇О" prop="processName" style="width: 100%">
+ <el-input v-model="mergeVisibleData.processName" placeholder="璇疯緭鍏ュ伐搴忓悕绉�" clearable></el-input>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ </el-form>
+ <template #footer>
+ <el-button @click="cencelMerge" >鍙栨秷</el-button>
+ <el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="mergeSubmit">纭畾</el-button>
+ </template>
+ </el-dialog>
</template>
<script>
@@ -52,9 +79,20 @@
export default {
name: 'workmanship',
components: {saveDialog,addWorkmanship},
- props: ["isCustomization"],
+ props: ["isCustomization","craftId"],
data() {
return {
+ mergeVisibleData: {
+ processCode: "",
+ processName: ""
+ },
+ mergeVisibleRules: {
+ processCode:[{required: true, message: '璇疯緭鍏ュ伐搴忕紪鍙�'}],
+ processName:[{required: true, message: '璇疯緭鍏ュ伐搴忓悕绉�'}]
+ },
+ mergeVisible: false,
+ mergeDisabled: true,
+ isClear: false,
drawer: false,
tableData: [],
selection: [],
@@ -64,23 +102,99 @@
}
},
mounted(){
-
+ },
+ watch: {
+ craftId(val) {
+ if(val) {
+ this.getcraftlList();
+ }
+ }
},
methods: {
- handleClose() {
+ setSelectable(row,rowIndex) {
+ return !row.children && row.index;
+ },
+ cencelMerge() {
+ this.mergeVisible=false;
+ this.mergeVisibleData = {
+ processCode: "",
+ processName: ""
+ };
+ },
+ mergeSubmit() {
+ var that = this;
+ this.selection.forEach(item=> {
+ item.versionProcessId = item.id;
+ });
+ var obj = {
+ parallelVO: this.selection,
+ processCode: this.mergeVisibleData.processCode,
+ processName: this.mergeVisibleData.processName,
+ sort: 1,
+ versionId: this.craftId
+ }
+ this.$refs.mergeVisibleData.validate(async (valid) => {
+ if (valid) {
+ that.$HTTP.post("/api/blade-cps/production-craft-process/save-parallel",obj).then(res=> {
+ if(res.code == 200) {
+ that.mergeVisible = false;
+ that.$message.success("鎿嶄綔鎴愬姛");
+ that.getcraftlList();
+ }else {
+ that.$alert(res.message, "鎻愮ず", {type: 'error'});
+ }
+ })
+ }else{
+ return false;
+ }
+ })
+ },
+ mergeBtn() {
+ this.mergeVisible = true;
+ },
+ handleSuccess(value) {
+ this.drawer = false;
+ this.isClear = false;
+ this.getcraftlList();
+ },
+ getcraftlList() {
+ // this.$HTTP.get(`/api/blade-cps/production-craft-version/detail/${this.craftId}`).then(res=> {
+ // if(res.code == 200) {
+ // res.data.processList.forEach((item,index)=> {
+ // item.index = index + 1;
+ // });
+ // this.tableData = res.data.processList;
+ // }
+ // })
+ this.$HTTP.get(`/api/blade-cps/production-craft-process/child-tree?versionId=${this.craftId}`).then(res=> {
+ if(res.code == 200) {
+ res.data.forEach((item,index)=> {
+ if(item.children && item.children.length > 0) {
+ item.disabled = true;
+ }
+ item.index = index + 1;
+ })
+ this.tableData = res.data;
+ }
+ })
+ },
+ handleClose(done) {
+ this.isClear = true;
+ done();
},
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();
- // }
- // })
+ this.$HTTP.put(`/api/blade-cps/production-craft-version/fix-version/${this.craftId}`).then(res=> {
+ if(res.code == 200) {
+ that.$message.success("鎿嶄綔鎴愬姛");
+ }else {
+ this.$message.error(res.msg);
+ }
+ })
}).catch(() => {
})
@@ -90,15 +204,6 @@
// 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;
@@ -107,6 +212,11 @@
},
HandleSelectionChange(selection) {
this.selection = selection;
+ if(this.selection.length >= 2) {
+ this.mergeDisabled = false;
+ }else {
+ this.mergeDisabled = true;
+ }
},
table_open() {
if(this.isCustomization) { //棣栭〉鐨勬柊寤�
@@ -117,6 +227,64 @@
this.$refs.saveDialog.open();
})
}
+ },
+ table_edit(row,index) {
+ this.drawer = true;
+ this.$nextTick(()=> {
+ this.$refs.addworkmanship.setData(row);
+ })
+ },
+ table_del(row,index) {
+ var that = this;
+ this.$confirm(`纭瑕佸垹闄ゆ宸ュ簭鍚�?`, '', {
+ type: 'warning'
+ }).then(() => {
+ var obj = {
+ mainProcess: [],
+ normalProcess: that.tableData,
+ removeIds: [row.id],
+ versionId: that.craftId
+ }
+ this.$HTTP.post(`/api/blade-cps/production-craft-process/child-process-update`,obj).then(res=> {
+ if(res.code == 200) {
+ that.$message.success("鎿嶄綔鎴愬姛");
+ that.getcraftlList();
+ }
+ })
+ }).catch(() => {
+
+ })
+ },
+ table_remove(row,index) {
+ var that = this;
+ var tableData = [];
+ this.tableData.forEach(item=> {
+ if(item.children && item.children.lenght !=0) {
+ item.children.forEach(item1=> {
+ tableData.push(item1);
+ })
+ }else {
+ tableData.push(item);
+ }
+ })
+ this.$confirm(`姝ゅ伐搴忕Щ闄ゅ悗锛屽師骞跺簭灏嗕細杞寲涓哄父瑙勫簭銆傜‘瀹氱Щ闄ゅ悧锛焋, '', {
+ type: 'warning'
+ }).then(() => {
+ var obj = {
+ mainProcess: [],
+ normalProcess: tableData,
+ removeIds: [row.parentId],
+ versionId: that.craftId
+ }
+ this.$HTTP.post(`/api/blade-cps/production-craft-process/child-process-update`,obj).then(res=> {
+ if(res.code == 200) {
+ that.$message.success("鎿嶄綔鎴愬姛");
+ that.getcraftlList();
+ }
+ })
+ }).catch(() => {
+
+ })
}
}
}
@@ -169,6 +337,6 @@
cursor: pointer;
}
.addworkmanship {
- padding: 0 20px;
+ padding: 0 40px;
}
</style>
--
Gitblit v1.9.3