|
@@ -18,26 +18,28 @@
|
|
|
</el-form-item>
|
|
|
|
|
|
<el-form-item label="数据库表" prop="tableName">
|
|
|
- <el-select
|
|
|
- v-model="datas.tableName"
|
|
|
- placeholder="请选择"
|
|
|
+ <el-select
|
|
|
+ v-model="datas.tableName"
|
|
|
+ placeholder="请选择"
|
|
|
style="width: 87%"
|
|
|
@change="
|
|
|
- (value) => {
|
|
|
- getFieldOptions(value);
|
|
|
- }
|
|
|
- ">
|
|
|
- <el-option
|
|
|
+ (value) => {
|
|
|
+ getFieldOptions(value);
|
|
|
+ }
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
v-for="item in tableList"
|
|
|
:key="item.tableName"
|
|
|
:label="item.tableComment"
|
|
|
- :value="item.tableName">
|
|
|
- <span class="discribe" style="float: left">{{
|
|
|
- item.tableComment
|
|
|
- }}</span>
|
|
|
- <span style="float: right; color: #8492a6; font-size: 13px">{{
|
|
|
- item.tableName
|
|
|
- }}</span>
|
|
|
+ :value="item.tableName"
|
|
|
+ >
|
|
|
+ <span class="discribe" style="float: left">{{
|
|
|
+ item.tableComment
|
|
|
+ }}</span>
|
|
|
+ <span style="float: right; color: #8492a6; font-size: 13px">{{
|
|
|
+ item.tableName
|
|
|
+ }}</span>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
@@ -48,7 +50,7 @@
|
|
|
class="lef"
|
|
|
>
|
|
|
<span class="delete" @click="deletetext(index)">x</span>
|
|
|
-
|
|
|
+
|
|
|
<el-select
|
|
|
v-model="item.fieldName"
|
|
|
placeholder="请选择控件字段"
|
|
@@ -61,7 +63,9 @@
|
|
|
:value="i.fieldName"
|
|
|
>
|
|
|
<span style="float: left">{{ i.fieldName }}</span>
|
|
|
- <span style="float: right; color: #8492a6; font-size: 13px">{{ i.fieldDescription }}</span>
|
|
|
+ <span style="float: right; color: #8492a6; font-size: 13px">{{
|
|
|
+ i.fieldDescription
|
|
|
+ }}</span>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
|
|
@@ -85,59 +89,92 @@
|
|
|
</el-select>
|
|
|
|
|
|
<!-- 动态显示按钮 -->
|
|
|
- <div v-if="showButtons">
|
|
|
- <el-button @click="onClickStatic">静态数据</el-button>
|
|
|
- <el-button @click="onClickDynamic">动态数据</el-button>
|
|
|
+ <div v-if="item.type == 1">
|
|
|
+ <!-- <el-button @click="onClickStatic">静态数据</el-button>
|
|
|
+ <el-button @click="onClickDynamic">动态数据</el-button> -->
|
|
|
+ <!-- <el-radio v-model="" label="" @change=""></el-radio> -->
|
|
|
+ <el-radio-group v-model="item.optionType" @change="onClickStatic">
|
|
|
+ <el-radio :label="false">静态数据</el-radio>
|
|
|
+ <el-radio :label="true">动态数据</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
</div>
|
|
|
|
|
|
<!-- 静态数据输入框 -->
|
|
|
- <div v-if="showStaticInput">
|
|
|
- <el-form :model="dynamicValidateForm" ref="dynamicValidateForm" label-width="100px" class="demo-dynamic">
|
|
|
+ <div v-if="!item.optionType && item.type == 1">
|
|
|
+ <el-form
|
|
|
+ :model="item.options"
|
|
|
+ ref="dynamicValidateForm"
|
|
|
+ label-width="100px"
|
|
|
+ class="demo-dynamic"
|
|
|
+ >
|
|
|
<el-form-item
|
|
|
- v-for="(domain, index) in dynamicValidateForm.domains"
|
|
|
- :key="domain.key"
|
|
|
+ v-for="(domain, index2) in item.options.static"
|
|
|
+ :key="domain.key"
|
|
|
:rules="[
|
|
|
{
|
|
|
validator: (rule, value, callback) => {
|
|
|
- const { label, value: domainValue } = this.dynamicValidateForm.domains[index];
|
|
|
+ const { label, value: domainValue } =
|
|
|
+ item.options.static[index2];
|
|
|
if (!label || !domainValue) {
|
|
|
callback(new Error('域名标签和值都不能为空'));
|
|
|
} else {
|
|
|
callback();
|
|
|
}
|
|
|
},
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
+ trigger: 'blur',
|
|
|
+ },
|
|
|
]"
|
|
|
>
|
|
|
- <el-input v-model="domain.lable" style="width: 100px; height: 30px; margin-top: 10px;margin-right: 10px;"></el-input>
|
|
|
- <el-input v-model="domain.value" style="width: 100px; height: 30px;"></el-input>
|
|
|
- <el-button type="danger" size="mini" icon="el-icon-delete" @click.prevent="removeDomain(domain)">删除</el-button>
|
|
|
+ <el-input
|
|
|
+ v-model="domain.lable"
|
|
|
+ @input="inputUpdate"
|
|
|
+ style="
|
|
|
+ width: 100px;
|
|
|
+ height: 30px;
|
|
|
+ margin-top: 10px;
|
|
|
+ margin-right: 10px;
|
|
|
+ "
|
|
|
+ ></el-input>
|
|
|
+ <el-input
|
|
|
+ v-model="domain.value"
|
|
|
+ @input="inputUpdate"
|
|
|
+ style="width: 100px; height: 30px"
|
|
|
+ ></el-input>
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="mini"
|
|
|
+ class="ml5"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click.prevent="removeDomain(item.options.static, index2)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="primary" size="small" @click="addDomain">新增</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="addDomain(item)"
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
|
|
|
<!-- 动态数据输入框 -->
|
|
|
- <div v-if="showDynamicInput">
|
|
|
- <el-input
|
|
|
+ <div v-if="item.optionType && item.type == 1">
|
|
|
+ <!-- <el-input
|
|
|
type="textarea"
|
|
|
v-model="item.value"
|
|
|
- placeholder="动态数据变量名"
|
|
|
- style="margin-top: 10px; margin-bottom: 10px;"
|
|
|
- ></el-input>
|
|
|
+ placeholder="动态数据变量名"
|
|
|
+ style="margin-top: 10px; margin-bottom: 10px"
|
|
|
+ ></el-input> -->
|
|
|
</div>
|
|
|
- <div v-if="item.value.length && showDynamicInput===true">
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- icon="el-icon-edit"
|
|
|
- circle
|
|
|
- @click="zisShowClick"
|
|
|
+ <div v-if="item.fieldKey && item.optionType && item.type == 1">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ circle
|
|
|
+ @click="zisShowClick(item, index)"
|
|
|
></el-button>
|
|
|
</div>
|
|
|
-
|
|
|
+
|
|
|
<el-input
|
|
|
type="textarea"
|
|
|
v-model="item.value"
|
|
@@ -149,7 +186,12 @@
|
|
|
v-model="item.value"
|
|
|
@input="item.value1 = item.value.split('#')"
|
|
|
placeholder="多项之间用‘#’逗号隔开"
|
|
|
- v-if="item.type !== 0 && showButtons === false && showStaticInput === false && showDynamicInput === false"
|
|
|
+ v-if="
|
|
|
+ item.type !== 0 &&
|
|
|
+ showButtons === false &&
|
|
|
+ showStaticInput === false &&
|
|
|
+ showDynamicInput === false
|
|
|
+ "
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
@@ -158,11 +200,11 @@
|
|
|
</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
- <selectEdit
|
|
|
- ref="selectEditRef"
|
|
|
+ <selectEdit
|
|
|
+ ref="selectEditRef"
|
|
|
:selectDataKey="lieData"
|
|
|
@select-confirmed="handleSelectConfirmed"
|
|
|
- ></selectEdit>
|
|
|
+ ></selectEdit>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -170,32 +212,34 @@
|
|
|
import { mapState } from "vuex";
|
|
|
import { getFormName, getListName } from "@/api/dragform/form.js";
|
|
|
import getOptionsSqlString from "@/utils/sqlString";
|
|
|
-import selectEdit from '@/views/asEditor/components/formDesign/selectEdit.vue'
|
|
|
+import selectEdit from "@/views/asEditor/components/formDesign/selectEdit.vue";
|
|
|
+import uuid from "@/utils/bpmn/uuid";
|
|
|
export default {
|
|
|
- name: 'investigatestyle',
|
|
|
+ name: "investigatestyle",
|
|
|
props: {
|
|
|
datas: Object,
|
|
|
-
|
|
|
},
|
|
|
components: {
|
|
|
- selectEdit
|
|
|
+ selectEdit,
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- lieData:'',
|
|
|
+ lieData: "",
|
|
|
zisShow: false,
|
|
|
isShow: false,
|
|
|
flagShow: false,
|
|
|
- formSelect:{
|
|
|
- tName: '',
|
|
|
- tLabel: '',
|
|
|
- tvalue:'',
|
|
|
+ formSelect: {
|
|
|
+ tName: "",
|
|
|
+ tLabel: "",
|
|
|
+ tvalue: "",
|
|
|
},
|
|
|
dynamicValidateForm: {
|
|
|
- domains: [{
|
|
|
- lable: ``,
|
|
|
- value: ''
|
|
|
- }],
|
|
|
+ domains: [
|
|
|
+ {
|
|
|
+ lable: ``,
|
|
|
+ value: "",
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
selectFormData: {
|
|
|
dynamicName: "", //英文字符串
|
|
@@ -203,39 +247,38 @@ export default {
|
|
|
optLabelData: "",
|
|
|
optValueData: "",
|
|
|
},
|
|
|
- formData: {
|
|
|
- component: 'investigate',
|
|
|
- text: '表单模块',
|
|
|
- type: '2-3',
|
|
|
+ formData: {
|
|
|
+ component: "investigate",
|
|
|
+ text: "表单模块",
|
|
|
+ type: "2-3",
|
|
|
active: true,
|
|
|
- style: 'investigatestyle',
|
|
|
+ style: "investigatestyle",
|
|
|
setStyle: {
|
|
|
- tableName: '',
|
|
|
- fieldName: '', // 这就是您想绑定的fieldName
|
|
|
- toPage: '',
|
|
|
- text: '表单模块',
|
|
|
- title: '表单模块',
|
|
|
- jsonData: [],
|
|
|
+ tableName: "",
|
|
|
+ fieldName: "", // 这就是您想绑定的fieldName
|
|
|
+ toPage: "",
|
|
|
+ text: "表单模块",
|
|
|
+ title: "表单模块",
|
|
|
+ jsonData: [],
|
|
|
},
|
|
|
},
|
|
|
- selecttext: ['文本', '下拉框', '单选', '多选'],
|
|
|
+ selecttext: ["文本", "下拉框", "单选", "多选"],
|
|
|
showButtons: false, // 控制按钮是否显示
|
|
|
showStaticInput: false, // 控制静态数据输入框显示
|
|
|
showDynamicInput: false, // 控制动态数据输入框显示
|
|
|
shouldShowButton: false, // 控制按钮是否显示
|
|
|
tableList: [],
|
|
|
fieldList: [],
|
|
|
- index1: 0,
|
|
|
- }
|
|
|
+ index1: 0,
|
|
|
+ };
|
|
|
},
|
|
|
mounted() {},
|
|
|
- watch: { },
|
|
|
+ watch: {},
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
databaseName: (state) => state.user.dataSource.databaseName,
|
|
|
databaseType: (state) => state.user.dataSource.databaseType,
|
|
|
}),
|
|
|
-
|
|
|
},
|
|
|
|
|
|
created() {
|
|
@@ -244,16 +287,22 @@ export default {
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
+ inputUpdate() {
|
|
|
+ this.$forceUpdate();
|
|
|
+ },
|
|
|
handleSelectConfirmed(selectedData) {
|
|
|
- console.log('从子组件接收到的数据:', selectedData);
|
|
|
- this.$emit('data-from-child', {
|
|
|
- selectQualifiedField: selectedData,
|
|
|
- selectMapValue: this.dynamicValidateForm.domains
|
|
|
- }); // 在这里处理接收到的数据,比如更新父组件的状态等
|
|
|
+ console.log("从子组件接收到的数据:", selectedData);
|
|
|
+ let { index, selectQualifiedField } = selectedData;
|
|
|
+ this.datas.jsonData[index].optionConditions = selectQualifiedField;
|
|
|
+ // this.$emit("data-from-child", {
|
|
|
+ // selectQualifiedField: selectedData,
|
|
|
+ // selectMapValue: this.dynamicValidateForm.domains,
|
|
|
+ // }); // 在这里处理接收到的数据,比如更新父组件的状态等
|
|
|
},
|
|
|
- zisShowClick(){
|
|
|
+ zisShowClick(item, index) {
|
|
|
// this.zisShow = !this.zisShow
|
|
|
- this.$refs.selectEditRef.dialogShow(1111)
|
|
|
+ console.log(item, index);
|
|
|
+ this.$refs.selectEditRef.dialogShow(item, index);
|
|
|
},
|
|
|
// 添加一级回调
|
|
|
addHandler() {
|
|
@@ -287,97 +336,79 @@ export default {
|
|
|
deleteFilterItem(index) {
|
|
|
this.filterTableData.splice(index, 1);
|
|
|
},
|
|
|
- // 新增一条筛选条件
|
|
|
- addFilterHandler() {
|
|
|
- this.filterTableData.push({
|
|
|
- // tableName: "",
|
|
|
- fieldName: "",
|
|
|
- flagValue: "",
|
|
|
- fieldOptions: [],
|
|
|
- flagFormData: {
|
|
|
- flagType: 0,
|
|
|
- tableField: {
|
|
|
- tableName: "",
|
|
|
- fieldName: "",
|
|
|
- fieldOptions: [],
|
|
|
- },
|
|
|
- flagValue: "",
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- // 编辑参照回调
|
|
|
- editFlagHandler(row, index) {
|
|
|
- this.flagEditIndex = index;
|
|
|
- this.flagFormData = JSON.parse(JSON.stringify(row.flagFormData));
|
|
|
- this.flagShow = true;
|
|
|
- },
|
|
|
- // 确认参照回调
|
|
|
- flagConfirm() {
|
|
|
- this.filterTableData[this.flagEditIndex].flagFormData = JSON.parse(
|
|
|
- JSON.stringify(this.flagFormData)
|
|
|
- );
|
|
|
- this.flagShow = false;
|
|
|
- },
|
|
|
+
|
|
|
// 开始编辑回调
|
|
|
-
|
|
|
+
|
|
|
// 弹窗取消回调
|
|
|
cancleHandler() {
|
|
|
this.reset();
|
|
|
this.isShow = false;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
handleClose(done) {
|
|
|
- this.$confirm('确认关闭?')
|
|
|
- .then(_ => {
|
|
|
+ this.$confirm("确认关闭?")
|
|
|
+ .then((_) => {
|
|
|
done();
|
|
|
})
|
|
|
- .catch(_ => {});
|
|
|
+ .catch((_) => {});
|
|
|
},
|
|
|
- removeDomain(item) {
|
|
|
- var index = this.dynamicValidateForm.domains.indexOf(item)
|
|
|
+ removeDomain(item, index) {
|
|
|
+ // var index = this.dynamicValidateForm.domains.indexOf(item);
|
|
|
if (index !== -1) {
|
|
|
- this.dynamicValidateForm.domains.splice(index, 1)
|
|
|
+ item.splice(index, 1);
|
|
|
+ this.$forceUpdate();
|
|
|
}
|
|
|
},
|
|
|
- addDomain() {
|
|
|
- this.dynamicValidateForm.domains.push({
|
|
|
- label: '',
|
|
|
- value: '',
|
|
|
- // key: Date.now()
|
|
|
- });
|
|
|
+ addDomain(item) {
|
|
|
+ if (!item.options.static) {
|
|
|
+ item.options = {};
|
|
|
+ item.options.static = [];
|
|
|
+ }
|
|
|
+ item.options.static.push({ label: "", value: "" });
|
|
|
+ this.$forceUpdate();
|
|
|
+ // this.dynamicValidateForm.domains.push({
|
|
|
+ // label: "",
|
|
|
+ // value: "",
|
|
|
+ // // key: Date.now()
|
|
|
+ // });
|
|
|
},
|
|
|
onInputChange() {
|
|
|
// 当输入框内容变化时,根据输入内容的长度决定是否显示按钮
|
|
|
this.shouldShowButton = event.target.value.trim().length > 0;
|
|
|
},
|
|
|
conChange(index) {
|
|
|
- this.showButtons = this.selecttext[index] === '下拉框';
|
|
|
- console.log(this.selecttext[index],888);
|
|
|
- console.log(this.showButtons,999);
|
|
|
+ this.showButtons = this.selecttext[index] === "下拉框";
|
|
|
+ console.log(this.selecttext[index], 888);
|
|
|
+ console.log(this.showButtons, 999);
|
|
|
// 当切换选项时重置输入框显示状态
|
|
|
this.showStaticInput = false;
|
|
|
this.showDynamicInput = false;
|
|
|
- console.log(this.datas.jsonData[index],0);
|
|
|
- if (this.datas && Array.isArray(this.datas.jsonData) && this.datas.jsonData.length > index) {
|
|
|
+ console.log(this.datas.jsonData[index], 0);
|
|
|
+ if (
|
|
|
+ this.datas &&
|
|
|
+ Array.isArray(this.datas.jsonData) &&
|
|
|
+ this.datas.jsonData.length > index
|
|
|
+ ) {
|
|
|
// 确保jsonData存在且index是有效的
|
|
|
- this.datas.jsonData[index].value = '';
|
|
|
+ this.datas.jsonData[index].value = "";
|
|
|
this.datas.jsonData[index].value1 = [];
|
|
|
} else {
|
|
|
- console.warn(`Index ${index} is out of bounds or jsonData not properly initialized.`);
|
|
|
+ console.warn(
|
|
|
+ `Index ${index} is out of bounds or jsonData not properly initialized.`
|
|
|
+ );
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
onClickStatic() {
|
|
|
this.showStaticInput = true;
|
|
|
this.showDynamicInput = false;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
onClickDynamic() {
|
|
|
this.showStaticInput = false;
|
|
|
this.showDynamicInput = true;
|
|
|
},
|
|
|
|
|
|
-
|
|
|
// 获取所有表格
|
|
|
async getAllTable() {
|
|
|
let data = {
|
|
@@ -385,7 +416,7 @@ export default {
|
|
|
databaseType: this.databaseType,
|
|
|
};
|
|
|
let res = await getFormName(data);
|
|
|
- console.log(res.data,123);
|
|
|
+ console.log(res.data, 123);
|
|
|
this.tableList = res.data;
|
|
|
},
|
|
|
async getFieldOptions(value, tempData) {
|
|
@@ -397,10 +428,10 @@ export default {
|
|
|
try {
|
|
|
let res = await getListName(data);
|
|
|
if (tempData) {
|
|
|
- console.log(res,456);
|
|
|
+ console.log(res, 456);
|
|
|
tempData.fieldOptions = res;
|
|
|
} else {
|
|
|
- console.log(res,4567);
|
|
|
+ console.log(res, 4567);
|
|
|
this.fieldList = res;
|
|
|
}
|
|
|
} catch (error) {
|
|
@@ -410,21 +441,32 @@ export default {
|
|
|
|
|
|
//添加文本
|
|
|
addText() {
|
|
|
- console.log(this.datas.jsonData)
|
|
|
+ console.log(this.datas);
|
|
|
+ if (!this.datas.tableName) {
|
|
|
+ this.$message.error("请先选择数据库表");
|
|
|
+ return;
|
|
|
+ }
|
|
|
var text = {
|
|
|
- name: '',
|
|
|
- type: '',
|
|
|
- value: '',
|
|
|
+ componentKey: this.datas.componentKey,
|
|
|
+ tableName: this.datas.tableName,
|
|
|
+ fieldKey: uuid(8),
|
|
|
+ name: "",
|
|
|
+ type: "",
|
|
|
+ value: "",
|
|
|
value1: [],
|
|
|
- value2: '',
|
|
|
- fieldName:'',
|
|
|
+ value2: "",
|
|
|
+ fieldName: "",
|
|
|
showPicker: false,
|
|
|
- }
|
|
|
- this.datas.jsonData.push(text)
|
|
|
+ optionType: false, //false 自定义数据 true 动态数据
|
|
|
+ optionConditions: "", //动态数据
|
|
|
+ options: { static: [] }, //静态数据
|
|
|
+ };
|
|
|
+ console.log(text);
|
|
|
+ this.datas.jsonData.push(text);
|
|
|
},
|
|
|
//删除文本
|
|
|
deletetext(index) {
|
|
|
- this.datas.jsonData.splice(index, 1)
|
|
|
+ this.datas.jsonData.splice(index, 1);
|
|
|
},
|
|
|
//下拉内容改变发生发生事件
|
|
|
/* conChange(index) {
|
|
@@ -433,11 +475,11 @@ export default {
|
|
|
}, */
|
|
|
// 列名变化回调
|
|
|
changeModel() {
|
|
|
- console.log('列',this.datas);
|
|
|
- this.lieData = this.datas.jsonData[0].fieldName
|
|
|
+ console.log("列", this.datas);
|
|
|
+ this.lieData = this.datas.jsonData[0].fieldName;
|
|
|
},
|
|
|
},
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|