refactor: 迁移ns-newform组件到标准components目录并更新引用

1. 将ns-newform组件从pages_tool/_components移动到项目标准components目录
2. 更新所有文件中对该组件的导入路径和文档引用
3. 优化diy-form组件的表单数据处理逻辑,兼容更多数据格式
This commit is contained in:
2026-06-09 09:50:27 +08:00
parent 605ca69238
commit fd6527aa38
4 changed files with 33 additions and 18 deletions

View File

@@ -17,7 +17,7 @@
:labelColor="value.label_color"
:requiredColor="value.required_color"
ref="nsNewform"
/>
></ns-newform>
<!-- 提交按钮 -->
<view @click.stop="submitForm" class="fui-btn btn-danger block mtop">提交信息</view>
</view>
@@ -26,7 +26,7 @@
<script>
// 自定义表单
import DiyMinx from './minx.js'
import NsNewform from '../pages_tool/_components/ns-newform/ns-newform.vue'
import NsNewform from '@/components/ns-newform/ns-newform.vue'
export default {
name: 'diy-from',
@@ -46,7 +46,7 @@ export default {
this.initForm();
},
watch: {
'value.formComponents': {
'value': {
deep: true,
handler() {
this.initForm();
@@ -72,13 +72,17 @@ export default {
methods: {
// 初始化表单 - 将 diy-form 的数据格式转换成 ns-newform 的格式
initForm() {
var components = this.value.formComponents || [];
if (!this.value) {
this.formComponents = [];
return;
}
var components = this.value.formComponents || this.value.form_components || [];
// 转换格式:type -> controller
this.formComponents = components.map(function(item) {
this.formComponents = (components || []).map(function(item) {
return {
controller: item.type,
value: item.value,
val: item.value.default || '' // 添加初始值
value: item.value || {},
val: (item.value && item.value.default) ? item.value.default : '' // 添加初始值
};
});
},