From 09f0861e61e69e2d818eafc7b9edbd17cf0822d4 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期四, 06 十一月 2025 17:20:02 +0800
Subject: [PATCH] 页面优化以及扣分详情导出
---
src/views/system/point/index.vue | 654 ++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 441 insertions(+), 213 deletions(-)
diff --git a/src/views/system/point/index.vue b/src/views/system/point/index.vue
index 4d9e163..fd85d22 100644
--- a/src/views/system/point/index.vue
+++ b/src/views/system/point/index.vue
@@ -1,178 +1,279 @@
<template>
<div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
+ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" @submit.native.prevent>
<el-form-item label="鐐逛綅鍚嶇О" prop="pointName">
- <el-input
- v-model="queryParams.pointName"
- placeholder="璇疯緭鍏ョ偣浣嶅悕绉�"
+ <el-input v-model="queryParams.pointName" placeholder="杈撳叆鐐逛綅鍚嶇О" clearable @clear="handleQuery" @keyup.enter.native="handleQuery" />
+ </el-form-item>
+ <el-form-item label="鍗曚綅" prop="unit">
+ <el-select
+ v-model="queryParams.unitId"
+ placeholder="璇烽�夋嫨鍗曚綅"
clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="鐐逛綅寮�濮嬫椂闂�" prop="startTime">
- <el-date-picker clearable
- v-model="queryParams.startTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="璇烽�夋嫨鐐逛綅寮�濮嬫椂闂�">
- </el-date-picker>
- </el-form-item>
- <el-form-item label="鐐逛綅缁撴潫鏃堕棿" prop="endTime">
- <el-date-picker clearable
- v-model="queryParams.endTime"
- type="date"
- value-format="yyyy-MM-dd"
- placeholder="璇烽�夋嫨鐐逛綅缁撴潫鏃堕棿">
- </el-date-picker>
+ @change="handleQuery"
+ >
+ <el-option
+ v-for="unit in unitList"
+ :key="unit.id"
+ :label="unit.value"
+ :value="unit.id"
+ />
+ </el-select>
</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-button type="primary" icon="el-icon-search" size="small" @click="handleQuery">鎼滅储</el-button>
+ <el-button icon="el-icon-refresh" size="small" @click="resetQuery">閲嶇疆</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
+ <!-- <el-col :span="1.5">-->
+ <!-- <el-button-->
+ <!-- type="primary"-->
+ <!-- plain-->
+ <!-- icon="el-icon-plus"-->
+ <!-- size="mini"-->
+ <!-- @click="handleAdd"-->
+ <!-- >鏂板</el-button>-->
+ <!-- </el-col>-->
<el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- >鏂板</el-button>
+ <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
+ v-hasPermi="['point:edit']">淇敼</el-button>
</el-col>
<el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- >淇敼</el-button>
+ <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
+ v-hasPermi="['point:remove']">鍒犻櫎</el-button>
</el-col>
<el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- >鍒犻櫎</el-button>
+ <el-button type="primary" plain icon="el-icon-top" v-loading="download" size="mini" @click="handleExport"
+ v-hasPermi="['point:export']">瀵煎嚭鐐逛綅</el-button>
</el-col>
+
<el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- v-hasPermi="['x:point:export']"
- >瀵煎嚭</el-button>
+ <el-popover>
+ <div class="bottom_">
+ <p>瀵煎叆鐐逛綅鍙仛鏇存柊鎿嶄綔</p>
+ </div>
+ <div class="bottom_">
+ <el-switch
+ v-model="needUpdateUnit"
+ active-text="淇敼杩愮淮鍗曚綅/鏃堕棿"
+ inactive-text="涓嶄慨鏀硅繍缁村崟浣�/鏃堕棿">
+ </el-switch>
+ </div>
+ <div class="bottom_" v-show="needUpdateUnit">
+ <el-select @change="getUnitContractTime" v-model="importUnitId" size="small" placeholder="鏇存崲杩愮淮鍗曚綅">
+ <el-option v-for="unit in unitList" :key="unit.id" :label="unit.value" :value="unit.id"></el-option>
+ </el-select>
+ </div>
+ <div class="bottom_" v-show="needUpdateUnit">
+ <el-select @change="showTimeRange" v-model="contractId" size="small" placeholder="杩愮淮鍚堝悓" :disabled="! importUnitId">
+ <el-option v-for="(time, index) in timeList" :key="index" :label="time.name" :value="time.id"></el-option>
+ </el-select>
+ <span style="margin-left: 10px;color: #8a8989" v-show="importUnitId">璇ュ崟浣嶆湁{{timeList.length}}涓悎鍚�</span>
+ </div>
+ <div class="bottom_" v-show="needUpdateUnit">
+ <el-date-picker
+ :disabled="! contractId"
+ size="small"
+ v-model="ywTimes"
+ type="daterange"
+ value-format="yyyy-MM-dd"
+ range-separator="鑷�"
+ start-placeholder="鏇存崲杩愮淮鏃堕棿"
+ end-placeholder="鏇存崲杩愮淮鏃堕棿">
+ </el-date-picker>
+ </div>
+ <div class="bottom_">
+ <el-upload
+ ref="upload"
+ class="upload-demo"
+ drag
+ :action="importUrl"
+ :file-list="fileList"
+ :before-upload="beforeUpload"
+ >
+ <i class="el-icon-upload"></i>
+ <div class="el-upload__text">灏嗘枃浠舵嫋鍒版澶勶紝鎴�<em>鐐瑰嚮涓婁紶</em></div>
+ <div class="el-upload__tip" slot="tip">鍙兘涓婁紶xls/xlsx鏂囦欢</div>
+ </el-upload>
+ </div>
+ <div>
+ <el-button class="bottom_" type="primary" size="small" v-loading="upload" @click="handleImport"
+ v-hasPermi="['point:import']">瀵煎叆</el-button>
+ </div>
+ <el-button type="primary" size="mini" plain icon="el-icon-bottom" slot="reference" v-hasPermi="['point:import']"></el-button>
+ </el-popover>
</el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+<!-- <el-col :span="1.5">-->
+<!-- <el-button type="danger" plain icon="el-icon-receiving" size="mini" @click="handleEditBatch"-->
+<!-- v-hasPermi="['point:edit']">鎵归噺淇敼</el-button>-->
+<!-- </el-col>-->
+ <right-toolbar @refreshHeader= "getDyColumn" :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
- <el-table v-loading="loading" :data="pointList" @selection-change="handleSelectionChange">
+ <el-table :key = "refreshkey" v-loading="loading" :data="pointList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
- <el-table-column label="鐐逛綅鍚嶇О" align="center" prop="pointName" />
- <el-table-column label="鐐逛綅寮�濮嬫椂闂�" align="center" prop="startTime" width="180">
+ <el-table-column label="鐐逛綅鍚嶇О" prop="pointName" width="200" show-overflow-tooltip/>
+ <el-table-column label="鏍囩" align="center" width="200" show-overflow-tooltip>
<template slot-scope="scope">
- <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
+ <!-- 浣跨敤璁$畻灞炴�ф潵鏄剧ず鎷兼帴鍚庣殑鏂囨湰 -->
+ <div>{{ getTagText(scope.row) }}</div>
</template>
</el-table-column>
- <el-table-column label="鐐逛綅缁撴潫鏃堕棿" align="center" prop="endTime" width="180">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
- </template>
+ <el-table-column label="杩愮淮寮�濮嬫椂闂�" align="center" prop="startTime" width="140">
+ </el-table-column>
+ <el-table-column label="杩愮淮缁撴潫鏃堕棿" align="center" prop="endTime" width="140">
</el-table-column>
<el-table-column label="杩愮淮鍗曚綅" align="center" prop="unitName" />
<el-table-column label="鐩戠閮ㄩ棬" align="center" prop="deptName" />
- <el-table-column label="杩愮淮绫诲埆" align="center" prop="category">
+ <el-table-column label="澶囨敞" align="center" prop="remark" />
+ <el-table-column v-for="(column, index) in dynamicColumnList" :key="index" :label="column.labelValue" :prop="column.propName" align="center">
<template slot-scope="scope">
- <div v-if="scope.row.category === 1">瑙嗛鐩戞帶</div>
- <div v-else-if="scope.row.category === 2">杞﹁締璇嗗埆</div>
- <div v-else-if="scope.row.category === 3">浜鸿劯璇嗗埆</div>
+ {{ getDynamicValue(scope.row, column.propName) }}
</template>
</el-table-column>
- <el-table-column label="杩愮淮鐘舵��" align="center" prop="status" />
- <el-table-column label="澶囨敞" align="center" prop="remark" />
- <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+ <el-table-column label="鎿嶄綔" align="center" fixed="right" class-name="small-padding fixed-width">
<template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- >淇敼</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- >鍒犻櫎</el-button>
+ <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+ v-hasPermi="['point:edit']">淇敼</el-button>
+ <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
+ v-hasPermi="['point:remove']">鍒犻櫎</el-button>
</template>
</el-table-column>
</el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
+ <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
+ @pagination="getList" />
<!-- 娣诲姞杩愮淮鐐逛綅瀵硅瘽妗� -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
- <el-form-item label="鐐逛綅鍚嶇О" prop="pointName">
- <el-input v-model="form.pointName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" />
+ <div style="display: flex;flex-direction: row">
+ <div style="flex: 5; border-right: 1px solid #d3d3d3; padding-right: 10px">
+ <el-form ref="form" :model="form" :rules="rules" label-width="130px">
+ <el-form-item label="鐐逛綅鍚嶇О" prop="pointName">
+ <el-input v-model="form.pointName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" />
+ </el-form-item>
+ <el-form-item label="鐩戠閮ㄩ棬" prop="deptId">
+ <el-cascader v-model="form.deptId" :options="deptOptions" :show-all-levels="false" clearable
+ :props="{ checkStrictly: true }">
+ </el-cascader>
+ </el-form-item>
+ <el-form-item label="杩愮淮鍗曚綅" prop="unitId">
+ <el-select v-model="form.unitId" placeholder="杩愮淮鍗曚綅" clearable @clear = "clearTime">
+ <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item label="杩愮淮鏃堕棿" prop="timezone">
+ <el-date-picker
+ size="small"
+ v-model="timezone"
+ type="daterange"
+ range-separator="鑷�"
+ start-placeholder="杩愮淮寮�濮嬫椂闂�"
+ end-placeholder="杩愮淮缁撴潫鏃堕棿">
+ </el-date-picker>
+ </el-form-item>
+ <el-form-item label="鐢ㄦ埛鍚�" prop="remark">
+ <el-input v-model="form.username"/>
+ </el-form-item>
+ <el-form-item label="瀵嗙爜" prop="remark">
+ <el-input v-model="form.password"/>
+ </el-form-item>
+ <el-form-item label="鐐逛綅澶囨敞" prop="remark">
+ <el-input type="textarea" v-model="form.remark"/>
+ </el-form-item>
+ </el-form>
+ </div>
+ <div style="flex: 5">
+ <el-form ref="form" :model="form" :rules="rules" label-width="130px">
+ <el-form-item label="閲嶇偣:" prop="importantTag">
+ <el-switch
+ v-model="form.importantTag"
+ active-color="#13ce66"
+ inactive-color="gray"
+ active-text="閲嶇偣鐐逛綅"
+ inactive-text="鏅�氱偣浣�">
+ </el-switch>
+ </el-form-item>
+ <el-form-item label="瑙嗛:" prop="provinceTagVideo">
+ <el-switch
+ v-model="form.provinceTagVideo"
+ active-color="#13ce66"
+ inactive-color="gray"
+ active-text="鐪佸巺鐐逛綅"
+ inactive-text="鏅�氱偣浣�">
+ </el-switch>
+ </el-form-item>
+ <el-form-item label="杞﹁締:" prop="provinceTagCar">
+ <el-switch
+ v-model="form.provinceTagCar"
+ active-color="#13ce66"
+ inactive-color="gray"
+ active-text="鐪佸巺鐐逛綅"
+ inactive-text="鏅�氱偣浣�">
+ </el-switch>
+ </el-form-item>
+ <el-form-item label="浜鸿劯:" prop="provinceTagFace">
+ <el-switch
+ v-model="form.provinceTagFace"
+ active-color="#13ce66"
+ inactive-color="gray"
+ active-text="鐪佸巺鐐逛綅"
+ inactive-text="鏅�氱偣浣�">
+ </el-switch>
+ </el-form-item>
+ <el-form-item label="閮ㄧ骇:" prop="deptTag">
+ <el-switch
+ v-model="form.deptTag"
+ active-color="#13ce66"
+ inactive-color="gray"
+ active-text="閮ㄧ骇鐐逛綅"
+ inactive-text="鏅�氱偣浣�">
+ </el-switch>
+ </el-form-item>
+ <el-form-item label="閲嶇偣鎸囨尌鍥惧儚:" prop="importantCommandImageTag">
+ <el-switch
+ v-model="form.importantCommandImageTag"
+ active-color="#13ce66"
+ inactive-color="gray"
+ active-text="閲嶇偣鎸囨尌鍥惧儚鐐逛綅"
+ inactive-text="鏅�氱偣浣�">
+ </el-switch>
+ </el-form-item>
+ </el-form>
+
+ </div>
+ </div>
+
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="cancel">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+
+ <!-- 鎵归噺淇敼杩愮淮鍗曚綅 -->
+ <el-dialog title="鎵归噺淇敼杩愮淮鍗曚綅" :visible.sync="batchOpen" width="600px" append-to-body>
+ <el-form ref="form" :model="batchEditForm" :rules="batchRules" label-width="120px">
+ <el-form-item label="鐐逛綅閫夋嫨" prop="ids">
+ <el-cascader @change="cos" v-model="batchEditForm.ids" :options="regionList" placeholder="璇烽�夋嫨鍖哄煙"
+ :props="props" collapse-tags></el-cascader>
</el-form-item>
<el-form-item label="杩愮淮鍗曚綅" prop="unitId">
- <el-select :disabled="title === '淇敼杩愮淮鐐逛綅'" v-model="form.unitId" placeholder="杩愮淮鍗曚綅">
- <el-option
- v-for="item in unitList"
- :key="item.id"
- :label="item.value"
- :value="item.id">
+ <el-select v-model="batchEditForm.unitId" placeholder="閫夋嫨杩愮淮鍗曚綅">
+ <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id">
</el-option>
</el-select>
</el-form-item>
- <el-form-item label="鐐逛綅鏃跺尯" prop="timezone">
- <el-date-picker
- :disabled="title === '淇敼杩愮淮鐐逛綅'"
- @change="dateChange"
- v-model="form.timezone"
- type="daterange"
- align="right"
- unlink-panels
- range-separator="鑷�"
- start-placeholder="寮�濮嬫棩鏈�"
- end-placeholder="缁撴潫鏃ユ湡"
- >
+ <el-form-item label="杩愮淮鏃堕棿娈�" prop="timezone">
+ <el-date-picker v-model="batchEditForm.timezone" type="daterange" align="right"
+ unlink-panels range-separator="鑷�" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡">
</el-date-picker>
</el-form-item>
- <el-form-item>
- <div style="display: flex;flex-direction: row-reverse">
- <el-button @click="nextAdd" type="primary" plain>娣诲姞鐐逛綅</el-button>
- </div>
- </el-form-item>
- <el-row style="min-height: 200px;max-height: 400px; overflow-y: auto">
- <el-col class="col-item" v-for="(point) in tempFormList" :span="8">
- <div style="margin-right: 5px">
- <el-cascader v-model="point.region" :options="regionList" placeholder="璇烽�夋嫨鍖哄煙" :show-all-levels="false"></el-cascader>
- </div>
- <div v-if="title === '淇敼杩愮淮鐐逛綅'">
- <el-button @click="removeRegion(point)" type="danger" icon="el-icon-delete" circle></el-button>
- </div>
- </el-col>
- </el-row>
</el-form>
<div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
- <el-button @click="cancel">鍙� 娑�</el-button>
+ <el-button @click="cancelBatchEdit">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitBatchEdit">纭� 瀹�</el-button>
</div>
</el-dialog>
@@ -180,17 +281,43 @@
</template>
<script>
-import { listPoint, getPoint, delPoint, addPoint, addPointBatch, updatePoint } from "@/api/platform/point";
+import { addDynamicColumn, deleteDynamicColumnById, editDynamicColumn, getDynamicColumnList } from '@/api/platform/dynamicColumn'
+import { listPoint, getPoint, delPoint, addPoint, batchEdit, updatePoint, exportData, importData, timeRange } from "@/api/platform/point";
import { unitSelect } from "@/api/platform/unit";
-import { getCascader } from '../../../api/platform/region'
-
+import { getCascader } from '@/api/platform/region'
+import { cascader } from '@/api/system/dept'
export default {
name: "Point",
+ dicts: ['point_tag', 'area_code'],
data() {
return {
+ refreshkey : 0,
+ dynamicColumnList: [],
+ needUpdateUnit: false,
+ importantTag: false,
+ provinceTag: false,
+ importantCommandImageTag: false,
+ timeList: [],
+ timezone: null,
+ ywTimes: [],
+ fileList: [],
+ importFile: null,
+ importUrl: '',
+ importUnitId: null,
+ contractId: null,
+ download: false,
+ upload: false,
+ deptOptions: [],
+ // 鎵归噺淇敼琛ㄥ崟
+ batchEditForm: {
+ ids: [],
+ unitId: null,
+ timezone: null,
+ },
+ // 鎵归噺淇敼寮圭獥
+ batchOpen: false,
+ props: { multiple: true },
regionList: [],
- // 姝e湪淇敼绗嚑涓�
- editingIndex: null,
// 閬僵灞�
loading: true,
// 閫変腑鏁扮粍
@@ -213,48 +340,157 @@
editOpen: false,
// 杩愮淮鍗曚綅
unitList: [],
- // 杩愮淮鏃跺尯
- timezone:[],
// 鏌ヨ鍙傛暟
queryParams: {
pageNum: 1,
pageSize: 10,
pointName: null,
- startTime: null,
- endTime: null,
unitId: null,
status: null,
},
// 琛ㄥ崟鍙傛暟
- form: {},
- // 鎵归噺琛ㄥ崟鍐呭
- formList:[],
- // 涓存椂琛ㄥ崟鏁版嵁
- tempForm: {},
- // 涓存椂琛ㄥ崟鏁版嵁鍒楄〃
- tempFormList: [],
+ form: {
+ },
// 琛ㄥ崟鏍¢獙
rules: {
pointName: [
{ required: true, message: "鐐逛綅鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
],
- timezone: [
- { required: true, message: "鐐逛綅鏃跺尯涓嶈兘涓虹┖", trigger: "blur" }
+ deptId: [
+ { required: true, message: "鐩戠閮ㄩ棬涓嶈兘涓虹┖", trigger: "change" }
],
- unitId: [
- { required: true, message: "杩愮淮鍗曚綅涓嶈兘涓虹┖", trigger: "change" }
+ category: [
+ { required: true, message: "璁惧绫诲瀷", trigger: "change" }
],
+ },
+ // 鎵归噺琛ㄥ崟鏍¢獙
+ batchRules: {
+ ids: [
+ { required: true, message: "璇烽�夋嫨鐐逛綅", trigger: "change" }
+ ]
}
};
},
created() {
this.getList();
this.getUnitSelect();
- this.getCascader();
+ // this.getCascader();
+ this.getDeptCascader();
+ this.getDyColumn();
},
methods: {
- removeRegion(item) {
- this.tempFormList = this.tempFormList.filter(data => data !== item)
+ clearTime() {
+ console.log("鐢熸晥")
+ this.timezone = '';
+ },
+ getDyColumn() {
+ // 鏌ヨ鍔ㄦ�佸垪
+ let params = {
+ tableName: 't_yw_point'
+ }
+ getDynamicColumnList(params).then(res => {
+ this.dynamicColumnList = res.data
+ this.refreshkey+=1
+ console.log("鍔犺浇鍔ㄦ�佸垪"+this.refreshkey)
+ })
+ },
+ getDynamicValue(row, propName) {
+ let target = row.dynamicColumnList.filter(item => item.propName === propName)
+ return target && target.length > 0 ? target[0].columnValue : ''
+ },
+ getTagText(row) {
+ let text = '';
+
+ // 妫�鏌ユ瘡涓爣绛撅紝濡傛灉涓簍rue锛屽垯娣诲姞鍒皌ext涓�
+ if (row.importantTag) text += '閲嶇偣鐐逛綅銆�';
+ if (row.provinceTagVideo) text += '鐪佸巺瑙嗛銆�';
+ if (row.provinceTagCar) text += '鐪佸巺杞﹁締銆�';
+ if (row.provinceTagFace) text += '鐪佸巺浜鸿劯銆�';
+ if (row.importantCommandImageTag) text += '閲嶇偣鎸囨尌鍥惧儚銆�';
+ if (row.deptTag) text += '閮ㄧ骇銆�';
+ text === '' ? '鏅�氱偣浣�' : text
+ // 杩斿洖鎷兼帴鍚庣殑鏂囨湰鍜屽浐瀹氭枃瀛�
+ return text.replace(/銆�$/, '')
+ },
+ getUnitContractTime(unitId) {
+ this.ywTimes = []
+ this.contractId = null;
+ timeRange(unitId).then(res => {
+ this.timeList = res.data;
+ })
+ },
+ showTimeRange(contractId) {
+ let a = this.timeList.filter(item => item.id === contractId)
+ if (a.length < 1) {
+ this.ywTimes = []
+ return
+ }
+ let target = a[0]
+ this.ywTimes = [target.startTime, target.endTime]
+ },
+ beforeUpload(file) {
+ this.importFile = file
+ this.fileList = [file]
+ return false
+ },
+ // 鐐逛綅瀵煎叆
+ handleImport() {
+ this.upload =true;
+ let formData = new FormData()
+ formData.append("file", this.importFile)
+ formData.append("startTime", this.ywTimes[0] ? this.ywTimes[0] : '')
+ formData.append("endTime", this.ywTimes[1] ? this.ywTimes[1] : '')
+ formData.append("unitId", this.importUnitId ? this.importUnitId : -1)
+ formData.append("needUpdateUnit", this.needUpdateUnit)
+ importData(formData).then(res => {
+ this.$message.success("瀵煎叆鎴愬姛")
+ this.upload = false
+ this.getList()
+ })
+ },
+ // 鐐逛綅瀵煎嚭
+ handleExport() {
+ this.download = true
+ exportData(this.queryParams).then(res => {
+ // 灏嗕簩杩涘埗鏁版嵁杞崲涓� Blob 瀵硅薄
+ let blob = new Blob([res], { type: 'application/octet-stream' });
+
+ // 鍒涘缓涓嬭浇閾炬帴
+ let downloadLink = document.createElement('a');
+ downloadLink.href = URL.createObjectURL(blob);
+ downloadLink.setAttribute('download', "鐐逛綅鏇存崲杩愮淮鍗曚綅.xlsx"); // 璁剧疆涓嬭浇鏂囦欢鐨勬枃浠跺悕
+ downloadLink.style.display = 'none';
+ // 娣诲姞鍒伴〉闈㈠苟瑙﹀彂涓嬭浇
+ document.body.appendChild(downloadLink);
+ downloadLink.click();
+ document.body.removeChild(downloadLink);
+ this.download = false
+ })
+ },
+ cos(value) {
+ console.log(value)
+ },
+ // 鎻愪氦鎵归噺淇敼
+ submitBatchEdit() {
+ this.batchEditForm.ids = this.batchEditForm.ids.map(array => array[array.length - 1]);
+ if (this.batchEditForm.timezone) {
+ this.batchEditForm.startTime = this.batchEditForm.timezone[0];
+ this.batchEditForm.endTime = this.batchEditForm.timezone[1];
+ }
+ },
+ // 鍙栨秷鎵归噺淇敼
+ cancelBatchEdit() {
+ this.batchOpen = false;
+ },
+ // 鎵归噺淇敼
+ handleEditBatch() {
+ this.batchOpen = true;
+ },
+ // 杩愮淮鍏徃涓嬫媺鏁版嵁
+ selectUnit() {
+ workList(this.queryParams).then(res => {
+ this.unitList = res.data;
+ })
},
// 鑾峰彇鍖哄幙绾ц仈
getCascader() {
@@ -262,33 +498,11 @@
this.regionList = res.data;
})
},
- // 鐐逛綅椤逛慨鏀瑰畬鎴�
- editFinishItem(index) {
- this.editingIndex = null;
- let form = this.tempFormList[index];
- form.startTime = form.timezone[0];
- form.endTime = form.timezone[1];
- this.formList[index] = form;
- },
- // 鐐逛綅椤逛慨鏀�
- editPointItem(index) {
- if (this.editingIndex !== index && this.editingIndex !== null) {
- this.$modal.msgWarning("璇峰厛瀹屾垚涓婁竴涓慨鏀�");
- } else {
- this.editingIndex = index;
- this.tempFormList[index] = this.formList[index];
- }
- },
- // 鏃堕棿閫夋嫨鍙戠敓鍙樺寲
- dateChange() {
- this.tempForm.startTime = this.tempForm.timezone[0];
- this.tempForm.endTime = this.tempForm.timezone[1];
- },
- // 缁х画娣诲姞鐐逛綅
- nextAdd() {
- let item = {}
- // this.formList.push(item);
- this.tempFormList.push(item);
+ // 鑾峰彇閮ㄩ棬绾ц仈
+ getDeptCascader() {
+ cascader().then(res => {
+ this.deptOptions = res.data;
+ })
},
getUnitSelect() {
// 杩愮淮鍗曚綅涓嬫媺鍒楄〃
@@ -310,24 +524,23 @@
this.open = false;
this.reset();
},
- updateCancel() {
- this.editOpen = false;
- this.reset();
- },
// 琛ㄥ崟閲嶇疆
reset() {
this.form = {
id: null,
pointName: null,
- startTime: null,
- endTime: null,
unitId: null,
+ deptId: [],
status: null,
remark: null,
createTime: null,
updateTime: null,
deleted: null,
- pointDetail: ""
+ importantTag: false,
+ provinceTagVideo: false,
+ provinceTagCar: false,
+ provinceTagFace: false,
+ deptTag: false,
};
this.resetForm("form");
},
@@ -359,38 +572,55 @@
const id = row.id || this.ids
getPoint(id).then(response => {
this.form = response.data;
- this.form.timezone = [this.form.startTime, this.form.endTime]
- if (this.form.pointDetail) {
- this.tempFormList = JSON.parse(this.form.pointDetail)
- }
+ this.form.deptId = response.data.deptIds
+ this.form.category = this.form.category + ''
+ this.timezone = [response.data.startTime, response.data.endTime]
this.open = true;
+ console.log(this.form)
this.title = "淇敼杩愮淮鐐逛綅";
});
},
/** 鎻愪氦鎸夐挳 */
submitForm() {
- if (this.tempFormList) {
- this.form.pointDetail = JSON.stringify(this.tempFormList)
- }
- if (this.form.id != null) {
- updatePoint(this.form).then(response => {
- this.$modal.msgSuccess("淇敼鎴愬姛");
- this.open = false;
- this.getList();
- });
- } else {
- addPoint(this.form).then(response => {
- this.$modal.msgSuccess("鏂板鎴愬姛");
- this.open = false;
- this.reset()
- this.getList();
- });
- }
+ this.$refs['form'].validate(valid => {
+ if (valid) {
+ if (this.timezone && this.timezone.length > 0) {
+ this.form.startTime = this.timezone[0]
+ this.form.endTime = this.timezone[1]
+ } else {
+ this.form.startTime = null
+ this.form.endTime = null
+ }
+ if (this.form.deptId && this.form.deptId.length > 0) {
+ this.form.deptId = this.form.deptId[this.form.deptId.length - 1]
+ }
+ let temp = {
+ ...this.form,
+ category: parseInt(this.form.category)
+ };
+ if (temp.id != null) {
+ updatePoint(temp).then(response => {
+ this.$modal.msgSuccess("淇敼鎴愬姛");
+ this.open = false;
+ this.getList();
+ });
+ } else {
+ addPoint(temp).then(response => {
+ this.$modal.msgSuccess("鏂板鎴愬姛");
+ this.open = false;
+ this.reset()
+ this.getList();
+ });
+ }
+ } else {
+ console.log("error")
+ }
+ })
},
/** 鍒犻櫎鎸夐挳鎿嶄綔 */
handleDelete(row) {
const ids = row.id || this.ids;
- this.$modal.confirm('鏄惁纭鍒犻櫎杩愮淮鐐逛綅缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+ this.$modal.confirm('鏄惁纭鍒犻櫎杩愮淮鐐逛綅缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function () {
return delPoint(ids);
}).then(() => {
this.getList();
@@ -398,17 +628,15 @@
}).catch(() => {
});
},
- /** 瀵煎嚭鎸夐挳鎿嶄綔 */
- handleExport() {
- this.download('x/point/export', {
- ...this.queryParams
- }, `point_${new Date().getTime()}.xlsx`)
- }
}
};
</script>
<style scoped>
+.bottom_ {
+ width: 100%;
+ margin-bottom: 8px;
+}
.col-item {
margin: 5px 0;
display: flex;
--
Gitblit v1.8.0