From 6c3ae44336f7f25e5b33330e353fc283ab04c1f4 Mon Sep 17 00:00:00 2001 From: lzhe <181968431@qq.com> Date: 星期一, 27 五月 2024 00:06:51 +0800 Subject: [PATCH] 1 --- src/views/console/product-process/process-route/addWorkmanship.vue | 268 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 216 insertions(+), 52 deletions(-) diff --git a/src/views/console/product-process/process-route/addWorkmanship.vue b/src/views/console/product-process/process-route/addWorkmanship.vue index f5341ab..e9fd4fb 100644 --- a/src/views/console/product-process/process-route/addWorkmanship.vue +++ b/src/views/console/product-process/process-route/addWorkmanship.vue @@ -118,69 +118,102 @@ </el-col> <el-col :span="24"> <el-form-item label="澶瑰叿"> - <el-button>鍏宠仈澶瑰叿</el-button> - <el-button>鎵归噺鍏宠仈</el-button> + <el-button type="primary" size="small" @click="isShowFirstFixtures = true" :disabled="isShowFirstFixtures">鍏宠仈澶瑰叿</el-button> + <el-button size="small">鎵归噺鍏宠仈</el-button> </el-form-item> </el-col> - - <!-- <el-col :span="24"> - <el-row style="margin-top: 12px;margin-bottom: 12px;" v-if="isAddData0"> + <!-- 娣诲姞澶瑰叿 --> + <el-col :span="24" v-if="isShowFirstFixtures"> + <el-row style="margin-top: 12px;margin-bottom: 12px;"> <el-col :span="4"> - <el-select v-model="addData0.type" placeholder="澶瑰叿缁�" size="small" style="padding-right: 20px;"> - <el-option v-for="item in typeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> + <el-tree-select + @change = "fixturesChange" + default-expand-all + v-model="fixturesFirstData.groupId" + clearable + size="small" + node-key="id" + placeholder="澶瑰叿缁�" + ref="fixturesFirstData" + :data="fixturesFirstTree" + check-strictly + :props="{ label: 'name' }" + style="width:100%;" + :render-after-expand="false" /> + </el-col> + <el-col :span="4"> + <el-select v-model="fixturesFirstData.fixtureCode" size="small" style="width: 100%" placeholder="澶瑰叿缂栧彿" @change="fixtureCodeChange"> + <el-option v-for="item in fixtureCodeList" :key="item.code" :label="item.code" :value="item.code"/> </el-select> </el-col> <el-col :span="4"> - <el-select v-model="addData0.type" placeholder="澶瑰叿缂栧彿" size="small" style="padding-right: 20px;"> - <el-option v-for="item in typeList" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey"/> - </el-select> + <el-input v-model="fixturesFirstData.name" disabled size="small" placeholder="澶瑰叿鍚嶇О" style="padding-right: 20px;"></el-input> </el-col> <el-col :span="4"> - <el-input v-model="addData0.description" disabled size="small" placeholder="澶瑰叿鍚嶇О" style="padding-right: 20px;"></el-input> + <el-button type="primary" size="small" @click="saveFirstFixture">淇濆瓨</el-button> + <el-button size="small" @click="cencelFirstFixture">鍙栨秷</el-button> </el-col> </el-row> - </el-col> --> - + </el-col> + <!-- 澶瑰叿table --> <el-col :span="24"> <el-table ref="multipleTableRef" :data="fixtures" border style="width: 100%;margin-bottom:12px;" class="multipleTableRef"> <el-table-column prop="fixtureGroupName" label="澶瑰叿缁�"> - <template #default="scope"> - <el-tree-select - @change = "fixturesChange" - default-expand-all - v-model="item.fixtureCode" - clearable - node-key="id" - placeholder="澶瑰叿缁�" - ref="parentTree" - :data="fixturesData" - check-strictly - :props="{ label: 'name' }" - style="width:100%;" - :render-after-expand="false" /> - </template> + <template #default="scope">{{scope.row.fixtureGroupName}}</template> </el-table-column> <el-table-column prop="name" label="澶瑰叿缂栧彿"> - <template #default="scope"> - <el-select v-model="item.fixtureCode" style="width: 100%" placeholder="鍒�鍏峰瀷鍙�"> - <el-option v-for="item in numJQList" :key="item.id" :label="item.name" :value="item.id"/> - </el-select> - </template> + <template #default="scope">{{scope.row.fixtureCode}}</template> </el-table-column> <el-table-column prop="fixtureName" 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="fixtures_del(scope.row, scope.$index)">鍒犻櫎</el-button> </template> </el-table-column> </el-table> </el-col> <el-col :span="24"> <el-form-item label="鍒�鍏�"> - <el-button>鍏宠仈鍒�鍏�</el-button> - <el-button>鎵归噺鍏宠仈</el-button> + <el-button type="primary" size="small" @click="isShowFirstTools = true" :disabled="isShowFirstTools">鍏宠仈鍒�鍏�</el-button> + <el-button size="small">鎵归噺鍏宠仈</el-button> </el-form-item> </el-col> + <!-- 娣诲姞鍒�鍏� --> + <el-col :span="24" v-if="isShowFirstTools"> + <el-row style="margin-top: 12px;margin-bottom: 12px;"> + <el-col :span="4"> + <el-tree-select + @change = "toolsChange" + default-expand-all + v-model="toolsFirstData.groupId" + clearable + size="small" + node-key="id" + placeholder="鍒�鍏风粍" + ref="toolsFirstData" + :data="toolsFirstTree" + check-strictly + :props="{ label: 'name' }" + style="width:100%;" + :render-after-expand="false" /> + </el-col> + <el-col :span="4"> + <el-select v-model="toolsFirstData.test" size="small" style="width: 100%" placeholder="鍒�鍏峰瀷鍙�"> + <el-option v-for="item in testList" :key="item.code" :label="item.code" :value="item.code"/> + </el-select> + </el-col> + <el-col :span="4"> + <el-select v-model="fixturesFirstData.test" size="small" style="padding-right: 20px;" placeholder="鍒�鍏风紪鍙�"> + <el-option v-for="item in testList" :key="item.code" :label="item.code" :value="item.code"/> + </el-select> + </el-col> + <el-col :span="4"> + <el-button type="primary" size="small" @click="saveFirstTools">淇濆瓨</el-button> + <el-button size="small" @click="cencelFirstTools">鍙栨秷</el-button> + </el-col> + </el-row> + </el-col> + <!-- 鍒�鍏穞able --> <el-col :span="24"> <el-table ref="multipleTableRef" :data="tools" border style="width: 100%;" class="multipleTableRef"> <el-table-column prop="code" label="鍒�鍏风被鍨�"> @@ -214,7 +247,7 @@ </el-row> </el-form> <div style="margin-top:12px;"> - <el-button>鍙栨秷</el-button> + <el-button @click="closeDrawer">鍙栨秷</el-button> <el-button type="primary" @click="craftSave">淇濆瓨</el-button> </div> </template> @@ -223,13 +256,25 @@ export default { data() { return { + toolsFirstTree: {}, + isShowFirstTools: false, + fixtureCodeList: [], + isShowFirstFixtures: false, + toolsFirstData: { + test: "" + }, + fixturesFirstData: { + fixtureId: "", + fixtureCode: "", + name: "", + groupId: "" + }, + testList: [], + fixturesFirstTree: {}, programIdData: {}, numDQList: [], modelDQList: [], typeDQList: [], - numJQList: [], - fixturesData: [], - parentDQData: [], fixtures: [], tools: [], bagIdData: {}, @@ -253,17 +298,14 @@ programName: "", //鍔犲伐椤哄簭 bagId: "", //宸ュ叿鍖� bagName: "", - isSelectProgramFiles: false, - test0: "", - test: "", - num: null, - box: false + isSelectProgramFiles: false }, workmanshipRules: { sort: [{ required: true, message: '璇烽�夋嫨 宸ュ簭椤哄簭' }], }, } }, + props: ["craftId","isClear"], mounted() { this.getToolingTree(); //澶瑰叿缁則ree this.getCategoryTree(); //鍒�鍏风被鍨� @@ -271,19 +313,135 @@ this.getNumberAndName(); //宸ュ簭缂栧彿鍜屽悕绉� this.getCatalogueTree(); //鍔犲伐绋嬪簭 }, + watch: { + isClear(val) { + if(val) { + this.resetAll(); + } + } + }, methods: { + closeDrawer() { + this.resetAll(); + this.$emit('success', {}); + }, + saveFirstTools() { + this.$message.error("璇烽�夋嫨鍒�鍏风被鍨�"); + return; + }, + cencelFirstTools() { + this.isShowFirstTools = false; + this.toolsFirstData = { + // fixtureId: "", + // fixtureCode: "", + // name: "" + } + //this.fixtureCodeList = []; + }, + fixtures_del(row,index) { + this.fixtures.splice(index,1); + }, + fixtureCodeChange(value) { + this.fixtureCodeList.forEach(item=> { + if(item.code == value) { + this.fixturesFirstData.name = item.name; + this.fixturesFirstData.fixtureId = item.id; + this.fixturesFirstData.fixtureGroupName = item.fixtureGroupName; + this.fixturesFirstData.fixtureName = item.name; + } + }) + }, + saveFirstFixture() { + if(this.fixturesFirstData.fixtureCode == "") { + this.$message.error("璇烽�夋嫨澶瑰叿"); + return; + } + this.fixturesFirstData.code = this.fixturesFirstData.fixtureCode; + this.fixtures.push(this.fixturesFirstData); + this.cencelFirstFixture(); + }, + cencelFirstFixture() { + this.isShowFirstFixtures = false; + this.fixturesFirstData = { + fixtureId: "", + fixtureCode: "", + name: "" + } + this.fixtureCodeList = []; + }, + fixturesChange(value) { + var row = this.$refs.fixturesFirstData.getCurrentNode(); + this.fixturesFirstData.groupName = row.name; + this.$HTTP.get(`/api/blade-cps/fixture/list?groupId=${value}`).then(res=> { + if(res.code == 200) { + this.fixtureCodeList = res.data; + } + }) + }, + toolsChange(value) { + + }, craftSave() { //淇濆瓨 - console.log(this.workmanshipForm) + if(this.isShowFirstFixtures) { + this.$message.error("璇峰厛淇濆瓨褰撳墠鍏宠仈鐨勫す鍏�"); + return; + } + if(this.isShowFirstTools) { + this.$message.error("璇峰厛淇濆瓨褰撳墠鍏宠仈鐨勫垁鍏�"); + return; + } + var obj = Object.assign({},this.workmanshipForm); + obj.id = ""; + obj.fixtures = this.fixtures; + obj.tools = this.tools; + this.$HTTP.post(`/api/blade-cps/production-craft-process/insert?versionId=${this.craftId}`,[obj]).then(res=> { + if(res.code == 200) { + this.$emit('success', obj); + this.resetAll(); + } + }) + }, + resetAll() { + this.workmanshipForm = { + processCode: "", + processId: "", + processName: "", + processTypeName: "-", + sort: null, + d: "", + h: "", + m: "", + s: "", + prepareTime: "", + disassemblyTime: "", + transportTime: "", + programId: "", + programName: "", //鍔犲伐椤哄簭 + bagId: "", //宸ュ叿鍖� + bagName: "", + isSelectProgramFiles: false + }; + this.fixtures = []; + this.tools = []; + this.toolsFirstData = { + test: "" + }; + this.fixturesFirstData = { + fixtureId: "", + fixtureCode: "", + name: "", + groupId: "" + }; }, processChange(val) { if(val) { this.processCodeList.forEach(item=> { if(val == item.id) { - console.log(item) this.workmanshipForm.processId = item.id; this.workmanshipForm.processCode = item.code; this.workmanshipForm.processName = item.name; this.workmanshipForm.processTypeName = item.typeName; + this.workmanshipForm.processType = item.type; } }) } @@ -309,7 +467,6 @@ if(res.code == 200) { this.processCodeList = res.data.records; this.processNameList = res.data.records; - console.log(res.data); } }) }, @@ -345,14 +502,11 @@ } this.$HTTP.post("/api/blade-cps/tray/tooling-tree",obj).then(res=> { if(res.code == 200) { - this.fixturesData = res.data; + this.fixturesFirstTree = res.data; } }) }, programIdChange() { - - }, - fixturesChange() { }, bagIdChange(val) { @@ -360,6 +514,16 @@ }, table_edit() { + }, + setData(data) { + this.$HTTP.get(`/api/blade-cps/production-craft-process/get/${data.id}`).then(res=> { + if(res.code == 200) { + this.workmanshipForm = res.data; + this.fixtures = res.data.fixtures; + this.tools = res.data.tools; + } + }) + } } } -- Gitblit v1.9.3