jiangping
2025-06-06 a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea
admin/src/views/Inspection/components/OperaYwPatrolLineWindow.vue
@@ -32,7 +32,7 @@
    </el-form>
    <!--  -->
    <el-dialog title="添加巡检点" :close-on-click-modal="false" append-to-body :visible.sync="isShowModal" width="780px">
    <el-dialog title="添加巡检点" :close-on-click-modal="false" append-to-body :visible.sync="isShowModal" width="880px">
      <!-- <el-select class="w400" v-model="selPoint" clearable multiple filterable>
        <el-option v-for="item in pointList" :value="item.id" :label="item.name"></el-option>
      </el-select> -->
@@ -50,16 +50,18 @@
        </el-form-item>
        <el-button type="primary" @click="initData">搜索</el-button>
        <el-button @click="reset">重置</el-button>
        <el-button type="primary" @click="editClick()" icon="el-icon-plus"
                   v-permissions="['business:ywpatrolpoint:create']">新建巡检点</el-button>
      </el-form>
      <el-table @selection-change="handleSelectionChange" v-loading="isWorking.search" :data="pointList" stripe>
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column prop="code" label="巡检点编码" min-width="100px"></el-table-column>
        <el-table-column prop="name" label="巡检点名称" min-width="100px"></el-table-column>
        <el-table-column prop="deviceName" label="巡检点名称" min-width="100px"></el-table-column>
        <el-table-column prop="areaName" label="巡检点名称" min-width="100px"></el-table-column>
        <el-table-column prop="deviceName" label="关联设备" min-width="100px"></el-table-column>
        <el-table-column prop="areaName" label="巡检区域" min-width="100px"></el-table-column>
      </el-table>
      <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="pagination">
      <pagination class="mt10" @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="pagination">
      </pagination>
      <span slot="footer" class="dialog-footer">
@@ -67,21 +69,23 @@
        <el-button type="primary" @click="subModal">确 定</el-button>
      </span>
    </el-dialog>
    <OperaYwPatrolPointWindow ref="operaYwPatrolPointWindow" @success="handlePageChange" />
  </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import OperaYwPatrolPointWindow from '@/views/Inspection/components/OperaYwPatrolPointWindow'
import Pagination from '@/components/common/Pagination'
import { fetchList as getFetchList } from '@/api/Inspection/ywPatrolPoint'
import { create,updateById, detailById } from '@/api/Inspection/ywPatrolLine'
import { create, updateById, detailById } from '@/api/Inspection/ywPatrolLine'
import { Message } from 'element-ui'
import { fetchList } from '@/api/business/category'
export default {
  name: 'OperaYwPatrolLineWindow',
  extends: BaseOpera,
  components: { GlobalWindow, Pagination },
  components: { GlobalWindow, Pagination,OperaYwPatrolPointWindow },
  data() {
    return {
      // 表单数据
@@ -120,6 +124,10 @@
    })
  },
  methods: {
    editClick(row) {
        this.$refs.operaYwPatrolPointWindow.open('新建巡检点')
      // this.$refs.operaYwPatrolPointWindow.initData()
    },
    confirm() {
      const { form, list } = this
      this.$refs['form'].validate((valid) => {
@@ -127,7 +135,7 @@
          if (list.length == 0) return Message.warning('请先选择巡检点')
          form.linePointList = list
          this.isWorking = true
          let  fn = form.id ? updateById : create
          let fn = form.id ? updateById : create
          fn({ ...form }).then(res => {
            Message.success('保存成功')
            this.isWorking = false
@@ -155,7 +163,6 @@
      })
    },
    initData() {
      this.list = []
      const { searchForm, pagination } = this
      getFetchList({
        page: pagination.page,
@@ -193,8 +200,8 @@
    },
    openModal() {
      this.selPoint = this.list.map(i => i.id)
      this.getProject()
      this.reset()
      this.isShowModal = true
    },
    changeSel(e) {
@@ -206,12 +213,23 @@
      this.initData()
    },
    subModal() {
      this.list = this.selList.map(item => {
        return {
          needScancode: 0,
          pointName: item.name,
          pointId: item.id,
          code: item.code
      // this.list = this.selList.map(item => {
      //   return {
      //     needScancode: 0,
      //     pointName: item.name,
      //     pointId: item.id,
      //     code: item.code
      //   }
      // })
      this.selList.forEach(item => {
        const index = this.list.findIndex(i => i.code === item.code)
        if (index === -1) {
          this.list.push({
            needScancode: 0,
            pointName: item.name,
            pointId: item.id,
            code: item.code
          })
        }
      })
      this.isShowModal = false