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 | 397 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 227 insertions(+), 170 deletions(-)
diff --git a/src/views/common/param-mergeTemplate.vue b/src/views/common/param-mergeTemplate.vue
index 511206f..d8a0cb7 100644
--- a/src/views/common/param-mergeTemplate.vue
+++ b/src/views/common/param-mergeTemplate.vue
@@ -1,166 +1,218 @@
<template>
- <div>
- <avue-crud
- ref="crud"
- class="l-mes"
- rowKey="oneId"
- :data="tableData"
- :option="option"
- :span-method="spanMethod"
+ <div>
+ <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">
- <small slot="more">...</small>
- </avue-text-ellipsis>
- </template>
+ :table-loading="loading">
+ <template slot="code" slot-scope="scope">
+ <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>
- </div>
+ </div>
</template>
<script>
export default {
- props:{
- option:{
- type: Object,
- default: ()=>{
- return {
- height: 600,
- loadingText: "鍔犺浇涓�...",
- columnBtn: false,
- index: true,
- indexLabel: '搴忓彿',
- menu: false,
- menuAlign: 'center',
- editBtn: false,
- delBtn: false,
- addBtn: false,
- border: true,
- size: 'small',
- refreshBtn: false,
- align: 'center',
- column: [
- {
- label: '鍙傛暟缂栧彿',
- prop: 'code',
- 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',
- slot: true,
- formslot: true,
- labelslot: true
- }, {
- label: '鍗曚綅',
- prop: 'unit',
- rules: [{
- required: true,
- message: "鍗曚綅涓嶈兘涓虹┖",
- trigger: "blur"
- }]
- },]
- }
- }
- },
- tableData:{
- type: Array,
- default: () => {
- return []
- },
- required: true
- },
- loading:{
- type: Boolean,
- default: false
- },
- page:{
- type: Object,
- default:()=>{
- return {
- total: 10,
- currentPage: 1,
- pageSize: 10
+ props: {
+ //鏄惁涓哄弬鏁版ā鏉�
+ isModel:{
+ type: Boolean,
+ default:()=>{
+ return false
}
- }
- },
- spanArr:{
- type: Array,
- default: ()=>{
- return [{
- prop: 'code',
- span: []
- }, {
- prop: 'paramItem',
- span: []
- }, {
- prop: 'paramItemTwo',
- span: []
- }]
- }
- },
- routingTemplateId:{
- type: String,
- default: ()=>{
- return ''
- }
- }
+ },
+ textEllipsisWidth:{
+ type: Number,
+ default:()=>{
+ return 100
+ }
+ },
+ textEllipsisHeight:{
+ type: Number,
+ default:()=>{
+ return 40
+ }
+ },
+ option: {
+ type: Object,
+ default: () => {
+ return {
+ height: 600,
+ columnBtn: false,
+ index: true,
+ indexLabel: '搴忓彿',
+ menu: true,
+ menuWidth: 100,
+ menuAlign: 'center',
+ editBtn: false,
+ delBtn: false,
+ addBtn: false,
+ border: true,
+ size: 'small',
+ refreshBtn: false,
+ align: 'center',
+ column: [
+ {
+ label: '鍙傛暟缂栧彿',
+ prop: 'code',
+ 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',
+ slot: true,
+ formslot: true,
+ labelslot: true
+ }, {
+ label: '鍗曚綅',
+ prop: 'unit',
+ rules: [{
+ required: true,
+ message: "鍗曚綅涓嶈兘涓虹┖",
+ trigger: "blur"
+ }]
+ },]
+ }
+ }
+ },
+ tableTreeData: {
+ type: Array,
+ default: () => {
+ return []
+ },
+ required: true
+ },
+ page: {
+ type: Object,
+ default: () => {
+ return {
+ total: 10,
+ currentPage: 1,
+ pageSize: 10
+ }
+ }
+ },
+ spanArr: {
+ type: Array,
+ default: () => {
+ return [{
+ prop: 'code',
+ span: []
+ }, {
+ prop: 'paramItem',
+ span: []
+ }, {
+ prop: 'paramItemTwo',
+ span: []
+ }]
+ }
+ },
+ routingTemplateId: {
+ type: String,
+ default: () => {
+ return null
+ }
+ },
+ handleParamDelete:{
+ type: Function
+ },
+ handleParamEdit:{
+ type: Function
+ },
+ handleParamInsert:{
+ type: Function
+ },
+ handleParamSave:{
+ type: Function
+ },
},
- created(){
- // this.rowSort()
- // this.rowCalc()
+ watch:{
+ table(val) {
+ this.doLayout()
+ },
+ tableTreeData:{
+ handler(old,newval){
+ this.loading = true
+ this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
+ this.rowSort()
+ this.rowCalc()
+ this.loading = false
+ },
+ deep: true
+ },
},
- beforeMount(){
+ created() {
+ this.loading = true
+ this.tableData=JSON.parse(JSON.stringify(this.tableTreeData))
this.rowSort()
this.rowCalc()
- },
- mounted(){
+ setTimeout(()=>{
+ this.loading = false
+ },1000)
},
data(){
return {
- checkType(row){
- if(row.paramType == '鏁板�兼牸寮�'){
- let val = row.paramValue
- const reg = /^[0-9]*$/
- if(!reg.test(val)){
- row.paramValue = ''
- this.$message.warning("璇疯緭鍏ユ暟鍊兼牸寮忕殑鏁版嵁锛�")
- }
- }
- }
+ tableData: [],
+ loading: false,
}
},
methods:{
+ checkType(row){
+ if(row.paramType == '鏁板�兼牸寮�'){
+ let val = row.paramValue
+ const reg = /^[0-9]*$/
+ if(!reg.test(val)){
+ row.paramValue = ''
+ this.$message.warning("璇疯緭鍏ユ暟鍊兼牸寮忕殑鏁版嵁锛�")
+ }
+ }
+ },
//鍔ㄦ�佸悎骞舵柟娉�
rowCalc() {
this.spanArr.forEach((ele, index) => {
- let parent
+ let parent = null
if (index !== 0) parent = this.spanArr[ele.parent || index - 1].span
ele.span = this.rowSpan(ele.prop, parent)
})
@@ -170,17 +222,17 @@
this.spanArr.forEach((ele, index) => {
let key = ele.prop
this.tableData = this.tableData.sort((a, b) => {
- let flag = true;
- for (let i = 0; i < index; i++) {
- let prop = this.spanArr[i].prop
- flag = flag && a[prop] == b[prop]
- }
- if (flag) {
- if (a[key] < b[key]) { return 1; }
- else if (a[key] > b[key]) { return -1; }
+ let flag = true;
+ for (let i = 0; i < index; i++) {
+ let prop = this.spanArr[i].prop
+ flag = flag && a[prop] == b[prop]
+ }
+ if (flag) {
+ if (a[key] < b[key]) { return 1; }
+ else if (a[key] > b[key]) { return -1; }
+ return 0;
+ }
return 0;
- }
- return 0;
})
})
},
@@ -189,21 +241,21 @@
let position = 0;
this.tableData.forEach((item, index) => {
if (index === 0) {
- list.push(1)
- let position = 0;
- } else {
- if (this.tableData[index][key] === this.tableData[index - 1][key]) {
- if (parent && parent[index] !== 0) {
list.push(1)
- position = index
+ let position = 0;
+ } else {
+ if (this.tableData[index][key] === this.tableData[index - 1][key]) {
+ if (parent && parent[index] !== 0) {
+ list.push(1)
+ position = index
+ } else {
+ list[position] += 1;
+ list.push(0)
+ }
} else {
- list[position] += 1;
- list.push(0)
+ list.push(1)
+ position = index
}
- } else {
- list.push(1)
- position = index
- }
}
})
return list
@@ -212,12 +264,12 @@
for (let i = 0; i < this.spanArr.length; i++) {
const ele = this.spanArr[i]
if (column.property == ele.prop) {
- const _row = ele.span[rowIndex];
- const _col = _row > 0 ? 1 : 0;
- return {
- rowspan: _row,
- colspan: _col
- }
+ const _row = ele.span[rowIndex];
+ const _col = _row > 0 ? 1 : 0;
+ return {
+ rowspan: _row,
+ colspan: _col
+ }
}
}
}
@@ -226,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