修改索引页面

This commit is contained in:
RenCheng 2025-04-21 23:52:49 +08:00
parent bf09962402
commit c67c727416
2 changed files with 63 additions and 137 deletions

View File

@ -75,14 +75,18 @@
<div class="linese"></div>
</a-col>
</a-row>
<dataIndexingModal ref="modalForm" @ok="getTableIndexList"></dataIndexingModal>
</a-card>
</template>
<script>
import { metaDataTypeTree, tableIndexes } from '@/api/metaData'
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
import dataIndexingModal from './modules/dataIndexingModal'
export default {
name: "metadata",
name: "dataIndexing",
components: {
dataIndexingModal
},
data() {
return {
@ -150,22 +154,40 @@ export default {
},
computed: {
},
created() {
this.getMetaDataTypeTree()
},
methods: {
handleAdd(){
if(this.tableParams.schemaMass == null || this.tableParams.tableName == null){
this.$message.warning("请先选择表信息");
return;
}
this.$refs.modalForm.add();
this.$refs.modalForm.schemaMass = this.tableParams.schemaMass;
this.$refs.modalForm.tableName= this.tableParams.tableName;
},
handleEdit(record){
if(this.tableParams.schemaMass == null || this.tableParams.tableName == null){
this.$message.warning("请先选择表信息");
return;
}
this.$refs.modalForm.edit(record);
this.$refs.modalForm.schemaMass = this.tableParams.schemaMass;
this.$refs.modalForm.tableName= this.tableParams.tableName;
},
Delete(item) {
var that = this
that.$confirm({
title: '确认删除',
content: '是否删除选中索引?',
onOk: function () {
postAction("/tableIndex/dropIndex?schemaMass="+this.tableParams.schemaMass+"&tableName="+this.tableParams.tableName+"&indexName="+item.indexName+"&columns="+item.columnName+"&indexTypeCode="+item.indexType,{}).then(res => {
postAction("/tableIndex/dropIndex?schemaMass="+that.tableParams.schemaMass+"&tableName="+that.tableParams.tableName+"&indexName="+item.indexName+"&columns="+item.columnName+"&indexTypeCode="+item.indexType,{}).then(res => {
if (res.success) {
that.$message.success(res.message);
this.getTableIndexList();
that.getTableIndexList();
} else {
that.$message.warning(res.message);
}

View File

@ -11,46 +11,25 @@
<a-spin :spinning="confirmLoading">
<a-form :form="form">
<a-form-item label="任务名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input v-decorator="['name']" ></a-input>
<a-form-item label="索引名称" :labelCol="labelCol" >
<a-input v-decorator="['indexName']" ></a-input>
</a-form-item>
<a-form-item label="选择型号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select show-search
placeholder="选择型号"
option-filter-prop="children" :filter-option="filterOption" size="large" v-decorator="['shipModelId', {}]"
@change="selectModel">
<a-select-option v-for="d in shipMode" :key="d.id">
{{ d.name }}
<a-form-item label="索引名称" :labelCol="labelCol" >
<a-input v-decorator="['columns']" ></a-input>
</a-form-item>
<a-form-item label="索引类型" >
<a-select placeholder="选择索引类型" option-filter-prop="children" size="large" v-decorator="['indexTypeCode', {}]">
<a-select-option key="0">
普通索引
</a-select-option>
<a-select-option key="1">
唯一索引
</a-select-option>
<a-select-option key="2">
全文索引
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="选择舷号" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-select show-search
placeholder="选择舷号"
option-filter-prop="children" :filter-option="filterOption" size="large" v-decorator="['shipNumId', {}]">
<a-select-option v-for="d in shipNum" :key="d.id">
{{ d.name }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item
label="开始结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-range-picker
style="width:500px"
:show-time="{ format: 'HH:mm:ss' }"
v-model="rangeTime"
format="YYYY-MM-DD HH:mm:ss"
:placeholder="['任务开始时间', '任务结束时间']"
@change="onChange"
@ok="onOk"
/>
</a-form-item>
<a-form-item
label="说明">
<a-textarea placeholder="请输入描述" :rows="3" v-decorator="['describe', {}]" />
</a-form-item>
</a-form>
</a-spin>
</a-modal>
@ -58,23 +37,14 @@
<script>
import moment from "moment"
import {
shipNumPageList,
shipNumQueryByModelId,
shipModelPageList
} from '@/api/ship'
import { taskCreate,
taskUpdateById } from '@/api/task'
import JCron from "@/components/jeecg/JCron";
import JSelectMultiple from '@/components/jeecg/JSelectMultiple'
import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
import pick from 'lodash.pick'
export default {
name: "taskModal",
name: "dataIndexingModal",
components: {
JCron,
JSelectMultiple
},
data () {
return {
@ -90,12 +60,6 @@ import { taskCreate,
dataStrategySelected:'',
idcDataStrategyId:"",
shipMode:{},
shipNum:{},
rangeTime:[],
queryParam: {
pageNum :1,
pageSize:20
},
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
@ -104,44 +68,16 @@ import { taskCreate,
xs: { span: 24 },
sm: { span: 16 },
},
shipNum:{},
rangeTime:[],
schemaMass:"",
tableName:""
}
},
created () {
this.loadData();
},
methods: {
loadData() {
shipModelPageList(this.queryParam).then((res) => {
if (res.success) {
this.shipMode = res.result.rows
} else {
this.$message.warning(res.message);
}
});
shipNumPageList(this.queryParam).then((res) => {
if (res.success) {
this.shipNum = res.result.rows
} else {
this.$message.warning(res.message);
}
});
},
filterOption(input, option) {
return (
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
);
},
selectModel(value){
shipNumQueryByModelId({modelId:value}).then((res) => {
if (res.success) {
this.shipNum = res.result
} else {
this.$message.warning(res.message);
}
});
},
add () {
this.rangeTime=[];
this.edit({});
},
edit (record) {
@ -149,24 +85,12 @@ import { taskCreate,
let that = this;
that.form.resetFields();
this.model = Object.assign({},record);
this.rangeTime.push(moment(this.model.startTime),moment(this.model.endTime))
this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'name','describe','shipModelId','shipNumId'));
this.form.setFieldsValue(pick(this.model,'indexName','columns','indexTypeCode'));
});
},
onChange(value, dateString) {
this.model.startTime = dateString[0];
this.model.endTime = dateString[1];
console.log(this.model);
},
onOk(value) {
this.model.startTime = value[0].format('YYYY-MM-DD HH:mm:ss');
this.model.endTime = value[1].format('YYYY-MM-DD HH:mm:ss');
console.log(this.model);
},
close () {
this.$emit('close');
this.visible = false;
this.visible =false;
},
handleOk () {
const that = this;
@ -175,40 +99,20 @@ import { taskCreate,
console.log('values',values)
if (!err) {
that.confirmLoading = true;
if(!this.model.id){
this.model.name = values.name;
this.model.shipModelId = values.shipModelId;
this.model.shipNumId = values.shipNumId;
this.model.describe = values.describe;
this.model.startTime = this.rangeTime[0].format('YYYY-MM-DD HH:mm:ss');
this.model.endTime = this.rangeTime[1].format('YYYY-MM-DD HH:mm:ss');
console.log(this.model);
taskCreate(this.model).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
this.model.indexName = values.indexName;
this.model.columns = values.columns;
this.model.indexTypeCode = values.indexTypeCode;
console.log(this.model);
postAction("/tableIndex/updateIndexSafe?schemaMass="+this.schemaMass+"&tableName="+this.tableName+"&indexName="+this.model.indexName+"&columns="+this.model.columns+"&indexTypeCode="+this.model.indexTypeCode,{}).then(res => {
if (res.success) {
that.$message.success(res.result);
that.visible =false;
that.$emit('ok');
} else {
that.$message.warning(res.message);
that.confirmLoading = false;
that.close();
})
}else{
taskUpdateById({id:this.model.id,name:values.name,describe:values.describe,shipModelId:values.shipModelId,shipNumId:values.shipNumId,
startTime:this.model.startTime,endTime:this.model.endTime
}).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
that.close();
})
}
}
})
}
})
},