|
@@ -10,7 +10,7 @@
|
|
|
>
|
|
|
<div class="app-containers">
|
|
|
<DataTable
|
|
|
- :tableHeader="state.list"
|
|
|
+ :tableHeader="tableCols"
|
|
|
:tableData="tableData"
|
|
|
:tableBtnGroup="tableBtnGroup"
|
|
|
:tableProperty="{ rowKey: 'ID' }"
|
|
@@ -24,6 +24,8 @@
|
|
|
:msgTitle="msgTitle"
|
|
|
@resetForm="resetForm"
|
|
|
@delRest="delRest"
|
|
|
+ @submitForm="submitForm"
|
|
|
+ @delRemove="delRemove"
|
|
|
>
|
|
|
<div class="diacont">
|
|
|
<el-form :model="tableForm">
|
|
@@ -31,7 +33,7 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="数据项名称" size="default">
|
|
|
<el-input
|
|
|
- v-model="tableForm.name"
|
|
|
+ v-model="tableForm.ItemName"
|
|
|
placeholder="请输入数据项名称"
|
|
|
/>
|
|
|
</el-form-item>
|
|
@@ -40,7 +42,7 @@
|
|
|
<el-form-item label="数据项类型" size="default">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
- v-model="tableForm.china"
|
|
|
+ v-model="tableForm.dataType"
|
|
|
class="input-shadow"
|
|
|
filterable
|
|
|
default-first-option
|
|
@@ -60,21 +62,21 @@
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="输出标识符" size="default">
|
|
|
<el-input
|
|
|
- v-model="tableForm.englin"
|
|
|
+ v-model="tableForm.outputIdentifier"
|
|
|
placeholder="请输入输出标识符"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="描述" size="default">
|
|
|
+ <!-- <el-form-item label="描述" size="default">
|
|
|
<el-input v-model="tableForm.two" placeholder="请输入描述" />
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="唯一项" size="default">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
- v-model="tableForm.three"
|
|
|
+ v-model="tableForm.isKey"
|
|
|
class="input-shadow"
|
|
|
filterable
|
|
|
default-first-option
|
|
@@ -95,7 +97,7 @@
|
|
|
<el-form-item label="必填项" size="default">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
- v-model="tableForm.text"
|
|
|
+ v-model="tableForm.isMust"
|
|
|
class="input-shadow"
|
|
|
filterable
|
|
|
default-first-option
|
|
@@ -116,7 +118,7 @@
|
|
|
<el-form-item label="多条拆分" size="default">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
- v-model="tableForm.text1"
|
|
|
+ v-model="tableForm.isSplite"
|
|
|
class="input-shadow"
|
|
|
filterable
|
|
|
default-first-option
|
|
@@ -133,7 +135,7 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col>
|
|
|
+ <!-- <el-col>
|
|
|
<el-form-item label="取值表达式" size="default">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
@@ -141,8 +143,8 @@
|
|
|
placeholder="请输入取值表达式"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col>
|
|
|
+ </el-col> -->
|
|
|
+ <!-- <el-col>
|
|
|
<el-form-item label="实时计算表达式" size="default">
|
|
|
<el-input
|
|
|
type="textarea"
|
|
@@ -150,28 +152,28 @@
|
|
|
placeholder="请输入实时计算表达式"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col>
|
|
|
+ </el-col> -->
|
|
|
+ <!-- <el-col>
|
|
|
<el-form-item label="计算结果标识符" size="default">
|
|
|
<el-input
|
|
|
v-model="tableForm.text4"
|
|
|
placeholder="请输入计算结果标识符"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col>
|
|
|
+ </el-col> -->
|
|
|
+ <!-- <el-col>
|
|
|
<el-form-item label="计算参数" size="default">
|
|
|
<el-input
|
|
|
v-model="tableForm.text5"
|
|
|
placeholder="请输入计算参数"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="计算数据源" size="default">
|
|
|
<el-select
|
|
|
style="width: 100%"
|
|
|
- v-model="tableForm.text6"
|
|
|
+ v-model="tableForm.dataSourceName"
|
|
|
class="input-shadow"
|
|
|
filterable
|
|
|
default-first-option
|
|
@@ -199,55 +201,36 @@
|
|
|
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 router = useRouter();
|
|
|
+const route = useRoute();
|
|
|
+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({
|
|
|
- name: "",
|
|
|
- china: "",
|
|
|
- englin: "",
|
|
|
- two: "",
|
|
|
- three: "",
|
|
|
- text: "",
|
|
|
- text1: "",
|
|
|
- text2: "",
|
|
|
- text3: "",
|
|
|
- text4: "",
|
|
|
- text5: "",
|
|
|
- text6: "",
|
|
|
+ ItemID: "",
|
|
|
+ dataStructureID: route.query.dataStructureID,
|
|
|
+ ItemName: "",
|
|
|
+ outputIdentifier: "",
|
|
|
+ dataType: "",
|
|
|
+ isKey: "",
|
|
|
+ isMust: "",
|
|
|
+ isSplite: "",
|
|
|
+ dataSourceName: "",
|
|
|
+ event: "",
|
|
|
}); //弹窗内容
|
|
|
//列表
|
|
|
-const tableData = ref([
|
|
|
- {
|
|
|
- name: "测试",
|
|
|
- china: "测试",
|
|
|
- englin: "测试",
|
|
|
- two: "测试",
|
|
|
- three: "测试",
|
|
|
- text: "测试",
|
|
|
- text1: "测试",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "测试",
|
|
|
- china: "测试",
|
|
|
- englin: "测试",
|
|
|
- two: "测试",
|
|
|
- three: "测试",
|
|
|
- text: "测试",
|
|
|
- text1: "测试",
|
|
|
- },
|
|
|
- {
|
|
|
- name: "测试",
|
|
|
- china: "测试",
|
|
|
- englin: "测试",
|
|
|
- two: "测试",
|
|
|
- three: "测试",
|
|
|
- text: "测试",
|
|
|
- text1: "测试",
|
|
|
- },
|
|
|
-]);
|
|
|
+const tableData = ref([]);
|
|
|
//表头
|
|
|
const state = reactive({
|
|
|
list: [
|
|
@@ -276,24 +259,21 @@ const tableBtnGroup = ref([
|
|
|
//新增
|
|
|
const addForm = () => {
|
|
|
msgTitle.value = "新增数据项";
|
|
|
+ tableForm.event = 1;
|
|
|
flag.value = true;
|
|
|
type.value = "";
|
|
|
};
|
|
|
//取消
|
|
|
const resetForm = () => {
|
|
|
flag.value = false;
|
|
|
- tableForm.name = "";
|
|
|
- tableForm.china = "";
|
|
|
- tableForm.englin = "";
|
|
|
- tableForm.two = "";
|
|
|
- tableForm.three = "";
|
|
|
- tableForm.text = "";
|
|
|
- tableForm.text1 = "";
|
|
|
- tableForm.text2 = "";
|
|
|
- tableForm.text3 = "";
|
|
|
- tableForm.text4 = "";
|
|
|
- tableForm.text5 = "";
|
|
|
- tableForm.text6 = "";
|
|
|
+ tableForm.ItemID = "";
|
|
|
+ tableForm.ItemName = "";
|
|
|
+ tableForm.outputIdentifier = "";
|
|
|
+ tableForm.dataType = "";
|
|
|
+ tableForm.isKey = "";
|
|
|
+ tableForm.isMust = "";
|
|
|
+ tableForm.isSplite = "";
|
|
|
+ tableForm.dataSourceName = "";
|
|
|
};
|
|
|
//编辑
|
|
|
// const editDialog = (data) => {
|
|
@@ -313,22 +293,28 @@ const btnClick = (row, index, param) => {
|
|
|
msgTitle.value = "编辑数据项";
|
|
|
flag.value = true;
|
|
|
type.value = "";
|
|
|
- tableForm.name = index.name;
|
|
|
- tableForm.china = index.china;
|
|
|
- tableForm.englin = index.englin;
|
|
|
- tableForm.two = index.two;
|
|
|
- tableForm.three = index.three;
|
|
|
- tableForm.text = index.text;
|
|
|
- tableForm.text1 = index.text1;
|
|
|
- tableForm.text2 = index.text2;
|
|
|
- tableForm.text3 = index.text3;
|
|
|
- tableForm.text4 = index.text4;
|
|
|
- tableForm.text5 = index.text5;
|
|
|
- tableForm.text6 = index.text6;
|
|
|
+ tableForm.event = 2;
|
|
|
+ tableForm.ItemID = index.ItemID;
|
|
|
+ tableForm.ItemName = index.ItemName;
|
|
|
+ tableForm.outputIdentifier = index.outputIdentifier;
|
|
|
+ tableForm.dataType = index.dataType;
|
|
|
+ tableForm.isKey = index.isKey;
|
|
|
+ tableForm.isMust = index.isMust;
|
|
|
+ tableForm.isSplite = index.isSplite;
|
|
|
+ tableForm.dataSourceName = index.dataSourceName;
|
|
|
} else if (param === 3) {
|
|
|
msgTitle.value = "删除数据项";
|
|
|
flag.value = true;
|
|
|
type.value = "del";
|
|
|
+ tableForm.event = 3;
|
|
|
+ tableForm.ItemID = index.ItemID;
|
|
|
+ tableForm.ItemName = index.ItemName;
|
|
|
+ tableForm.outputIdentifier = index.outputIdentifier;
|
|
|
+ tableForm.dataType = index.dataType;
|
|
|
+ tableForm.isKey = index.isKey;
|
|
|
+ tableForm.isMust = index.isMust;
|
|
|
+ tableForm.isSplite = index.isSplite;
|
|
|
+ tableForm.dataSourceName = index.dataSourceName;
|
|
|
} else if (param === 4) {
|
|
|
}
|
|
|
};
|
|
@@ -338,10 +324,99 @@ const eleDialog = () => {
|
|
|
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.dataitemTabId,
|
|
|
+ needPage: ++page.value,
|
|
|
+ dataContent: [route.query.dataStructureID],
|
|
|
+ });
|
|
|
+ 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 submitForm = () => {
|
|
|
+ generalDataReception(tableForm);
|
|
|
+};
|
|
|
+const resetTable = () => {
|
|
|
+ page.value = 0;
|
|
|
+ noMore.value = false;
|
|
|
+ tableData.value = [];
|
|
|
+};
|
|
|
+//新增-编辑-删除
|
|
|
+const generalDataReception = async (data) => {
|
|
|
+ try {
|
|
|
+ let obj = {
|
|
|
+ dataStructureID: route.query.dataStructureID,
|
|
|
+ };
|
|
|
+ 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 {
|