更新列表
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
<div class="infoCnt">
|
||||
<div class="baseInfo">
|
||||
<div v-for="(item, index) in tableData" :key="index" >
|
||||
发掘文本{{ index + 1 }}:<span class="text-danger">{{ item.fjWb }}</span>
|
||||
发掘文本{{ index + 1 }}:<span class="text-danger">{{ item.nr }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<MyTable
|
||||
|
@ -15,66 +15,38 @@
|
||||
|
||||
<script setup>
|
||||
import FormMessage from "@/components/aboutTable/FormMessage.vue";
|
||||
import { qcckGet, qcckPost } from "@/api/qcckApi.js";
|
||||
import { ref, defineExpose, defineEmits, getCurrentInstance } from "vue";
|
||||
import { ref, defineExpose,defineProps, defineEmits } from "vue";
|
||||
const emit = defineEmits(["updateDate"]);
|
||||
const props = defineProps({
|
||||
dic: Object
|
||||
});
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { D_GS_RQFJ_LX } = proxy.$dict("D_GS_RQFJ_LX"); //获取字典数据
|
||||
const dialogForm = ref(false); //弹窗
|
||||
const formData = ref([
|
||||
{ label: "发掘类型", prop: "fjLx", type: "select", options: D_GS_RQFJ_LX },
|
||||
{ label: "发掘文本", prop: "fjWb", type: "textarea", width: "100%" }
|
||||
{ label: "数据来源", prop: "sjly", type: "select", options:props.dic.D_GS_RQFJ_LX,disabled:true },
|
||||
{ label: "是否发掘", prop: "sffj", type: "select", options: props.dic.D_BZ_SF,disabled:true },
|
||||
{ label: "数据时间", prop: "sj", type: "datetime"},
|
||||
{ label: "指向地点", prop: "dd", type: "textarea", width: "100%" },
|
||||
{ label: "数据内容", prop: "nr", type: "textarea", width: "100%" },
|
||||
]);
|
||||
const listQuery = ref({}); //表单
|
||||
const loading = ref(false);
|
||||
const elform = ref();
|
||||
const title = ref("");
|
||||
const title = ref("编辑");
|
||||
const disabled = ref(false)
|
||||
// 初始化数据
|
||||
const init = (type, row) => {
|
||||
const init = (row) => {
|
||||
dialogForm.value = true;
|
||||
title.value = type == "add" ? "新增" : type == "info" ? "详情" : "编辑";
|
||||
disabled.value = title.value == '详情' ? true : false ;
|
||||
// 初始化表单数据,并根据详情页设置禁用状态
|
||||
formData.value = [
|
||||
{ label: "发掘类型", prop: "fjLx", type: "select", options: D_GS_RQFJ_LX },
|
||||
{ label: "发掘文本", prop: "fjWb", type: "textarea", width: "100%" }
|
||||
];
|
||||
if (row) getDataById(row.id);
|
||||
};
|
||||
// 根据id查询详情
|
||||
const getDataById = (id) => {
|
||||
qcckGet({}, "/mosty-gsxt/tbGsxtRqfjNr/" + id).then((res) => {
|
||||
listQuery.value = res;
|
||||
});
|
||||
listQuery.value = JSON.parse(JSON.stringify(row))
|
||||
};
|
||||
|
||||
// 提交
|
||||
const submit = () => {
|
||||
elform.value.submit((data) => {
|
||||
let url = title.value == "新增" ? "/mosty-gsxt/tbGsxtRqfjNr/save" : "/mosty-gsxt/tbGsxtRqfjNr/update";
|
||||
let params = { ...data };
|
||||
loading.value = true;
|
||||
qcckPost(params, url).then((res) => {
|
||||
loading.value = false;
|
||||
proxy.$message({ type: "success", message: title.value + "成功" });
|
||||
emit("onSearch");
|
||||
close();
|
||||
}).catch(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
emit('updateDate',data)
|
||||
close();
|
||||
});
|
||||
};
|
||||
|
||||
// 接收父组件传入的数据并回显
|
||||
const setFormData = (data) => {
|
||||
listQuery.value = {
|
||||
...data // 假设 data 包含所有需要的字段
|
||||
};
|
||||
};
|
||||
// 关闭
|
||||
const close = () => {
|
||||
listQuery.value = {};
|
||||
@ -82,14 +54,7 @@ const close = () => {
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
// 2. 暴露获取数据的方法
|
||||
const getFormData = () => {
|
||||
// 可以在这里添加验证逻辑
|
||||
return {
|
||||
formData: listQuery.value
|
||||
};
|
||||
};
|
||||
defineExpose({ init, setFormData });
|
||||
defineExpose({ init });
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
@ -11,6 +11,12 @@
|
||||
:key="pageData.keyCount"
|
||||
:tableConfiger="pageData.tableConfiger"
|
||||
@chooseData="chooseData">
|
||||
<template #sjly="{row}">
|
||||
<DictTag :tag="false" :value="row.sjly" :options="props.dic.D_GS_RQFJ_LX" />
|
||||
</template>
|
||||
<template #sffj="{row}">
|
||||
<DictTag :tag="false" :value="row.sffj" :options="props.dic.D_BZ_SF" />
|
||||
</template>
|
||||
</MyTable>
|
||||
<Pages @changeNo="changeNo" @changeSize="changeSize" :tableHeight="pageData.tableHeight" :pageConfiger="{...pageData.pageConfiger}"></Pages>
|
||||
<template #footer>
|
||||
@ -22,10 +28,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { qcckGet, qcckDelete } from "@/api/qcckApi.js";
|
||||
import MyTable from "@/components/aboutTable/MyTable.vue";
|
||||
import Pages from "@/components/aboutTable/Pages.vue";
|
||||
import Search from "@/components/aboutTable/Search.vue";
|
||||
import { ref,reactive, onMounted, nextTick } from 'vue';
|
||||
import { ref,reactive, onMounted, nextTick,getCurrentInstance } from 'vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
const props = defineProps({
|
||||
modelValue:{
|
||||
type:Boolean,
|
||||
@ -36,15 +44,14 @@ const props = defineProps({
|
||||
default:{}
|
||||
}
|
||||
})
|
||||
const ids = ref([])
|
||||
const chooseList = ref([])
|
||||
const title =ref('')
|
||||
const searchRef = ref()
|
||||
const emits = defineEmits(['update:modelValue','cancel','submit'])
|
||||
const searchConfiger = ref([
|
||||
{ label: "数据来源", prop: "sjly", placeholder: "请选择数据来源", showType: "select" },
|
||||
{ label: "数据类型", prop: "sjlx", placeholder: "请选择数据类型", showType: "select" },
|
||||
{ label: "指向地点", prop: "zxdz", placeholder: "请输入指向地点", showType: "input" },
|
||||
{ label: "数据内容", prop: "sjnr", placeholder: "请输入数据内容", showType: "input" },
|
||||
{ label: "指向地点", prop: "dd", placeholder: "请输入指向地点", showType: "input" },
|
||||
{ label: "数据内容", prop: "nr", placeholder: "请输入数据内容", showType: "input" },
|
||||
{ label: "是否发掘", prop: "sffj", placeholder: "请输入数据内容", showType: "select" },
|
||||
{ label: "数据时间", prop: "times", showType: "datetimerange" },
|
||||
]);
|
||||
const pageData = reactive({
|
||||
@ -52,52 +59,85 @@ const pageData = reactive({
|
||||
keyCount: 0,
|
||||
tableConfiger: {
|
||||
rowHieght: 61,
|
||||
showSelectType: "checkBox",
|
||||
showSelectType: "radio",
|
||||
haveControls: false,
|
||||
loading: false,
|
||||
},
|
||||
tableHeight: 190,
|
||||
pageConfiger: {
|
||||
total: 0,
|
||||
pageSize: 20,
|
||||
pageCurrent: 1
|
||||
},
|
||||
tableColumn: [
|
||||
{ label: "所属部门", prop: "ssbm"},
|
||||
{ label: "数据来源", prop: "sjly"},
|
||||
{ label: "数据来源", prop: "sjly",showSolt:true},
|
||||
{ label: "数据类型", prop: "sjlx"},
|
||||
{ label: "数据时间", prop: "sjsj"},
|
||||
{ label: "指向地点", prop: "zxdz"},
|
||||
{ label: "数据内容", prop: "zxnr"},
|
||||
{ label: "是否发掘", prop: "sffj",showSolt:true},
|
||||
{ label: "数据时间", prop: "sj", showOverflowTooltip: true,},
|
||||
{ label: "指向地点", prop: "dd", showOverflowTooltip: true,},
|
||||
{ label: "数据内容", prop: "nr", showOverflowTooltip: true},
|
||||
],
|
||||
});
|
||||
|
||||
const dm = ref('');
|
||||
onMounted(()=>{
|
||||
nextTick(()=>{
|
||||
tabHeightFn()
|
||||
})
|
||||
})
|
||||
const init = (val) =>{
|
||||
tabHeightFn();
|
||||
dm.value = val;
|
||||
let zdlist = props.dic.D_GS_RQFJ_LX || []
|
||||
let obj = zdlist.find(v=>v.dm == val);
|
||||
title.value = obj ? obj.zdmc+'选择' :'选择数据'
|
||||
title.value = obj ? obj.zdmc+'选择' :'选择数据';
|
||||
getList()
|
||||
}
|
||||
|
||||
const getList = () =>{
|
||||
let params = {
|
||||
fjlx:dm.value,
|
||||
pageCurrent:pageData.pageConfiger.pageCurrent,
|
||||
pageSize:pageData.pageConfiger.pageSize,
|
||||
}
|
||||
pageData.tableConfiger.loading = true;
|
||||
qcckGet(params,'/mosty-gsxt/qbcj/getZdryCbfjtc').then(res=>{
|
||||
let arr = res.records || [];
|
||||
pageData.tableData = arr.map((item,idex)=>{
|
||||
item.sjly = dm.value ;
|
||||
item.id = idex;
|
||||
return item;
|
||||
});
|
||||
pageData.pageConfiger.total = res.total;
|
||||
pageData.tableConfiger.loading = false;
|
||||
}).catch(()=>{
|
||||
pageData.tableConfiger.loading = false;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const changeNo = (val) => {
|
||||
pageData.pageConfiger.pageCurrent = val;
|
||||
getList()
|
||||
};
|
||||
const changeSize = (val) => {
|
||||
pageData.pageConfiger.pageSize = val;
|
||||
getList()
|
||||
};
|
||||
|
||||
const chooseData = (val) =>{
|
||||
if(Array.isArray(val)) ids.value = val.map(v=>val.id);
|
||||
if(Array.isArray(val)) chooseList.value = val;
|
||||
}
|
||||
|
||||
const handleSubmit = () =>{
|
||||
if(chooseList.value.length == 0) return proxy.$message({ type: "warning", message: "请选择数据" });;
|
||||
emits('submit',chooseList.value);
|
||||
cancelDailg()
|
||||
}
|
||||
|
||||
const cancelDailg = () =>{
|
||||
emits('update:modelValue',false);
|
||||
emits('cancel');
|
||||
chooseList.value = []
|
||||
}
|
||||
|
||||
const tabHeightFn = () => {
|
||||
|
@ -18,16 +18,14 @@
|
||||
:tableHeight="pageData.tableHeight"
|
||||
:key="pageData.keyCount"
|
||||
:tableConfiger="pageData.tableConfiger0"
|
||||
:controlsWidth="pageData.controlsWidth"
|
||||
@chooseData="chooseDataTop">
|
||||
<template #fjLx="{ row }">
|
||||
<DictTag :tag="false" :value="row.fjLx" :options="D_GS_RQFJ_LX" />
|
||||
:controlsWidth="pageData.controlsWidth">
|
||||
<template #sjly="{ row }">
|
||||
<DictTag :tag="false" :value="row.sjly" :options="D_GS_RQFJ_LX" />
|
||||
</template>
|
||||
<!-- 操作 -->
|
||||
<template #controls="{ row }">
|
||||
<el-link size="small" type="success" @click="handleData('edit', row)">编辑</el-link>
|
||||
<el-link size="small" type="primary" @click="handleData('info', row)">查看</el-link>
|
||||
<el-link size="small" type="danger" @click="deleteRow([row.id])">删除</el-link>
|
||||
<template #controls="{ row}">
|
||||
<el-link size="small" type="success" @click="handleData(row)">编辑</el-link>
|
||||
<el-link size="small" type="danger" @click="deleteRow(row.id)">删除</el-link>
|
||||
</template>
|
||||
</MyTable>
|
||||
<div class="ww100 flex just-center mt8">
|
||||
@ -35,7 +33,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tableCnt mb10 pl10 pr10">
|
||||
<PageTitle title="模型智能识别/LP解析结果" style="color: #333"></PageTitle>
|
||||
<PageTitle title="解析结果" style="color: #333"></PageTitle>
|
||||
<div ref="searchBox" class="mb8">
|
||||
<el-button :type="it == '批量删除' ? 'danger' : 'primary'" size="small" v-for="it in btnsList" :key="it" @click="chooseType(it)">{{ it }}</el-button>
|
||||
</div>
|
||||
@ -88,9 +86,9 @@
|
||||
<!-- 弹窗智能分析 -->
|
||||
<IntelligentParsing :tableData="pageData.tableData" ref="IntelligentParsingRef" @upadate="getModelList" />
|
||||
<!-- 新增 -->
|
||||
<addForm ref="addFormDiloag" @onSearch="onSearch" />
|
||||
<addForm ref="addFormDiloag" v-if="showEdit" @updateDate="updateDate" :dic="{D_GS_RQFJ_LX,D_BZ_SF}" />
|
||||
<!-- 弹窗 -->
|
||||
<ListDialog ref="modelList" v-model="showDialog" v-if="showDialog" @cancel="active = ''" :dic="{D_GS_RQFJ_LX}"></ListDialog>
|
||||
<ListDialog ref="modelList" v-model="showDialog" v-if="showDialog" @submit="handelSub" @cancel="active = ''" :dic="{D_GS_RQFJ_LX,D_BZ_SF}"></ListDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -128,9 +126,9 @@ const searchConfiger = ref([
|
||||
const active = ref('');
|
||||
const btnsList = reactive(["级别变更","警种变更","指定分配","添加标签","导出","批量删除"]);
|
||||
const chooselx = ref("");
|
||||
const idsTop = ref([]);
|
||||
const ids = ref([]);
|
||||
const addFormDiloag = ref();
|
||||
const showEdit = ref(false);
|
||||
const IntelligentParsingRef = ref();
|
||||
const searchBox = ref();
|
||||
const queryFrom = ref({});
|
||||
@ -156,8 +154,10 @@ const pageData = reactive({
|
||||
},
|
||||
controlsWidth: 160,
|
||||
tableColumn: [
|
||||
{ label: "发掘类型", prop: "fjLx", showSolt: true },
|
||||
{ label: "发掘文本 ", prop: "fjWb", showOverflowTooltip: true }
|
||||
{ label: "数据来源", prop: "sjly",showSolt:true},
|
||||
{ label: "数据时间", prop: "sj", showOverflowTooltip: true,},
|
||||
{ label: "指向地点", prop: "dd", showOverflowTooltip: true,},
|
||||
{ label: "数据内容", prop: "nr", showOverflowTooltip: true},
|
||||
],
|
||||
tableColumn2: [
|
||||
{ label: "姓名", prop: "ryXm", showOverflowTooltip: true },
|
||||
@ -183,7 +183,6 @@ const pageData = reactive({
|
||||
const onSearch = (val) => {
|
||||
queryFrom.value = { ...val };
|
||||
pageData.pageConfiger.pageCurrent = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
const changeNo = (val) => {
|
||||
@ -195,17 +194,6 @@ const changeSize = (val) => {
|
||||
getModelList();
|
||||
};
|
||||
|
||||
// 获取内容列表
|
||||
const getList = () => {
|
||||
pageData.tableConfiger.loading = true;
|
||||
let data = { ...queryFrom.value };
|
||||
qcckGet(data, "/mosty-gsxt/tbGsxtRqfjNr/selectPage").then((res) => {
|
||||
pageData.tableData = res.records || [];
|
||||
pageData.tableConfiger.loading = false;
|
||||
}).catch(() => {
|
||||
pageData.tableConfiger.loading = false;
|
||||
});
|
||||
};
|
||||
|
||||
//获取模型识别列表
|
||||
const getModelList = () => {
|
||||
@ -222,29 +210,13 @@ const getModelList = () => {
|
||||
};
|
||||
//新增- 编辑
|
||||
const handleData = (type, row) => {
|
||||
addFormDiloag.value.init(type, row);
|
||||
};
|
||||
// 智能解析
|
||||
const intelligent = () => {
|
||||
IntelligentParsingRef.value.init();
|
||||
showEdit.value = true;
|
||||
nextTick(()=>{
|
||||
addFormDiloag.value.init(type, row);
|
||||
})
|
||||
};
|
||||
|
||||
// 选择数据
|
||||
const chooseDataTop = (val) => {
|
||||
if (Array.isArray(val)) idsTop.value = val.map((item) => item.id);
|
||||
};
|
||||
|
||||
//删除操作
|
||||
const deleteRow = (ids) => {
|
||||
proxy.$confirm("确定要删除", "警告", { type: "warning" }).then(() => {
|
||||
ids.forEach((id) => {
|
||||
qcckGet({}, "/mosty-gsxt/tbGsxtRqfjNr/closeById/" + id).then((res) => {
|
||||
ElMessage.success("删除成功");
|
||||
getList();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
const deleteRowBottom = (id) => {
|
||||
proxy.$confirm("确定要删除", "警告", { type: "warning" }).then(() => {
|
||||
qcckDelete({}, "/mosty-gsxt/tbGsxtRqfjRy/" + id).then((res) => {
|
||||
@ -289,6 +261,28 @@ const changeRadio = () =>{
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//删除操作
|
||||
const deleteRow = (id) => {
|
||||
pageData.tableData = pageData.tableData.filter(v=>v.id != id);
|
||||
};
|
||||
|
||||
const updateDate = (val) =>{
|
||||
let index = pageData.tableData.findIndex(v=>v.id == val.id);
|
||||
if(index != -1) pageData.tableData[index] = val;
|
||||
}
|
||||
|
||||
const handelSub = (val) =>{
|
||||
pageData.tableData = val;
|
||||
}
|
||||
|
||||
// 智能解析
|
||||
const intelligent = () => {
|
||||
if(pageData.tableData.length == 0) return proxy.$message({ type: "warning", message: "请先选择数据" });;
|
||||
IntelligentParsingRef.value.init();
|
||||
};
|
||||
|
||||
|
||||
const tabHeightFn = () => {
|
||||
pageData.tableHeight2 = window.innerHeight - searchBox.value.offsetHeight - 650;
|
||||
window.onresize = function () {
|
||||
@ -297,7 +291,6 @@ const tabHeightFn = () => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
tabHeightFn();
|
||||
getModelList();
|
||||
});
|
||||
|
Reference in New Issue
Block a user