|
@@ -41,7 +41,7 @@
|
|
|
:underline="false"
|
|
|
style="font-size: 12px; vertical-align: baseline"
|
|
|
@click="importTemplate"
|
|
|
- >下载模板
|
|
|
+ >下载模板
|
|
|
</el-link>
|
|
|
</div>
|
|
|
</el-upload>
|
|
@@ -65,7 +65,7 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
- >新增
|
|
|
+ >新增
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5" v-if="false">
|
|
@@ -76,7 +76,7 @@
|
|
|
size="mini"
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
- >修改
|
|
|
+ >修改
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -87,7 +87,7 @@
|
|
|
size="mini"
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
- >删除
|
|
|
+ >删除
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -96,7 +96,7 @@
|
|
|
icon="el-icon-upload2"
|
|
|
size="mini"
|
|
|
@click="upload.open = true"
|
|
|
- >导入
|
|
|
+ >导入
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
@@ -106,7 +106,7 @@
|
|
|
icon="el-icon-download"
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
- >导出
|
|
|
+ >导出
|
|
|
</el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar
|
|
@@ -121,13 +121,15 @@
|
|
|
:data="tableList"
|
|
|
@selection-change="handleSelectionChange"
|
|
|
row-key="id"
|
|
|
+ :cell-style="cellStyle"
|
|
|
>
|
|
|
<el-table-column
|
|
|
type="selection"
|
|
|
width="55"
|
|
|
reserve-selection
|
|
|
align="center"
|
|
|
- />
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
<!-- <span v-for="(key, val) in columns" :key="key">
|
|
|
<el-table-column :label="key" align="center" :prop="val" />
|
|
|
</span> -->
|
|
@@ -137,38 +139,88 @@
|
|
|
:label="item.value"
|
|
|
align="center"
|
|
|
:prop="item.key"
|
|
|
- />
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <!-- 存在字段样式或字典样式 -->
|
|
|
+ <template
|
|
|
+ v-if="
|
|
|
+ scope.row.styleFieldObj != undefined &&
|
|
|
+ scope.row.styleFieldObj[item.key]
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <!-- 字段样式 -->
|
|
|
+ <template v-if="scope.row.styleFieldObj[item.key].styleType == 1">
|
|
|
+ <!-- 一般字体样式 -->
|
|
|
+ <template
|
|
|
+ v-if="scope.row.styleFieldObj[item.key].fieldStyleType == 0"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ :style="`color:${
|
|
|
+ scope.row.styleFieldObj[item.key].fontColor
|
|
|
+ }`"
|
|
|
+ >{{ scope.row[item.key] }}</span
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ <!-- 标签字体样式 -->
|
|
|
+ <template
|
|
|
+ v-else-if="
|
|
|
+ scope.row.styleFieldObj[item.key].fieldStyleType == 1
|
|
|
+ "
|
|
|
+ >
|
|
|
+ <el-tag
|
|
|
+ :type="scope.row.styleFieldObj[item.key].tagType"
|
|
|
+ :effect="
|
|
|
+ scope.row.styleFieldObj[item.key].isTagFullBg
|
|
|
+ ? 'dark'
|
|
|
+ : 'light'
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ scope.row[item.key] }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <!-- 字典样式 -->
|
|
|
+ <template
|
|
|
+ v-else-if="scope.row.styleFieldObj[item.key].styleType == 2"
|
|
|
+ >
|
|
|
+ <span
|
|
|
+ v-if="
|
|
|
+ scope.row.styleFieldObj[item.key].listClass == '' ||
|
|
|
+ scope.row.styleFieldObj[item.key].listClass == 'default'
|
|
|
+ "
|
|
|
+ >{{ scope.row.styleFieldObj[item.key].dictLabel }}</span
|
|
|
+ >
|
|
|
+ <el-tag
|
|
|
+ v-else
|
|
|
+ :type="
|
|
|
+ scope.row.styleFieldObj[item.key].listClass == 'primary'
|
|
|
+ ? ''
|
|
|
+ : scope.row.styleFieldObj[item.key].listClass
|
|
|
+ "
|
|
|
+ >{{ scope.row.styleFieldObj[item.key].dictLabel }}</el-tag
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ <!-- 显示默认值 -->
|
|
|
+ <template v-else>
|
|
|
+ {{ scope.row[item.key] }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
+ v-show="isShowExcuteCol"
|
|
|
label="操作"
|
|
|
align="center"
|
|
|
class-name="small-padding fixed-width"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <el-dropdown>
|
|
|
- <el-button type="warning" plain size="small">
|
|
|
- 处理<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
- </el-button>
|
|
|
- <el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item>
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="text"
|
|
|
- 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>
|
|
|
+ <Menu
|
|
|
+ :row="scope.row"
|
|
|
+ v-for="btnObj in excuteBtnArr"
|
|
|
+ :key="btnObj.id"
|
|
|
+ :listAll="btnObj"
|
|
|
+ @excuteHandler="excuteHandler"
|
|
|
+ ></Menu>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -192,8 +244,10 @@
|
|
|
<k-form-build
|
|
|
class="formBuild"
|
|
|
ref="addFromRef"
|
|
|
+ :dynamicData="dynamicData"
|
|
|
:defaultValue="defaultValue"
|
|
|
@submit="tempSubBtn"
|
|
|
+ @change="formChangeHandler"
|
|
|
:value="jsonData"
|
|
|
/>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -212,16 +266,18 @@ import {
|
|
|
getInfoBySqlKey,
|
|
|
addTableData,
|
|
|
batchEdit,
|
|
|
- getStatisticList
|
|
|
+ getStatisticList,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
-import {getToken} from "@/utils/auth";
|
|
|
+import { listData } from "@/api/system/tenant/data";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
import Queryfrom from "@/views/tablelist/commonTable/queryfrom.vue";
|
|
|
-import {camelCase} from "@/utils";
|
|
|
-import {inputDisableComplete} from "@/utils/other";
|
|
|
+import { camelCase } from "@/utils";
|
|
|
+import { inputDisableComplete } from "@/utils/other";
|
|
|
+import Menu from "./BtnMenu.vue";
|
|
|
|
|
|
export default {
|
|
|
name: "listInfo",
|
|
|
- components: {Queryfrom},
|
|
|
+ components: { Queryfrom, Menu },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -260,7 +316,7 @@ export default {
|
|
|
// 是否更新已经存在的数据
|
|
|
updateSupport: 0,
|
|
|
// 设置上传的请求头部
|
|
|
- headers: {Authorization: "Bearer " + getToken()},
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
// 上传的地址
|
|
|
url: process.env.VUE_APP_BASE_API3 + "common/uploadData",
|
|
|
},
|
|
@@ -302,6 +358,14 @@ export default {
|
|
|
defaultValue: {},
|
|
|
// 统计card
|
|
|
statisticList: [],
|
|
|
+ // 样式表
|
|
|
+ styleList: [],
|
|
|
+ // 字典样式对象
|
|
|
+ dictStyleObj: {},
|
|
|
+ // 操作列 按钮数据
|
|
|
+ excuteBtnArr: [],
|
|
|
+ // 下拉框动态数据
|
|
|
+ dynamicData: {},
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -309,6 +373,20 @@ export default {
|
|
|
// 得到当前展示的table的唯一标识
|
|
|
this.tableKey = this.$route.query.tableKey;
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ tableList: {
|
|
|
+ handler(val) {
|
|
|
+ console.log(JSON.parse(JSON.stringify(val)), "tableListChange");
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ isShowExcuteCol() {
|
|
|
+ // return true;
|
|
|
+ return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
|
|
|
+ },
|
|
|
+ },
|
|
|
methods: {
|
|
|
/** 查询列表 */
|
|
|
getList(queryParams) {
|
|
@@ -316,16 +394,24 @@ export default {
|
|
|
// 序列化当前查询参数列表
|
|
|
queryParams && (this.queryParams.queryMap = queryParams.queryMap);
|
|
|
// 获取当前表单结构信息
|
|
|
- dragTableInfo({queryMap: {tableKey: this.tableKey}})
|
|
|
+ dragTableInfo({ queryMap: { tableKey: this.tableKey } })
|
|
|
.then((res) => {
|
|
|
// 得到当前模版信息 --- sql columns queryWhere
|
|
|
this.templateInfo = res.data.resultMap;
|
|
|
+ this.styleList = res.data.resultMap.style?.map((item) => {
|
|
|
+ item.styleField = camelCase(
|
|
|
+ item.styleField.replace(".", "_") || ""
|
|
|
+ );
|
|
|
+ return item;
|
|
|
+ });
|
|
|
+ // 获取操作列的按钮数据
|
|
|
+ this.excuteBtnArr = res.data.resultMap.button;
|
|
|
// console.log('res', this.templateInfo)
|
|
|
this.queryParams.orderByColumn =
|
|
|
res.data.resultMap.querySql.orderByColumn;
|
|
|
this.sortOrder = JSON.parse(res.data.resultMap.querySql.sortOrder);
|
|
|
// 根据拖拽时设置当前列表排列顺序
|
|
|
- this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC"
|
|
|
+ this.queryParams.isAsc = this.sortOrder ? "DESC" : "ASC";
|
|
|
this.tableName = this.templateInfo.template.dtTableName;
|
|
|
// 得到查询条件
|
|
|
this.queryFromWhere = res.data.resultMap.where;
|
|
@@ -342,27 +428,32 @@ export default {
|
|
|
this.queryParams.orderByColumn || ""
|
|
|
);
|
|
|
// 根据sql语句查询当前表数据
|
|
|
- console.log(this.queryParams)
|
|
|
- unionListTableData(this.queryParams).then((res) => {
|
|
|
+ unionListTableData(this.queryParams).then(async (res) => {
|
|
|
// console.log('unionListTableData');
|
|
|
this.tableList = [];
|
|
|
res.rows.forEach((item) => {
|
|
|
this.tableList.push(item.resultMap);
|
|
|
});
|
|
|
// 驼峰转换
|
|
|
- this.tableList = this.tableList.map((item) => {
|
|
|
+ let tempTableList = [];
|
|
|
+ tempTableList = this.tableList.map((item) => {
|
|
|
let kv = {};
|
|
|
for (let itemKey in item) {
|
|
|
kv[camelCase(itemKey)] = item[itemKey];
|
|
|
}
|
|
|
return kv;
|
|
|
});
|
|
|
+ // this.setDictStyleData().then(() => {
|
|
|
+ // this.tableList = this.setFieldStyleData(this.tableList);
|
|
|
+ // });
|
|
|
+ this.tableList = await this.setFieldStyleData(tempTableList);
|
|
|
this.total = res.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
|
|
|
// 查询统计信息
|
|
|
getStatisticList({
|
|
|
+<<<<<<< HEAD
|
|
|
queryMap: {
|
|
|
tableKey: this.templateInfo.template.tableKey,
|
|
|
queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue
|
|
@@ -371,6 +462,12 @@ export default {
|
|
|
// console.log('getStatisticList', res);
|
|
|
this.statisticList = res.data
|
|
|
})
|
|
|
+=======
|
|
|
+ queryMap: { tableKey: this.templateInfo.template.tableKey },
|
|
|
+ }).then((res) => {
|
|
|
+ this.statisticList = res.data;
|
|
|
+ });
|
|
|
+>>>>>>> 0b02a879572de5f5533cacbfea997e10bc594762
|
|
|
});
|
|
|
},
|
|
|
isUpperCase(char) {
|
|
@@ -440,9 +537,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
|
|
|
);
|
|
|
},
|
|
@@ -472,11 +569,15 @@ export default {
|
|
|
handleAdd(row) {
|
|
|
// this.reset();
|
|
|
this.defaultValue = {};
|
|
|
- getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({data}) => {
|
|
|
+ getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
|
this.$message.error("当前表格未绑定表单!");
|
|
|
return;
|
|
|
}
|
|
|
+ if (data.dfFormSql) {
|
|
|
+ let dynamicData = JSON.parse(data.dfFormSql);
|
|
|
+ Object.assign(this.dynamicData, dynamicData);
|
|
|
+ }
|
|
|
this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
this.open = true;
|
|
|
this.title = "添加信息";
|
|
@@ -487,13 +588,38 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ longestCommonSubstring(strs) {
|
|
|
+ if (!strs || strs.includes("")) return "";
|
|
|
+ let str1_Length = strs[0].length;
|
|
|
+ let str_Nums = strs.length;
|
|
|
+ let flag = 0;
|
|
|
+ for (let i = 0; i < str1_Length && flag == 0; i++) {
|
|
|
+ let char = strs[0][i];
|
|
|
+ for (var j = 1; j < str_Nums; j++) {
|
|
|
+ if (char !== strs[j][i] || i == strs[j].length) {
|
|
|
+ return strs[1].substring(0, i);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return strs[0];
|
|
|
+ },
|
|
|
+
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({data}) => {
|
|
|
+ console.log(row);
|
|
|
+ getInfoBySqlKey(this.templateInfo.template.sqlKey).then(({ data }) => {
|
|
|
if (!data || !data.dfVueTemplate) {
|
|
|
this.$message.error("当前表格未绑定表单!");
|
|
|
return;
|
|
|
}
|
|
|
+ // let fieldList = Object.keys(row);
|
|
|
+ // let tableName = this.longestCommonSubstring(fieldList);
|
|
|
+ // fieldList.forEach((field) => {
|
|
|
+ // let realField = field.replace(tableName, "");
|
|
|
+ // realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
+ // row[realField] = row[field];
|
|
|
+ // });
|
|
|
+ this.addRealFieldName(row);
|
|
|
Object.assign(this.defaultValue, row);
|
|
|
this.jsonData = JSON.parse(data.dfVueTemplate);
|
|
|
this.open = true;
|
|
@@ -517,6 +643,16 @@ export default {
|
|
|
this.form.password = "";
|
|
|
});
|
|
|
},
|
|
|
+ // 添加真正的字段名
|
|
|
+ addRealFieldName(row) {
|
|
|
+ let fieldList = Object.keys(row);
|
|
|
+ let tableName = this.longestCommonSubstring(fieldList);
|
|
|
+ fieldList.forEach((field) => {
|
|
|
+ let realField = field.replace(tableName, "");
|
|
|
+ realField = realField[0].toLocaleLowerCase() + realField.substring(1);
|
|
|
+ row[realField] = row[field];
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
/** 提交按钮 */
|
|
|
submitForm: function () {
|
|
@@ -545,6 +681,7 @@ export default {
|
|
|
handleDelete(row) {
|
|
|
let delIds = this.ids;
|
|
|
let primary = camelCase(this.templateInfo.template?.primaryKey);
|
|
|
+ this.addRealFieldName(row);
|
|
|
if (row[primary] != undefined && row[primary] != null) {
|
|
|
delIds = [];
|
|
|
delIds.push(row[primary]);
|
|
@@ -568,8 +705,7 @@ export default {
|
|
|
this.$refs.mychild.pageList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- });
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
@@ -602,7 +738,7 @@ export default {
|
|
|
importTemplate() {
|
|
|
this.download(
|
|
|
process.env.VUE_APP_BASE_API3 +
|
|
|
- `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
|
|
|
+ `common/exportTemplate?tableName=${this.tableName}&sqlkey=${this.templateInfo.template.sqlKey}`,
|
|
|
{},
|
|
|
`下载模版名称${new Date().getTime()}.xlsx`
|
|
|
);
|
|
@@ -618,10 +754,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,
|
|
@@ -669,7 +805,7 @@ export default {
|
|
|
updateData.conditionMap[this.templateInfo.template?.primaryKey] =
|
|
|
this.defaultValue[
|
|
|
camelCase(this.templateInfo.template?.primaryKey)
|
|
|
- ];
|
|
|
+ ];
|
|
|
Object.keys(values).map((k) => {
|
|
|
updateData.commMap[k] = values[k];
|
|
|
});
|
|
@@ -695,7 +831,6 @@ export default {
|
|
|
.catch((res) => {
|
|
|
this.$modal.msgError("表单校验失败,请规范填写数据");
|
|
|
});
|
|
|
-
|
|
|
},
|
|
|
// 使用提交数据类型的按钮获取数据
|
|
|
tempSubBtn(getData) {
|
|
@@ -707,6 +842,160 @@ export default {
|
|
|
console.log("验证未通过,获取失败");
|
|
|
});
|
|
|
},
|
|
|
+ // 判断是否生效行样式
|
|
|
+ cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
|
+ let rowStyleList = this.styleList.filter((item) => item.styleType == 0);
|
|
|
+ if (!rowStyleList.length) return "";
|
|
|
+ let mainTableName = this.templateInfo.querySql.tableAlias; //主表名
|
|
|
+ for (let i = 0; i < rowStyleList.length; i++) {
|
|
|
+ let item = rowStyleList[i];
|
|
|
+ let judgeRes = this.determineCondition(item.styleCondtion, row);
|
|
|
+ if (judgeRes) {
|
|
|
+ let styleCode = JSON.parse(item.styleCode);
|
|
|
+ return `background-color:${styleCode.rowBgColor};`;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取生效条件组结果
|
|
|
+ determineCondition(conditionStr, row) {
|
|
|
+ let conditionList = JSON.parse(conditionStr);
|
|
|
+ if (!conditionList.length) return false;
|
|
|
+ return conditionList.every((item) => this.judgeOneCondition(item, row));
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取单个判断条件结果
|
|
|
+ judgeOneCondition(item, row) {
|
|
|
+ let fullField = camelCase(item.tableName + "_" + item.fieldName);
|
|
|
+ switch (item.condition) {
|
|
|
+ case 1:
|
|
|
+ return row[fullField] > item.flagValue;
|
|
|
+ case 2:
|
|
|
+ return row[fullField] < item.flagValue;
|
|
|
+ case 3:
|
|
|
+ return row[fullField] == item.flagValue;
|
|
|
+ case 4:
|
|
|
+ return row[fullField] >= item.flagValue;
|
|
|
+ case 5:
|
|
|
+ return row[fullField] <= item.flagValue;
|
|
|
+ default:
|
|
|
+ return true; //默认为true
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 设置表格字段样式
|
|
|
+ async setFieldStyleData(tableList) {
|
|
|
+ let fieldConditionList = this.styleList.filter(
|
|
|
+ (item) => item.styleType == 1 || item.styleType == 2
|
|
|
+ );
|
|
|
+ if (!fieldConditionList.length) return tableList;
|
|
|
+ let res = await this.setDictStyleData();
|
|
|
+ console.log(res);
|
|
|
+ this.dictStyleObj = res;
|
|
|
+ // console.log(JSON.parse(JSON.stringify(this.dictStyleObj)));
|
|
|
+ tableList.forEach((row) => {
|
|
|
+ // if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
+ for (let i = 0; i < fieldConditionList.length; i++) {
|
|
|
+ let item = fieldConditionList[i];
|
|
|
+ if (item.styleType == 1) {
|
|
|
+ //字段样式
|
|
|
+ let judgeRes = this.determineCondition(item.styleCondtion, row);
|
|
|
+ if (judgeRes) {
|
|
|
+ let styleCode = JSON.parse(item.styleCode);
|
|
|
+ if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
+ row.styleFieldObj[item.styleField] = {
|
|
|
+ styleType: item.styleType,
|
|
|
+ fieldStyleType: styleCode.fieldStyleType,
|
|
|
+ fontColor: styleCode.fontColor,
|
|
|
+ isTagFullBg: styleCode.isTagFullBg,
|
|
|
+ tagType: styleCode.tagType,
|
|
|
+ };
|
|
|
+ // row.styleField = item.styleField; //样式生效字段
|
|
|
+ // row.styleType = item.styleType; //0:行样式 1:字段样式 2:字典样式
|
|
|
+ // row.fieldStyleType = styleCode.fieldStyleType; //0:文本 1:标签
|
|
|
+ // row.fontColor = styleCode.fontColor;
|
|
|
+ // row.isTagFullBg = styleCode.isTagFullBg; //true/false
|
|
|
+ // row.tagType = styleCode.tagType; //string
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //字典样式
|
|
|
+ let dicStyle = this.dictStyleObj[item.styleField]?.find((dict) => {
|
|
|
+ return dict.dictValue == row[item.styleField];
|
|
|
+ });
|
|
|
+ if (dicStyle) {
|
|
|
+ if (!row.styleFieldObj) row.styleFieldObj = {};
|
|
|
+ row.styleFieldObj[item.styleField] = dicStyle; //设置该字段应该显示的字典样式
|
|
|
+ row.styleFieldObj[item.styleField].styleType = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return tableList;
|
|
|
+ },
|
|
|
+
|
|
|
+ //设置表格字典相关数据
|
|
|
+ setDictStyleData() {
|
|
|
+ let fieldConditionList = this.styleList.filter(
|
|
|
+ (item) => item.styleType == 2
|
|
|
+ );
|
|
|
+ if (!fieldConditionList.length) return;
|
|
|
+
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ fieldConditionList.forEach((item) => {
|
|
|
+ try {
|
|
|
+ let temp = {};
|
|
|
+ listData({
|
|
|
+ isEnablePaging: false,
|
|
|
+ dictType: item.styleCondtion,
|
|
|
+ }).then((res) => {
|
|
|
+ temp[item.styleField] = res.rows;
|
|
|
+ resolve(temp);
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ reject(error);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 内链页面跳转
|
|
|
+ routerHandler(link, type) {
|
|
|
+ console.log(link);
|
|
|
+ if (type == "3") {
|
|
|
+ this.$router.push(link);
|
|
|
+ } else {
|
|
|
+ window.open("http://" + link, "_blank");
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // 操作列回调
|
|
|
+ excuteHandler(btnData, row) {
|
|
|
+ console.log(btnData, row);
|
|
|
+ let { btnType, btnParams } = btnData;
|
|
|
+ switch (
|
|
|
+ btnType //3:内链 6:目录 7:外链 8:修改 9:删除
|
|
|
+ ) {
|
|
|
+ case "3":
|
|
|
+ this.routerHandler(btnParams, btnType);
|
|
|
+ break;
|
|
|
+ case "7":
|
|
|
+ this.routerHandler(btnParams, btnType);
|
|
|
+ break;
|
|
|
+ case "8":
|
|
|
+ this.handleUpdate(row);
|
|
|
+ break;
|
|
|
+ case "9":
|
|
|
+ this.handleDelete(row);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ // k-form-build表单变化回调
|
|
|
+ formChangeHandler(value, label) {
|
|
|
+ console.log(value, label);
|
|
|
+ },
|
|
|
},
|
|
|
};
|
|
|
</script>
|