修改索引页面

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> <div class="linese"></div>
</a-col> </a-col>
</a-row> </a-row>
<dataIndexingModal ref="modalForm" @ok="getTableIndexList"></dataIndexingModal>
</a-card> </a-card>
</template> </template>
<script> <script>
import { metaDataTypeTree, tableIndexes } from '@/api/metaData' import { metaDataTypeTree, tableIndexes } from '@/api/metaData'
import { getAction, deleteAction, putAction, postAction } from '@/api/manage' import { getAction, deleteAction, putAction, postAction } from '@/api/manage'
import dataIndexingModal from './modules/dataIndexingModal'
export default { export default {
name: "metadata", name: "dataIndexing",
components: { components: {
dataIndexingModal
}, },
data() { data() {
return { return {
@ -150,22 +154,40 @@ export default {
}, },
computed: { computed: {
}, },
created() { created() {
this.getMetaDataTypeTree() this.getMetaDataTypeTree()
}, },
methods: { 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) { Delete(item) {
var that = this var that = this
that.$confirm({ that.$confirm({
title: '确认删除', title: '确认删除',
content: '是否删除选中索引?', content: '是否删除选中索引?',
onOk: function () { 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) { if (res.success) {
that.$message.success(res.message); that.$message.success(res.message);
this.getTableIndexList(); that.getTableIndexList();
} else { } else {
that.$message.warning(res.message); that.$message.warning(res.message);
} }

View File

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