chenjun 2 years ago
parent
commit
7890f3e96c

+ 292 - 0
src/views/systemSettings/queryTemplate/index.vue

@@ -0,0 +1,292 @@
+<template>
+  <div class="airportInfo scroll-y">
+    <div class="wrap">
+      <Minheader
+        :is-auth="true"
+        :is-statuser="true"
+        :is-Search="true"
+        @addForm="addForm"
+        @searchForms="searchForms"
+        @clearForm="clearForm"
+      >
+        <template #header>
+          <div class="status flex-wrap">
+            <div class="manageTitle">查询模板</div>
+          </div>
+        </template></Minheader
+      >
+      <div class="app-containers">
+        <DataTable
+          :btnGroupWidth="width"
+          :tableHeader="tableCols"
+          :tableData="tableData"
+          :tableBtnGroup="tableBtnGroup"
+          :tableProperty="{ rowKey: 'ID' }"
+          @btnClick="btnClick"
+        />
+      </div>
+      <Dialog
+        :flag="flag"
+        :type="type"
+        :msgTitle="msgTitle"
+        @resetForm="resetForm"
+        @delRest="delRest"
+        @submitForm="submitForm"
+        @delRemove="delRemove"
+      >
+      </Dialog>
+    </div>
+  </div>
+</template>
+<script setup lang="ts">
+import DataTable from "@/components/tableTemp/index.vue";
+import Minheader from "@/components/minheader/index.vue";
+import Dialog from "@/components/dialog/index.vue";
+import { Query, GeneralDataReception } from "@/api/webApi";
+import { ElMessage } from "element-plus";
+import { el } from "element-plus/es/locale";
+const width = ref("200px");
+const router = useRouter();
+const dataId = ref<String>("4"); //请求id
+const page = ref<number>(0); //分页参数
+const dataContent = ref<object>({});
+const noMore = ref<Boolean>(false);
+const rowTitle = ref<String>("");
+const tableCols = ref([]); //表头数据
+const serviceId = ref<String>("");
+const tableObj = ref({}); //增删改数据缓存
+const flag = ref<Boolean>(false); //弹窗开关
+const type = ref<String>(""); //判断是否删除
+const msgTitle = ref<String>("新增查询模板"); //弹窗标题
+const tableColsCopys = reactive<Object>({}); //弹窗
+const tableOptionser = ref<Array>([]); //弹窗下拉
+const tableForm = reactive({
+  queryConditionType: "",
+  queryTemplateID: "",
+  queryTemplateName: "",
+  queryTemplateDescribe: "",
+  dataSourceName: "",
+  queryTemplate: "",
+  serviceName: "",
+  pageRows: "",
+  event: "",
+}); //弹窗内容
+//列表
+const tableData = ref([]);
+const tableDatcopy = ref([]);
+//表头
+const state = reactive({
+  list: [
+    { label: "查询模板名称", key: "name" },
+    { label: "查询模板协议", key: "china" },
+    { label: "查询模板描述", key: "englin" },
+  ],
+  listLoading: true,
+});
+const tableBtnGroup = ref([
+  {
+    name: "编辑",
+    className: "editBtn",
+    param: 2,
+  },
+  {
+    name: "列设置",
+    className: "editBtn",
+    param: 4,
+  },
+  {
+    name: "删除",
+    className: "delBtn",
+    param: 3,
+  },
+]);
+//新增
+const addForm = () => {
+  router.push({ path: "/systemSettings/queryTemplateAdd" });
+  // msgTitle.value = "新增查询模板";
+  // flag.value = true;
+  // type.value = "";
+};
+//取消
+const resetForm = () => {
+  flag.value = false;
+  tableForm.name = "";
+  tableForm.china = "";
+  tableForm.englin = "";
+  tableForm.two = "";
+  tableForm.three = "";
+  tableForm.text = "";
+};
+//编辑
+// const editDialog = (data) => {
+//   msgTitle.value = "编辑航司信息维护";
+//   flag.value = true;
+//   type.value = "";
+//   tableForm.name = data.name;
+//   tableForm.china = data.china;
+//   tableForm.englin = data.englin;
+//   tableForm.two = data.two;
+//   tableForm.three = data.three;
+//   tableForm.text = data.text;
+// };
+//编辑-删除
+const btnClick = (row, index, param) => {
+  if (param === 2) {
+    router.push({
+      path: "/systemSettings/queryTemplateEdit",
+      query: {
+        queryTemplateID: index.queryTemplateID,
+      },
+    });
+  } else if (param === 3) {
+    msgTitle.value = "删除查询模板";
+    flag.value = true;
+    type.value = "del";
+    tableForm.event = 3;
+    tableForm.queryConditionType = index.queryConditionType;
+    tableForm.queryTemplateID = index.queryTemplateID;
+    tableForm.queryTemplateName = index.queryTemplateName;
+    tableForm.queryTemplateDescribe = index.queryTemplateDescribe;
+    tableForm.dataSourceName = index.dataSourceName;
+    tableForm.queryTemplate = index.queryTemplate;
+    tableForm.serviceName = index.serviceName;
+    tableForm.pageRows = index.pageRows;
+  } else if (param === 4) {
+    router.push({
+      path: "/systemSettings/queryTemplateColumn",
+      query: {
+        queryTemplateID: index.queryTemplateID,
+      },
+    });
+  }
+};
+//删除
+const eleDialog = () => {
+  msgTitle.value = "删除查询模板";
+  flag.value = true;
+  type.value = "del";
+};
+const delRemove = () => {
+  tableForm.event = 3;
+  generalDataReception(tableForm);
+};
+//删除
+const delRest = () => {
+  flag.value = false;
+};
+//获取表格数据
+const getQuery = async () => {
+  try {
+    const { code, returnData } = await Query({
+      id: dataId.value,
+      needPage: ++page.value,
+      dataContent: Object.values(dataContent.value),
+    });
+    if (code === "0") {
+      if (returnData.listValues.length === 0) {
+        page.value--;
+        noMore.value = true;
+      }
+      const titleColumn = returnData.columnSet.find(
+        (item) => item.needShow === 1
+      );
+      if (titleColumn) {
+        rowTitle.value = titleColumn.columnName;
+      }
+      tableData.value.push(...returnData.listValues);
+      tableDatcopy.value.push(...returnData.listValues);
+      tableCols.value = returnData.columnSet;
+      tableCols.value.forEach((element) => {
+        element.label = element.columnLabel;
+        element.key = element.columnName;
+        // if (element.columnName === "queryTemplate") {
+        //   element.width = "300px";
+        // }
+      });
+      serviceId.value = returnData.submitID;
+    } else {
+      page.value--;
+    }
+  } catch (error) {
+    page.value--;
+  }
+};
+//确认提交
+const submitForm = () => {
+  generalDataReception(tableForm);
+};
+const resetTable = () => {
+  page.value = 0;
+  noMore.value = false;
+  tableData.value = [];
+};
+//新增-编辑-删除
+const generalDataReception = async (data) => {
+  try {
+    data = {
+      ...data,
+    };
+    const { code } = await GeneralDataReception({
+      serviceId: serviceId.value,
+      dataContent: JSON.stringify(data),
+    });
+    if (code === "0") {
+      ElMessage.success(`操作成功`);
+      // this.$message.success("操作成功");
+      resetTable();
+      getQuery();
+      resetForm();
+      flag.value = false;
+      // rmFlag.value = false;
+      tableObj.value = {};
+      // this.$router.go(0);
+    } else {
+      ElMessage.error(`操作失败`);
+      // this.$message.error("操作失败");
+      // this.flag = false;
+      // this.rmFlag = false;
+      tableObj.value = {};
+      resetForm();
+    }
+  } catch (error) {
+    flag.value = false;
+    //  rmFlag.value = false;
+    tableObj.value = {};
+    resetForm();
+  }
+};
+//搜索
+const searchForms = (data) => {
+  if (data) {
+    tableData.value = [];
+    tableDatcopy.value.forEach((element) => {
+      if (element.queryTemplateID == data) {
+        tableData.value.push(element);
+      }
+    });
+  } else {
+    tableData.value = [];
+    tableDatcopy.value = [];
+    page.value = 0;
+    getQuery();
+  }
+};
+//清除
+const clearForm = () => {
+  tableData.value = [];
+  tableDatcopy.value = [];
+  page.value = 0;
+  getQuery();
+};
+onMounted(() => {
+  getQuery();
+});
+</script>
+<style lang="scss" scoped>
+::v-deep .el-form-item__label {
+  width: 100px;
+}
+.app-containers {
+  height: calc(100vh - 180px);
+}
+</style>

+ 214 - 0
src/views/systemSettings/queryTemplate/queryTemplateAdd.vue

@@ -0,0 +1,214 @@
+<template>
+  <div class="airportInfo scroll-y">
+    <Minheader
+      :is-statuser="true"
+      :is-Preser="true"
+      :is-Measure="true"
+      @preserForm="preserForm"
+    >
+      <template #header>
+        <div class="status flex-wrap">
+          <div class="manageTitle">新增查询模板</div>
+        </div>
+      </template></Minheader
+    >
+    <div class="app-container">
+      <el-form :model="ruleForm" :rules="formRules" ref="queryTemplateAddForm">
+        <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item
+              label="查询模板名称"
+              size="default"
+              prop="queryTemplateName"
+              :rules="formRules.isNotNull"
+            >
+              <el-input
+                v-model="ruleForm.queryTemplateName"
+                placeholder="请输入查询模板名称"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item
+              label="数据源"
+              prop="dataSourceID"
+              size="default"
+              :rules="formRules.isNotNull"
+            >
+              <el-select
+                v-model="ruleForm.dataSourceID"
+                placeholder="请选择"
+                clearable
+              >
+                <el-option
+                  v-for="item in dataSourceList"
+                  :key="item.dataSourceID"
+                  :label="item.dataSourceName"
+                  :value="item.dataSourceID"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item
+              label="服务名称"
+              prop="serviceID"
+              size="default"
+              :rules="formRules.isNotNull"
+            >
+              <el-select
+                v-model="ruleForm.serviceID"
+                placeholder="请选择"
+                clearable
+              >
+                <el-option
+                  v-for="item in serviceList"
+                  :key="item.serviceID"
+                  :label="item.serviceName"
+                  :value="item.serviceID"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item
+              label="每页显示"
+              prop="pageRows"
+              size="default"
+              :rules="formRules.isNotNull"
+            >
+              <el-input
+                v-model="ruleForm.pageRows"
+                size="medium"
+                placeholder="请输入每页显示行数"
+                type="number"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+          <el-col>
+            <el-form-item label="查询模板描述" size="default">
+              <el-input
+                v-model="ruleForm.queryTemplateDescribe"
+                placeholder="请输入查询模板描述"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col>
+            <el-form-item
+              label="查询语句"
+              size="default"
+              prop="queryTemplate"
+              :rules="formRules.isNotNull"
+            >
+              <el-input
+                :autosize="{ minRows: 24, maxRows: 24 }"
+                type="textarea"
+                v-model="ruleForm.queryTemplate"
+                placeholder="请输入查询语句"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import Minheader from "@/components/minheader/index.vue";
+import { Query, myQuery, GeneralDataReception } from "@/api/webApi";
+import { ElMessage } from "element-plus";
+const formRules = useElement().formRules;
+const router = useRouter();
+const asShOW = ref<boolean>(false);
+const dataSourceList = ref<Array>([]); //下拉
+const serviceList = ref<Array>([]); //下拉
+const ruleForm = reactive({
+  queryTemplateName: "",
+  queryTemplateDescribe: "",
+  serviceName: "",
+  dataSourceID: "",
+  submitID: null,
+  queryTemplate: "",
+  pageRows: null,
+  serviceID: "",
+  event: 1,
+}); //内容
+//确认提交
+const queryTemplateAddForm: any = ref(null);
+const preserForm = () => {
+  queryTemplateAddForm.value.validate((valid: any) => {
+    if (valid) {
+      preserFormer();
+    } else {
+      return false;
+    }
+  });
+};
+//保存
+const preserFormer = async () => {
+  const params = {
+    ...ruleForm,
+    submitID: ruleForm.serviceID,
+  };
+  delete params.serviceID;
+  try {
+    const res = await GeneralDataReception({
+      serviceId: SERVICE_ID.sysQueryTabId,
+      dataContent: JSON.stringify(params),
+    });
+    if (Number(res.code) === 0) {
+      ElMessage.success(`成功`);
+      router.push({ path: "/systemSettings/queryTemplate" });
+      // this.$message.success(res.message ?? "成功");
+      // this.$router.push("/systemSettings/queryTemplate");
+    } else {
+      ElMessage.error(`失败`);
+      // this.$message.error(res.message ?? "失败");
+    }
+  } catch (error) {
+    ElMessage.error(`失败`);
+  }
+  // router.push({ path: "/systemSettings/queryTemplate" });
+};
+const getDataSourceList = async () => {
+  const dataSourceLists = await getSelectOption(13);
+  dataSourceList.value = dataSourceLists.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 [];
+  }
+};
+const queryServiceList = async (ID) => {
+  const serviceLists = await getSelectOption(DATACONTENT_ID.sysServiceTable);
+  serviceList.value = serviceLists.map((item) => {
+    item[item.setlabel] = item.k;
+    item[item.setvalue] = item.v;
+    return item;
+  });
+};
+getDataSourceList();
+queryServiceList();
+</script>
+
+<style lang="scss" scoped>
+.airportInfo {
+  padding: 24px;
+  height: 100%;
+  background: #ffffff;
+  border-radius: 4px;
+}
+::v-deep .el-form-item__label {
+  width: 110px;
+}
+</style>

+ 502 - 0
src/views/systemSettings/queryTemplate/queryTemplateColumn.vue

@@ -0,0 +1,502 @@
+<template>
+  <div class="airportInfo scroll-y">
+    <div class="wrap">
+      <Minheader :is-auth="true" :is-statuser="true" @addForm="addForm">
+        <template #header>
+          <div class="status flex-wrap">
+            <div class="manageTitle">查询项设置</div>
+          </div>
+        </template></Minheader
+      >
+      <div class="app-containers">
+        <DataTable
+          :tableHeader="tableCols"
+          :tableData="tableData"
+          :tableBtnGroup="tableBtnGroup"
+          :tableProperty="{ rowKey: 'ID' }"
+          @btnClick="btnClick"
+        />
+      </div>
+      <Dialog
+        width="734px"
+        :flag="flag"
+        :type="type"
+        :msgTitle="msgTitle"
+        @resetForm="resetForm"
+        @delRest="delRest"
+        @submitForm="submitForm"
+        @delRemove="delRemove"
+      >
+        <div class="diacont">
+          <el-form
+            :model="tableForm"
+            :rules="formRules"
+            ref="queryTemplateColumnForm"
+          >
+            <el-row :gutter="24">
+              <el-col :span="12">
+                <el-form-item
+                  label="名称"
+                  size="default"
+                  prop="columnName"
+                  :rules="formRules.isNotNull"
+                >
+                  <el-input
+                    v-model="tableForm.columnName"
+                    placeholder="请输入名称"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item
+                  label="标签"
+                  size="default"
+                  prop="columnLabel"
+                  :rules="formRules.isNotNull"
+                >
+                  <el-input
+                    v-model="tableForm.columnLabel"
+                    placeholder="请输入标签"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="描述" size="default">
+                  <el-input
+                    v-model="tableForm.columnDescribe"
+                    placeholder="请输入描述"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="排序" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.needSort"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="过滤" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.needFilters"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="显示" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.needShow"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="数据类型" size="default">
+                  <el-input
+                    v-model="tableForm.dataType"
+                    placeholder="请输入数据类型"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="分组" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.needGroup"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="下拉" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.listqueryTemplateID"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="合计" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.needCount"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="字段排序" size="default">
+                  <el-select
+                    style="width: 100%"
+                    v-model="tableForm.orderNumber"
+                    class="input-shadow"
+                    filterable
+                    default-first-option
+                    clearable
+                    placeholder="请选择"
+                  >
+                    <el-option
+                      v-for="item in tableOptionser"
+                      :key="item.v ? item.v : item.planDepartureApt"
+                      :label="item.k ? item.k : item.planDepartureApt"
+                      :value="item.v ? item.v : item.planDepartureApt"
+                    >
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </div>
+      </Dialog>
+    </div>
+  </div>
+</template>
+<script setup lang="ts">
+import DataTable from "@/components/tableTemp/index.vue";
+import Minheader from "@/components/minheader/index.vue";
+import Dialog from "@/components/dialog/index.vue";
+import { Query, GeneralDataReception } from "@/api/webApi";
+import { ElMessage } from "element-plus";
+const route = useRoute();
+const formRules = useElement().formRules;
+const page = ref<number>(0); //分页参数
+const dataContent = ref<object>({});
+const noMore = ref<Boolean>(false);
+const rowTitle = ref<String>("");
+const tableCols = ref([]); //表头数据
+const serviceId = ref<String>("");
+const tableObj = ref({}); //增删改数据缓存
+const flag = ref<Boolean>(false); //弹窗开关
+const type = ref<String>(""); //判断是否删除
+const msgTitle = ref<String>("新增查询项"); //弹窗标题
+const tableColsCopys = reactive<Object>({}); //弹窗
+const tableOptionser = ref<Array>([
+  {
+    k: "是",
+    v: "1",
+  },
+  {
+    k: "否",
+    v: "0",
+  },
+]); //弹窗下拉
+const tableForm = reactive({
+  queryTemplateColumnSetID: "",
+  queryTemplateID: route.query.queryTemplateID,
+  columnName: "",
+  columnLabel: "",
+  columnDescribe: "",
+  needSort: "",
+  needFilters: "",
+  needShow: "",
+  needGroup: "",
+  dataType: "",
+  listqueryTemplateID: "",
+  needCount: "",
+  orderNumber: "",
+  needSearch: "",
+  event: "",
+}); //弹窗内容
+//列表
+const tableData = ref([]);
+//表头
+const state = reactive({
+  list: [
+    { label: "名称", key: "name" },
+    { label: "标签", key: "china" },
+    { label: "描述", key: "englin" },
+    { label: "排序", key: "two" },
+    { label: "过滤", key: "three" },
+    { label: "显示", key: "text" },
+    { label: "分组", key: "text1" },
+    { label: "下拉", key: "text2" },
+    { label: "数据类型", key: "text3" },
+    { label: "字段排位", key: "text4" },
+    { label: "合计", key: "text5" },
+  ],
+  listLoading: true,
+});
+const tableBtnGroup = ref([
+  {
+    name: "编辑",
+    className: "editBtn",
+    param: 2,
+  },
+  {
+    name: "删除",
+    className: "delBtn",
+    param: 3,
+  },
+]);
+//新增
+const addForm = () => {
+  msgTitle.value = "新增查询项";
+  flag.value = true;
+  tableForm.event = 1;
+  type.value = "";
+};
+//取消
+const resetForm = () => {
+  flag.value = false;
+  tableForm.queryTemplateColumnSetID = "";
+  tableForm.columnName = "";
+  tableForm.columnLabel = "";
+  tableForm.columnDescribe = "";
+  tableForm.needSort = "";
+  tableForm.needFilters = "";
+  tableForm.needShow = "";
+  tableForm.needGroup = "";
+  tableForm.dataType = "";
+  tableForm.listqueryTemplateID = "";
+  tableForm.needCount = "";
+  tableForm.orderNumber = "";
+  tableForm.needSearch = "";
+};
+//编辑
+// const editDialog = (data) => {
+//   msgTitle.value = "编辑航司信息维护";
+//   flag.value = true;
+//   type.value = "";
+//   tableForm.name = data.name;
+//   tableForm.china = data.china;
+//   tableForm.englin = data.englin;
+//   tableForm.two = data.two;
+//   tableForm.three = data.three;
+//   tableForm.text = data.text;
+// };
+//编辑-删除
+const btnClick = (row, index, param) => {
+  if (param === 2) {
+    msgTitle.value = "编辑查询项";
+    flag.value = true;
+    type.value = "";
+    tableForm.event = 2;
+    tableForm.queryTemplateColumnSetID = index.queryTemplateColumnSetID;
+    tableForm.columnName = index.columnName;
+    tableForm.columnLabel = index.columnLabel;
+    tableForm.columnDescribe = index.columnDescribe;
+    tableForm.needSort = index.needSort === "需要" ? "1" : "0";
+    tableForm.needFilters = index.needFilters === "需要" ? "1" : "0";
+    tableForm.needShow = index.needShow === "需要" ? "1" : "0";
+    tableForm.needGroup = index.needGroup === "需要" ? "1" : "0";
+    tableForm.dataType = index.dataType;
+    tableForm.listqueryTemplateID =
+      index.listqueryTemplateID === "需要" ? "1" : "0";
+    tableForm.needCount = index.needCount === "需要" ? "1" : "0";
+    tableForm.orderNumber = index.orderNumber === "需要" ? "1" : "0";
+    tableForm.needSearch = index.needSearch === "需要" ? "1" : "0";
+  } else if (param === 3) {
+    msgTitle.value = "删除查询项";
+    flag.value = true;
+    type.value = "del";
+    tableForm.event = 3;
+    tableForm.queryTemplateColumnSetID = index.queryTemplateColumnSetID;
+    tableForm.columnName = index.columnName;
+    tableForm.columnLabel = index.columnLabel;
+    tableForm.columnDescribe = index.columnDescribe;
+    tableForm.needSort = index.needSort;
+    tableForm.needFilters = index.needFilters;
+    tableForm.needShow = index.needShow;
+    tableForm.needGroup = index.needGroup;
+    tableForm.dataType = index.dataType;
+    tableForm.listqueryTemplateID = index.listqueryTemplateID;
+    tableForm.needCount = index.needCount;
+    tableForm.orderNumber = index.orderNumber;
+    tableForm.needSearch = index.needSearch;
+  } else if (param === 4) {
+  }
+};
+//删除
+const eleDialog = () => {
+  msgTitle.value = "删除查询项";
+  flag.value = true;
+  type.value = "del";
+};
+const delRemove = () => {
+  tableForm.event = 3;
+  generalDataReception(tableForm);
+};
+//删除
+const delRest = () => {
+  flag.value = false;
+};
+//获取表格数据
+const getQuery = async () => {
+  try {
+    const { code, returnData } = await Query({
+      id: DATACONTENT_ID.sysQueryChildTabId,
+      needPage: ++page.value,
+      dataContent: [route.query.queryTemplateID],
+    });
+    if (code === "0") {
+      if (returnData.listValues.length === 0) {
+        page.value--;
+        noMore.value = true;
+      }
+      const titleColumn = returnData.columnSet.find(
+        (item) => item.needShow === 1
+      );
+      if (titleColumn) {
+        rowTitle.value = titleColumn.columnName;
+      }
+      tableData.value.push(...returnData.listValues);
+      tableCols.value = returnData.columnSet;
+      tableCols.value.forEach((element) => {
+        element.label = element.columnLabel;
+        element.key = element.columnName;
+        // if (element.columnName === "queryTemplate") {
+        //   element.width = "300px";
+        // }
+      });
+      serviceId.value = returnData.submitID;
+    } else {
+      page.value--;
+    }
+  } catch (error) {
+    page.value--;
+  }
+};
+//确认提交
+const queryTemplateColumnForm: any = ref(null);
+const submitForm = () => {
+  queryTemplateColumnForm.value.validate((valid: any) => {
+    if (valid) {
+      generalDataReception(tableForm);
+    } else {
+      return false;
+    }
+  });
+};
+const resetTable = () => {
+  page.value = 0;
+  noMore.value = false;
+  tableData.value = [];
+};
+//新增-编辑-删除
+const generalDataReception = async (data) => {
+  try {
+    let obj = {
+      IATACode: route.query.IATACode,
+    };
+    data = {
+      ...data,
+      ...obj,
+    };
+    const { code } = await GeneralDataReception({
+      serviceId: serviceId.value,
+      dataContent: JSON.stringify(data),
+    });
+    if (code == 0) {
+      ElMessage.success(`操作成功`);
+      // this.$message.success("操作成功");
+      resetTable();
+      getQuery();
+      resetForm();
+      flag.value = false;
+      // rmFlag.value = false;
+      tableObj.value = {};
+      // this.$router.go(0);
+    } else {
+      ElMessage.error(`操作失败`);
+      // this.$message.error("操作失败");
+      // this.flag = false;
+      // this.rmFlag = false;
+      tableObj.value = {};
+      resetForm();
+    }
+  } catch (error) {
+    flag.value = false;
+    //  rmFlag.value = false;
+    tableObj.value = {};
+    resetForm();
+  }
+};
+getQuery();
+</script>
+<style lang="scss" scoped>
+::v-deep .el-form-item__label {
+  width: 100px;
+}
+.app-containers {
+  height: calc(100vh - 180px);
+}
+</style>

+ 231 - 0
src/views/systemSettings/queryTemplate/queryTemplateEdit.vue

@@ -0,0 +1,231 @@
+<template>
+  <div class="airportInfo scroll-y">
+    <Minheader
+      :is-statuser="true"
+      :is-Preser="true"
+      :is-Measure="true"
+      @preserForm="preserForm"
+    >
+      <template #header>
+        <div class="status flex-wrap">
+          <div class="manageTitle">编辑查询模板</div>
+        </div>
+      </template></Minheader
+    >
+    <div class="app-container">
+      <el-form :model="ruleForm" :rules="formRules" ref="queryTemplateEditForm">
+        <el-row :gutter="24">
+          <el-col :span="6">
+            <el-form-item
+              label="查询模板名称"
+              size="default"
+              prop="queryTemplateName"
+              :rules="formRules.isNotNull"
+            >
+              <el-input
+                v-model="ruleForm.queryTemplateName"
+                placeholder="请输入查询模板名称"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item
+              label="数据源"
+              prop="dataSourceID"
+              size="default"
+              :rules="formRules.isNotNull"
+            >
+              <el-select
+                v-model="ruleForm.dataSourceID"
+                placeholder="请选择"
+                clearable
+              >
+                <el-option
+                  v-for="item in dataSourceList"
+                  :key="item.dataSourceID"
+                  :label="item.dataSourceName"
+                  :value="item.dataSourceID"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item
+              label="服务名称"
+              prop="serviceID"
+              size="default"
+              :rules="formRules.isNotNull"
+            >
+              <el-select
+                v-model="ruleForm.serviceID"
+                placeholder="请选择"
+                clearable
+              >
+                <el-option
+                  v-for="item in serviceList"
+                  :key="item.serviceID"
+                  :label="item.serviceName"
+                  :value="item.serviceID"
+                />
+              </el-select>
+            </el-form-item>
+          </el-col>
+          <el-col :span="6">
+            <el-form-item
+              label="每页显示"
+              prop="pageRows"
+              size="default"
+              :rules="formRules.isNotNull"
+            >
+              <el-input
+                v-model="ruleForm.pageRows"
+                size="medium"
+                placeholder="请输入每页显示行数"
+                type="number"
+                clearable
+              />
+            </el-form-item>
+          </el-col>
+          <el-col>
+            <el-form-item label="查询模板描述" size="default">
+              <el-input
+                v-model="ruleForm.queryTemplateDescribe"
+                placeholder="请输入查询模板描述"
+              />
+            </el-form-item>
+          </el-col>
+          <el-col>
+            <el-form-item
+              label="查询语句"
+              size="default"
+              prop="queryTemplate"
+              :rules="formRules.isNotNull"
+            >
+              <el-input
+                :autosize="{ minRows: 24, maxRows: 24 }"
+                type="textarea"
+                v-model="ruleForm.queryTemplate"
+                placeholder="请输入查询语句"
+              />
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+    </div>
+  </div>
+</template>
+
+<script setup lang="ts">
+import Minheader from "@/components/minheader/index.vue";
+import { Query, myQuery, GeneralDataReception } from "@/api/webApi";
+import { ElMessage } from "element-plus";
+const formRules = useElement().formRules;
+const router = useRouter();
+const route = useRoute();
+const asShOW = ref<boolean>(false);
+const dataSourceList = ref<Array>([]); //下拉
+const serviceList = ref<Array>([]); //下拉
+const queryTemplateID = ref<String>("");
+const ruleForm = reactive({
+  queryTemplateName: "",
+  queryTemplateDescribe: "",
+  serviceName: "",
+  dataSourceID: "",
+  submitID: null,
+  queryTemplate: "",
+  pageRows: null,
+  serviceID: "",
+  event: 2,
+}); //内容
+queryTemplateID.value = route.query.queryTemplateID;
+//确认提交
+const queryTemplateEditForm: any = ref(null);
+const preserForm = () => {
+  queryTemplateEditForm.value.validate((valid: any) => {
+    if (valid) {
+      preserFormer();
+    } else {
+      return false;
+    }
+  });
+};
+//保存
+const preserFormer = async () => {
+  const params = {
+    ...ruleForm,
+    submitID: ruleForm.serviceID,
+  };
+  delete params.serviceID;
+  try {
+    const res = await GeneralDataReception({
+      serviceId: SERVICE_ID.sysQueryTabId,
+      dataContent: JSON.stringify(params),
+    });
+    if (Number(res.code) === 0) {
+      ElMessage.success(`成功`);
+      router.push({ path: "/systemSettings/queryTemplate" });
+      // this.$message.success(res.message ?? "成功");
+      // this.$router.push("/systemSettings/queryTemplate");
+    } else {
+      ElMessage.error(`失败`);
+      // this.$message.error(res.message ?? "失败");
+    }
+  } catch (error) {
+    ElMessage.error(`失败`);
+  }
+  // router.push({ path: "/systemSettings/queryTemplate" });
+};
+const getDataSourceList = async () => {
+  const dataSourceLists = await getSelectOption(13);
+  dataSourceList.value = dataSourceLists.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 [];
+  }
+};
+const queryServiceList = async (ID) => {
+  const serviceLists = await getSelectOption(DATACONTENT_ID.sysServiceTable);
+  serviceList.value = serviceLists.map((item) => {
+    item[item.setlabel] = item.k;
+    item[item.setvalue] = item.v;
+    return item;
+  });
+};
+const queryQueryTemplateByID = async (queryTemplateID) => {
+  try {
+    const templateInfo = await myQuery(
+      DATACONTENT_ID.sysQueryEditId,
+      queryTemplateID.value
+    );
+    Object.entries(templateInfo[0]).forEach(([key, value]) => {
+      ruleForm[key] = value;
+    });
+  } catch (error) {
+    // this.$message.error(error)
+  }
+};
+getDataSourceList();
+queryServiceList();
+queryQueryTemplateByID(queryTemplateID);
+</script>
+
+<style lang="scss" scoped>
+.airportInfo {
+  padding: 24px;
+  height: 100%;
+  background: #ffffff;
+  border-radius: 4px;
+}
+::v-deep .el-form-item__label {
+  width: 110px;
+}
+</style>