From a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 06 六月 2025 19:19:34 +0800
Subject: [PATCH] 开发更新

---
 admin/src/views/Inspection/components/OperaYwPatrolLineWindow.vue |  277 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 227 insertions(+), 50 deletions(-)

diff --git a/admin/src/views/Inspection/components/OperaYwPatrolLineWindow.vue b/admin/src/views/Inspection/components/OperaYwPatrolLineWindow.vue
index abbc222..432d082 100644
--- a/admin/src/views/Inspection/components/OperaYwPatrolLineWindow.vue
+++ b/admin/src/views/Inspection/components/OperaYwPatrolLineWindow.vue
@@ -1,78 +1,255 @@
 <template>
-  <GlobalWindow
-    :title="title"
-    :visible.sync="visible"
-    :confirm-working="isWorking"
-    @confirm="confirm"
-  >
+  <GlobalWindow width="800px" :title="title" :visible.sync="visible" :confirm-working="isWorking" @confirm="confirm">
     <el-form :model="form" ref="form" :rules="rules">
-      <el-form-item label="鍒涘缓浜虹紪鐮�" prop="creator">
-        <el-input v-model="form.creator" placeholder="璇疯緭鍏ュ垱寤轰汉缂栫爜" v-trim/>
+      <el-form-item label="绾胯矾鍚嶇О" prop="name">
+        <el-input v-model="form.name" placeholder="璇疯緭鍏ョ嚎璺悕绉�" v-trim />
       </el-form-item>
-      <el-form-item label="鍒涘缓鏃堕棿" prop="createDate">
-        <el-date-picker v-model="form.createDate" value-format="yyyy-MM-dd" placeholder="璇疯緭鍏ュ垱寤烘椂闂�"></el-date-picker>
-      </el-form-item>
-      <el-form-item label="鏇存柊浜虹紪鐮�" prop="editor">
-        <el-input v-model="form.editor" placeholder="璇疯緭鍏ユ洿鏂颁汉缂栫爜" v-trim/>
-      </el-form-item>
-      <el-form-item label="鏇存柊鏃堕棿" prop="editDate">
-        <el-date-picker v-model="form.editDate" value-format="yyyy-MM-dd" placeholder="璇疯緭鍏ユ洿鏂版椂闂�"></el-date-picker>
-      </el-form-item>
-      <el-form-item label="鏄惁鍒犻櫎0鍚� 1鏄�" prop="isdeleted">
-        <el-input v-model="form.isdeleted" placeholder="璇疯緭鍏ユ槸鍚﹀垹闄�0鍚� 1鏄�" v-trim/>
-      </el-form-item>
-      <el-form-item label="鍚嶇О" prop="name">
-        <el-input v-model="form.name" placeholder="璇疯緭鍏ュ悕绉�" v-trim/>
-      </el-form-item>
-      <el-form-item label="澶囨敞" prop="remark">
-        <el-input v-model="form.remark" placeholder="璇疯緭鍏ュ娉�" v-trim/>
-      </el-form-item>
-      <el-form-item label="鐘舵�� 0鍚敤 1绂佺敤" prop="status">
-        <el-input v-model="form.status" placeholder="璇疯緭鍏ョ姸鎬� 0鍚敤 1绂佺敤" v-trim/>
-      </el-form-item>
-      <el-form-item label="鎺掑簭鐮�" prop="sortnum">
-        <el-input v-model="form.sortnum" placeholder="璇疯緭鍏ユ帓搴忕爜" v-trim/>
-      </el-form-item>
-      <el-form-item label="鍥炬爣" prop="imgurl">
-        <el-input v-model="form.imgurl" placeholder="璇疯緭鍏ュ浘鏍�" v-trim/>
-      </el-form-item>
+      <div class="head">
+        <div class="title">宸℃鐐�</div>
+        <el-button type="primary" @click="openModal">娣诲姞宸℃鐐�</el-button>
+      </div>
+      <el-table :data="list" stripe>
+        <el-table-column prop="code" label="宸℃鐐圭紪鐮�" min-width="100px"></el-table-column>
+        <el-table-column prop="pointName" label="宸℃鐐瑰悕绉�" min-width="100px"></el-table-column>
+        <el-table-column prop="name" label="鎵爜鎵撳崱" min-width="100px">
+          <template v-slot="scope">
+            <el-switch v-model="scope.row.needScancode" :disabled="true" @change="changeStatus" :active-value="0"
+              :inactive-value="1"></el-switch>
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="鎺掑簭鐮�" min-width="100px">
+          <template v-slot="scope">
+            <el-input v-model="scope.row.sortnum" class="w100"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column prop="name" label="鎿嶄綔" min-width="100px">
+          <template v-slot="scope">
+            <span class="red cu" @click="handleDel(scope)">鍒犻櫎</span>
+          </template>
+        </el-table-column>
+      </el-table>
+
+
     </el-form>
+    <!--  -->
+    <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> -->
+      <el-form ref="searchForm" :model="searchForm" label-width="80px" inline>
+        <el-form-item label="宸℃鐐�" prop="name">
+          <el-input v-model="searchForm.name" placeholder="璇疯緭鍏ュ贰妫�鐐瑰悕绉�/缂栫爜" @keypress.enter.native="search"></el-input>
+        </el-form-item>
+        <el-form-item label="宸℃鍖哄煙">
+          <el-cascader v-model="searchForm.areaIds" @change="changeSel" placeholder="璇烽�夋嫨宸℃鍖哄煙" clearable
+            :options="areaList" :props="{
+              label: 'name',
+              value: 'id',
+              children: 'childCategoryList'
+            }"></el-cascader>
+        </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>
+      <pagination class="mt10" @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="pagination">
+      </pagination>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="isShowModal = false">鍙� 娑�</el-button>
+        <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 { Message } from 'element-ui'
+import { fetchList } from '@/api/business/category'
 export default {
   name: 'OperaYwPatrolLineWindow',
   extends: BaseOpera,
-  components: { GlobalWindow },
-  data () {
+  components: { GlobalWindow, Pagination,OperaYwPatrolPointWindow },
+  data() {
     return {
       // 琛ㄥ崟鏁版嵁
       form: {
-        id: null,
-        creator: '',
-        createDate: '',
-        editor: '',
-        editDate: '',
-        isdeleted: '',
         name: '',
-        remark: '',
-        status: '',
-        sortnum: '',
-        imgurl: ''
       },
+      selPoint: [],
+
+      pointList: [],
+      selList: [],
+      areaList: [],
+      searchForm: {
+        name: '',
+        areaId: '',
+        areaIds: []
+      },
+      pagination: {
+        pageSize: 10,
+        page: 1,
+        total: 0
+      },
+
+      list: [],
+      isWorking: false,
+      isShowModal: false,
       // 楠岃瘉瑙勫垯
       rules: {
-      }
+        name: [{ required: true, message: '璇疯緭鍏�' }],
+        selPoint: [{ type: 'array', required: true, message: '璇疯緭鍏�' }],
+      },
     }
   },
-  created () {
+  created() {
     this.config({
       api: '/Inspection/ywPatrolLine',
-      'field.id': 'id'
     })
+  },
+  methods: {
+    editClick(row) {
+        this.$refs.operaYwPatrolPointWindow.open('鏂板缓宸℃鐐�')
+      // this.$refs.operaYwPatrolPointWindow.initData()
+    },
+    confirm() {
+      const { form, list } = this
+      this.$refs['form'].validate((valid) => {
+        if (valid) {
+          if (list.length == 0) return Message.warning('璇峰厛閫夋嫨宸℃鐐�')
+          form.linePointList = list
+          this.isWorking = true
+          let fn = form.id ? updateById : create
+          fn({ ...form }).then(res => {
+            Message.success('淇濆瓨鎴愬姛')
+            this.isWorking = false
+            this.close()
+          }, () => {
+            this.isWorking = false
+          })
+        }
+      })
+
+    },
+    getDetail(row) {
+      detailById(row.id).then(res => {
+        this.form = res
+        this.list = res.linePointList || []
+      })
+    },
+    getProject() {
+      fetchList({
+        model: { type: 4 },
+        capacity: 1000,
+        page: 1,
+      }).then(res => {
+        this.areaList = res.records || []
+      })
+    },
+    initData() {
+      const { searchForm, pagination } = this
+      getFetchList({
+        page: pagination.page,
+        capacity: pagination.pageSize,
+        model: { ...searchForm }
+      }).then(res => {
+        this.pointList = res.records || []
+        this.pagination.total = res.total
+      })
+    },
+    handleSelectionChange(val) {
+      this.selList = val
+    },
+    reset() {
+      this.searchForm = {
+        name: '',
+        areaId: '',
+        areaIds: []
+      }
+      this.initData()
+    },
+    handleSizeChange(val) {
+      this.pagination.pageSize = val
+      this.initData()
+    },
+    handlePageChange(val) {
+      this.pagination.page = val
+      this.initData()
+    },
+    handleDel(row) {
+      this.list.splice(row.$index, 1)
+
+    },
+    changeStatus(row) {
+
+    },
+    openModal() {
+      this.getProject()
+      this.reset()
+      this.isShowModal = true
+    },
+    changeSel(e) {
+      if (e && e.length == 1) {
+      } else if (e && e.length == 2) {
+        this.$set(this.searchForm, 'areaId', e[1])
+      } else {
+      }
+      this.initData()
+    },
+    subModal() {
+      // 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
+    },
+    close() {
+      this.visible = false
+      this.$emit('success')
+    }
   }
 }
 </script>
+<style lang="scss" scoped>
+.head {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin-bottom: 20px;
+
+  div {
+    font-weight: 500;
+  }
+}
+</style>

--
Gitblit v1.9.3