From c552dfd69248938b68e349a047a599063402044c Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期三, 15 十一月 2023 19:06:06 +0800
Subject: [PATCH] modified: src/views/plan/customerorder/customerorder-form.vue modified: src/views/plan/customerorder/index.vue modified: src/views/plan/masterproductionschedule/auto-manufacturingorder.vue
---
src/views/common/param-mergeTemplate.vue | 196 ++++++++++++++++++++++--------------------------
1 files changed, 89 insertions(+), 107 deletions(-)
diff --git a/src/views/common/param-mergeTemplate.vue b/src/views/common/param-mergeTemplate.vue
index 2e7a21f..d8a0cb7 100644
--- a/src/views/common/param-mergeTemplate.vue
+++ b/src/views/common/param-mergeTemplate.vue
@@ -1,61 +1,68 @@
<template>
<div>
- <avue-crud ref="crud" class="l-mes" rowKey="oneId" :data="tableData" :option="option" :span-method="spanMethod"
- :page="page" :table-loading="loading">
+ <avue-crud
+ ref="crud"
+ class="l-mes"
+ rowKey="id"
+ :data="tableData"
+ :option="option"
+ :span-method="spanMethod"
+ :page="page"
+ :table-loading="loading">
<template slot="code" slot-scope="scope">
- <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="40" :width="100">
+ <avue-text-ellipsis use-tooltip :text="scope.row.code" :height="textEllipsisHeight" :width="textEllipsisWidth">
<small slot="more">...</small>
</avue-text-ellipsis>
</template>
<template slot="paramValue" slot-scope="scope">
- <el-input @blur="checkType(scope.row)" :readonly="routingTemplateId != null"
- :placeholder="'璇疯緭鍏�' + scope.row.paramType" v-model="scope.row.paramValue" />
+ <el-input @blur="checkType(scope.row)" :disabled="routingTemplateId!=null || !scope.row.isUpdate" :placeholder="'璇疯緭鍏�'+scope.row.paramType" v-model="scope.row.paramValue"/>
+ </template>
+ <template slot="menu" slot-scope="scope">
+ <el-button type="text" v-if="scope.row.isUpdate && isModel" size="mini"
+ @click="handleParamSave(scope.$index, scope.row)">淇濆瓨</el-button>
+ <el-button type="text" v-if="!scope.row.isUpdate && isModel" size="mini"
+ @click="handleParamEdit(scope.$index, scope.row)">缂栬緫</el-button>
+ <el-button type="text" size="mini" v-if="isModel"
+ @click.stop="handleParamInsert(scope.row)">鎻掑叆</el-button>
+ <el-button type='text' :disabled="routingTemplateId!=null"
+ @click.stop="handleParamDelete(scope.row, scope.index)">鍒犻櫎</el-button>
</template>
</avue-crud>
- <!-- <el-table :data="tableData" ref="commonTree" :span-method="objectSpanMethod" border row-key="id" style="width: 100%">
- <el-table-column prop="code" label="缂栫爜"></el-table-column>
- <el-table-column prop="paramItem" label="涓�绾�"></el-table-column>
- <el-table-column prop="paramItemTwo" label="浜岀骇"></el-table-column>
- <el-table-column prop="paramItemThree" label="涓夌骇"></el-table-column>
- <el-table-column prop="paramType" label="绫诲瀷"></el-table-column>
- <el-table-column prop="paramValue" label="鍊�"></el-table-column>
- <el-table-column prop="unit" label="鍗曚綅"></el-table-column>
- </el-table> -->
</div>
</template>
<script>
export default {
- // props: ["tableTreeData"],
- data() {
- return {
- checkType(row) {
- if (row.paramType == '鏁板�兼牸寮�') {
- let val = row.paramValue
- const reg = /^[0-9]*$/
- if (!reg.test(val)) {
- row.paramValue = ''
- this.$message.warning("璇疯緭鍏ユ暟鍊兼牸寮忕殑鏁版嵁锛�")
- }
- }
- },
- mergeObj: {},
- mergeArr: ['code','paramItem', 'paramItemTwo',],
- tableData: [],
- // routingTemplateId: null
- }
- },
props: {
+ //鏄惁涓哄弬鏁版ā鏉�
+ isModel:{
+ type: Boolean,
+ default:()=>{
+ return false
+ }
+ },
+ textEllipsisWidth:{
+ type: Number,
+ default:()=>{
+ return 100
+ }
+ },
+ textEllipsisHeight:{
+ type: Number,
+ default:()=>{
+ return 40
+ }
+ },
option: {
type: Object,
default: () => {
return {
height: 600,
- loadingText: "鍔犺浇涓�...",
columnBtn: false,
index: true,
indexLabel: '搴忓彿',
- menu: false,
+ menu: true,
+ menuWidth: 100,
menuAlign: 'center',
editBtn: false,
delBtn: false,
@@ -106,7 +113,7 @@
message: "鍗曚綅涓嶈兘涓虹┖",
trigger: "blur"
}]
- },]
+ },]
}
}
},
@@ -116,10 +123,6 @@
return []
},
required: true
- },
- loading: {
- type: Boolean,
- default: false
},
page: {
type: Object,
@@ -149,86 +152,60 @@
routingTemplateId: {
type: String,
default: () => {
- return ''
+ return null
}
- }
+ },
+ handleParamDelete:{
+ type: Function
+ },
+ handleParamEdit:{
+ type: Function
+ },
+ handleParamInsert:{
+ type: Function
+ },
+ handleParamSave:{
+ type: Function
+ },
},
watch:{
+ table(val) {
+ this.doLayout()
+ },
tableTreeData:{
handler(old,newval){
- console.log(this.tableTreeData);
- this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
- // this.getSpanArr(this.tableData);
- this.rowSort()
- this.rowCalc()
+ this.loading = true
+ this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
+ this.rowSort()
+ this.rowCalc()
+ this.loading = false
},
deep: true
- }
+ },
},
created() {
- // this.$nextTick(() => {
- // this.$refs.crud.doLayout()
- // })
+ this.loading = true
this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
this.rowSort()
this.rowCalc()
+ setTimeout(()=>{
+ this.loading = false
+ },1000)
},
- beforeMount() {
- // this.rowSort()
- // this.rowCalc()
- // this.$nextTick(()=>{
-
-
- // })
+ data(){
+ return {
+ tableData: [],
+ loading: false,
+ }
},
- beforeDestroy() {
-
- },
- mounted() {
-
- },
- activated(){
- this.doLayout()
- },
- methods: {
- doLayout(){
- let that=this
- this.$nextTick(()=>{
- that.$refs.commonTree.dolayout()
- })
- },
- getSpanArr(data) {
- this.mergeArr.forEach((key, index1) => {
- let count = 0; // 鐢ㄦ潵璁板綍闇�瑕佸悎骞惰鐨勮捣濮嬩綅缃�
- this.mergeObj[key] = []; // 璁板綍姣忎竴鍒楃殑鍚堝苟淇℃伅
- data.forEach((item, index) => {
- // index == 0琛ㄧず鏁版嵁涓虹涓�琛岋紝鐩存帴 push 涓�涓� 1
- if(index === 0) {
- this.mergeObj[key].push(1);
- } else {
- // 鍒ゆ柇褰撳墠琛屾槸鍚︿笌涓婁竴琛屽叾鍊肩浉绛� 濡傛灉鐩哥瓑 鍦� count 璁板綍鐨勪綅缃叾鍊� +1 琛ㄧず褰撳墠琛岄渶瑕佸悎骞� 骞秔ush 涓�涓� 0 浣滀负鍗犱綅
- if(item[key] === data[index - 1][key]) {
- this.mergeObj[key][count] += 1;
- this.mergeObj[key].push(0);
- } else {
- // 濡傛灉褰撳墠琛屽拰涓婁竴琛屽叾鍊间笉鐩哥瓑
- count = index; // 璁板綍褰撳墠浣嶇疆
- this.mergeObj[key].push(1); // 閲嶆柊push 涓�涓� 1
- }
- }
- })
- })
- },
- // 榛樿鎺ュ彈鍥涗釜鍊� { 褰撳墠琛岀殑鍊�, 褰撳墠鍒楃殑鍊�, 琛岀殑涓嬫爣, 鍒楃殑涓嬫爣 }
- objectSpanMethod({ row, column, rowIndex, columnIndex }) {
- // 鍒ゆ柇鍒楃殑灞炴��
- if(this.mergeArr.indexOf(column.property) !== -1) {
- // 鍒ゆ柇鍏跺�兼槸涓嶆槸涓�0
- if(this.mergeObj[column.property][rowIndex]) {
- return [this.mergeObj[column.property][rowIndex], 1]
- } else {
- // 濡傛灉涓�0鍒欎负闇�瑕佸悎骞剁殑琛�
- return [0, 0];
+ methods:{
+ checkType(row){
+ if(row.paramType == '鏁板�兼牸寮�'){
+ let val = row.paramValue
+ const reg = /^[0-9]*$/
+ if(!reg.test(val)){
+ row.paramValue = ''
+ this.$message.warning("璇疯緭鍏ユ暟鍊兼牸寮忕殑鏁版嵁锛�")
}
}
},
@@ -301,7 +278,12 @@
</script>
<style>
-.avue-crud__menu {
+.avue-crud_menu{
display: none;
}
+.avue-crud .el-table th {
+ word-break: break-word;
+ color: rgba(102,102,102,1);
+ background-color: white;
+}
</style>
\ No newline at end of file
--
Gitblit v1.9.3