From c094d4a32180130de0c26c75a5abc414128a5ec1 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期四, 20 三月 2025 18:31:33 +0800 Subject: [PATCH] test --- pages/modal/5601.vue | 398 ++++++++++++++++++++------------------------------------ 1 files changed, 141 insertions(+), 257 deletions(-) diff --git a/pages/modal/5601.vue b/pages/modal/5601.vue index 3055125..bc16b22 100644 --- a/pages/modal/5601.vue +++ b/pages/modal/5601.vue @@ -2,8 +2,8 @@ <view class="uni-page-modal-5601"> <!-- 琛ㄥご鏍峰紡 --> <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" :focusId="focusFieldId" - @click="onClick" @focus="ontap" @change="onEnterChange" @click-prefix="classAttr_extButton" - @click-suffix="classAttr_extButton"></OIForm> + @on-click="onClick" @on-focus="ontap" @on-change="onEnterChange" @on-click-prefix="classAttr_extButton" + @on-click-suffix="classAttr_extButton"></OIForm> <view class="view-content"> <!-- 鐮佺洏瀛愮晫闈�--> @@ -23,16 +23,53 @@ src="../../images/mobox_log_200x40.png"> </image> <checkbox-group @change="checkboxChange"> - <div class="dv-panel" v-for="(style,ii) in pageData.DefList" + <div class="dv-panel" v-for="(style,ii) in pageData.DefList" :key="ii" @tap="onPanelClick(ii,style.form.htmlobjId)" :id="'dvpanel'+style.form.htmlobjId" :class="style.form.htmlobjId==active_id?'bk-active':''"> - <OIForm class="dv-panel-form" :form="style.form" viewMode></OIForm> + <uni-forms class="dv-panel-form" label-align="right"> + <view v-for="(item,index) in style.form.items" :key="index"> + <!-- 鏍呮牸甯冨眬 --> + <uni-row v-if="item.name == 'Layout'" :gutter="item.setting.gutter"> + <uni-col + :span="item.setting.spanList && item.setting.spanList[key]? item.setting.spanList[key] : 24 / item.setting.col" + v-for="(col,key) in item.setting.colList" :key="key"> + <uni-forms-item v-if="col != null" + :label="col.labelWidth === 0 ? '' : col.label? col.label+'锛�:''" + :label-width="col.labelWidth || col.labelWidth === 0 ? col.labelWidth : 100+'px'"> + <view v-if="col.disabled">{{col.value}}</view> + <input class="uni-input" + v-else-if="col.name=='Input' || col.name=='InputNumber'" + :type="col.name=='InputNumber'?'number':'text'" + v-model="col.value" :placeholder="col.placeholder" + :maxlength="-1" /> + <view v-else>{{col.value}}</view> + + </uni-forms-item> + <uni-forms-item v-else label=""></uni-forms-item> + </uni-col> + </uni-row> + <uni-forms-item v-else + :label="item.labelWidth === 0 ? '' : item.label? item.label+'锛�:''" + :label-width="item.labelWidth || item.labelWidth === 0 ? item.labelWidth : 100+'px'" + :style="{ textAlign: item.setting.align }"> + <view v-if="item.disabled">{{item.value}}</view> + <input v-else-if="item.name=='Input' || item.name=='InputNumber' " + class="uni-input" + :type="item.name=='InputNumber'?'number':'text'" + v-model="item.value" :disabled="item.disabled" + :placeholder="item.placeholder" :maxlength="-1" /> + <view v-else>{{item.value}}</view> + + </uni-forms-item> + </view> + </uni-forms> + <!-- <OIForm class="dv-panel-form" :form="style.form" viewMode></OIForm> --> <div class="dv-panel-button" v-if="pageData.Select_Button==true || pageData.Row_Button.length > 0"> - <checkbox v-if="pageData.Select_Button==true" :model="ii" + <checkbox v-if="pageData.Select_Button==true" :value="ii" :checked="style.SelBut_Checked" /> <!-- <text></text> --> <!-- <button type="primary" @click="savaItem(ii)" v-if="param.Sub_Page[0].OK_Button==true">淇濆瓨</Button> --> @@ -123,6 +160,9 @@ } from "@/api/data.js" import dayjs from "dayjs"; import OIForm from '@/components/oi-form/index.vue' + import OIFormItem from '@/components/oi-form/list/index.vue' + import OIFormInput from '@/components/oi-form/list/input/index.vue' + import OIFormInputNumber from '@/components/oi-form/list/input-number/index.vue' export default { name: "PageModal5601", @@ -131,6 +171,10 @@ }, components: { OIForm, + OIFormItem, + OIFormInput, + OIFormInputNumber + }, data() { return { @@ -152,7 +196,6 @@ selectAttrObj: {}, global_attr: [], - refdatastore: [], //寮曠敤鏁版嵁瀛樺偍鍖�/ {attr:'G_PRJ_' + bindattr + '_ID', value:info.id} popupType: "center", check_list: {}, popupParam: {}, @@ -1000,7 +1043,7 @@ const pageData = $this.pageDetail[pageIndex] pageData.DefList = [] pageData.ExtData = {} - + $this.$set(this.pageDetail, pageIndex, pageData) } @@ -1163,48 +1206,27 @@ if (ele.form.objId == rowData.id) { rowData.attrs.forEach(attr => { ele.form.items.forEach(ele2 => { - if (ele2.name != - 'Layout') { - if (ele2.fieldId == - attr - .attr) { - ele2.value = - $this - .operationNumber( - ele2 - .value, - attr - .value, - attr - .operation - ) + if (ele2.name != 'Layout') { + if (ele2.fieldId == attr.attr) { + ele2.value = $this.operationNumber( + ele2.value, + attr.value, + attr.operation + ) } - } else if (ele2.name == - 'Layout') { - ele2.setting - .colList - .forEach( - col => { - if ( - col) { - if (col - .fieldId == - attr - .attr - ) { - col.value = - $this - .operationNumber( - col - .value, - attr - .value, - attr - .operation - ) - } - } - }) + } else if (ele2.name == 'Layout') { + ele2.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == attr.attr) { + col.value = $this + .operationNumber( + col.value, + attr.value, + attr.operation + ) + } + } + }) } }); }); @@ -1244,51 +1266,29 @@ } } if (bFindCondition) { - rowData.attrs.forEach(attr => { ele.form.items.forEach(ele2 => { - if (ele2.name != - 'Layout') { - if (ele2.fieldId == - attr - .attr) { + if (ele2.name != 'Layout') { + if (ele2.fieldId == attr.attr) { ele2.value = - $this - .operationNumber( - ele2 - .value, - attr - .value, - attr - .operation + $this.operationNumber( + ele2.value, + attr.value, + attr.operation ) } - } else if (ele2.name == - 'Layout') { - ele2.setting - .colList - .forEach( - col => { - if ( - col) { - if (col - .fieldId == - attr - .attr - ) { - col.value = - $this - .operationNumber( - col - .value, - attr - .value, - attr - .operation - ) - } - } - }) + } else if (ele2.name == 'Layout') { + ele2.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == attr.attr) { + col.value = + $this.operationNumber( + col.value, attr + .value, attr + .operation) + } + } + }) } }); }); @@ -1321,28 +1321,21 @@ data.row.forEach(row => { detailStyle = JSON.parse(styleStr); detailStyle.form.objId = row.id; - detailStyle.form.htmlobjId = row.id ? row.id.replace(/-/g, '') - .replace( - '{', '').replace('}', - '') : 'null'; + detailStyle.form.htmlobjId = row.id ? row.id.replace(/-/g, '').replace('{', '').replace( + '}', '') : 'null'; detailStyle.form.attrs = row.attrs; row.attrs.forEach(attr => { detailStyle.form.items.forEach(ele => { if (ele.name != 'Layout') { - if (ele.fieldId == attr.attr) ele - .value = - attr.value; + if (ele.fieldId == attr.attr) + ele.value = attr.value; } else if (ele.name == 'Layout') { - ele.setting.colList.forEach( - col => { - if (col) { - if (col.fieldId == - attr - .attr) col - .value = attr - .value; - } - }); + ele.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == attr.attr) + col.value = attr.value; + } + }); } }); }); @@ -1385,18 +1378,15 @@ cont.attrs.forEach(attr => { detailStyle.form.items.forEach(ele => { if (ele.name != 'Layout') { - if (ele.fieldId == attr.attr) ele - .value = - attr.value; + if (ele.fieldId == attr.attr) + ele.value = attr.value; } else if (ele.name == 'Layout') { ele.setting.colList.forEach( col => { if (col) { if (col.fieldId == - attr - .attr) col - .value = attr - .value; + attr.attr) + col.value = attr.value; } }); } @@ -1406,42 +1396,22 @@ if (data.clear == false) { var isflag = true; pageData.DefList.forEach((style, index) => { - if (style.form.objId == detailStyle.form - .objId) { + if (style.form.objId == detailStyle.form.objId) { cont.attrs.forEach(attr => { - style.form.items.forEach( - ele => { - if (ele.name != - 'Layout') { - if (ele - .fieldId == - attr.attr) - ele - .value = - attr.value; - } else if (ele - .name == - 'Layout') { - ele.setting - .colList - .forEach( - col => { - if ( - col - ) { - if (col - .fieldId == - attr - .attr - ) - col - .value = - attr - .value; - } - }); - } - }); + style.form.items.forEach(ele => { + if (ele.name != 'Layout') { + if (ele.fieldId == attr.attr) + ele.value = attr.value; + } else if (ele.name == 'Layout') { + ele.setting.colList.forEach(col => { + if (col) { + if (col.fieldId == attr + .attr) + col.value = attr.value; + } + }); + } + }); }); isflag = false; } @@ -1801,36 +1771,25 @@ } else if (action.action_type == 'set_dlg_attr_show') { var result = action.value; result.forEach(async (attr, key) => { - $this.$data.head_styledef.form.items - .forEach( - async (ele, - index) => { - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') { - if (ele.fieldId == attr + $this.$data.head_styledef.form.items.forEach(async (ele, + index) => { + //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+ if (ele.name != 'Layout') { + if (ele.fieldId == attr.attr) { + ele.show = attr.show; + } + } else if (ele.name == 'Layout') { + ele.setting.colList.forEach((col) => { + if (col) { + if (col.fieldId == attr .attr) { - ele.show = attr + col.show = attr .show; } - } else if (ele.name == - 'Layout') { - ele.setting.colList - .forEach( - col => { - if (col) { - if (col - .fieldId == - attr - .attr - ) { - col.show = - attr - .show; - } - } - }); } }); + } + }); }); var head_styledef = JSON.parse(JSON.stringify($this.$data .head_styledef)); @@ -1858,63 +1817,8 @@ console.log($this.head_styledef); if (data.result) { var result = data.result; - for (var i = 0; i < result.length; i++) { - for (var c = 0; c < $this.$data.head_styledef.form.items - .length; c++) { - var attr = $this.$data.head_styledef.form.items[c]; - //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�- if ($this.head_styledef.form.model[result[i].attr] == - undefined) { - $this.head_styledef.form.model[result[i].attr] = - result[i] - .value; - } - //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (attr.name != 'Layout') { - if (attr.fieldId == result[i].attr) { - attr.value = ''; - attr.oldvalue = ''; - attr.value = result[i].value; - attr.oldvalue = result[i].value; - $this.head_styledef.form.model[attr.fieldId] = - result[i] - .value; - } - } else if (attr.name == 'Layout') { - attr.setting.colList.forEach(col => { - if (col) { - if (col.fieldId == result[i].attr) { - col.value = ''; - col.oldvalue = ''; - col.value = result[i].value; - col.oldvalue = result[i].value; - $this.head_styledef.form.model[col - .fieldId] = - result[i].value; - } - } - }); - } - } - - var length = 0; - if (!$this.$data.refdatastore.filter(function(s) { - return result[i].attr == s.attr - }).length) { - length = 1; - $this.$data.refdatastore.push(result[i]); - } - if (length == 0) { - for (var j = 0; j < $this.$data.refdatastore.length; j++) { - if ($this.$data.refdatastore[j].attr == result[i] - .attr) { - $this.$data.refdatastore[j].value = result[i] - .value; - } - } - } + $this.setFormValues(result) } - } } }).catch(ex => { @@ -1950,18 +1854,6 @@ attr: a, value: obj_attr[a] || "", })); - if ($this.refdatastore.length > 0) { - for (var i = 0; i < $this.refdatastore.length; i++) { - if (!req.filter(function(s) { - return $this.refdatastore[i].attr == s.name - }).length) { - req.push({ - 'attr': $this.refdatastore[i].attr, - 'value': $this.refdatastore[i].value - }); - } - } - } var extinfo = enviroment; extinfo.edit_dlg = { @@ -2469,6 +2361,7 @@ } }) $this.$set($this.pageDetail, pageIndex, pageData) + console.log($this.pageDetail) }, } @@ -3036,10 +2929,6 @@ padding: 0px; margin: 0; - .dv-panel-form-item { - margin: 0; - padding: 0px; - } .uni-forms-item { padding-bottom: 5rpx; @@ -3066,15 +2955,10 @@ vertical-align: middle; } - .form-item-span { - vertical-align: text-top; - color: #2d8cf0; - white-space: normal; - word-break: break-all; - width: 100%; + .uni-input:hover { + border: 1px solid rgb(41, 121, 255); } } - } @@ -3198,13 +3082,13 @@ background-color: #f3f3f3 !important; } - ::v-deep .uni-row { - margin-bottom: 0px; - } + // ::v-deep .uni-row { + // margin-bottom: 0px; + // } - .view-tabpage ::v-deep .uni-row { - margin-bottom: 5px; - } + // .view-tabpage ::v-deep .uni-row { + // margin-bottom: 5px; + // } .demo-uni-col { height: 36px; -- Gitblit v1.9.1