From 9e8d1bd0b6fb495920921214775b84d490e032a3 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 06 九月 2024 16:43:53 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/system/point/index.vue | 625 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 357 insertions(+), 268 deletions(-) diff --git a/src/views/system/point/index.vue b/src/views/system/point/index.vue index 100f98b..5f162cf 100644 --- a/src/views/system/point/index.vue +++ b/src/views/system/point/index.vue @@ -1,250 +1,275 @@ <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"> <el-form-item label="鐐逛綅鍚嶇О" prop="pointName"> - <el-input - v-model="queryParams.pointName" - 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> + <el-input v-model="queryParams.pointName" placeholder="杈撳叆鐐逛綅鍚嶇О" clearable @keyup.enter.native="handleQuery" /> </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" + 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> +<!-- <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 :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> <el-table 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"> - <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> - </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="tempForm" :rules="rules" label-width="120px"> - <el-form-item label="鐐逛綅鍚嶇О" prop="pointName"> - <el-input v-model="tempForm.pointName" placeholder="璇疯緭鍏ョ偣浣嶅悕绉�" /> - </el-form-item> - <el-form-item label="杩愮淮鍗曚綅" prop="unitId"> - <el-select v-model="tempForm.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 - @change="dateChange" - v-model="tempForm.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> - <div class="point-row" v-for="(point,index) in tempFormList"> - <div class="row-item"> - <el-input :disabled="editingIndex!==index" v-model="point.pointName" placeholder="鐐逛綅鍚嶇О"></el-input> - </div> - <div class="row-item"> - <el-select :disabled="editingIndex!==index" v-model="point.unitId" placeholder="杩愮淮鍗曚綅"> - <el-option - v-for="item in unitList" - :key="item.id" - :label="item.value" - :value="item.id"> + <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="杩愮淮鍗曚綅"> + <el-option v-for="item in unitList" :key="item.id" :label="item.value" :value="item.id"> </el-option> </el-select> - </div> - <div class="row-item"> + </el-form-item> + <el-form-item label="杩愮淮鏃堕棿" prop="timezone"> <el-date-picker - :disabled="editingIndex!==index" - v-model="point.timezone" + size="small" + v-model="timezone" type="daterange" - align="right" - unlink-panels range-separator="鑷�" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - > + start-placeholder="杩愮淮寮�濮嬫椂闂�" + end-placeholder="杩愮淮缁撴潫鏃堕棿"> </el-date-picker> - </div> - <div class="row-item"> - <el-button v-show="editingIndex!==index" @click="editPointItem(index)" type="danger" size="small" plain>淇敼</el-button> - <el-button v-show="editingIndex===index" @click="editFinishItem(index)" type="success" size="small" plain>瀹屾垚</el-button> - </div> - </div> - </el-form> + </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="provinceTag"> + <el-switch + v-model="form.provinceTag" + 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 type="primary" @click="submitForm">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> </div> </el-dialog> - <!-- 淇敼杩愮淮鐐逛綅瀵硅瘽妗� --> - <el-dialog :title="title" :visible.sync="editOpen" width="500px" 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="璇疯緭鍏ョ偣浣嶅悕绉�" /> + <!-- 鎵归噺淇敼杩愮淮鍗曚綅 --> + <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 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 - @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> <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="updateCancel">鍙� 娑�</el-button> + <el-button @click="cancelBatchEdit">鍙� 娑�</el-button> + <el-button type="primary" @click="submitBatchEdit">纭� 瀹�</el-button> </div> </el-dialog> + </div> </template> <script> -import { listPoint, getPoint, delPoint, addPoint, addPointBatch, updatePoint } from "@/api/platform/point"; +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 { cascader } from '@/api/system/dept' export default { name: "Point", + dicts: ['point_tag', 'area_code'], data() { return { - // 姝e湪淇敼绗嚑涓� - editingIndex: null, + needUpdateUnit: false, + importantTag: false, + provinceTag: false, + importantCommandImageTag: false, + timeList: [], + timezone: [], + 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: [], // 閬僵灞� loading: true, // 閫変腑鏁扮粍 @@ -267,72 +292,142 @@ 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.getDeptCascader(); }, methods: { - // 鐐逛綅椤逛慨鏀瑰畬鎴� - editFinishItem(index) { - this.editingIndex = null; - let form = this.tempFormList[index]; - form.startTime = form.timezone[0]; - form.endTime = form.timezone[1]; - this.formList[index] = form; + getTagText(row) { + let text = ''; + + // 妫�鏌ユ瘡涓爣绛撅紝濡傛灉涓簍rue锛屽垯娣诲姞鍒皌ext涓� + if (row.importantTag) text += '閲嶇偣鐐逛綅銆�'; + if (row.provinceTag) text += '鐪佸巺鐐逛綅銆�'; + if (row.importantCommandImageTag) text += '閲嶇偣鎸囨尌鍥惧儚銆�'; + if (row.deptTag) text += '閮ㄧ骇銆�'; + text === '' ? '鏅�氱偣浣�' : text + // 杩斿洖鎷兼帴鍚庣殑鏂囨湰鍜屽浐瀹氭枃瀛� + return text.replace(/銆�$/, '') }, - // 鐐逛綅椤逛慨鏀� - editPointItem(index) { - if (this.editingIndex !== index && this.editingIndex !== null) { - this.$modal.msgWarning("璇峰厛瀹屾垚涓婁竴涓慨鏀�"); - } else { - this.editingIndex = index; - this.tempFormList[index] = this.formList[index]; + 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]; } }, - // 鏃堕棿閫夋嫨鍙戠敓鍙樺寲 - dateChange() { - this.tempForm.startTime = this.tempForm.timezone[0]; - this.tempForm.endTime = this.tempForm.timezone[1]; + // 鍙栨秷鎵归噺淇敼 + cancelBatchEdit() { + this.batchOpen = false; }, - // 缁х画娣诲姞鐐逛綅 - nextAdd() { - this.formList.push(this.tempForm); - this.tempFormList.push(this.tempForm); - this.tempForm = {}; + // 鎵归噺淇敼 + handleEditBatch() { + this.batchOpen = true; + }, + + // 鑾峰彇鍖哄幙绾ц仈 + getCascader() { + getCascader().then(res => { + this.regionList = res.data; + }) + }, + // 鑾峰彇閮ㄩ棬绾ц仈 + getDeptCascader() { + cascader().then(res => { + this.deptOptions = res.data; + }) }, getUnitSelect() { // 杩愮淮鍗曚綅涓嬫媺鍒楄〃 @@ -354,23 +449,21 @@ 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 + deleted: null, + importantTag: false, + provinceTag: false, + deptTag: false, }; this.resetForm("form"); }, @@ -387,7 +480,7 @@ // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { this.ids = selection.map(item => item.id) - this.single = selection.length!==1 + this.single = selection.length !== 1 this.multiple = !selection.length }, /** 鏂板鎸夐挳鎿嶄綔 */ @@ -402,73 +495,69 @@ const id = row.id || this.ids getPoint(id).then(response => { this.form = response.data; - this.form.timezone = [this.form.startTime, this.form.endTime] - this.editOpen = true; + 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.formList.length > 0) { - // 鎵归噺澧炲姞 - if (this.formList.every(item => !item.hasOwnProperty("id"))) { - addPointBatch(this.formList).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - // 閲嶇疆 - this.tempForm = {}; - this.tempFormList = []; - this.formList = []; - this.getList(); - }); - } - }else { - if (this.form.id != null) { - updatePoint(this.form).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.editOpen = false; - this.getList(); - }); + this.$refs['form'].validate(valid => { + if (valid) { + 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 { - addPoint(this.form).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); + 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(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + }).catch(() => { + }); }, - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - this.download('x/point/export', { - ...this.queryParams - }, `point_${new Date().getTime()}.xlsx`) - } } }; </script> <style scoped> -.point-row { +.bottom_ { + width: 100%; + margin-bottom: 8px; +} +.col-item { + margin: 5px 0; display: flex; flex-direction: row; + align-content: center; justify-content: center; - align-items: center; -} -.row-item { - margin-right: 5px; -} -.row-item:nth-last-child { - margin-right: 0; } </style> -- Gitblit v1.8.0