|
@@ -16,7 +16,9 @@
|
|
|
'?updateSupport=' +
|
|
|
upload.updateSupport +
|
|
|
'&tableName=' +
|
|
|
- tableName+'&sqlKey=' + sqlkey
|
|
|
+ tableName +
|
|
|
+ '&sqlKey=' +
|
|
|
+ sqlkey
|
|
|
"
|
|
|
:disabled="upload.isUploading"
|
|
|
:on-progress="handleFileUploadProgress"
|
|
@@ -38,7 +40,7 @@
|
|
|
:underline="false"
|
|
|
style="font-size: 12px; vertical-align: baseline"
|
|
|
@click="importTemplate"
|
|
|
- >下载模板
|
|
|
+ >下载模板
|
|
|
</el-link>
|
|
|
</div>
|
|
|
</el-upload>
|
|
@@ -60,7 +62,7 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
- >新增
|
|
|
+ >新增
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -71,7 +73,7 @@
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
- >修改
|
|
|
+ >修改
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -82,7 +84,7 @@
|
|
|
size="mini"
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
- >删除
|
|
|
+ >删除
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -91,7 +93,7 @@
|
|
|
icon="el-icon-upload2"
|
|
|
size="mini"
|
|
|
@click="upload.open = true"
|
|
|
- >导入
|
|
|
+ >导入
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -101,7 +103,7 @@
|
|
|
icon="el-icon-download"
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
- >导出
|
|
|
+ >导出
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar
|
|
@@ -114,7 +116,7 @@
|
|
|
:data="tableList"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
>
|
|
|
- <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
<!-- <span v-for="(key, val) in columns" :key="key">
|
|
|
<el-table-column :label="key" align="center" :prop="val" />
|
|
|
</span> -->
|
|
@@ -143,18 +145,19 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
>修改</el-button
|
|
|
- ></el-dropdown-item>
|
|
|
- <el-dropdown-item
|
|
|
- ><el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- icon="el-icon-delete"
|
|
|
- @click="handleDelete(scope.row)"
|
|
|
- >删除</el-button
|
|
|
- >
|
|
|
- </el-dropdown-item>
|
|
|
- </el-dropdown-menu>
|
|
|
- </el-dropdown>
|
|
|
+ ></el-dropdown-item
|
|
|
+ >
|
|
|
+ <el-dropdown-item
|
|
|
+ ><el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ @click="handleDelete(scope.row)"
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
+ </el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -198,13 +201,13 @@ import {
|
|
|
addTableData,
|
|
|
batchEdit,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
-import {getToken} from "@/utils/auth";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
|
-import {camelCase} from "@/utils";
|
|
|
+import { camelCase } from "@/utils";
|
|
|
|
|
|
export default {
|
|
|
name: "listInfo",
|
|
|
- components: {Queryfrom},
|
|
|
+ components: { Queryfrom },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -241,7 +244,7 @@ export default {
|
|
|
// 是否更新已经存在的数据
|
|
|
updateSupport: 0,
|
|
|
// 设置上传的请求头部
|
|
|
- headers: {Authorization: "Bearer " + getToken()},
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
// 上传的地址
|
|
|
url: process.env.VUE_APP_BASE_API3 + "common/uploadData",
|
|
|
},
|
|
@@ -297,7 +300,7 @@ export default {
|
|
|
if (str === null) {
|
|
|
return null;
|
|
|
}
|
|
|
- let sb = '';
|
|
|
+ let sb = "";
|
|
|
// 前置字符是否大写
|
|
|
let preCharIsUpperCase = true;
|
|
|
// 当前字符是否大写
|
|
@@ -314,13 +317,17 @@ export default {
|
|
|
|
|
|
curreCharIsUpperCase = isUpperCase(c);
|
|
|
|
|
|
- if (i < (str.length - 1)) {
|
|
|
+ if (i < str.length - 1) {
|
|
|
nexteCharIsUpperCase = isUpperCase(str.charAt(i + 1));
|
|
|
}
|
|
|
|
|
|
- if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) {
|
|
|
+ if (
|
|
|
+ preCharIsUpperCase &&
|
|
|
+ curreCharIsUpperCase &&
|
|
|
+ !nexteCharIsUpperCase
|
|
|
+ ) {
|
|
|
sb += SEPARATOR;
|
|
|
- } else if ((i !== 0 && !preCharIsUpperCase) && curreCharIsUpperCase) {
|
|
|
+ } else if (i !== 0 && !preCharIsUpperCase && curreCharIsUpperCase) {
|
|
|
sb += SEPARATOR;
|
|
|
}
|
|
|
sb += c.toLowerCase();
|
|
@@ -347,7 +354,7 @@ export default {
|
|
|
// 序列化当前查询参数列表
|
|
|
queryParams && (this.queryParams.queryMap = queryParams.queryMap);
|
|
|
// 获取当前表单结构信息
|
|
|
- dragTableInfo({queryMap: {sqlkey: this.sqlkey}})
|
|
|
+ dragTableInfo({ queryMap: { sqlkey: this.sqlkey } })
|
|
|
.then((res) => {
|
|
|
// 得到当前模版信息 --- sql columns queryWhere
|
|
|
this.templateInfo = res.data.resultMap;
|
|
@@ -358,15 +365,21 @@ export default {
|
|
|
// 得到查询条件
|
|
|
this.queryFromWhere = res.data.resultMap.where;
|
|
|
// 得到当前列表信息
|
|
|
- let test = [];
|
|
|
- test = JSON.parse(this.templateInfo.template.dtColumnName);
|
|
|
+ let test = JSON.parse(
|
|
|
+ this.templateInfo.template.dtColumnName.replace(/=/g, ":")
|
|
|
+ );
|
|
|
+ console.log(test);
|
|
|
+ // test = JSON.parse(this.templateInfo.template.dtColumnName);
|
|
|
+ // console.log(JSON.parse(test), typeof test);
|
|
|
this.columns = this.columnsHandler(test);
|
|
|
})
|
|
|
.finally((fes) => {
|
|
|
if (this.templateInfo == {}) return;
|
|
|
// 调用查询需要携带当前table的唯一标识
|
|
|
this.queryParams.queryMap.sqlkey = this.sqlkey;
|
|
|
- this.queryParams.orderByColumn = camelCase(this.queryParams.orderByColumn);
|
|
|
+ this.queryParams.orderByColumn = camelCase(
|
|
|
+ this.queryParams.orderByColumn
|
|
|
+ );
|
|
|
// 根据sql语句查询当前表数据
|
|
|
unionListTableData(this.queryParams).then((res) => {
|
|
|
this.tableList = [];
|
|
@@ -374,13 +387,13 @@ export default {
|
|
|
this.tableList.push(item.resultMap);
|
|
|
});
|
|
|
// 驼峰转换
|
|
|
- this.tableList = this.tableList.map(item => {
|
|
|
- let kv = {}
|
|
|
+ this.tableList = this.tableList.map((item) => {
|
|
|
+ let kv = {};
|
|
|
for (let itemKey in item) {
|
|
|
- kv[camelCase(itemKey)] = item[itemKey]
|
|
|
+ kv[camelCase(itemKey)] = item[itemKey];
|
|
|
}
|
|
|
- return kv
|
|
|
- })
|
|
|
+ return kv;
|
|
|
+ });
|
|
|
this.total = res.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
@@ -398,9 +411,9 @@ export default {
|
|
|
this.$refs.mychild.pageList(
|
|
|
row == undefined
|
|
|
? {
|
|
|
- limit: this.queryParams.pageSize,
|
|
|
- page: this.queryParams.pageNum,
|
|
|
- }
|
|
|
+ limit: this.queryParams.pageSize,
|
|
|
+ page: this.queryParams.pageNum,
|
|
|
+ }
|
|
|
: row
|
|
|
);
|
|
|
},
|
|
@@ -430,7 +443,7 @@ export default {
|
|
|
handleAdd(row) {
|
|
|
// this.reset();
|
|
|
this.defaultValue = {};
|
|
|
- getInfoBySqlKey(this.sqlkey).then(({data}) => {
|
|
|
+ getInfoBySqlKey(this.sqlkey).then(({ data }) => {
|
|
|
// const htmlCode = data.dfHtmlTemplate;
|
|
|
// this.iframeUrl = "data:text/html;charset=utf-8," + encodeURI(htmlCode);
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
@@ -448,7 +461,7 @@ export default {
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- getInfoBySqlKey(this.sqlkey).then(({data}) => {
|
|
|
+ getInfoBySqlKey(this.sqlkey).then(({ data }) => {
|
|
|
// const htmlCode = data.dfHtmlTemplate;
|
|
|
// this.iframeUrl = "data:text/html;charset=utf-8," + encodeURI(htmlCode);
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
@@ -506,7 +519,7 @@ export default {
|
|
|
* 删除提示信息语句(标识)
|
|
|
* */
|
|
|
handleDelete(row) {
|
|
|
- console.log(this.ids)
|
|
|
+ console.log(this.ids);
|
|
|
let delIds = this.ids;
|
|
|
let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
|
if (row[primary] != undefined && row[primary] != null) {
|
|
@@ -532,8 +545,7 @@ export default {
|
|
|
this.$refs.mychild.pageList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- });
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
@@ -566,7 +578,7 @@ export default {
|
|
|
importTemplate() {
|
|
|
this.download(
|
|
|
process.env.VUE_APP_BASE_API3 +
|
|
|
- `dragform/common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.sqlkey}`,
|
|
|
+ `dragform/common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.sqlkey}`,
|
|
|
{},
|
|
|
`下载模版名称${new Date().getTime()}.xlsx`
|
|
|
);
|
|
@@ -582,10 +594,10 @@ export default {
|
|
|
this.$refs.upload.clearFiles();
|
|
|
this.$alert(
|
|
|
"<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
|
|
|
- response.msg +
|
|
|
- "</div>",
|
|
|
+ response.msg +
|
|
|
+ "</div>",
|
|
|
"导入结果",
|
|
|
- {dangerouslyUseHTMLString: true}
|
|
|
+ { dangerouslyUseHTMLString: true }
|
|
|
);
|
|
|
this.$refs.mychild.pageList({
|
|
|
limit: this.queryParams.pageSize,
|
|
@@ -630,7 +642,10 @@ export default {
|
|
|
};
|
|
|
|
|
|
// 后台接收需要是表中字段真实的名称,无所谓驼峰。
|
|
|
- updateData.conditionMap[this.templateInfo.template?.primaryKey] = this.defaultValue[camelCase(this.templateInfo.template?.primaryKey)];
|
|
|
+ updateData.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
+ this.defaultValue[
|
|
|
+ camelCase(this.templateInfo.template?.primaryKey)
|
|
|
+ ];
|
|
|
Object.keys(values).map((k) => {
|
|
|
updateData.commMap[k] = values[k];
|
|
|
});
|