From 8ad7fe19f6cef00a5578c07b0570b8a0af9a8dcb Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期二, 21 二月 2023 15:23:14 +0800
Subject: [PATCH] 去掉勾选框
---
src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue | 74 +++++++++----------------------------
1 files changed, 18 insertions(+), 56 deletions(-)
diff --git a/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue b/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
index 0109e2a..b1c6b10 100644
--- a/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
+++ b/src/views/systemSetting/device/handheldTerminal/components/dialogForm.vue
@@ -40,21 +40,10 @@
</el-form-item>
<!-- 閮ㄩ棬 -->
<el-form-item class="optionItems" label="鎵�灞為儴闂�:" prop="departId">
- <el-select v-model="form.departName" placeholder="璇疯緭鍏ユ墍灞為儴闂�">
- <el-option :value="mylabel">
- <el-tree
- ref="tree"
- :check-strictly="true"
- :data="departList"
- :props="defaultProps"
- show-checkbox
- @check-change="handleCheck"
- default-expand-all
- node-key="id"
- >
- </el-tree>
- </el-option>
- </el-select>
+ <departTree
+ :depart="userDepart"
+ @selectDepart="selectDepart"
+ ></departTree>
</el-form-item>
<el-form-item>
<div class="optionBtn">
@@ -76,8 +65,11 @@
import { createNamespacedHelpers } from "vuex";
const { mapActions } = createNamespacedHelpers("handheldTerminal");
-
+import departTree from "@/components/departTree/index.vue";
export default {
+ components: {
+ departTree,
+ },
data() {
const checkName = (rule, value, callback) => {
if (value) {
@@ -177,9 +169,7 @@
// }
// ]
},
- selectOrg: {
- orgsid: [],
- },
+ userDepart: {},
mylabel: "",
departList: [],
defaultProps: {
@@ -189,14 +179,15 @@
};
},
created() {
- const { getDepartTree } = this;
- // 鍒濆鍖栭儴闂ㄦ爲
- getDepartTree();
// 鍒濆鍖栨暟鎹�
this.form = this.info;
if (!this.form.departName) {
this.form.departName = this.form.pdepartName;
}
+ this.userDepart = {
+ departId: this.form.departId,
+ departName: this.form.departName,
+ };
},
watch: {
@@ -233,41 +224,12 @@
}
});
},
- // 閮ㄩ棬淇敼
- handleCheck(data, checked) {
- this.form.departId = data.id;
- this.form.departName = data.departName;
- // 鑾峰彇褰撳墠閫夋嫨鐨刬d鍦ㄦ暟缁勪腑鐨勭储寮�
- const indexs = this.selectOrg.orgsid.indexOf(data.id);
- // 濡傛灉涓嶅瓨鍦ㄦ暟缁勪腑锛屽苟涓旀暟缁勪腑宸茬粡鏈変竴涓猧d骞朵笖checked涓簍rue鐨勬椂鍊欙紝浠h〃涓嶈兘鍐嶆閫夋嫨銆�
- if (indexs < 0 && this.selectOrg.orgsid.length === 1 && checked) {
- this.$message({
- message: "鍙兘閫夋嫨涓�涓儴闂紒",
- type: "warning",
- showClose: true,
- });
- // 璁剧疆宸查�夋嫨鐨勮妭鐐逛负false 寰堥噸瑕�
- this.$refs.tree.setChecked(data, false);
- } else if (this.selectOrg.orgsid.length === 0 && checked) {
- // 鍙戠幇鏁扮粍涓虹┖ 骞朵笖鏄凡閫夋嫨
- // 闃叉鏁扮粍鏈夊�硷紝棣栧厛娓呯┖锛屽啀push
- this.selectOrg.orgsid = [];
- this.selectOrg.orgsid.push(data.id);
- } else if (
- indexs >= 0 &&
- this.selectOrg.orgsid.length === 1 &&
- !checked
- ) {
- // 鍐嶆鐩存帴杩涜璧嬪�间负绌烘搷浣�
- this.selectOrg.orgsid = [];
- this.form.departName = "";
+
+ selectDepart(depart) {
+ if (depart) {
+ this.form.departId = depart.departId;
+ this.form.departName = depart.departName;
}
- },
- // 鑾峰彇閮ㄩ棬鏍�
- getDepartTree() {
- this.$axios.get("/sccg/depart/tree").then((res) => {
- this.departList = res.data;
- });
},
},
props: ["info", "closeDialog"],
--
Gitblit v1.8.0