|
@@ -2,32 +2,34 @@
|
|
|
<div class="bigBox">
|
|
|
<div class="info">
|
|
|
<p class="tt">基础信息</p>
|
|
|
- <div v-for="item in infoData[0]" :key="item.title">
|
|
|
- <span class="titlestyle">{{ item.value }}</span>
|
|
|
- <span
|
|
|
- class="infostyle"
|
|
|
- v-for="(val, index) in infoData[1]"
|
|
|
- :key="index"
|
|
|
- >{{ val[item.key] }}</span
|
|
|
- >
|
|
|
+ <div
|
|
|
+ class="base-info-item"
|
|
|
+ v-for="{ label, prop, value } in infoData"
|
|
|
+ :key="prop"
|
|
|
+ >
|
|
|
+ <span class="titlestyle">{{ label }}</span>
|
|
|
+ <span class="infostyle">{{ value }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="tableBox">
|
|
|
<div class="top">
|
|
|
- <div class="left" v-if="tableCount[0]">
|
|
|
- <p>{{ tableCount[0].statisticTitle }}</p>
|
|
|
- <i>{{ tableCount[0].result }}</i>
|
|
|
+ <div class="left" v-if="topTableCountInfo.length">
|
|
|
+ <p>{{ topTableCountInfo[0].title }}</p>
|
|
|
+ <i>{{
|
|
|
+ getDictLabel(topTableCountInfo[0].value, dict.type.node_task_status)
|
|
|
+ }}</i>
|
|
|
</div>
|
|
|
- <div class="right">
|
|
|
+ <!-- <div class="right">
|
|
|
<p>是否外协</p>
|
|
|
<el-checkbox v-model="checked"></el-checkbox>
|
|
|
- </div>
|
|
|
+ </div> -->
|
|
|
</div>
|
|
|
<!-- 按钮组 -->
|
|
|
<el-button-group>
|
|
|
<el-button v-for="(item, index) in controlBtnArr" :key="index">
|
|
|
+ <!-- :loading="isLoading" -->
|
|
|
<template>
|
|
|
- <span @click="clickHandler(item, row)"
|
|
|
+ <span @click="clickHandler(item, index)"
|
|
|
><svg-icon
|
|
|
v-if="item.btnIcon"
|
|
|
class="pre-icon"
|
|
@@ -42,37 +44,47 @@
|
|
|
<el-form ref="tableform" :model="tableDataForm">
|
|
|
<el-table
|
|
|
border
|
|
|
- :data="tableData[1].data"
|
|
|
+ :data="tableData"
|
|
|
style="width: 100%; margin-bottom: 20px"
|
|
|
>
|
|
|
<el-table-column
|
|
|
- v-for="item in tableData[0].column"
|
|
|
- :prop="item.key"
|
|
|
- :label="item.value"
|
|
|
- :key="item.value"
|
|
|
+ v-for="item in columns"
|
|
|
+ :prop="item.prop"
|
|
|
+ :label="item.label"
|
|
|
+ :key="item.prop"
|
|
|
width="180"
|
|
|
+ align="center"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
<el-input
|
|
|
- :v-if="scope.row[item.key]"
|
|
|
- v-model="scope.row[item.key]"
|
|
|
+ v-if="!scope.row.id"
|
|
|
+ v-model="scope.row[item.prop]"
|
|
|
></el-input>
|
|
|
+ <span v-else>
|
|
|
+ {{ scope.row[item.prop] }}
|
|
|
+ </span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- v-if="isShowExcuteCol"
|
|
|
label="操作"
|
|
|
align="center"
|
|
|
class-name="small-padding fixed-width"
|
|
|
>
|
|
|
<template slot-scope="scope">
|
|
|
- <Menu
|
|
|
+ <!-- <Menu
|
|
|
:row="scope.row"
|
|
|
v-for="btnObj in excuteBtnArr"
|
|
|
:key="btnObj.id"
|
|
|
:listAll="btnObj"
|
|
|
@excuteHandler="excuteHandler"
|
|
|
- ></Menu>
|
|
|
+ ></Menu> -->
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ size="small"
|
|
|
+ @click="deleteHandler(scope.$index, scope.row)"
|
|
|
+ >
|
|
|
+ 删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -80,7 +92,7 @@
|
|
|
<div>
|
|
|
<b>统计信息 </b>
|
|
|
<span v-for="(item, index) in subCount" :key="index"
|
|
|
- >{{ item.statisticTitle }}: {{ item.result }}</span
|
|
|
+ >{{ item.title }}: {{ item.value }}</span
|
|
|
>
|
|
|
</div>
|
|
|
|
|
@@ -108,6 +120,10 @@ import {
|
|
|
btnCommonApi,
|
|
|
dragTableInfo,
|
|
|
unionListTableData,
|
|
|
+ getStatisticList,
|
|
|
+ addTableData,
|
|
|
+ delTableData,
|
|
|
+ batchEdit,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
import { camelCase } from "@/utils";
|
|
|
import Menu from "@/views/tablelist/commonTable/BtnMenu.vue";
|
|
@@ -115,17 +131,33 @@ import {
|
|
|
getProcessPopupTableInfo,
|
|
|
getProcessPopupTableList,
|
|
|
} from "@/api/dragform/form"; //新的弹窗数据请求
|
|
|
+import dict from "@/utils/dict";
|
|
|
|
|
|
export default {
|
|
|
components: { Menu },
|
|
|
+ dicts: ["node_task_status"],
|
|
|
data() {
|
|
|
return {
|
|
|
+ isLoading: false,
|
|
|
+ conditions: {}, //查询条件
|
|
|
+ // 当前行信息
|
|
|
+ row: {},
|
|
|
+ groupKey: "",
|
|
|
// 基础信息行数据
|
|
|
infoData: [],
|
|
|
listInfo: {},
|
|
|
// 是否外协
|
|
|
checked: false,
|
|
|
+ topTableCountInfo: [], //上部状态统计信息
|
|
|
+ topInfo: {},
|
|
|
+ topData: {},
|
|
|
+ // 表格数据
|
|
|
tableData: [],
|
|
|
+ columns: [],
|
|
|
+ tableBtnInfo: {},
|
|
|
+ subTableName: "",
|
|
|
+ subTableInfo: {},
|
|
|
+ subCount: [], //表格统计数据
|
|
|
// 动态增加表格数据
|
|
|
editData: [],
|
|
|
tableDataForm: {},
|
|
@@ -148,7 +180,6 @@ export default {
|
|
|
// tableCondition: ''
|
|
|
},
|
|
|
},
|
|
|
- columns: [],
|
|
|
// 排序方式 默认降序
|
|
|
sortOrder: true,
|
|
|
tableName: "",
|
|
@@ -165,7 +196,7 @@ export default {
|
|
|
controlBtnArr: [],
|
|
|
};
|
|
|
},
|
|
|
- props: ["groupKey", "rowobj", "tableCount", "subCount", "subTableName"],
|
|
|
+ props: ["rowobj", "tableCount"],
|
|
|
computed: {
|
|
|
isShowExcuteCol() {
|
|
|
return !this.excuteBtnArr?.every((arr) => arr.children.length == 0);
|
|
@@ -177,33 +208,166 @@ export default {
|
|
|
let obj = {
|
|
|
// id:'',
|
|
|
};
|
|
|
+ this.columns.forEach((item) => {
|
|
|
+ obj[item.prop] = "";
|
|
|
+ });
|
|
|
+ console.log(obj);
|
|
|
this.addListData.push(obj);
|
|
|
- this.tableData[1].data.push(obj);
|
|
|
+ this.tableData.push(obj);
|
|
|
+ },
|
|
|
+ // 校验新增数据非空
|
|
|
+ getValidateRes(addListData) {
|
|
|
+ let hasEmpty = addListData.some((item) => {
|
|
|
+ return Object.values(item).some((val) => val == "");
|
|
|
+ });
|
|
|
+ return hasEmpty;
|
|
|
},
|
|
|
// 保存
|
|
|
saveBtnHandler() {
|
|
|
- console.log(this.addListData);
|
|
|
+ let addCondition = {
|
|
|
+ task_key: this.row.bpmExecuteProcessTaskKey,
|
|
|
+ task_node_key: this.row.benTaskNodeKey,
|
|
|
+ };
|
|
|
+ // console.log(this.conditions);
|
|
|
+ // for (const key in this.conditions) {
|
|
|
+ // addCondition[key.replace("#{", "").split(".")[1]] =
|
|
|
+ // this.conditions[key];
|
|
|
+ // }
|
|
|
+ let addListData = this.tableData.filter((item) => !item.id);
|
|
|
+ let validate = this.getValidateRes(addListData);
|
|
|
+ if (validate) {
|
|
|
+ this.$message.warning("请完善表单字段!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ addListData.forEach((item) => {
|
|
|
+ Object.assign(item, addCondition);
|
|
|
+ });
|
|
|
+
|
|
|
let data = {
|
|
|
- addListMap: this.addListData,
|
|
|
+ addListMap: addListData,
|
|
|
basicMap: {
|
|
|
- btnType: 10,
|
|
|
+ // btnType: "INSERT",
|
|
|
tableName: this.subTableName,
|
|
|
- visible: true,
|
|
|
+ // visible: true,
|
|
|
},
|
|
|
commMap: {},
|
|
|
conditionMap: {},
|
|
|
};
|
|
|
- btnCommonApi(data).then((res) => {
|
|
|
+ // btnCommonApi(data).then((res) => {
|
|
|
+ // console.log("保存", res);
|
|
|
+ // });
|
|
|
+ addTableData(data).then((res) => {
|
|
|
console.log("保存", res);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.reloadInfo();
|
|
|
+ this.$message.success("保存成功!");
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常,请稍后保存");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 设置基础信息-表格信息
|
|
|
+ setBaseInfo(baseObj, dataObj) {
|
|
|
+ let tempObj = JSON.parse(baseObj.dtColumnNameEcho);
|
|
|
+ let Keys = tempObj.map((item) => {
|
|
|
+ return {
|
|
|
+ prop: Object.keys(item)[0],
|
|
|
+ label: item[Object.keys(item)[0]],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ this.infoData = Keys.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ value: dataObj.resultMap[item.prop],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 设置表格数据
|
|
|
+ async setTableData(tableInfo, tableData) {
|
|
|
+ let { dtColumnNameEcho, dragTableBtnList, tableKey, dtTableName } =
|
|
|
+ tableInfo;
|
|
|
+ this.subTableInfo = tableInfo;
|
|
|
+ this.tableData =
|
|
|
+ tableData.map((item) => {
|
|
|
+ return item.resultMap;
|
|
|
+ }) || [];
|
|
|
+ console.log(this.tableData);
|
|
|
+ this.subTableName = dtTableName;
|
|
|
+ console.log(this.subTableName);
|
|
|
+ this.tableBtnInfo = dragTableBtnList;
|
|
|
+ this.columns = JSON.parse(dtColumnNameEcho)?.map((item) => {
|
|
|
+ let prop = Object.keys(item)[0];
|
|
|
+ return {
|
|
|
+ prop,
|
|
|
+ label: item[prop],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let res = await this.getStatisticsData(tableKey);
|
|
|
+ this.subCount = res.map((item) => {
|
|
|
+ return {
|
|
|
+ title: item.statisticTitle,
|
|
|
+ value: item.result,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 设置顶部状态数据
|
|
|
+ setTopData(baseObj, dataObj) {
|
|
|
+ let { dtColumnNameEcho, dragTableBtnList, tableKey } = baseObj;
|
|
|
+ this.controlBtnArr = dragTableBtnList[0].children;
|
|
|
+ let temp = JSON.parse(dtColumnNameEcho) || [];
|
|
|
+ this.topTableCountInfo = temp.map((item) => {
|
|
|
+ let prop = camelCase(Object.keys(item)[0]);
|
|
|
+ return {
|
|
|
+ prop,
|
|
|
+ title: item[Object.keys(item)[0]],
|
|
|
+ value: dataObj.resultMap[prop] || "未知状态",
|
|
|
+ };
|
|
|
});
|
|
|
+ this.topInfo = baseObj;
|
|
|
+ this.topData = dataObj.resultMap;
|
|
|
+ },
|
|
|
+ // 获取统计数据
|
|
|
+ async getStatisticsData(tableKey) {
|
|
|
+ try {
|
|
|
+ let res = await getStatisticList({
|
|
|
+ queryMap: { tableKey, ...this.conditions },
|
|
|
+ });
|
|
|
+ if (res.code == 200) {
|
|
|
+ console.log(res);
|
|
|
+ return res.data;
|
|
|
+ } else {
|
|
|
+ throw new Error();
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("网络异常,获取数据失败");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ reloadInfo() {
|
|
|
+ let { row, groupKey } = this;
|
|
|
+ this.getLists({ row, groupKey });
|
|
|
},
|
|
|
// 获取弹窗信息
|
|
|
async getLists(payload) {
|
|
|
// let res = await dragGroupTableInfo({ queryMap: { groupKey: groupKey } });
|
|
|
- let resTableInfo = await getProcessPopupTableInfo({ queryMap: payload });
|
|
|
- let resTableData = await getProcessPopupTableList({ queryMap: payload });
|
|
|
+ this.addListData = [];
|
|
|
+ this.row = payload.row;
|
|
|
+ this.groupKey = payload.groupKey;
|
|
|
+ let resTableInfo = await getProcessPopupTableInfo({
|
|
|
+ queryMap: { groupKey: payload.groupKey },
|
|
|
+ });
|
|
|
+
|
|
|
+ if (resTableInfo.code == 200) {
|
|
|
+ let res = await this.getTableData(resTableInfo.data, payload.row);
|
|
|
+ let { template } = resTableInfo.data.resultMap;
|
|
|
+ this.setBaseInfo(template[0], res[0][0]); //设置基础信息
|
|
|
+ this.setTableData(template[1], res[1]);
|
|
|
+ this.setTopData(template[2], res[2][0]);
|
|
|
+ }
|
|
|
+
|
|
|
// 获取表格tablekey 和 sort
|
|
|
- console.log(resTableData);
|
|
|
+ console.log(resTableInfo);
|
|
|
+ return;
|
|
|
this.tableLists = JSON.parse(res.msg);
|
|
|
|
|
|
this.tableLists.forEach(async (item) => {
|
|
@@ -242,6 +406,34 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // 获取所有表格数据
|
|
|
+ async getTableData(tableInfo, row) {
|
|
|
+ let queryMap = {
|
|
|
+ groupKey: this.groupKey,
|
|
|
+ },
|
|
|
+ conditionKeys = [];
|
|
|
+ conditionKeys = tableInfo.resultMap?.condition.map((item) =>
|
|
|
+ camelCase(item.replace("#{", "").replace(".", "_"))
|
|
|
+ );
|
|
|
+ this.conditions = {};
|
|
|
+ conditionKeys.forEach((item, index) => {
|
|
|
+ queryMap[tableInfo.resultMap?.condition[index]] = row[item];
|
|
|
+ this.conditions[tableInfo.resultMap?.condition[index]] = row[item];
|
|
|
+ });
|
|
|
+
|
|
|
+ try {
|
|
|
+ let resTableData = await getProcessPopupTableList({
|
|
|
+ queryMap,
|
|
|
+ });
|
|
|
+ if (resTableData.code == 200) {
|
|
|
+ console.log("resTableData", resTableData);
|
|
|
+ return resTableData.data.resultMap.result;
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ this.$message.error("网络异常");
|
|
|
+ }
|
|
|
+ },
|
|
|
// 获取基础信息 表头数据
|
|
|
async getTableHandle(res, sort) {
|
|
|
this.columns = [];
|
|
@@ -336,6 +528,40 @@ export default {
|
|
|
return this.tableList;
|
|
|
}
|
|
|
},
|
|
|
+ // 删除回调
|
|
|
+ async deleteHandler(index, row) {
|
|
|
+ if (row.id) {
|
|
|
+ let { primaryKey } = this.subTableInfo;
|
|
|
+ let ids = [];
|
|
|
+ ids.push(row[camelCase(primaryKey)]);
|
|
|
+ let payload = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: this.subTableName,
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ // id: delIds,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ payload.conditionMap[camelCase(primaryKey)] = ids;
|
|
|
+ // 发送请求 删除数据
|
|
|
+ this.$modal
|
|
|
+ .confirm('是否确认删除"' + ids + '"的数据项?')
|
|
|
+ .then(function () {
|
|
|
+ return delTableData(payload);
|
|
|
+ // return btnCommonApi(data);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ // 调用子组件查询方法 目的是携带上子组件中的查询参数
|
|
|
+ // this.$refs.mychild.pageList();
|
|
|
+ this.reloadInfo();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
+ // let res = await delTableData(payload);
|
|
|
+ } else {
|
|
|
+ this.tableData.splice(index, 1);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 处理列表信息
|
|
|
columnsHandler(columns) {
|
|
|
let resArr = [];
|
|
@@ -388,7 +614,54 @@ export default {
|
|
|
console.log(row);
|
|
|
},
|
|
|
// 按钮组点击
|
|
|
- clickHandler(item, row) {},
|
|
|
+ async clickHandler(btnData) {
|
|
|
+ this.isLoading = true;
|
|
|
+ let { primaryKey, dtName } = this.topInfo;
|
|
|
+ let { btnParams, btnType, btnKey } = btnData;
|
|
|
+ let payload = {
|
|
|
+ basicMap: {
|
|
|
+ tableName: dtName,
|
|
|
+ // btnKey: btnData.btnKey,
|
|
|
+ },
|
|
|
+ conditionMap: {},
|
|
|
+ commMap: {},
|
|
|
+ // btnParametersMap: {},
|
|
|
+ };
|
|
|
+ payload.conditionMap[primaryKey] = this.topData[primaryKey];
|
|
|
+ if (btnParams) {
|
|
|
+ let tempParams = JSON.parse(btnParams)[0];
|
|
|
+ payload.commMap[tempParams.fieldName] = tempParams.fieldValue;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ let res = await batchEdit(payload);
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message.success("修改成功!");
|
|
|
+ this.reloadInfo();
|
|
|
+ } else {
|
|
|
+ this.$message.error("网络异常请稍后再试");
|
|
|
+ }
|
|
|
+ this.isLoading = false;
|
|
|
+ } catch (error) {
|
|
|
+ this.isLoading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取字典对应label
|
|
|
+ getDictLabel(value, dictLsit = []) {
|
|
|
+ // value += "";
|
|
|
+ return dictLsit.find((item) => {
|
|
|
+ return item.value == value;
|
|
|
+ })?.label;
|
|
|
+ },
|
|
|
+ // 获取状态等数据
|
|
|
+ getComposeFormData() {
|
|
|
+ let res = {};
|
|
|
+ console.log(this.dict.type.node_task_status);
|
|
|
+ let currentStatus = this.dict.type.node_task_status.filter(
|
|
|
+ (item) => item.value == this.topTableCountInfo[0].value
|
|
|
+ );
|
|
|
+ res.isSuccess = currentStatus[0].raw.listClass == "success";
|
|
|
+ return res;
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
// this.getLists()
|
|
@@ -426,7 +699,7 @@ export default {
|
|
|
border-radius: 20px;
|
|
|
}
|
|
|
.infostyle {
|
|
|
- background-color: #ebedf2;
|
|
|
+ // background-color: #ebedf2;
|
|
|
color: #e84e95;
|
|
|
}
|
|
|
}
|
|
@@ -489,4 +762,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+.base-info-item {
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+}
|
|
|
</style>
|