123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- <template>
- <div class="app-container">
- <headerdiv ref="headerDiv" :currentindexP = currentindexNew></headerdiv>
- <div class="divtitle">
- <img src="~@/assets/images/icon.png" style="width:1.8rem;height:1.8rem;margin-top:0.3rem"/>
- <div style="font-size:1.6rem;font-family: Adobe Heiti Std;font-weight: normal;color: #DFEEF3;margin-left:1rem">{{divtitle}}</div>
- </div>
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="6.8rem" style="margin-top:1rem">
- <el-form-item label="巡更人员" prop="nickName">
- <el-select v-model="queryParams.nickName" placeholder="请选择人员" style="width:25rem">
- <el-option
- v-for="obj in userList"
- :key="obj.userId"
- :label="obj.nickName"
- :value="obj.userId"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="开始时间" prop="startDate">
- <el-date-picker
- v-model="queryParams.startDate"
- type="date"
- placeholder="选择日期"
- style="width:15rem"
- value-format="yyyy-MM-dd">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="结束时间" prop="endDate">
- <el-date-picker
- v-model="queryParams.endDate"
- type="date"
- placeholder="选择日期"
- style="width:15rem"
- value-format="yyyy-MM-dd">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <!-- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- style="width:8rem;height:3.2rem;"
- type="primary"
- plain
- icon="el-icon-plus"
- @click="handleAdd"
- v-hasPermi="['qdtl:location:add']"
- >新增</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- style="width:8rem;height:3.2rem;"
- type="primary"
- plain
- icon="el-icon-edit"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['qdtl:location:edit']"
- >修改</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- style="width:8rem;height:3.2rem;"
- type="primary"
- plain
- icon="el-icon-delete"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['qdtl:location:remove']"
- >删除</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row> -->
- <el-table v-loading="loading" :data="scheduleList" @selection-change="handleSelectionChange" stripe
- class="my_table"
- :row-class-name="tableRowClassName"
- :header-cell-style="{background:'#24A3B3 50%',color: '#C5D0D4'}">
- <el-table-column label="生效日期" align="center" prop="effectDate" width='250'/>
- <el-table-column label="巡更点" align="center" prop="locationName" width='200'>
- <template slot-scope="scope">
- <div v-for="item of scope.row.locations">
- <span> {{item}} </span>
- </br>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="巡更时间" align="center" prop="detail" width='150' >
- <template slot-scope="scope">
- <div v-for="item of scope.row.timeUnit">
- <span> {{item}} </span>
- </br>
- </div>
- </template>
- </el-table-column>
- <el-table-column :label="dateRange" align="center">
- <el-table-column
- prop="name"
- label="姓名"
- align="center"
- >
- </el-table-column>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </div>
- </template>
- <script>
- import { getSchedule } from "@/api/qdtl/data";
- import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
- import headerdiv from '@/components/HeaderDiv/index.vue'
- import mapdiv from "@/components/map/index.vue"
- export default {
- name: "Location",
- data() {
- return {
- // 遮罩层
- loading: true,
- divtitle:'排班管理',
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- // 总条数
- total: 0,
- // 巡检点管理表格数据
- locationList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- isEdit:'true',
- selectUser:[],
- userList:[],
- dateRange:'',
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- },
- // 表单参数
- form: {},
- pointArry:{
- locations:'',
- type:''
- },
- scheduleList:[],
- // 表单校验
- rules: {
- }
- };
- },
- components:{
- mapdiv,
- headerdiv
- },
- created() {
- this.getList();
- this.getUserList();
- // this.getAreaList();
- },
- methods: {
- getUserList(){
- listUser().then(response =>{
- this.userList = response.rows
- console.log(this.userList);
- // console.log(response.rows);
- })
- },
- /** 查询巡检点管理列表 */
- getList() {
- this.loading = true;
- getSchedule().then(response =>{
- console.log(response);
- this.scheduleList = response.data
- this.loading = false
- })
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- locationCode: null,
- locationName: null,
- detail: null,
- deviceIds: null,
- areaId: null,
- lnglat: null,
- remark: null,
- delFlag: null,
- createBy: null,
- createTime: null,
- updateBy: null,
- updateTime: null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- console.log(this.queryParams);
- this.dateRange = this.queryParams.startDate + '至' +this.queryParams.endDate
- console.log(this.dateRange);
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加巡检点管理";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getLocation(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改巡检点管理";
- this.openMap();
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- if(this.$refs.mapv.locations.length > 0){
- this.form.lnglat = this.$refs.mapv.locations.join(',');
- }
- updateLocation(this.form).then(response => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- this.form.lnglat = this.$refs.mapv.locations.join(',');
- addLocation(this.form).then(response => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal.confirm('是否确认删除巡检点管理编号为"' + ids + '"的数据项?').then(function() {
- return delLocation(ids);
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('qdtl/location/export', {
- ...this.queryParams
- }, `location_${new Date().getTime()}.xlsx`)
- },
- tableRowClassName({ row, rowIndex }) {
- if ((rowIndex + 1) % 2 === 0) {
- return "warning-row";
- } else {
- return "success-row";
- }
- },
- deleteLocation(){
- // this.$refs.mapv.draw.set
- this.$refs.mapv.vector.getSource().clear()
- }
- }
- };
- </script>
- <style>
- .divtitle{
- background: url("~@/assets/images/title2@2x.png") no-repeat;
- background-size: 100% 100%;
- width:100%;
- height:3.9rem;
- padding-top:0.8rem;
- padding-left:3rem;
- display: inline-flex;
- }
- </style>
|