From d8ac6057eaad648687699e25a575f3b7b8c1b102 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 17 十一月 2023 18:52:19 +0800
Subject: [PATCH] modified: src/views/plan/customerorder/schedule-table.vue
---
src/views/basic/template/index.vue | 208 ++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 153 insertions(+), 55 deletions(-)
diff --git a/src/views/basic/template/index.vue b/src/views/basic/template/index.vue
index d6fc5da..477a137 100644
--- a/src/views/basic/template/index.vue
+++ b/src/views/basic/template/index.vue
@@ -15,9 +15,9 @@
<template #toolbar></template>
</ttable>
</el-col>
- <el-col :span="12" style="padding-left: 10px">
+ <el-col :span="12">
<el-card>
- <div slot="header">
+ <div slot="header" style="height:20px">
<el-row>
<el-col :span="8">
<span>鍙傛暟</span>
@@ -32,7 +32,20 @@
</el-col>
</el-row>
</div>
- <el-table
+ <paramMergeTemplate
+ style="padding: 0px 5px;"
+ :key="isShowTree"
+ :isModel="true"
+ :option="paramTemplateOption"
+ :page="{}"
+ :textEllipsisWidth="60"
+ :handleParamDelete="deleteOperationParam"
+ :handleParamEdit="editSample"
+ :handleParamInsert="insertTechnologyOperationParam"
+ :handleParamSave="saveSample"
+ :tableTreeData="operationParams">
+ </paramMergeTemplate>
+ <!-- <el-table
:data="operationParams"
id="templateParamTable"
ref="operationParam"
@@ -67,7 +80,7 @@
align="center"
>
</el-table-column>
- <!-- <el-table-column
+ <el-table-column
label="鍙傛暟绫诲瀷"
prop="type"
align="center"
@@ -106,7 +119,7 @@
</el-table-column>
<el-table-column label="鍗曚綅" prop="unit" align="center">
- </el-table-column> -->
+ </el-table-column>
<el-table-column label="鎿嶄綔" align="center">
<template slot-scope="scope">
<el-button
@@ -116,13 +129,13 @@
@click="saveSample(scope.$index, scope.row)"
>淇濆瓨
</el-button>
- <!-- <el-button
+ <el-button
type="text"
v-if="!scope.row.isUpdate"
size="mini"
@click="editSample(scope.$index, scope.row)"
>缂栬緫
- </el-button> -->
+ </el-button>
<el-button
type="text"
size="mini"
@@ -137,7 +150,7 @@
</el-button>
</template>
</el-table-column>
- </el-table>
+ </el-table> -->
</el-card>
</el-col>
</el-row>
@@ -164,6 +177,7 @@
} from '@/api/basic/template'
import TableForm from './template-form'
import ttable from '@/views/common/ztt-table.vue'
+import { getStore } from '@/util/store.js'
import ParamDialog from '@/views/common/param.vue'
import { mapGetters } from 'vuex'
import {
@@ -172,9 +186,12 @@
relateOperationParamTemplate
} from '../../../api/basic/template'
import { remote } from '@/api/admin/dict'
+import paramMergeTemplate from '../../common/param-mergeTemplate.vue'
export default {
data() {
return {
+ isShowTree: false,
+ paramMergeTemplate: '',
paramSelArr: [],
paramSelCol: 'code',
templateIndex: null,
@@ -283,20 +300,88 @@
minWidth: 100
}
},
- addOrUpdateVisible: false
+ addOrUpdateVisible: false,
+ paramTemplateOption: {
+ height: '66vh',
+ loadingText: "Loading...",
+ columnBtn: false,
+ index: true,
+ indexLabel: '搴忓彿',
+ indexWidth: 50,
+ menu: true,
+ menuWidth: 130,
+ menuAlign: 'center',
+ editBtn: false,
+ delBtn: false,
+ addBtn: false,
+ border: true,
+ size: 'small',
+ refreshBtn: false,
+ align: 'center',
+ column: [
+ {
+ label: '鍙傛暟缂栧彿',
+ prop: 'code',
+ width:80,
+ slot: true
+ },
+ {
+ label: '鍙傛暟椤�',
+ prop: 'paramItem',
+ },
+ {
+ label: '浜岀骇鍙傛暟',
+ prop: 'paramItemTwo',
+ },
+ {
+ label: '涓夌骇鍙傛暟',
+ prop: 'paramItemThree',
+ },
+ {
+ label: '鍙傛暟绫诲瀷',
+ prop: 'paramType',
+ formslot: true,
+ rules: [{
+ required: true,
+ message: "璇烽�夋嫨鍙傛暟绫诲瀷",
+ trigger: "change"
+ }]
+ },
+ {
+ label: '鍊�',
+ prop: 'paramValue',
+ minWidth: 100,
+ slot: true,
+ formslot: true,
+ labelslot: true
+ }, {
+ label: '鍗曚綅',
+ prop: 'unit',
+ rules: [{
+ required: true,
+ message: "鍗曚綅涓嶈兘涓虹┖",
+ trigger: "blur"
+ }]
+ },]
+ }
}
},
components: {
ttable,
TableForm,
- ParamDialog
+ ParamDialog,
+ paramMergeTemplate
},
computed: {
...mapGetters(['permissions'])
},
+ created(){
+ },
+ watch:{
+ },
mounted() {
this.getParamType()
- this.rowDrop()
+ // this.rowDrop()
},
methods: {
// 鑾峰彇鏁版嵁鍒楄〃
@@ -312,6 +397,11 @@
},
handleCurrentChange(val) {
this.templateId = val.id
+ if(this.isShowTree){
+ this.isShowTree=false
+ }else{
+ this.isShowTree=true
+ }
if (val != null) {
this.operationParams = []
this.getJoinParamTemplateData()
@@ -343,7 +433,12 @@
technologyOperationTemplateId: this.templateId
})
).then((response) => {
- this.operationParams = response.data.data.records
+ let data = response.data.data
+ data.forEach(obj=>{
+ obj.templateId = this.templateId
+ })
+ this.operationParams = data
+
})
},
rowDrop() {
@@ -444,7 +539,6 @@
},
// 娣诲姞
relateOperationParam() {
- console.log(11111);
if (this.templateId !== 0) {
// 绛涢�夊嚭褰撳墠椤甸潰宸叉湁鐨勫弬鏁�
this.paramSelArr = []
@@ -468,7 +562,7 @@
this.newOperationParams.push(
Object.assign({
technologyOperationTemplateId: this.templateId,
- technologyOperationParamId: this.operationParams[j].id,
+ technologyOperationParamId: this.operationParams[j].id ? this.operationParams[j].id : this.operationParams[j].oneId,
sort: this.operationParams[j].index
})
)
@@ -477,34 +571,7 @@
(response) => {
const resData = response.data
if (resData.code === 0) {
- const resSteps = resData.data
- if (resSteps.length > 0) {
- this.operationParams = []
- let operationParam
- for (let i = 0; i < resSteps.length; i++) {
- operationParam = {
- id: resSteps[i].id,
- code: resSteps[i].code,
- parameterItem: resSteps[i].parameterItem,
- unit: resSteps[i].unit,
- index: resSteps[i].index,
- type: resSteps[i].type,
- defaultValue: resSteps[i].defaultValue,
- dict: resSteps[i].dict,
- sysDictItemList: resSteps[i].sysDictItemList,
- technologyOperationTemplateId:
- resSteps[i].technologyOperationTemplateId
- }
- /* operationParam.id = resSteps[i].id
- operationParam.code = resSteps[i].code
- operationParam.parameterItem = resSteps[i].parameterItem
- operationParam.unit = resSteps[i].unit
- operationParam.index = resSteps[i].index
- operationParam.type = resSteps[i].type
- operationParam.defaultValue = resSteps[i].defaultValue */
- this.operationParams.push(operationParam)
- }
- }
+ this.operationParams = resData.data
if (state) {
this.$message.success('鍙傛暟鍏宠仈鎴愬姛')
}
@@ -561,29 +628,49 @@
})
},
deleteOperationParam(row) {
+ let id = null
+ if(row.threeId && row.threeId!='null'){
+ id = row.threeId
+ }else{
+ if(row.twoId && row.twoId!='null'){
+ id = row.twoId
+ }else{
+ id = row.oneId
+ }
+ }
this.$confirm('鏄惁纭鍒犻櫎鍙傛暟缂栧彿涓猴細' + row.code, {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then((data) => {
this.operationParams.splice(
- this.operationParams.findIndex((item) => item.index === row.index),
- 1
- )
- this.operationParams
- .filter((e) => e.index >= row.index)
- .forEach((e) => (e.index = e.index - 1))
+ this.operationParams.findIndex((item) => {
+ let itemId = null
+ if(item.threeId && item.threeId!='null'){
+ itemId = item.threeId
+ }else{
+ if(item.twoId && item.twoId!='null'){
+ itemId = item.twoId
+ }else{
+ itemId = item.oneId
+ }
+ }
+ return itemId === id
+ }),1)
+ // this.operationParams
+ // .filter((e) => e.oneId >= row.oneId)
+ // .forEach((e) => (e.index = e.index - 1))
deleteOperationParamTemplate(
Object.assign({
technologyOperationTemplateId: this.templateId,
- technologyOperationParamId: row.id
+ technologyOperationParamId: id
})
).then((response) => {
this.$message.success('鍒犻櫎鍏宠仈鎴愬姛')
+ // if (response.data.code == 0 && this.operationParams.length > 0) {
+ // this.dataFormRelateOperationParam(false)
+ // }
})
- if (this.operationParams.length > 0) {
- this.dataFormRelateOperationParam(false)
- }
})
},
// 鑾峰彇宸ュ簭鍙傛暟绫诲瀷
@@ -608,9 +695,20 @@
saveSample(index, row) {
console.log('row', row)
var obj = {}
- obj.technologyOperationParamId = row.id
- obj.technologyOperationTemplateId = row.technologyOperationTemplateId
- obj.defaultValue = row.defaultValue
+ let id = null
+ if(row.threeId && row.threeId!='null'){
+ id = row.threeId
+ }else{
+ if(row.twoId && row.twoId!='null'){
+ id = row.twoId
+ }else{
+ id = row.oneId
+ }
+ }
+ obj.technologyOperationParamId = id
+ obj.technologyOperationTemplateId = row.templateId
+ obj.defaultValue = row.paramValue
+ console.log(obj);
putRelateOperationParamTemplate(obj).then((response) => {
this.$message.success('鍙傛暟淇濆瓨鎴愬姛')
this.$set(row, 'isUpdate', false)
--
Gitblit v1.9.3