From 84e53f29d2c7eaceace2c7dd29d4f7125f211b76 Mon Sep 17 00:00:00 2001
From: weidy <lastanimals@163.com>
Date: 星期三, 05 七月 2023 20:31:56 +0800
Subject: [PATCH] 生命周期的方法写完了,等着联调
---
Source/UBCS-WEB/src/components/Tree/attrCrud.vue | 267 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 184 insertions(+), 83 deletions(-)
diff --git a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue
index 68cdd6c..9848275 100644
--- a/Source/UBCS-WEB/src/components/Tree/attrCrud.vue
+++ b/Source/UBCS-WEB/src/components/Tree/attrCrud.vue
@@ -1,9 +1,6 @@
<template>
-
- <!-- <avue-crud :data="ProData" :option="option" @sort-change="sortChange" @row-update="addUpdate"-->
- <!-- @cell-click="handleRowClick" @select="selectHandle" @row-del="CrudRowDel">-->
<div>
- <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArray.length>=1">
+ <div style="display: flex;flex-wrap: wrap;" v-if="this.crudArrayFlag">
<!--鏂板-->
<el-button v-if="attrEditVisible == false && attrFlagChiledren==false" size="small" type="primary"
@click="busineHandle">锛� 娣诲姞 {{ msg }}
@@ -37,7 +34,6 @@
<!-- 缂栫爜鐢宠棰勮-->
<el-button size="small" @click="applicationHandle" style="">缂栫爜鐢宠棰勮</el-button>
<!-- 楠岃瘉瑙勫垯-->
-
</div>
<!-- 寮圭獥-->
<div>
@@ -203,7 +199,7 @@
</el-dialog>
<!-- 鍏ㄥ睆缂栬緫-->
<el-dialog :visible.sync="attrEditVisible" append-to-body fullscreen="true">
- <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag"></attrCrud>
+ <attrCrud :ProData="this.ProData" :attrFlagChiledren="this.attrFlag" :crudArrayFlag="this.crudArrayFlag"></attrCrud>
</el-dialog>
<!-- 缁勫悎瑙勫垯-->
<formula-editor :systemVariableTableData="systemVariableTableData"
@@ -213,7 +209,7 @@
></formula-editor>
<!-- 鏂板 -->
<el-dialog :visible.sync="addVisible" append-to-body title="浠庝笟鍔$被鍨嬩腑閫夋嫨灞炴��">
- <avue-crud :data="businessData" :option="businessOption" @select="businessSelect">
+ <avue-crud :data="businessData" :option="businessOption" @selection-change="businessSelect">
<template slot="menuLeft">
<div style="display: flex;">
<el-select>
@@ -236,14 +232,13 @@
style="width: 100%"
@cell-click="handleCellClicks"
@select="selectHandle"
- v-if="this.crudArray.length>=1"
-
+ v-if="this.crudArrayFlag"
>
<el-table-column
type="selection"
width="55">
</el-table-column>
- <el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>
+ <!--<el-table-column fixed label="搴忓彿" type="index" width="55"></el-table-column>-->
<el-table-column v-for="item in this.option.column" :key="item.id"
:label="item.label"
:prop="item.prop"
@@ -253,12 +248,13 @@
align="center"
>
<template slot-scope="{ row }">
- <el-input v-if="editingRows === row && editShows== item.prop" v-model="row[item.prop]"
+ <el-input v-if="editingRows === row && editShows== item.prop && (item.edit == 'text' || item.edit == 'select' ||item.edit == 'refer')" v-model="row[item.prop]"
@blur="saveRows"></el-input>
+ <el-input-number controls-position="right" v-if="editingRows === row && editShows== item.prop && item.edit == 'number'" v-model="row[item.prop]"
+ @blur="saveRows"></el-input-number>
<el-switch
- v-if="item.label === 'true' || item.label === 'false'"
- active-color="#13ce66"
- inactive-color="#ff4949">
+ v-if="item.edit === 'switch'" v-model="row[item.prop]" active-value="true"
+ inactive-value="false">
</el-switch>
<span v-else>{{ row[item.prop] }}</span>
</template>
@@ -286,7 +282,6 @@
export default {
name: "attrCrud .vue",
- // props: ['ProData','crudOid','crudArray','Formlist','codeClassifyOid'],
props: {
ProData: {
type: Array,
@@ -309,10 +304,29 @@
type: Boolean,
default: false
},
-
+ crudArrayFlag:{
+ type: Boolean,
+ default: false
+ }
+ },
+ watch:{
+ crudArray:{
+ handler(newval,oldval){
+ if(newval != undefined){
+ if(newval.length>=1){
+ this.crudArrayFlag=true
+ }else{
+ this.crudArrayFlag=false
+ }
+ }
+ },
+ deep:true,
+ immediate:true
+ }
},
data() {
return {
+ crudArrayFlag:false,
editingRows: null,
editShows:"",
attrFlag: false,
@@ -322,14 +336,14 @@
},
// 缂栫爜鐢宠棰勮data
applicationData: [],
- //涓氬姟绫诲瀷鍗曢�夋暟缁�
+ //涓氬姟绫诲瀷閫夋嫨鏁扮粍
busineSelectList: [],
//涓氬姟绫诲瀷娣诲姞鏁版嵁
busineAddList: {},
//琛ㄦ牸鍗曢�夋暟缁�
- CrudSelect: [],
+ attrSelectList: [],
//琛ㄦ牸oid
- CrudOid: "",
+ attrOid: "",
//鍦烘櫙鍙橀噺
thisSceneTableData: [
{
@@ -927,7 +941,7 @@
rowCellList: [],
List: [],
option: {
- index: true,
+ index: false,
border: true,
editBtn: false,
selection: true,
@@ -940,8 +954,14 @@
prop: 'name',
order: 'descending'
},
- column: [
- {
+ column: [{
+ prop: 'orderNum',
+ label: '鎺掑簭鍙�',
+ sortable: true,
+ edit: 'number',
+ width: 60,
+ fixed: true
+ }, {
label: "灞炴�ц嫳鏂囩紪鍙�",
prop: "id",
fixed: true,
@@ -956,6 +976,7 @@
fixed: true,
cell: false,
width: 125,
+ edit: 'text',
sortable: true
},
{
@@ -963,6 +984,7 @@
prop: "attributeGroup",
cell: false,
sortable: true,
+ edit: 'text',
width: 125,
},
{
@@ -977,78 +999,90 @@
cell: false,
sortable: true,
width: 105,
+ edit: 'number'
},
{
label: "鍏抽敭灞炴��",
prop: "keyAttrFlag",
cell: false,
- type: "switch",
+ edit: "switch"
},
{
label: "鏌ヨ灞炴��",
prop: "queryAttrFlag",
cell: false,
+ edit: "switch"
},
{
label: "楂樼骇鏌ヨ灞炴��",
prop: "seniorQueryAttrFlag",
width: 95,
cell: false,
+ edit: "switch"
},
{
- label: "鐩镐技鏌ヨ灞炴��",
+ label: "鐩镐技鏌ラ噸灞炴��",
prop: "sameRepeatAttrFlag",
width: 95,
cell: false,
+ edit: "switch"
},
{
label: "蹇呰緭",
prop: "requireFlag",
cell: false,
+ edit: "switch"
},
{
label: "琛ㄥ崟鏄剧ず",
prop: "formDisplayFlag",
cell: false,
+ edit: "switch"
},
{
label: "鍒楄〃鏄剧ず",
prop: "tableDisplayFlag",
cell: false,
+ edit: "switch"
},
{
label: "鍙",
prop: "readonlyFlag",
cell: false,
+ edit: "switch"
},
{
label: "鍒楄〃鎺掑簭",
prop: "sortAttrFlag",
cell: false,
+ edit: "switch"
},
-
{
label: "澶氳鏂囨湰",
prop: "textareaFlag",
cell: false,
+ edit: "switch"
},
{
label: "榛樿鍊�",
prop: "defaultValue",
sortable: true,
cell: false,
+ edit: 'text',
width: 95,
},
{
label: "鍓嶇紑",
prop: "prefixValue",
sortable: true,
+ edit: 'select',
cell: false,
},
{
label: "鍚庣紑",
prop: "suffixValue",
sortable: true,
+ edit: 'select',
cell: false,
},
{
@@ -1056,6 +1090,7 @@
prop: "componentRule",
sortable: true,
cell: false,
+ edit: 'refer',
width: 105,
},
{
@@ -1063,6 +1098,7 @@
prop: "verifyRule",
sortable: true,
cell: false,
+ edit: 'refer',
width: 105,
},
{
@@ -1070,84 +1106,97 @@
prop: "codeDateFormat",
sortable: true,
width: 105,
+ edit: 'select',
cell: false,
},
{
label: "鍒嗙被娉ㄥ叆",
prop: "classifyInvokeLevel",
cell: false,
+ edit: 'refer'
},
{
label: "鏋氫妇娉ㄥ叆",
prop: "enumString",
cell: false,
+ edit: 'refer'
},
{
label: "绾ц仈灞炴��",
prop: "parentCode",
cell: false,
+ edit: 'refer'
},
{
label: "鍙傜収閰嶇疆",
prop: "referConfig",
cell: false,
+ edit: 'refer'
},
{
label: "绾ц仈鏌ヨ灞炴��",
prop: "parentQueryAttr",
width: 105,
cell: false,
+ edit: 'text'
},
{
label: "閫夋嫨搴撴爣璇�",
prop: "libraryIdentification",
width: 105,
cell: false,
+ edit: 'text'
},
{
label: "濉啓鎻愮ず",
prop: "explain",
cell: false,
+ edit: 'text'
},
{
label: "琛ㄥ崟鏄剧ず鏍峰紡",
prop: "formDisplayStyle",
width: 105,
cell: false,
+ edit: 'text'
},
{
label: "琛ㄦ牸鏄剧ず鏍峰紡",
prop: "tableDisplayStyle",
width: 105,
cell: false,
+ edit: 'text'
},
{
label: "琛ㄥ崟瓒呴摼鎺�",
prop: "formHref",
width: 95,
cell: false,
+ edit: 'text'
},
{
label: "琛ㄦ牸瓒呴摼鎺�",
prop: "tableHref",
width: 95,
cell: false,
+ edit: 'text'
},
{
label: "琛ㄦ牸鏄剧ずjs",
prop: "tableDisplayJs",
width: 95,
cell: false,
+ edit: 'text'
},
{
label: "闀垮害",
prop: "controlLength",
- cell: false,
+ cell: false
},
{
label: "灏忔暟绮惧害",
prop: "precisionLength",
- cell: false,
+ cell: false
},
{
label: "鍙栧�艰寖鍥�",
@@ -1155,10 +1204,39 @@
sortable: true,
cell: false,
width: 105,
+ edit: 'text'
},
],
List: []
+ },
+ vciFieldTypeMap : {
+ VTBoolean: "甯冨皵鍨�",
+ VTClob: "闀挎枃鏈�",
+ VTDate: "鏃ユ湡",
+ VTDateTime: "鏃ユ湡鏃堕棿",
+ VTTime: "鏃堕棿",
+ VTLong: "闀挎暣鍨�",
+ VTDouble: "閲戦/鍙岀簿搴�",
+ VTInteger: "鏁村舰",
+ VTFilePath: "鏂囦欢",
+ VTString: "瀛楃涓�"
}
+ }
+ },
+ computed:{
+ attrOids() {
+ let oids = [];
+ this.attrSelectList.forEach(ele => {
+ oids.push(ele.oid);
+ });
+ return oids.join(",");
+ },
+ busineOids() {
+ let oids = [];
+ this.busineSelectList.forEach(ele => {
+ oids.push(ele.oid);
+ });
+ return oids.join(",");
}
},
mounted() {
@@ -1169,26 +1247,15 @@
methods: {
formAttr(row, column) {
console.log(row,column)
- // if (column.property === "keyAttrFlag"
- // ||column.property === "queryAttrFlag"
- // ||column.property === "seniorQueryAttrFlag"
- // ||column.property === "sameRepeatAttrFlag"
- // ||column.property === "requireFlag"
- // ||column.property === "formDisplayFlag"
- // ||column.property === "tableDisplayFlag"
- // ||column.property === "sortAttrFlag") {
- // return row[column.property] =='true'? "鏄�" : "鍚�";
- // }
- // return row[column.property];
},
//灞炴�у垎缁勬寜閽�
attrVisibleHandle() {
- this.formatBoolean()
- if (this.CrudSelect.length > 1) {
+
+ if (this.attrSelectList.length > 1) {
this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�')
- } else if (this.CrudSelect < 1) {
+ } else if (this.attrSelectList < 1) {
this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�')
- } else if (this.CrudSelect.length === 1) {
+ } else if (this.attrSelectList.length === 1) {
this.attrVisible = true;
}
},
@@ -1214,42 +1281,74 @@
},
//涓氬姟绫诲瀷淇濆瓨
busineAddHandle() {
- if (this.busineSelectList.length > 1) {
- this.$message.warning('璇烽�夋嫨涓�鏉′笟鍔$被鍨嬫暟鎹�')
- } else {
- this.$set(this.busineAddList, 'classifytemplateoid', this.crudOid)
- this.$set(this.busineAddList, 'oid', '')
- this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
- this.addVisible = false;
+ if (this.busineSelectList.length == 0) {
+ this.$message.warning('璇烽�夋嫨灞炴�ч泦');
+ return false;
}
+debugger;
+ let ordernum = this.ProData.length;
+ this.busineSelectList.forEach((citem) => {
+ let isCopy = false;
+ this.ProData.forEach((item) => {
+ if (citem.id == item.id) {
+ isCopy = true;
+ return false;
+ }
+ })
+ if (!isCopy) {
+ citem.oid = ''
+ this.busineAddList=Object.assign(citem, {
+ orderNum: ++ordernum,
+ attributedatatype: citem.attrDataType,
+ attributeDataTypeText: this.vciFieldTypeMap[citem.attrDataType],
+ controlLength: citem.attributeLength,
+ valueArea: citem.range,
+ referbtmid: citem.referBtmTypeId,
+ referbtmname: citem.referBtmTypeName,
+ referConfig: '',
+ enumid: citem.enumId,
+ precisionLength: (citem.precisionLength ? citem.precisionLength : '') + (citem.scaleLength ? '(' + citem.scaleLength + ')' : ''),
+ classifyTemplateOid: this.crudOid,
+ classifytemplateoid: this.crudOid,
+ formDisplayFlag: true,
+ tableDisplayFlag: true,
+ sortAttrFlag: false,
+ queryAttrFlag: true,
+ seniorQueryAttrFlag: true,
+ attrTableWidth: 120
+ })
+ this.ProData.push(JSON.parse(JSON.stringify(this.busineAddList)))
+ }
+ })
+
+
+ this.addVisible = false;
+
},
- //涓氬姟绫诲瀷鍗曢��
+ //涓氬姟绫诲瀷閫夋嫨
businessSelect(selection, row) {
this.busineSelectList = selection
- this.busineAddList = row
},
- // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁
+ // 浠庝笟鍔$被鍨嬩腑閫夋嫨鏁版嵁寮圭獥
busineHandle() {
- if (this.crudArray.length < 1) {
- this.$message.error('璇烽�夋嫨涓�鏉℃ā鏉�')
- } else {
- this.addVisible = true;
- AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => {
- this.businessData = res.data.data;
- })
- }
+ this.addVisible = true;
+ this.busineSelectList = []
+ this.busineAddList = [];
+ AttrByBtm({'conditionMap[oid]': this.crudOid}).then(res => {
+ this.businessData = res.data.data;
+ })
},
// 绾ц仈灞炴�ф寜閽�
CascadeHandle() {
- if (this.CrudSelect.length > 1) {
+ if (this.attrSelectList.length > 1) {
this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�')
- } else if (this.CrudSelect.length < 1) {
+ } else if (this.attrSelectList.length < 1) {
this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�')
- } else if (this.CrudSelect.length === 1) {
+ } else if (this.attrSelectList.length === 1) {
this.CascadeVisible = true;
gridCodeClassifyTemplateAttr({
'conditionMap[classifyTemplateOid]': this.Formlist[0].oid,
- 'conditionMap[oid_notequal]': this.CrudOid
+ 'conditionMap[oid_notequal]': this.attrOid
}).then(res => {
this.CascadeData = res.data.data;
})
@@ -1257,14 +1356,16 @@
},
//琛ㄦ牸鍗曢��
selectHandle(selection, row) {
- this.CrudOid = row.oid;
- this.CrudSelect = selection;
+ this.attrOid = row.oid;
this.attrRow = row;
- console.log('123',row,selection)
+ },
+ //琛ㄦ牸閫夋嫨
+ selectionChange(list) {
+ this.attrSelectList = list;
},
//淇濆瓨
addsHandler() {
- batchAddSave(JSON.parse(JSON.stringify(this.ProData).replace(/classifyTemplateOid/g,"classifytemplateoid"))).then(res => {
+ batchAddSave(JSON.parse(JSON.stringify(this.ProData))).then(res => {
this.$message.success('淇濆瓨鎴愬姛')
})
},
@@ -1285,9 +1386,9 @@
},
//琛ㄦ牸琛岀紪杈�
handleCellClicks(row, column) {
- this.editingRows = row;
- this.editShows = column.property;
- this.rowOid = row.oid;
+ this.editingRows = row;
+ this.editShows = column.property;
+ this.rowOid = row.oid;
},
saveRows() {
this.editingRows = null;
@@ -1310,11 +1411,11 @@
},
//鏋氫妇娉ㄥ叆鎸夐挳
enmuVisHandle() {
- if (this.CrudSelect.length > 1) {
+ if (this.attrSelectList.length > 1) {
this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬�')
- } else if (this.CrudSelect < 1) {
+ } else if (this.attrSelectList < 1) {
this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬�')
- } else if (this.CrudSelect.length === 1) {
+ } else if (this.attrSelectList.length === 1) {
this.enumVisible = true;
}
},
@@ -1356,11 +1457,11 @@
},
//鐐瑰嚮鍒嗙被娉ㄥ叆鎸夐挳
injectBtn() {
- if (this.CrudSelect.length > 1) {
+ if (this.attrSelectList.length > 1) {
this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉挎暟鎹�')
- } else if (this.CrudSelect.length < 1) {
+ } else if (this.attrSelectList.length < 1) {
this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉挎暟鎹�')
- } else if (this.CrudSelect.length === 1) {
+ } else if (this.attrSelectList.length === 1) {
this.injectVisible = true
}
},
@@ -1414,11 +1515,11 @@
},
//鍚屾鍒板叾浠栨ā鏉�
syncHandle() {
- if (this.CrudSelect.length > 1) {
+ if (this.attrSelectList.length > 1) {
this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
- } else if (this.CrudSelect.length < 1) {
+ } else if (this.attrSelectList.length < 1) {
this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
- } else if (this.CrudSelect.length === 1) {
+ } else if (this.attrSelectList.length === 1) {
copyto({oid: this.attrRow.oid}).then(res => {
this.$message.success('鍚屾鎴愬姛')
})
@@ -1430,11 +1531,11 @@
},
//缁勫悎瑙勫垯
isShowHandler() {
- if (this.CrudSelect.length > 1) {
+ if (this.attrSelectList.length > 1) {
this.$message.warning('鍙兘閫夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
- } else if (this.CrudSelect.length < 1) {
+ } else if (this.attrSelectList.length < 1) {
this.$message.warning('璇烽�夋嫨涓�鏉℃ā鏉垮睘鎬ф暟鎹�')
- } else if (this.CrudSelect.length === 1) {
+ } else if (this.attrSelectList.length === 1) {
this.isShowformulaEdit = true;
}
},
--
Gitblit v1.9.3