From 2c2188d3b41b9646ea5ee4202a11d135ce03daa2 Mon Sep 17 00:00:00 2001 From: gaoluyang <2820782392@qq.com> Date: 星期三, 26 二月 2025 17:49:21 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- src/views/system/menu/index.vue | 8 src/views/system/role/index.vue | 277 +++++++--------- src/views/CNAS/process/sampleDisposal/index.vue | 625 ++++++++++++++++++++++++++++++++++++ src/api/cnas/process/sampleDisposal.js | 65 +++ 4 files changed, 815 insertions(+), 160 deletions(-) diff --git a/src/api/cnas/process/sampleDisposal.js b/src/api/cnas/process/sampleDisposal.js new file mode 100644 index 0000000..9eef314 --- /dev/null +++ b/src/api/cnas/process/sampleDisposal.js @@ -0,0 +1,65 @@ +// 妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃� +import request from "@/utils/request"; + +// 淇敼 +export function doProcessDeal(data) { + return request({ + url: "/processDeal/doProcessDeal", + method: "post", + data: data, + }); +} + +// 鏂板 +export function addProcessDeal(data) { + return request({ + url: "/processDeal/addProcessDeal", + method: "post", + data: data, + }); +} + +// 鎻愪氦鍘嗗彶 浼犲弬id +export function submitProcessTotaldeal(data) { + return request({ + url: "/processTotaldeal/submitProcessTotaldeal", + method: "post", + data: data, + }); +} + +//鏌ヨ璇︽儏 鍒嗛〉鏌ヨ閲岄潰totaldealId 浼犲弬鍘嗗彶鐨刬d +export function pageProcessDeal(query) { + return request({ + url: "/processDeal/pageProcessDeal", + method: "get", + params: query, + }); +} + +// 瀹℃牳 浼犲弬id鍜岄�氳繃涓嶉�氳繃state(涓枃) +export function checkProcessTotaldeal(data) { + return request({ + url: "/processTotaldeal/checkProcessTotaldeal", + method: "post", + data: data, + }); +} + +// 鎵瑰噯 浼犲弬id鍜岄�氳繃涓嶉�氳繃state(涓枃) +export function ratifyProcessTotaldeal(data) { + return request({ + url: "/processTotaldeal/ratifyProcessTotaldeal", + method: "post", + data: data, + }); +} + +//鍒犻櫎 +export function delProcessDeal(query) { + return request({ + url: "/processDeal/delProcessDeal", + method: "delete", + params: query, + }); +} diff --git a/src/views/CNAS/process/sampleDisposal/index.vue b/src/views/CNAS/process/sampleDisposal/index.vue new file mode 100644 index 0000000..705000e --- /dev/null +++ b/src/views/CNAS/process/sampleDisposal/index.vue @@ -0,0 +1,625 @@ +<template> + <div class="sample-disposal"> + <el-row class="title"> + <el-col :span="20" style="padding-left: 20px;text-align: left;">妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�</el-col> + <el-col :span="4" style="text-align: right;"> + <!-- <el-button size="medium" type="primary" @click="handleDown" v-loading="outLoading" style="margin-right: 16px;">瀵煎嚭</el-button> --> + </el-col> + </el-row> + <el-tabs type="border-card" v-model="activeName" style="height: 100%;" @tab-click="queryParams.totaldealId = ''"> + <el-tab-pane label="濉啓" name="濉啓" style="height: 100%;" :key="1"> + <el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;" + v-if="addPower">鏂板</el-button> + <div class="table" style="height: calc(100% - 200px)" v-if="activeName == '濉啓'"> + <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" :page="page" @pagination="pagination"></lims-table> + <!-- <ValueTable ref="ValueTable0" :url="$api.processTotaldeal.pageProcessDeal" :componentData="componentData0" + :key="upIndex0" :delUrl="$api.processTotaldeal.delProcessDeal" /> --> + </div> + </el-tab-pane> + <el-tab-pane label="鍘嗗彶璁板綍" name="鍘嗗彶璁板綍" style="height: 100%;" :key="2"> + <div class="search"> + <div class="search_thing"> + <div class="search_label">骞存湀锛�</div> + <div class="search_input"> + <el-date-picker v-model="componentData.entity.month" type="month" placeholder="閫夋嫨鏈�" format="yyyy-MM" + value-format="yyyy-MM" size="small" @change="refreshTable()"> + </el-date-picker> + </div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + </div> + <div class="table"> + <!-- <ValueTable ref="ValueTable" :url="$api.processTotaldeal.pageProcessTotaldeal" :componentData="componentData" + :key="upIndex" /> --> + </div> + </el-tab-pane> + </el-tabs> + <!-- 鏂板鏍峰搧 --> + <el-dialog :title="title" :visible.sync="addDialogVisible" width="400px"> + <el-row> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏍峰搧鍚嶇О锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.sampleName"></el-input></div> + </div> + </el-col> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏍峰搧缂栧彿锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.sampleCode"></el-input></div> + </div> + </el-col> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">渚涙牱鍗曚綅锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.sampleSupplier" size="small"> + <el-option :label="item.company" :value="item.company" v-for="(item, index) in customPageList" + :key="item.id"></el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏁伴噺锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.num"></el-input> + </div> + </div> + </el-col> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">澶勭悊鏂瑰紡锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.dealMethod"></el-input></div> + </div> + </el-col> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.dealTime" type="date" size="small" placeholder="閫夋嫨鏃ユ湡" format="yyyy-MM-dd" + value-format="yyyy-MM-dd" style="width: 100%;"> + </el-date-picker> + </div> + </div> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="submitAdd" :loading="addLoading">纭� 瀹�</el-button> + </span> + </el-dialog> + <!-- 璇︽儏/涓嬭浇/瀹℃牳/鎵瑰噯 --> + <el-dialog :title="title0" :visible.sync="lookDialogVisible" width="800px" :class="{ downPdf: title0 == '涓嬭浇' }" + :modal="title0 != '涓嬭浇'" top="5vh"> + <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}" + style="max-height: 70vh;overflow-y: auto;" /> + <span slot="footer" class="dialog-footer" v-if="title0 == '瀹℃牳' || title0 == '鎵瑰噯'"> + <el-button @click="submitCheck('涓嶉�氳繃')" :loading="noCheckLoading">涓嶉�氳繃</el-button> + <el-button type="primary" @click="submitCheck('閫氳繃')" :loading="checkLoading">閫� 杩�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import limsTable from "@/components/Table/lims-table.vue"; +import filePreview from "@/components/Preview/filePreview.vue"; +import { selectCustomPageList } from "@/api/system/customer"; +import { + doProcessDeal, + addProcessDeal, + submitProcessTotaldeal, + pageProcessDeal, + checkProcessTotaldeal, + ratifyProcessTotaldeal, + delProcessDeal, +} from "@/api/cnas/process/sampleDisposal"; +export default { + components: { + limsTable, + filePreview, + }, + name: "SampleDisposal", + data() { + return { + activeName: '濉啓', + title: '鏂板', + addDialogVisible: false, + addLoading: false, + outLoading: false, + editDialogVisible: false, + lookDialogVisible: false, + title0: '鏌ョ湅', + noCheckLoading: false, + checkLoading: false, + // 鍘嗗彶鍒楄〃 + componentData: { + entity: { + month: null, + orderBy: { + field: 'id', + order: 'desc' + } + }, + isIndex: true, + showSelect: false, + select: false, + do: [{ + id: 'handleLook', + font: '鏌ョ湅', + type: 'text', + method: 'handleLook', + }, { + id: 'handleDown0', + font: '涓嬭浇', + type: 'text', + method: 'handleDown0', + disabFun: (row, index) => { + return !row.url + } + }, + // { + // id: 'handleAdd', + // font: '濉啓', + // type: 'text', + // method: 'handleAdd', + // disabFun: (row, index) => { + // return row.submitState=='宸叉彁浜�' + // } + // }, + { + id: 'handleSubmit', + font: '鎻愪氦', + type: 'text', + method: 'handleSubmit', + disabFun: (row, index) => { + return !!row.submitState && row.submitState != '寰呮彁浜�' + } + }, { + id: 'handleCheck', + font: '瀹℃牳', + type: 'text', + method: 'handleCheck', + disabFun: (row, index) => { + return row.examineState == '閫氳繃' || row.submitState == '寰呮彁浜�' + } + }, { + id: 'handleApproval', + font: '鎵瑰噯', + type: 'text', + method: 'handleApproval', + disabFun: (row, index) => { + return row.ratifyState == '閫氳繃' || row.submitState == '寰呮彁浜�' + } + }], + tagField: {}, + selectField: {}, + requiredAdd: [], + requiredUp: [], + needSort: [], + inputType: '' + }, + // 鏍峰搧鍒楄〃 + componentData0: { + entity: { + totaldealId: null, + orderBy: { + field: 'id', + order: 'desc' + } + }, + isIndex: true, + showSelect: false, + select: false, + do: [{ + id: 'handleAdd0', + font: '淇敼', + type: 'text', + method: 'handleAdd0' + }, { + id: 'delete', + font: '鍒犻櫎', + type: 'text', + method: 'doDiy' + }], + tagField: {}, + selectField: {}, + requiredAdd: [], + requiredUp: [], + needSort: [], + inputType: '' + }, + upIndex0: 100, + entityCopy: {}, + upIndex: 0, + addInfo: {},//鏂板鏍峰搧 + customPageList: [], + currentInfo: { + arr: [] + },//鏌ョ湅鐨勮鎯� + outPower: false, + addPower: false, + queryParams: {}, + tableData: [], + column: [ + { label: "鏍峰搧鍚嶇О", prop: "sampleName" }, + { label: "鏍峰搧缂栧彿", prop: "sampleCode" }, + { label: "渚涙牱鍗曚綅", prop: "sampleSupplier" }, + { label: "鏁伴噺", prop: "num" }, + { label: "澶勭悊鏂瑰紡", prop: "dealMethod" }, + { label: "鏃堕棿", prop: "dealTime" }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + this.handleAdd0(row); + }, + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + }; + }, + mounted() { + // this.entityCopy = this.HaveJson(this.componentData.entity); + this.getCustomPageList() + // this.getPower() + }, + methods: { + getPower() { + let power = JSON.parse(sessionStorage.getItem('power')) + let add = false + let out = false + let submitProcessTotaldeal = false + let checkProcessTotaldeal = false + let ratifyProcessTotaldeal = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'addProcessDeal') { + add = true + } + // if (power[i].menuMethod == 'exportProcessEvaluate') { + // out = true + // } + if (power[i].menuMethod == 'submitProcessTotaldeal') { + submitProcessTotaldeal = true + } + if (power[i].menuMethod == 'checkProcessTotaldeal') { + checkProcessTotaldeal = true + } + if (power[i].menuMethod == 'ratifyProcessTotaldeal') { + ratifyProcessTotaldeal = true + } + } + if (!ratifyProcessTotaldeal) { + this.componentData.do.splice(4, 1) + } + if (!checkProcessTotaldeal) { + this.componentData.do.splice(3, 1) + } + if (!submitProcessTotaldeal) { + this.componentData.do.splice(2, 1) + } + if (!add) { + this.componentData0.do.splice(1, 1) + this.componentData0.do.splice(0, 1) + } + this.addPower = add + }, + // 鑾峰彇閫佹牱鍗曚綅鍒楄〃 + getCustomPageList() { + selectCustomPageList({ + current: -1, + size: -1 + }).then(res => { + this.customPageList = res.data.body.records + }).catch(err => { }); + }, + handleDown() { }, + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + pageProcessDeal({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + refreshTable() { + this.page.current = 1; + this.getList(); + }, + // 濉啓 + // handleAdd(row){ + // this.componentData0.entity.totaldealId = row.id + // this.editDialogVisible = true + // }, + // 鎵撳紑鏂板鐣岄潰 + handleAdd0(row) { + if (row) { + this.addInfo = this.HaveJson(row) + this.title = '缂栬緫' + } else { + this.title = '鏂板' + this.addInfo = {} + } + this.addDialogVisible = true + }, + // 鎻愪氦鏂板 + submitAdd() { + if (this.addInfo.id) { + // 缂栬緫 + this.addLoading = true + doProcessDeal({ + totaldealId: this.queryParams.totaldealId, + ...this.addInfo + }).then(res => { + this.addLoading = false + if (res.code === 201) return + this.addDialogVisible = false + this.$message({ + type: 'success', + message: '缂栬緫鎴愬姛!' + }); + this.$refs.ValueTable0.selectList() + }).catch(err => { }); + } else { + // 鏂板 + this.addLoading = true + addProcessDeal({ + totaldealId: this.queryParams.totaldealId, + ...this.addInfo + }).then(res => { + this.addLoading = false + if (res.code === 201) return + this.addDialogVisible = false + this.$message({ + type: 'success', + message: '鏂板鎴愬姛!' + }); + this.$refs.ValueTable0.selectList() + }).catch(err => { }); + } + }, + // 鎻愪氦 + handleSubmit(row) { + this.$confirm('鏄惁鎻愪氦 ' + row.month + ' 鏈堜唤鐨勬暟鎹�', '鎻愪氦', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + submitProcessTotaldeal({ + id: row.id + }).then(res => { + if (res.code === 201) return + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛!' + }); + this.$refs['ValueTable'].selectList() + }).catch(err => { }); + }) + }, + // 鏌ョ湅 + handleLook(row) { + // console.log(row) + // this.title0 = '鏌ョ湅' + // this.commonFun(row) + this.activeName = '濉啓' + this.queryParams.totaldealId = row.id + this.$nextTick(() => { + this.$refs['ValueTable0'].selectList() + }) + }, + commonFun(row, callbanck) { + this.currentInfo = row + this.queryParams.totaldealId = row.id + pageProcessDeal({ + current: -1, + size: -1, ...this.queryParams + }).then(res => { + this.currentInfo.arr = res.data.body.records + this.lookDialogVisible = true + if (callbanck) { + callbanck() + } + }).catch(err => { }); + }, + // 瀹℃牳 + handleCheck(row) { + this.title0 = '瀹℃牳' + this.commonFun(row) + }, + // 鎵瑰噯 + handleApproval(row) { + this.title0 = '鎵瑰噯' + this.commonFun(row) + }, + // 鎻愪氦瀹℃牳/鎵瑰噯 + submitCheck(state) { + if (state == '閫氳繃') { + this.checkLoading = true + } else { + this.noCheckLoading = true + } + if (this.title0 == '瀹℃牳') { + checkProcessTotaldeal({ + id: this.currentInfo.id, + state: state + }).then(res => { + this.checkLoading = false + this.noCheckLoading = false + if (res.code === 201) return + this.$message({ + type: 'success', + message: '鎿嶄綔鎴愬姛!' + }); + this.$refs['ValueTable'].selectList() + this.lookDialogVisible = false + }).catch(err => { }); + } else if (this.title0 == '鎵瑰噯') { + ratifyProcessTotaldeal({ + id: this.currentInfo.id, + state: state + }).then(res => { + this.checkLoading = false + this.noCheckLoading = false + if (res.code === 201) return + this.$message({ + type: 'success', + message: '鎿嶄綔鎴愬姛!' + }); + this.$refs['ValueTable'].selectList() + this.lookDialogVisible = false + }).catch(err => { }); + } + }, + // 瀵煎嚭璇︽儏 + handleDown0(row) { + // 鍚庣涓嬭浇 + let url = this.javaApi + '/word/' + row.url + this.$download.saveAs(url, row.month + ' 鏍峰搧澶勭悊鐢宠琛�'); + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delProcessDeal({ id: row.id }).then((res) => { + if (res.code == 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.refresh(); + }); + }) + .catch(() => { }); + }, + }, +} +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + width: calc(100% - 40px); + height: calc(100% - 60px - 140px); + padding: 20px; +} + +.downPdf { + opacity: 0 !important; +} + +.tables { + table-layout: fixed; + width: 100%; + margin-top: 10px; +} + +.tables td { + height: 40px; + width: 100px; + text-align: center; + font-size: 14px; + word-wrap: break-word; + white-space: normal; +} + +.en { + font-size: 12px; + word-break: break-word; + /* 鑷姩鏂 */ + overflow-wrap: break-word; + /* 闃叉婧㈠嚭 */ + white-space: normal; + /* 榛樿鎹㈣ */ +} + +.user-info { + display: flex; + align-items: center; + justify-content: space-evenly; + margin-top: 20px; +} + +.user-info .el-button { + margin: 0; +} + +>>>.el-tabs__content { + height: 100%; +} +</style> diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index c9e5b75..108aa2a 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -223,8 +223,8 @@ </el-tooltip> 鍙湅鎴戞寜閽� </span> - <el-switch v-model="form.isRersonalButton" inactive-text="涓嶆樉绀�" active-text="鏄剧ず" inactive-value="0" - active-value="1"> + <el-switch v-model="form.isRersonalButton" inactive-text="涓嶆樉绀�" active-text="鏄剧ず" :inactive-value="0" + :active-value="1"> </el-switch> </el-form-item> </el-col> @@ -340,7 +340,8 @@ isFrame: "1", isCache: "0", visible: "0", - status: "0" + status: "0", + isRersonalButton: 0 }; this.resetForm("form"); }, @@ -379,6 +380,7 @@ this.getTreeselect(); getMenu(row.menuId).then(response => { this.form = response.data; + this.form.isRersonalButton = Number(this.form.isRersonalButton) this.open = true; this.title = "淇敼鑿滃崟"; }); diff --git a/src/views/system/role/index.vue b/src/views/system/role/index.vue index 0f5f894..93de712 100644 --- a/src/views/system/role/index.vue +++ b/src/views/system/role/index.vue @@ -4,48 +4,22 @@ <div> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form-item label="瑙掕壊鍚嶇О" prop="roleName"> - <el-input - v-model="queryParams.roleName" - placeholder="璇疯緭鍏ヨ鑹插悕绉�" - clearable - style="width: 200px" - @keyup.enter.native="handleQuery" - /> + <el-input v-model="queryParams.roleName" placeholder="璇疯緭鍏ヨ鑹插悕绉�" clearable style="width: 200px" + @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="鏉冮檺瀛楃" prop="roleKey"> - <el-input - v-model="queryParams.roleKey" - placeholder="璇疯緭鍏ユ潈闄愬瓧绗�" - clearable - style="width: 200px" - @keyup.enter.native="handleQuery" - /> + <el-input v-model="queryParams.roleKey" placeholder="璇疯緭鍏ユ潈闄愬瓧绗�" clearable style="width: 200px" + @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="鐘舵��" prop="status"> - <el-select - v-model="queryParams.status" - placeholder="瑙掕壊鐘舵��" - clearable - style="width: 200px" - > - <el-option - v-for="dict in dict.type.sys_normal_disable" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> + <el-select v-model="queryParams.status" placeholder="瑙掕壊鐘舵��" clearable style="width: 200px"> + <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" + :value="dict.value" /> </el-select> </el-form-item> <el-form-item label="鍒涘缓鏃堕棿"> - <el-date-picker - v-model="dateRange" - style="width: 200px" - value-format="yyyy-MM-dd" - type="daterange" - range-separator="-" - start-placeholder="寮�濮嬫棩鏈�" - end-placeholder="缁撴潫鏃ユ湡" - ></el-date-picker> + <el-date-picker v-model="dateRange" style="width: 200px" value-format="yyyy-MM-dd" type="daterange" + range-separator="-" start-placeholder="寮�濮嬫棩鏈�" end-placeholder="缁撴潫鏃ユ湡"></el-date-picker> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鏌� 璇�</el-button> @@ -54,7 +28,8 @@ </el-form> </div> <div class="addButton mb8"> - <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:role:add']">鏂板</el-button> + <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" + v-hasPermi="['system:role:add']">鏂板</el-button> </div> </div> @@ -66,12 +41,8 @@ <el-table-column label="鏄剧ず椤哄簭" prop="roleSort" width="100" /> <el-table-column label="鐘舵��" align="center" width="100"> <template slot-scope="scope"> - <el-switch - v-model="scope.row.status" - active-value="0" - inactive-value="1" - @change="handleStatusChange(scope.row)" - ></el-switch> + <el-switch v-model="scope.row.status" active-value="0" inactive-value="1" + @change="handleStatusChange(scope.row)"></el-switch> </template> </el-table-column> <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" width="180"> @@ -81,52 +52,32 @@ </el-table-column> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope" v-if="scope.row.roleId !== 1"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:role:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:role:remove']" - >鍒犻櫎</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-view" - @click="handleView(scope.row)" - >璇︾粏</el-button> -<!-- <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">--> -<!-- <el-button size="mini" type="text" icon="el-icon-d-arrow-right">鏇村</el-button>--> -<!-- <el-dropdown-menu slot="dropdown">--> -<!-- <el-dropdown-item command="handleDataScope" icon="el-icon-circle-check"--> -<!-- v-hasPermi="['system:role:edit']">鏁版嵁鏉冮檺</el-dropdown-item>--> -<!-- <el-dropdown-item command="handleAuthUser" icon="el-icon-user"--> -<!-- v-hasPermi="['system:role:edit']">鍒嗛厤鐢ㄦ埛</el-dropdown-item>--> -<!-- </el-dropdown-menu>--> -<!-- </el-dropdown>--> + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" + v-hasPermi="['system:role:edit']">淇敼</el-button> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" + v-hasPermi="['system:role:remove']">鍒犻櫎</el-button> + <el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">璇︾粏</el-button> + <!-- <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['system:role:edit']">--> + <!-- <el-button size="mini" type="text" icon="el-icon-d-arrow-right">鏇村</el-button>--> + <!-- <el-dropdown-menu slot="dropdown">--> + <!-- <el-dropdown-item command="handleDataScope" icon="el-icon-circle-check"--> + <!-- v-hasPermi="['system:role:edit']">鏁版嵁鏉冮檺</el-dropdown-item>--> + <!-- <el-dropdown-item command="handleAuthUser" icon="el-icon-user"--> + <!-- v-hasPermi="['system:role:edit']">鍒嗛厤鐢ㄦ埛</el-dropdown-item>--> + <!-- </el-dropdown-menu>--> + <!-- </el-dropdown>--> </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="500px" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form-item label="瑙掕壊鍚嶇О" prop="roleName"> - <el-input v-model="form.roleName" placeholder="璇疯緭鍏ヨ鑹插悕绉�" :disabled="title === '鏌ョ湅瑙掕壊'"/> + <el-input v-model="form.roleName" placeholder="璇疯緭鍏ヨ鑹插悕绉�" :disabled="title === '鏌ョ湅瑙掕壊'" /> </el-form-item> <el-form-item prop="roleKey"> <span slot="label"> @@ -135,35 +86,35 @@ </el-tooltip> 鏉冮檺瀛楃 </span> - <el-input v-model="form.roleKey" placeholder="璇疯緭鍏ユ潈闄愬瓧绗�" :disabled="title === '鏌ョ湅瑙掕壊'"/> + <el-input v-model="form.roleKey" placeholder="璇疯緭鍏ユ潈闄愬瓧绗�" :disabled="title === '鏌ョ湅瑙掕壊'" /> </el-form-item> <el-form-item label="瑙掕壊椤哄簭" prop="roleSort"> - <el-input-number v-model="form.roleSort" controls-position="right" :min="0" :disabled="title === '鏌ョ湅瑙掕壊'"/> + <el-input-number v-model="form.roleSort" controls-position="right" :min="0" :disabled="title === '鏌ョ湅瑙掕壊'" /> </el-form-item> <el-form-item label="鐘舵��"> <el-radio-group v-model="form.status" :disabled="title === '鏌ョ湅瑙掕壊'"> - <el-radio - v-for="dict in dict.type.sys_normal_disable" - :key="dict.value" - :label="dict.value" - >{{dict.label}}</el-radio> + <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ dict.label + }}</el-radio> </el-radio-group> </el-form-item> <el-form-item label="鑿滃崟鏉冮檺"> - <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')" v-if="title !== '鏌ョ湅瑙掕壊'">灞曞紑/鎶樺彔</el-checkbox> - <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')" v-if="title !== '鏌ョ湅瑙掕壊'">鍏ㄩ��/鍏ㄤ笉閫�</el-checkbox> - <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')" v-if="title !== '鏌ョ湅瑙掕壊'">鐖跺瓙鑱斿姩</el-checkbox> - <el-tree - :disabled="title === '鏌ョ湅瑙掕壊'" - class="tree-border" - :data="menuOptions" - show-checkbox - ref="menu" - node-key="id" - :check-strictly="!form.menuCheckStrictly" - empty-text="鍔犺浇涓紝璇风◢鍊�" - :props="defaultProps" - ></el-tree> + <el-checkbox v-model="menuExpand" @change="handleCheckedTreeExpand($event, 'menu')" + v-if="title !== '鏌ョ湅瑙掕壊'">灞曞紑/鎶樺彔</el-checkbox> + <el-checkbox v-model="menuNodeAll" @change="handleCheckedTreeNodeAll($event, 'menu')" + v-if="title !== '鏌ョ湅瑙掕壊'">鍏ㄩ��/鍏ㄤ笉閫�</el-checkbox> + <el-checkbox v-model="form.menuCheckStrictly" @change="handleCheckedTreeConnect($event, 'menu')" + v-if="title !== '鏌ョ湅瑙掕壊'">鐖跺瓙鑱斿姩</el-checkbox> + <el-tree :disabled="title === '鏌ョ湅瑙掕壊'" class="tree-border" :data="menuOptions" show-checkbox ref="menu" + node-key="id" :check-strictly="!form.menuCheckStrictly" empty-text="鍔犺浇涓紝璇风◢鍊�" :props="defaultProps"> + <span class="custom-tree-node" slot-scope="{ node, data }"> + <span>{{ node.label }}</span> + <span> + <el-checkbox v-model="data.isRersonal" :true-label="1" :false-label="0" + v-if="data.isRersonalButton == 1" @change="m => chooseMe(m, data)" + :disabled="title === '鏌ョ湅瑙掕壊'">鍙湅鎴�</el-checkbox> + </span> + </span> + </el-tree> </el-form-item> <el-form-item label="澶囨敞"> <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" :disabled="title === '鏌ョ湅瑙掕壊'"></el-input> @@ -179,36 +130,24 @@ <el-dialog :title="title" :visible.sync="openDataScope" width="500px" append-to-body> <el-form :model="form" label-width="80px"> <el-form-item label="瑙掕壊鍚嶇О"> - <el-input v-model="form.roleName" :disabled="true"/> + <el-input v-model="form.roleName" :disabled="true" /> </el-form-item> <el-form-item label="鏉冮檺瀛楃"> <el-input v-model="form.roleKey" :disabled="true" /> </el-form-item> <el-form-item label="鏉冮檺鑼冨洿"> <el-select v-model="form.dataScope" @change="dataScopeSelectChange"> - <el-option - v-for="item in dataScopeOptions" - :key="item.value" - :label="item.label" - :value="item.value" - ></el-option> + <el-option v-for="item in dataScopeOptions" :key="item.value" :label="item.label" + :value="item.value"></el-option> </el-select> </el-form-item> <el-form-item label="鏁版嵁鏉冮檺" v-show="form.dataScope == 2"> <el-checkbox v-model="deptExpand" @change="handleCheckedTreeExpand($event, 'dept')">灞曞紑/鎶樺彔</el-checkbox> <el-checkbox v-model="deptNodeAll" @change="handleCheckedTreeNodeAll($event, 'dept')">鍏ㄩ��/鍏ㄤ笉閫�</el-checkbox> - <el-checkbox v-model="form.deptCheckStrictly" @change="handleCheckedTreeConnect($event, 'dept')">鐖跺瓙鑱斿姩</el-checkbox> - <el-tree - class="tree-border" - :data="deptOptions" - show-checkbox - default-expand-all - ref="dept" - node-key="id" - :check-strictly="!form.deptCheckStrictly" - empty-text="鍔犺浇涓紝璇风◢鍊�" - :props="defaultProps" - ></el-tree> + <el-checkbox v-model="form.deptCheckStrictly" + @change="handleCheckedTreeConnect($event, 'dept')">鐖跺瓙鑱斿姩</el-checkbox> + <el-tree class="tree-border" :data="deptOptions" show-checkbox default-expand-all ref="dept" node-key="id" + :check-strictly="!form.deptCheckStrictly" empty-text="鍔犺浇涓紝璇风◢鍊�" :props="defaultProps"></el-tree> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> @@ -232,6 +171,8 @@ loading: true, // 閫変腑鏁扮粍 ids: [], + // 鍙湅鎴戞暟缁� + isRersonalMenuIds: [], // 闈炲崟涓鐢� single: true, // 闈炲涓鐢� @@ -317,10 +258,10 @@ getList() { this.loading = true; listRole(this.addDateRange(this.queryParams, this.dateRange)).then(response => { - this.roleList = response.rows; - this.total = response.total; - this.loading = false; - } + this.roleList = response.rows; + this.total = response.total; + this.loading = false; + } ); }, /** 鏌ヨ鑿滃崟鏍戠粨鏋� */ @@ -364,11 +305,11 @@ // 瑙掕壊鐘舵�佷慨鏀� handleStatusChange(row) { let text = row.status === "0" ? "鍚敤" : "鍋滅敤"; - this.$modal.confirm('纭瑕�"' + text + '""' + row.roleName + '"瑙掕壊鍚楋紵').then(function() { + this.$modal.confirm('纭瑕�"' + text + '""' + row.roleName + '"瑙掕壊鍚楋紵').then(function () { return changeRoleStatus(row.roleId, row.status); }).then(() => { this.$modal.msgSuccess(text + "鎴愬姛"); - }).catch(function() { + }).catch(function () { row.status = row.status === "0" ? "1" : "0"; }); }, @@ -388,21 +329,22 @@ this.$refs.menu.setCheckedKeys([]); } this.menuExpand = false, - this.menuNodeAll = false, - this.deptExpand = true, - this.deptNodeAll = false, - this.form = { - roleId: undefined, - roleName: undefined, - roleKey: undefined, - roleSort: 0, - status: "0", - menuIds: [], - deptIds: [], - menuCheckStrictly: true, - deptCheckStrictly: true, - remark: undefined - }; + this.menuNodeAll = false, + this.deptExpand = true, + this.deptNodeAll = false, + this.form = { + roleId: undefined, + roleName: undefined, + roleKey: undefined, + roleSort: 0, + status: "0", + menuIds: [], + deptIds: [], + isRersonalMenuIds: [], + menuCheckStrictly: true, + deptCheckStrictly: true, + remark: undefined + }; this.resetForm("form"); }, /** 鎼滅储鎸夐挳鎿嶄綔 */ @@ -419,7 +361,7 @@ // 澶氶�夋閫変腑鏁版嵁 handleSelectionChange(selection) { this.ids = selection.map(item => item.roleId) - this.single = selection.length!=1 + this.single = selection.length != 1 this.multiple = !selection.length }, // 鏇村鎿嶄綔瑙﹀彂 @@ -452,17 +394,17 @@ // 鏍戞潈闄愶紙鍏ㄩ��/鍏ㄤ笉閫夛級 handleCheckedTreeNodeAll(value, type) { if (type == 'menu') { - this.$refs.menu.setCheckedNodes(value ? this.menuOptions: []); + this.$refs.menu.setCheckedNodes(value ? this.menuOptions : []); } else if (type == 'dept') { - this.$refs.dept.setCheckedNodes(value ? this.deptOptions: []); + this.$refs.dept.setCheckedNodes(value ? this.deptOptions : []); } }, // 鏍戞潈闄愶紙鐖跺瓙鑱斿姩锛� handleCheckedTreeConnect(value, type) { if (type == 'menu') { - this.form.menuCheckStrictly = value ? true: false; + this.form.menuCheckStrictly = value ? true : false; } else if (type == 'dept') { - this.form.deptCheckStrictly = value ? true: false; + this.form.deptCheckStrictly = value ? true : false; } }, /** 鏂板鎸夐挳鎿嶄綔 */ @@ -484,9 +426,9 @@ roleMenu.then(res => { let checkedKeys = res.checkedKeys checkedKeys.forEach((v) => { - this.$nextTick(()=>{ - this.$refs.menu.setChecked(v, true ,false); - }) + this.$nextTick(() => { + this.$refs.menu.setChecked(v, true, false); + }) }) }); }); @@ -494,7 +436,7 @@ this.title = "淇敼瑙掕壊"; }, // 鏌ョ湅瑙掕壊璇︽儏 - handleView (row) { + handleView(row) { this.title = "鏌ョ湅瑙掕壊"; this.reset(); const roleId = row.roleId || this.ids @@ -506,8 +448,8 @@ roleMenu.then(res => { let checkedKeys = res.checkedKeys checkedKeys.forEach((v) => { - this.$nextTick(()=>{ - this.$refs.menu.setChecked(v, true ,false); + this.$nextTick(() => { + this.$refs.menu.setChecked(v, true, false); }) }) }); @@ -516,7 +458,7 @@ }, /** 閫夋嫨瑙掕壊鏉冮檺鑼冨洿瑙﹀彂 */ dataScopeSelectChange(value) { - if(value !== '2') { + if (value !== '2') { this.$refs.dept.setCheckedKeys([]); } }, @@ -536,16 +478,17 @@ this.title = "鍒嗛厤鏁版嵁鏉冮檺"; }, /** 鍒嗛厤鐢ㄦ埛鎿嶄綔 */ - handleAuthUser: function(row) { + handleAuthUser: function (row) { const roleId = row.roleId; this.$router.push("/system/role-auth/user/" + roleId); }, /** 鎻愪氦鎸夐挳 */ - submitForm: function() { + submitForm: function () { this.$refs["form"].validate(valid => { if (valid) { if (this.form.roleId != undefined) { this.form.menuIds = this.getMenuAllCheckedKeys(); + this.form.isRersonalMenuIds = this.isRersonalMenuIds; updateRole(this.form).then(response => { this.$modal.msgSuccess("淇敼鎴愬姛"); this.open = false; @@ -553,6 +496,7 @@ }); } else { this.form.menuIds = this.getMenuAllCheckedKeys(); + this.form.isRersonalMenuIds = this.isRersonalMenuIds; addRole(this.form).then(response => { this.$modal.msgSuccess("鏂板鎴愬姛"); this.open = false; @@ -563,7 +507,7 @@ }); }, /** 鎻愪氦鎸夐挳锛堟暟鎹潈闄愶級 */ - submitDataScope: function() { + submitDataScope: function () { if (this.form.roleId != undefined) { this.form.deptIds = this.getDeptAllCheckedKeys(); dataScope(this.form).then(response => { @@ -576,18 +520,27 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const roleIds = row.roleId || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎瑙掕壊缂栧彿涓�"' + roleIds + '"鐨勬暟鎹」锛�').then(function() { + this.$modal.confirm('鏄惁纭鍒犻櫎瑙掕壊缂栧彿涓�"' + roleIds + '"鐨勬暟鎹」锛�').then(function () { return delRole(roleIds); }).then(() => { this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + }).catch(() => { }); }, /** 瀵煎嚭鎸夐挳鎿嶄綔 */ handleExport() { this.download('system/role/export', { ...this.queryParams }, `role_${new Date().getTime()}.xlsx`) + }, + // 鍙湅鎴� + chooseMe(val, data) { + let index = this.isRersonalMenuIds.findIndex(m => m == data.id) + if (index < 0 && val == 1) { + this.isRersonalMenuIds.push(data.id) + } else if (val == 0 && index > -1) { + this.isRersonalMenuIds.splice(index, 1) + } } } }; @@ -598,7 +551,17 @@ display: flex; justify-content: space-between; } + .addButton { margin-top: 3px; } + +.custom-tree-node { + flex: 1; + display: flex; + align-items: center; + justify-content: space-between; + font-size: 14px; + padding-right: 8px; +} </style> -- Gitblit v1.9.3