|
@@ -18,13 +18,27 @@
|
|
|
<el-col :span="5">
|
|
|
<el-form-item label="查询模板名称" size="default">
|
|
|
<el-input
|
|
|
- v-model="tableForm.name"
|
|
|
+ v-model="tableForm.queryTemplateName"
|
|
|
placeholder="请输入查询模板名称"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="5">
|
|
|
- <el-form-item label="查询协议" size="default">
|
|
|
+ <el-form-item label="数据源" prop="dataSourceID" size="default">
|
|
|
+ <el-select
|
|
|
+ v-model="tableForm.dataSourceID"
|
|
|
+ placeholder="请选择"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in tableOptionser"
|
|
|
+ :key="item.v"
|
|
|
+ :label="item.k"
|
|
|
+ :value="item.v"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="查询协议" size="default">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
v-model="tableForm.china"
|
|
@@ -42,12 +56,12 @@
|
|
|
>
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
</el-col>
|
|
|
<el-col :span="14">
|
|
|
<el-form-item label="查询模板描述" size="default">
|
|
|
<el-input
|
|
|
- v-model="tableForm.englin"
|
|
|
+ v-model="tableForm.queryTemplateDescribe"
|
|
|
placeholder="请输入查询模板描述"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -67,7 +81,7 @@
|
|
|
<el-input
|
|
|
:autosize="{ minRows: 24, maxRows: 24 }"
|
|
|
type="textarea"
|
|
|
- v-model="tableForm.three"
|
|
|
+ v-model="tableForm.serviceName"
|
|
|
placeholder="请输入查询语句"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -80,20 +94,62 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import Minheader from "@/components/minheader/index.vue";
|
|
|
+import { Query, myQuery } from "@/api/webApi";
|
|
|
const router = useRouter();
|
|
|
const tableOptionser = ref<Array>([]); //下拉
|
|
|
const tableForm = reactive({
|
|
|
- name: "",
|
|
|
- china: "",
|
|
|
- englin: "",
|
|
|
- two: "",
|
|
|
- three: "",
|
|
|
- text: "",
|
|
|
+ queryTemplateName: "",
|
|
|
+ queryTemplateDescribe: "",
|
|
|
+ submitID: null,
|
|
|
+ queryTemplate: "",
|
|
|
+ pageRows: null,
|
|
|
+ serviceName: "",
|
|
|
+ dataSourceID: "",
|
|
|
}); //内容
|
|
|
//保存
|
|
|
-const preserForm = () => {
|
|
|
- router.push({ path: "/systemSettings/queryTemplate" });
|
|
|
+const preserForm = async () => {
|
|
|
+ const params = {
|
|
|
+ ...tableForm,
|
|
|
+ submitID: tableForm.serviceID,
|
|
|
+ };
|
|
|
+ delete params.serviceID;
|
|
|
+ try {
|
|
|
+ const res = await Query({
|
|
|
+ serviceId: "5",
|
|
|
+ dataContent: JSON.stringify(params),
|
|
|
+ });
|
|
|
+ if (Number(res.code) === 0) {
|
|
|
+ // this.$message.success(res.message ?? "成功");
|
|
|
+ // this.$router.push("/systemSettings/queryTemplate");
|
|
|
+ } else {
|
|
|
+ // this.$message.error(res.message ?? "失败");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ // this.$message.error("失败");
|
|
|
+ }
|
|
|
+ // router.push({ path: "/systemSettings/queryTemplate" });
|
|
|
+};
|
|
|
+const getDataSourceList = async () => {
|
|
|
+ const tableOptionser = await getSelectOption(13);
|
|
|
+ tableOptionser.value = tableOptionser.map((item) => {
|
|
|
+ item[item.setlabel] = item.k;
|
|
|
+ item[item.setvalue] = item.v;
|
|
|
+ return item;
|
|
|
+ });
|
|
|
};
|
|
|
+const getSelectOption = async (ID) => {
|
|
|
+ try {
|
|
|
+ const listValues = await myQuery(ID);
|
|
|
+ return listValues;
|
|
|
+ } catch (error) {
|
|
|
+ // this.$message.error(error)
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getDataSourceList();
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|