|
|
@@ -97,7 +97,7 @@
|
|
|
<template #default="scope">
|
|
|
<!-- 使用按钮 -->
|
|
|
<el-button
|
|
|
- type="success"
|
|
|
+ type="primary"
|
|
|
size="small"
|
|
|
@click="handleUse(scope.row)"
|
|
|
>
|
|
|
@@ -261,7 +261,7 @@
|
|
|
<div class="editor-container">
|
|
|
<WangEditor
|
|
|
v-model="content"
|
|
|
- :height="400"
|
|
|
+ :height="300"
|
|
|
style="max-width: 1350px"
|
|
|
:disabled="false"
|
|
|
@change="handleContentChange"
|
|
|
@@ -272,19 +272,30 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
<el-button icon="el-icon-plus" @click="openAdd">添加</el-button>
|
|
|
+ <el-input
|
|
|
+ v-model="searchKeyword"
|
|
|
+ placeholder="请输入关键词(装备名称、位置、任务描述)"
|
|
|
+ clearable
|
|
|
+ style="width: 300px;margin-left: 20px"
|
|
|
+ />
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-table
|
|
|
- :data="zbInfoList"
|
|
|
- style="width: 100%"
|
|
|
- border
|
|
|
+ :data="filteredZbInfoList"
|
|
|
+ style="width: 100%"
|
|
|
+ border
|
|
|
+ height="300"
|
|
|
:header-cell-style="{ 'text-align': 'center' }"
|
|
|
:cell-style="{ 'text-align': 'center' }"
|
|
|
>
|
|
|
- <el-table-column label="序号" prop="89"></el-table-column>
|
|
|
- <el-table-column label="装备" prop="89"></el-table-column>
|
|
|
- <el-table-column label="位置" prop="89"></el-table-column>
|
|
|
- <el-table-column label="任务" prop="89"></el-table-column>
|
|
|
+ <el-table-column label="序号" width="55" type="index"></el-table-column>
|
|
|
+ <el-table-column label="装备名称" prop="zbName"></el-table-column>
|
|
|
+ <el-table-column label="位置" prop="positionDescription">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.positionDescription ? scope.row.positionDescription : scope.row.equipPositionX + ',' + scope.row.equipPositionY }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="任务描述" prop="taskRemark"></el-table-column>
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-button type="danger" @click="delZbInfo(row)">删除</el-button>
|
|
|
@@ -292,15 +303,6 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
- <el-pagination
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page="zbQueryForm.pageNo"
|
|
|
- :page-sizes="[10, 20, 50, 100]"
|
|
|
- :page-size="zbQueryForm.pageSize"
|
|
|
- layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="zbQueryForm.total"
|
|
|
- />
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -308,7 +310,7 @@
|
|
|
<!-- 添加装备弹窗 -->
|
|
|
<el-dialog
|
|
|
:title="addOrUpdateTitle"
|
|
|
- :visible.sync="addOrUpdateTVisible"
|
|
|
+ :visible.sync="addOrUpdateVisible"
|
|
|
class="dark-dialog"
|
|
|
width="60%"
|
|
|
:close-on-click-modal="false"
|
|
|
@@ -317,7 +319,22 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="装备名称" prop="zbName">
|
|
|
- <el-input v-model="addForm.zbName" placeholder="请输入任务名称"/>
|
|
|
+ <el-select
|
|
|
+ v-model="addForm.zbName"
|
|
|
+ placeholder="请输入装备名称"
|
|
|
+ filterable
|
|
|
+ remote
|
|
|
+ :remote-method="handleRemoteSearch"
|
|
|
+ :loading="loading"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="zb in zbList"
|
|
|
+ :key="zb.id"
|
|
|
+ :label="zb.zbName"
|
|
|
+ :value="zb.zbName"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
@@ -341,7 +358,7 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row :gutter="20">
|
|
|
+ <el-row :gutter="20" v-if="addForm.isExactLocation === 0">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="位置描述" prop="positionDescription">
|
|
|
<el-input type="textarea" :rows="4" v-model="addForm.positionDescription" placeholder="请输入位置描述"/>
|
|
|
@@ -358,7 +375,7 @@
|
|
|
</el-form>
|
|
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="addOrUpdateTVisible = false">取 消</el-button>
|
|
|
+ <el-button @click="addOrUpdateVisible = false">取 消</el-button>
|
|
|
<el-button type="primary" @click="handleAddSubmit">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
@@ -396,6 +413,7 @@ import WangEditor from "@/components/Components/WangEditor.vue";
|
|
|
import QAChat from "@/components/Components/QAChat.vue"
|
|
|
import DrawioEmbed from "@/components/DrawioEmbed/index.vue";
|
|
|
import {getSynergismScheme, zbAdd, zbPage, zbGet, zbUpdate, zbDel} from "@/api/planningScheme";
|
|
|
+import {getSubPlanZbZbList, getZbList} from "@/api/subPlanZb";
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
|
@@ -419,8 +437,12 @@ export default {
|
|
|
return {
|
|
|
// 表格编辑相关
|
|
|
zbInfoList: [],
|
|
|
+ searchKeyword: '', // 搜索关键词
|
|
|
+ zbList:[],
|
|
|
+
|
|
|
+ loading:false,
|
|
|
addOrUpdateTitle: '新增装备信息',
|
|
|
- addOrUpdateTVisible: false,
|
|
|
+ addOrUpdateVisible: false,
|
|
|
addForm: {
|
|
|
zbName: '',
|
|
|
isExactLocation: 0,
|
|
|
@@ -521,6 +543,19 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
+ filteredZbInfoList() {
|
|
|
+ const keyword = this.searchKeyword.trim().toLowerCase();
|
|
|
+ if (!keyword) {
|
|
|
+ return this.zbInfoList; // 无关键词,显示全部
|
|
|
+ }
|
|
|
+
|
|
|
+ // 在 zbName、positionDescription、taskRemark 中搜索
|
|
|
+ return this.zbInfoList.filter(item =>
|
|
|
+ item.zbName?.toLowerCase().includes(keyword) ||
|
|
|
+ item.positionDescription?.toLowerCase().includes(keyword) ||
|
|
|
+ item.taskRemark?.toLowerCase().includes(keyword)
|
|
|
+ );
|
|
|
+ },
|
|
|
// 过滤模板数据
|
|
|
filteredTemplates() {
|
|
|
if (!this.templateSearch) {
|
|
|
@@ -555,16 +590,75 @@ export default {
|
|
|
// }
|
|
|
// if (data) {
|
|
|
},
|
|
|
+
|
|
|
+ // 远程搜索方法
|
|
|
+ handleRemoteSearch(query) {
|
|
|
+ // query 就是用户输入的内容
|
|
|
+ if (!query) {
|
|
|
+ this.zbList = [];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.loading = true;
|
|
|
+
|
|
|
+ // 防抖优化(可选):避免输入过快频繁请求
|
|
|
+ clearTimeout(this._searchTimer);
|
|
|
+ this._searchTimer = setTimeout(async () => {
|
|
|
+ try {
|
|
|
+ const res = await getZbList({zbName: query})
|
|
|
+ this.zbList = res.data || [];
|
|
|
+ } catch (err) {
|
|
|
+ this.zbList = [];
|
|
|
+ console.error('搜索失败:', err);
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ }, 300); // 防抖 300ms
|
|
|
+ },
|
|
|
// 添加装备
|
|
|
openAdd(row) {
|
|
|
- this.addOrUpdateTVisible = true
|
|
|
+ if(row.tempId){
|
|
|
+ this.addForm = { ...row }
|
|
|
+ }
|
|
|
+ this.addOrUpdateVisible = true
|
|
|
},
|
|
|
// 添加装备确认按钮
|
|
|
handleAddSubmit() {
|
|
|
+ console.log(this.addForm)
|
|
|
+ if (this.addForm.tempId || this.addForm.id) {
|
|
|
+ // 编辑:找到列表中 id 相同的项,替换它
|
|
|
+ let index = null
|
|
|
+ if(this.addForm.tempId){
|
|
|
+ index = this.zbInfoList.findIndex(item => item.tempId === this.addForm.tempId);
|
|
|
+ }else {
|
|
|
+ index = this.zbInfoList.findIndex(item => item.id === this.addForm.id);
|
|
|
+ }
|
|
|
|
|
|
+ if (index > -1) {
|
|
|
+ this.zbInfoList.splice(index, 1, { ...this.addForm });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 新增:添加新项,生成 id
|
|
|
+ this.zbInfoList.push({
|
|
|
+ tempId: Date.now(),
|
|
|
+ ...this.addForm
|
|
|
+ });
|
|
|
+ console.log(this.zbInfoList)
|
|
|
+ }
|
|
|
+
|
|
|
+ this.addForm = {
|
|
|
+ zbName: '',
|
|
|
+ isExactLocation: 0,
|
|
|
+ equipPositionX: '',
|
|
|
+ equipPositionY: '',
|
|
|
+ positionDescription: '',
|
|
|
+ taskRemark: '',
|
|
|
+ }
|
|
|
+ this.addOrUpdateVisible = false
|
|
|
},
|
|
|
// 删除装备信息
|
|
|
delZbInfo(row) {
|
|
|
+ this.zbInfoList = this.zbInfoList.filter(item => item.zbName !== row.zbName)
|
|
|
},
|
|
|
async loadDefaultData(xml) {
|
|
|
try {
|
|
|
@@ -589,7 +683,8 @@ export default {
|
|
|
const planJson = JSON.stringify({
|
|
|
algorithmJson: this.algorithmParams, // 布设算法
|
|
|
textJson: this.content, // 富文本
|
|
|
- xml: xml
|
|
|
+ xml: xml, //图编辑器
|
|
|
+ zbInfoList: this.zbInfoList
|
|
|
})
|
|
|
|
|
|
this.$emit("save-plan", {planJson: planJson});
|
|
|
@@ -600,7 +695,8 @@ export default {
|
|
|
return JSON.stringify({
|
|
|
algorithmJson: this.algorithmParams, // 布设算法
|
|
|
textJson: this.content, // 富文本
|
|
|
- xml: xml
|
|
|
+ xml: xml,
|
|
|
+ zbInfoList: this.zbInfoList,
|
|
|
})
|
|
|
},
|
|
|
handleUse(plan) {
|
|
|
@@ -673,11 +769,15 @@ export default {
|
|
|
getSynergismScheme({id: this.planInfo.id}).then((res) => {
|
|
|
this.schemeInfo = res.data;
|
|
|
})
|
|
|
+ getZbList({zbName:''}).then((res)=>{
|
|
|
+ this.zbList = res.data
|
|
|
+ })
|
|
|
if (this.dataJson) {
|
|
|
const data = JSON.parse(this.dataJson)
|
|
|
console.log(data)
|
|
|
this.algorithmParams = data.algorithmJson;
|
|
|
this.content = data.textJson;
|
|
|
+ this.zbInfoList = data.zbInfoList || [];
|
|
|
this.loadDefaultData(data.xml.xmlData);
|
|
|
}
|
|
|
window.addEventListener('resize', () => {
|