|
@@ -63,7 +63,9 @@
|
|
|
<el-table-column prop="fieldDescription" label="字段描述">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <el-form-item size="normal" prop="fieldDescription"> -->
|
|
|
- <el-input v-model="scope.row.fieldDescription"></el-input>
|
|
|
+ <input :class="{isNullDesc : scope.row.fieldDescription == ''&& scope.row.isShow && isInputInvalid ? true : false, ipt:true}" v-model="scope.row.fieldDescription" />
|
|
|
+
|
|
|
+ <!-- <el-input v-model="scope.row.fieldDescription" /> -->
|
|
|
<!-- </el-form-item> -->
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -168,6 +170,11 @@
|
|
|
<el-switch v-model="scope.row.isExport"> </el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <!-- <el-table-column prop="isCount" label="是否统计">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-switch v-model="scope.row.isCount"> </el-switch>
|
|
|
+ </template>
|
|
|
+ </el-table-column> -->
|
|
|
<!-- <el-table-column
|
|
|
label="操作"
|
|
|
align="center"
|
|
@@ -288,7 +295,7 @@
|
|
|
class="inline-large-button"
|
|
|
icon="el-icon-plus"
|
|
|
size="mini"
|
|
|
- @click="isShowAddData = true"
|
|
|
+ @click="addDataDialog"
|
|
|
>
|
|
|
添加数据字段
|
|
|
</el-button>
|
|
@@ -296,38 +303,45 @@
|
|
|
<el-button size="mini" type="primary" @click=countHandle>确定统计</el-button>
|
|
|
|
|
|
<el-table
|
|
|
- :data="datacountTable"
|
|
|
+ :data="dragTableStatisticList"
|
|
|
border
|
|
|
class="mb10"
|
|
|
style="width: 100%">
|
|
|
<el-table-column
|
|
|
- prop="number"
|
|
|
+ type="index"
|
|
|
label="序号"
|
|
|
- width="50">
|
|
|
+ width="50"
|
|
|
+ class-name="allowDrag"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="statisticTitle"
|
|
|
+ label="统计标题"
|
|
|
+ width="83">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="datafield"
|
|
|
- label="数据字段"
|
|
|
+ prop="statisticField"
|
|
|
+ label="统计数据"
|
|
|
width="80">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="type"
|
|
|
- label="类型"
|
|
|
+ prop="statisticType"
|
|
|
+ label="统计类型"
|
|
|
width="50">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
+ <!-- <el-table-column
|
|
|
prop="statuscode"
|
|
|
label="状态码"
|
|
|
width="70">
|
|
|
- </el-table-column>
|
|
|
+ </el-table-column> -->
|
|
|
<el-table-column
|
|
|
- prop="title"
|
|
|
- label="标题"
|
|
|
- width="83">
|
|
|
+ prop="statisticDescription"
|
|
|
+ label="统计描述"
|
|
|
+ width="150">
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="description"
|
|
|
- label="描述"
|
|
|
+ prop="statisticObject"
|
|
|
+ label="统计对象"
|
|
|
width="150">
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -501,42 +515,45 @@
|
|
|
<el-form
|
|
|
label-width="100px"
|
|
|
:model="dataCountFormData">
|
|
|
- <el-form-item label="数据字段">
|
|
|
+ <el-form-item label="统计标题" prop="statisticTitle">
|
|
|
+ <el-input v-model="dataCountFormData.statisticTitle"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="统计数据">
|
|
|
<el-select
|
|
|
- v-model="dataCountFormData.datafield"
|
|
|
- placeholder="请选择数据字段">
|
|
|
+ v-model="dataCountFormData.statisticField"
|
|
|
+ placeholder="请选择统计字段">
|
|
|
<el-option
|
|
|
v-for="item in dataArr"
|
|
|
:key="item.id"
|
|
|
:label="item.fieldName"
|
|
|
:value="item.fieldName">
|
|
|
- </el-option>
|
|
|
+ </el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="类型">
|
|
|
+ <el-form-item label="统计类型">
|
|
|
<el-select
|
|
|
- v-model="dataCountFormData.type"
|
|
|
- placeholder="请选择类型">
|
|
|
- <el-option label="数量" value="num"></el-option>
|
|
|
- <el-option label="状态" value="status"></el-option>
|
|
|
+ v-model="dataCountFormData.statisticType"
|
|
|
+ placeholder="请选择统计类型">
|
|
|
+ <el-option v-for="item in dataType" :key="item.dictCode" :label="item.dictLabel" :value="item.dictLabel"></el-option>
|
|
|
+ <!-- <el-option label="状态" value="status"></el-option> -->
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="状态码" v-show="dataCountFormData.type === 'status' ">
|
|
|
+<!--
|
|
|
+ <el-form-item label="状态码" v-show="dataCountFormData.statisticType === 'status' ">
|
|
|
<el-select
|
|
|
v-model="dataCountFormData.statuscode"
|
|
|
placeholder="请选择状态码">
|
|
|
<el-option label="已完成" value="1"></el-option>
|
|
|
<el-option label="未完成" value="0"></el-option>
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item> -->
|
|
|
|
|
|
- <el-form-item label="标题" prop="title">
|
|
|
- <el-input v-model="dataCountFormData.title"></el-input>
|
|
|
+ <el-form-item label="统计描述" prop="statisticDescription">
|
|
|
+ <el-input v-model="dataCountFormData.statisticDescription"></el-input>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="描述" prop="description">
|
|
|
- <el-input v-model="dataCountFormData.description"></el-input>
|
|
|
+ <el-form-item label="统计对象" prop="statisticObject">
|
|
|
+ <el-input v-model="dataCountFormData.statisticObject"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
@@ -574,11 +591,12 @@ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
import { v4 as uuidv4 } from "uuid";
|
|
|
export default {
|
|
|
name: "tableMange",
|
|
|
- dicts: ["sys_time_format"],
|
|
|
+ dicts: ["sys_time_format", "table_statistic_type"],
|
|
|
props: [],
|
|
|
components: { Queryfrom, Treeselect },
|
|
|
data() {
|
|
|
return {
|
|
|
+ isInputInvalid: false,
|
|
|
// 修改表格时的menuId
|
|
|
menuId: "",
|
|
|
// 修改表格的id
|
|
@@ -594,6 +612,7 @@ export default {
|
|
|
// 当前table唯一标识
|
|
|
sqlkey: "",
|
|
|
// 表格的高度
|
|
|
+ tableKey: "",
|
|
|
// tableHeight: document.documentElement.scrollHeight - 245 + "px",
|
|
|
tableList: [], //所有表格列表
|
|
|
tableFieldList: [], // 当前表格字段数据
|
|
@@ -650,6 +669,10 @@ export default {
|
|
|
prop: "isExport",
|
|
|
label: "是否导出",
|
|
|
},
|
|
|
+ {
|
|
|
+ prop: "isCount",
|
|
|
+ label: "是否统计",
|
|
|
+ },
|
|
|
], //表头列表
|
|
|
|
|
|
// 右侧筛选条件勾选数据
|
|
@@ -705,11 +728,12 @@ export default {
|
|
|
// 数据统计对象
|
|
|
dataCountFormData: {},
|
|
|
// 数据统计表格
|
|
|
- datacountTable: [],
|
|
|
+ dragTableStatisticList: [],
|
|
|
// 是否切换到数据统计
|
|
|
menudata: false,
|
|
|
// 显示添加字段对话框
|
|
|
- isShowAddData: false
|
|
|
+ isShowAddData: false,
|
|
|
+ dataType : [],
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
@@ -771,6 +795,11 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+ // 字段描述验证规则
|
|
|
+ // blurval(value){
|
|
|
+ // this.isInputInvalid = value == '' ? true : false;
|
|
|
+ // },
|
|
|
// 树形控件change回调
|
|
|
treeSelectChange(val) {
|
|
|
//没有change事件
|
|
@@ -796,9 +825,10 @@ export default {
|
|
|
databaseType: this.databaseType,
|
|
|
tableName: this.tableName,
|
|
|
};
|
|
|
-
|
|
|
+ console.log(data);
|
|
|
// 获取当前表单结构信息
|
|
|
getListName(data).then((res) => {
|
|
|
+ console.log(res)
|
|
|
this.tableFieldList = res.map((item, index) => {
|
|
|
return {
|
|
|
id: this.tableName + "_" + item.fieldName,
|
|
@@ -1279,6 +1309,9 @@ export default {
|
|
|
},
|
|
|
// 创建回调
|
|
|
async createHandle() {
|
|
|
+ console.log(123);
|
|
|
+ this.tableKey = uuidv4();
|
|
|
+ this.isInputInvalid = true
|
|
|
this.$refs.formData.validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
// 检验表单合法性
|
|
@@ -1369,7 +1402,7 @@ export default {
|
|
|
tId: this.tId,
|
|
|
dtName: this.formData.menuName,
|
|
|
// menuId: this.formData.routePath,
|
|
|
- // tableKey: this.formData.routePath, // 暂定
|
|
|
+ tableKey: this.tableKey, // 暂定
|
|
|
dtTableName: this.tableName,
|
|
|
primaryKey: this.formData.primaryKey,
|
|
|
orderByColumn: this.formData.orderByColumn,
|
|
@@ -1414,6 +1447,10 @@ export default {
|
|
|
res = await addDragTable(data);
|
|
|
}
|
|
|
|
|
|
+ console.log('res', res);
|
|
|
+ if(res.code == 200){
|
|
|
+ this.countHandle()
|
|
|
+ }
|
|
|
// 关闭当前页面
|
|
|
if (this.tId) {
|
|
|
if (res.code == 200) {
|
|
@@ -1510,16 +1547,18 @@ export default {
|
|
|
tabhandleClick() {
|
|
|
this.menudata = this.activeName === 'datacount' ? true : false;
|
|
|
},
|
|
|
+ // 添加数据字段对话框
|
|
|
+ async addDataDialog() {
|
|
|
+ this.isShowAddData = true
|
|
|
+ this.dataType = await this.getDicts("table_statistic_type")
|
|
|
+ this.dataType = this.dataType.data
|
|
|
+ // console.log(this.dataType)
|
|
|
+ },
|
|
|
// 添加数据字段
|
|
|
addData(){
|
|
|
- this.dataCountFormData.number = this.datacountTable.length + 1
|
|
|
- console.log(this.dataCountFormData)
|
|
|
- this.dataCountFormData.type = this.dataCountFormData.type == 'num' ? '数量' : '状态'
|
|
|
- if(this.dataCountFormData.type == 'status'){
|
|
|
- this.dataCountFormData.statuscode = this.dataCountFormData.type == '1' ? '已完成' : '未完成'
|
|
|
- }
|
|
|
-
|
|
|
- this.datacountTable.push(this.dataCountFormData)
|
|
|
+ this.dataCountFormData.tableKey = this.tableKey
|
|
|
+ this.dragTableStatisticList.push(this.dataCountFormData)
|
|
|
+ console.log(this.dragTableStatisticList)
|
|
|
this.isShowAddData = false
|
|
|
this.dataCountFormData = {}
|
|
|
},
|
|
@@ -1530,11 +1569,13 @@ export default {
|
|
|
},
|
|
|
// 确定统计
|
|
|
countHandle(){
|
|
|
- if(this.datacountTable.length == 0){
|
|
|
+ if(this.dragTableStatisticList.length == 0){
|
|
|
this.$message.warning("请确定统计数据字段");
|
|
|
return
|
|
|
}
|
|
|
console.log('确定统计');
|
|
|
+
|
|
|
+ console.log(this.dragTableStatisticList);
|
|
|
}
|
|
|
},
|
|
|
created() {},
|
|
@@ -1551,6 +1592,26 @@ export default {
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
+.ipt{
|
|
|
+ height: 36px;
|
|
|
+ line-height: 36px;
|
|
|
+ font-size: 14px;
|
|
|
+ width: 100%;
|
|
|
+ outline: none;
|
|
|
+ text-align: center;
|
|
|
+ background-color: #fff;
|
|
|
+ border: 1px solid #DCDFE6;
|
|
|
+ color: #606266;
|
|
|
+ display: inline-block;
|
|
|
+ border-radius: 4px;
|
|
|
+}
|
|
|
+.isNullDesc{
|
|
|
+ border-color: #FF4949 !important;
|
|
|
+}
|
|
|
+
|
|
|
+.ipt:focus{
|
|
|
+ border-color: #1890ff;
|
|
|
+}
|
|
|
::v-deep .right_card {
|
|
|
min-height: 500px !important;
|
|
|
}
|
|
@@ -1566,5 +1627,4 @@ export default {
|
|
|
.mb10{
|
|
|
margin-top: 10px;
|
|
|
}
|
|
|
-
|
|
|
</style>
|