From fde4758dd43927cce678d99ffe71e05931616f26 Mon Sep 17 00:00:00 2001 From: “dzb” <2632970487@qq.com> Date: 星期日, 09 十月 2022 10:46:35 +0800 Subject: [PATCH] 创建车辆管理 --- src/views/systemSetting/baseSetting/department/index.vue | 65 +++++++++++++++++++++++++------- 1 files changed, 50 insertions(+), 15 deletions(-) diff --git a/src/views/systemSetting/baseSetting/department/index.vue b/src/views/systemSetting/baseSetting/department/index.vue index 169b284..1e1ac1b 100644 --- a/src/views/systemSetting/baseSetting/department/index.vue +++ b/src/views/systemSetting/baseSetting/department/index.vue @@ -13,7 +13,7 @@ <el-button class="addBtn" type="primary" @click="dialogCreate = true">鏂板閮ㄩ棬</el-button> <el-dialog :visible.sync="dialogCreate" title="鏂板閮ㄩ棬淇℃伅" width="45%" v-if="dialogCreate" :before-close="handleClose"> - <createUser :refresh="context==='' ? getUserList : search " /> + <createUser :refresh="context==='' ? getUserList : search " @changMyDialog="changMyDialog" /> </el-dialog> </div> </div> @@ -48,11 +48,8 @@ <el-table-column prop="operation" label="鎿嶄綔" min-width="15"> <template slot-scope="scope"> <div class="operation"> - <!-- <span @click="handleChangeRole(scope.row)">淇敼瑙掕壊</span> --> <span @click="handleFind(scope.row)">鏌ョ湅</span> <span class="line">|</span> - <!-- <span>淇敼瀵嗙爜</span> --> - <!-- <span>鍒犻櫎</span> --> <span @click="handleUpdate(scope.row)">淇敼</span> <span class="line">|</span> <span @click="handleDelete(scope.row)">鍒犻櫎</span> @@ -116,6 +113,7 @@ all: false, unsame: false, myIdx: 0, + preMyIdx: 0, options: [ { value: 0, @@ -143,11 +141,50 @@ }, methods: { selectChange(list) { - console.log(list); console.log(this.tempList); + if (this.tempList.length !== 0) { + if (list === 3) { + this.preMyIdx = list; + this.mulDelete(this.tempList); + } + } else { + this.myIdx = this.preMyIdx; + this.$message({ + type: 'warning', + message: '鎮ㄨ繕娌¢�変腑浠讳綍鏁版嵁', + }) + } + }, + // 澶氭潯鏁版嵁鍒犻櫎 + mulDelete(idArr) { + this.$confirm('鎮ㄧ‘瀹氳鎵归噺鍒犻櫎閮ㄩ棬鍚�?') + .then(_ => { + this.$axios({ + method: 'post', + url: 'sccg/depart/batch_deletion?ids=' + idArr, + }) + .then(res => { + if (res.code === 200) { + this.$message({ + type: 'success', + message: '鎵归噺鍒犻櫎閮ㄩ棬鎴愬姛', + }) + this.getUserList(); + } else { + this.$message({ + type: 'error', + message: res.message + }) + } + }) + }) + .catch(err => { console.log(err) }); }, tableChange(list) { - this.tempList = list; + this.tempList = []; + list.forEach(item => { + this.tempList.push(item.id); + }) if (list.length === this.tableData.length) { this.all = true; } else { @@ -168,6 +205,7 @@ this.$refs.multipleTable.toggleRowSelection(row) }) }, + // 鍗曟潯鏁版嵁鍒犻櫎 handleDelete({ id }) { this.$confirm('纭鍒犻櫎锛�') .then(_ => { @@ -190,19 +228,15 @@ }) .catch(_ => { }); }, - // 淇敼瑙掕壊 - handleChangeRole(obj) { - this.dialogUpdate = true - this.user = obj; - // console.log(obj) - }, // 淇敼鐢ㄦ埛鐘舵�� handleChangeStatus(obj) { let { id, status } = obj; status == true ? status = 1 : status = 0; console.log(id, status); this.$axios.post(`sccg/depart/status`, { id: id, status: status }).then(res => { - console.log(res); + if (res.code == 200) { + this.getUserList(); + } }) }, // 鑾峰彇鐢ㄦ埛鍒楄〃 @@ -273,8 +307,9 @@ this.search(); }, // 鍏抽棴dialog - changMyDialog(val) { - this.dialogUpdate = val.dialogFlag; + changMyDialog({flag}) { + this.dialogUpdate = flag; + this.dialogCreate = flag; }, handleClose(done) { this.$confirm('纭鍏抽棴锛�') -- Gitblit v1.8.0