From e09b848b65d7fda7264e9e536e37ad8e45f65e9c Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期三, 06 九月 2023 17:42:47 +0800
Subject: [PATCH] 	modified:   src/views/inspectionManagement/commissionInspection/index.vue 	modified:   src/views/standardLibrary/index.vue

---
 src/views/standardLibrary/index.vue |  997 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 761 insertions(+), 236 deletions(-)

diff --git a/src/views/standardLibrary/index.vue b/src/views/standardLibrary/index.vue
index f589079..5cbf919 100644
--- a/src/views/standardLibrary/index.vue
+++ b/src/views/standardLibrary/index.vue
@@ -1,244 +1,769 @@
 <template>
-  <div class="standard-library-main">
-    <div class="content-main">
-      <div class="library-bom">
-        <el-input
-          v-model="filterText"
-          placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"
-        />
-        <el-tree
-          ref="tree"
-          class="filter-tree"
-          :data="data"
-          :props="defaultProps"
-          default-expand-all
-          :filter-node-method="filterNode"
-        >
-        </el-tree>
-      </div>
-      <div class="library-table">
-        <div class="table-header">
-          <div class="search-bar">
-            <el-form ref="form" inline="true" :model="searchData">
-              <el-form-item>
-                <el-input
-                  placeholder="璇疯緭鍏ヤ汉鍛樺悕绉�/鍘熸潗鏂欏悕绉�"
-                  v-model="searchData.keyword"
-                >
-                  <i slot="prefix" class="el-input__icon el-icon-search" />
-                </el-input>
-              </el-form-item>
-              <el-form-item>
-                <el-button type="primary">鏌ヨ</el-button>
-                <el-button type="primary" plain>閲嶇疆</el-button>
-                <!-- <el-button type="text">楂樼骇鎼滅储<i class="el-icon-arrow-down el-icon--right" /></el-button> -->
-              </el-form-item>
-            </el-form>
-          </div>
-          <div class="serve-btn">
-            <el-button type="primary" icon="el-icon-plus">鏂板浜哄憳</el-button>
-          </div>
-        </div>
-        <div class="table-box">
-          <el-table
-            ref="standardLibraryTable"
-            :cell-style="{textAlign: 'center'}"
-            :header-cell-style="{border:'0px',background:'#f5f7fa',color:'#606266',boxShadow: 'inset 0 1px 0 #ebeef5',textAlign: 'center'}"
-            :data="standardLibraryTable"
-            style="width: 100%"
-          >
-            <el-table-column
-              type="index"
-              label="搴忓彿"
-              min-width="50"
-            />
-            <el-table-column
-              prop="name"
-              label="浜у搧鍚嶇О"
-              min-width="150"
-            />
-            <el-table-column
-              prop="username"
-              label="鏇存柊浜�"
-              min-width="100"
-            />
-            <el-table-column
-              prop="updateTime"
-              label="鏇存柊鏃堕棿"
-              min-width="150"
-            />
-            <el-table-column
-              prop="vel"
-              label="鐗堟湰"
-              min-width="100"
-            />
-            <el-table-column
-              prop="spe_state"
-              label="鐘舵��"
-              min-width="150"
-            >
-              <template slot-scope="scope">
-                <el-tag
-                  :type="scope.row.spe_state === 0 ? 'primary' : 'success'"
-                  disable-transitions
-                >{{ scope.row.spe_state === 0 ? '鏈悓鎰�' : '宸插悓鎰�' }}</el-tag>
-              </template>
-            </el-table-column>
-            <el-table-column
-              label="鎿嶄綔"
-              min-width="150"
-            >
-              <template slot-scope="scope">
-                <el-button
-                  type="text"
-                  size="small"
-                  @click="handleClick(scope.row)"
-                >鏌ョ湅</el-button>
-                <el-button type="text" size="small"><i class="el-icon-more" /></el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <div>
-            <el-pagination
-              @size-change="handleSizeChange"
-              @current-change="handleCurrentChange"
-              :current-page="currentPage"
-              :page-sizes="[100, 200, 300, 400]"
-              :page-size="100"
-              layout="total, sizes, prev, pager, next, jumper"
-              :total="400">
-            </el-pagination>
-          </div>
-        </div>
-      </div>
-    </div>
-  </div>
+	<div class="standard-library-main">
+		<div class="content-main">
+			<div class="library-bom" style="width: 300px">
+				<el-row :gutter="10">
+					<el-col :span="19">
+					<el-input size="small" clearable v-model="filterText" placeholder="杈撳叆鍏抽敭瀛楄繘琛岃繃婊�"></el-input>
+					</el-col>
+					<el-col :span="5">
+						<el-button size="small" type="primary" icon="el-icon-plus" @click="addTreeFormVisible = true"></el-button>
+					</el-col>
+				</el-row>
+				<el-button size="small" type="text">鍏ㄩ儴</el-button>
+				<el-tree ref="tree" style="width: 100%" class="filter-tree" :data="standardTree" :props="defaultProps"
+					node-key="id" :highlight-current="true" :default-expand-all="true" :filter-node-method="filterNode"
+					:render-content="renderContent" @node-click="nodeClick" />
+			</div>
+			<div class="library-table" style="width: 80%">
+				<div class="table-header">
+					<div class="serve-btn">
+						<span class="tipMsg">{{ msg !== "" ? msg : "" }}</span>
+						<el-select size="small" v-model="versionValue" @change="changeSelect" placeholder="璇烽�夋嫨鐗堟湰鍙�">
+							<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+							</el-option>
+						</el-select>
+						<el-button size="small" type="primary" @click="addVersionFun">鏂板鐗堟湰鍙�</el-button>
+						<el-button size="small" type="primary" @click="centerDialogVisible = true">鏂板椤圭洰</el-button>
+						<el-button size="small" class="top_div_button" icon="el-icon-delete-solid" style="color: #00a5ff"
+							@click="deleteListClick">鍒犻櫎</el-button>
+					</div>
+				</div>
+				<div class="table-box">
+					<el-table :data="tableData" style="width: 100%; margin-bottom: 20px" row-key="id" border
+						height="calc(100vh - 250px)" default-expand-all ref="multipleTable" @select="selectTr"
+						@select-all="selectAll" @selection-change="handleSelectionChange"
+						:tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
+						<el-table-column type="selection" label="搴忓彿"> </el-table-column>
+						<el-table-column type="index" width="50px" label="搴忓彿"></el-table-column>
+						<el-table-column label="椤圭洰鍚嶇О" sortable>
+							<template scope="scope">
+								<el-tag>
+									<div class="firstDiv" :style="`color: ${
+                      scope.row.code == '[1]' ? '#16a7ff' : '#58c173'
+                    }`">
+										{{ scope.row.code == "[1]" ? "01" : "02" }}
+									</div>
+									<span style="color: black">{{ scope.row.name }}</span>
+								</el-tag>
+							</template>
+						</el-table-column>
+						<el-table-column prop="unit" label="鍗曚綅" sortable></el-table-column>
+						<el-table-column label="鏍囧噯鍊�" sortable>
+							<template scope="scope">
+								<el-input v-if="scope.row.edit === true || scope.row.code === '[2]'" @blur="requiredOnfocus(scope)"
+									v-model="scope.row.required" placeholder="璇疯緭鍏ユ爣鍑嗗��"></el-input>
+							</template>
+						</el-table-column>
+						<el-table-column prop="internal" label="鍐呮帶鍊�" sortable>
+							<template scope="scope">
+								<el-input v-if="scope.row.edit === true || scope.row.code === '[2]'" @blur="requiredOnfocus(scope)"
+									v-model="scope.row.internal" placeholder="璇疯緭鍏ュ唴鎺у��"></el-input>
+							</template>
+						</el-table-column>
+					</el-table>
+					<!-- 寮瑰嚭琛ㄥ崟椤� -->
+					<div>
+						<!--  -->
+					</div>
+				</div>
+			</div>
+		</div>
+		<el-dialog class="addTree" title="娣诲姞鏍囧噯鎸囨爣" width="28%" :visible.sync="addTreeFormVisible">
+			<el-form v-model="addTreeForm" label-position="top">
+				<el-form-item label="鏍囧噯绫诲瀷">
+					<el-cascader  v-model="addTreeForm.addTypeArr" :options="formTypeOptions"
+						:props="{ ...defaultProps, checkStrictly: true }" clearable @change="changeCascader"/>
+				</el-form-item>
+				<el-form-item v-show="addTreeForm.addTypeArr.length < 2" label="鐗╂枡鍚嶇О">
+					<el-input @change="changeSample" v-model="addTreeForm.materialName" />
+				</el-form-item>
+				<el-form-item v-show="addTreeForm.addTypeArr.length < 3" label="鎵ц鏍囧噯">
+					<el-input  v-model="addTreeForm.standardName" />
+				</el-form-item>
+				<el-form-item v-show="addTreeForm.addTypeArr.length < 4" label="瑙勬牸鍨嬪彿">
+					<el-input  v-model="addTreeForm.specificationsName" />
+				</el-form-item>
+			</el-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button type="primary" @click="subAddTreeForm">纭� 瀹�</el-button>
+				<el-button @click="clear">鍙� 娑�</el-button>
+			</div>
+		</el-dialog>
+		<el-dialog :visible.sync="centerDialogVisible" width="30%" title="鏂板" :hide-required-asterisk="false">
+			<el-form :model="form" :rules="rules" ref="ruleForm" class="addForm">
+				<el-form-item prop="father">
+					<span>椤圭洰鍒嗙粍锛�</span>
+					<el-autocomplete class="inline-input" v-model="form.father" :fetch-suggestions="querySearch"
+						placeholder="璇疯緭鍏ユ牱鍝佸垎缁�" style="width: calc(100% - 70px);"></el-autocomplete>
+				</el-form-item>
+				<el-row :gutter="24">
+					<el-col :span="12">
+						<el-form-item prop="name">
+							<span>椤圭洰鍚嶇О锛�</span>
+							<el-input style="width: calc(100% - 70px);" v-model="form.name" placeholder="璇疯緭鍏ラ」鐩悕绉�"></el-input>
+						</el-form-item>
+					</el-col>
+					<el-col :span="12">
+						<el-form-item prop="unit">
+							<span v-html="'鍗�&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;浣嶏細'"></span>
+							<el-input style="width: calc(100% - 70px);" v-model="form.unit" placeholder="璇疯緭鍏ュ崟浣�"></el-input>
+						</el-form-item>
+					</el-col>
+				</el-row>
+			</el-form>
+			<span slot="footer" class="dialog-footer">
+				<el-button @click="centerDialogVisible = false" size="small ">鍙� 娑�</el-button>
+				<el-button type="primary" @click="submitAdd" size="small ">纭</el-button>
+			</span>
+		</el-dialog>
+	</div>
 </template>
 
 <script>
-export default {
-  data() {
-    return {
-      // 鏍囧噯搴揵om鏍�
-      data: [{
-        id: 1,
-        label: '涓�绾� 1',
-        children: [{
-          id: 4,
-          label: '浜岀骇 1-1',
-          children: [{
-            id: 9,
-            label: '涓夌骇 1-1-1'
-          }, {
-            id: 10,
-            label: '涓夌骇 1-1-2'
-          }]
-        }]
-      }],
-      // 榛樿鍊�
-      defaultProps: {
-        children: 'children',
-        label: 'label'
-      },
-      // 鏌ヨ鏉′欢
-      searchData: {
-        keyword: ''
-      },
-      standardLibraryTable: [
-        {
-          id: 2,
-          name: 'AB',
-          updateTime: '2023-07-12 00:00:12',
-          username: '灏忓皬',
-          vel: 'V1.0',
-          spe_state: 1
-        }
-      ]
-    }
-  },
-  watch: {
-    filterText(val) {
-      this.$refs.tree.filter(val)
-    }
-  },
-  methods: {
-    filterNode(value, data) {
-      if (!value) return true
-      return data.label.indexOf(value) !== -1
-    }
-  }
-}
+	import {
+		getMaterialList,
+		getProductList,
+		addMaterial,
+		addStandards,
+		addSpecifications,
+		deleteListApi,
+		blurUpdateApi,
+		getVersion,
+		addVersion,
+		addProduct
+	} from "@/api/standardLibrary";
+	import {
+		addStandardProjectGroupApi,
+	} from "@/api/basicData/index";
+	export default {
+		data() {
+			return {
+				projectGroupingOptions:[],
+				form: {
+					father: "", // 椤圭洰鍒嗙粍
+					name: "", // 椤圭洰鍚嶇О
+					unit: "", // 鍗曚綅
+				},
+				rules: {
+					fater:[{required:true,message:"璇烽�夋嫨椤圭洰鍚嶇О",trigger:"blur"}],
+					name: [
+						{required: true,message: "璇疯緭鍏ラ」鐩悕绉�",trigger: "blur"},
+						{min: 2,max: 25,message: "闀垮害鍦� 2 鍒� 25 涓瓧绗�",trigger: "blur",},
+					],
+					unit: [
+						{required: true,message: "璇疯緭鍏ュ崟浣�",trigger: "blur"},
+						{min: 1,max: 25,message: "闀垮害鍦� 1 鍒� 25 涓瓧绗�",trigger: "blur"}
+					],
+				},
+				centerDialogVisible : false,
+				filterNodeData: [],
+				options: [],
+				versionValue: "",
+				deleteList: [],
+				msg: "",
+				isAllSelect: false,
+				addTreeFormVisible: false,
+				filterText: "",
+				// 鏍囧噯搴揵om鏍�
+				standardTree: [],
+				// bom鐨�,榛樿閰嶇疆鍊�
+				defaultProps: {
+					children: "children",
+					label: "name",
+					value: "id",
+				},
+				tableData: [],
+				oldtableData: [],
+				tablespecifications: [],
+				// 閫変腑鐨勮妭鐐规暟鎹�
+				selectData: {},
+				formTypeOptions: [],
+				addTreeForm: {
+					addTypeArr: [],
+					specificationsName: "",
+					materialName: "",
+					standardName: "",
+				}
+			};
+		},
+		watch: {
+			filterText(val) {
+				this.$refs.tree.filter(val);
+			},
+			addTreeFormVisible(newVal){
+				if(newVal === false){
+					this.clear();
+				}
+			},
+			centerDialogVisible: {
+				handler(newVal, oldVal) {
+					if (newVal == true) {
+						addStandardProjectGroupApi().then((res) => {
+							this.projectGroupingOptions = res.data;
+						});
+					} else {
+						// 璇锋眰鎴愬姛娓呴櫎鏁版嵁
+						this.form = {};
+						// 鎻愪氦鎴愬姛娓呴櫎妫�楠�
+						this.$refs.ruleForm.resetFields();
+					}
+				},
+			},
+		},
+		created() {
+			this.getStandardTree();
+		},
+		mounted() {
+
+		},
+		methods: {
+			querySearch(queryString, cb) {
+				var restaurants = []
+				this.projectGroupingOptions.forEach(a => {
+					restaurants.push({
+						value: a
+					})
+				})
+				var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
+				// 璋冪敤 callback 杩斿洖寤鸿鍒楄〃鐨勬暟鎹�
+				cb(results);
+			},
+			createFilter(queryString) {
+				return (restaurant) => {
+					return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
+				};
+			},
+			clear(){
+				this.addTreeFormVisible = false;
+				this.addTreeForm.addTypeArr=[];
+				this.addTreeForm.specificationsName='';
+				this.addTreeForm.materialName=''
+				this.addTreeForm.standardName=''
+			},
+			changeSample(){
+				let selectType=this.standardTree.filter(item=>{
+					return item.id===this.addTreeForm.addTypeArr[0]
+				})[0];
+				if(this.addTreeForm.addTypeArr.length==1){
+					let samples=selectType.children.filter(item=>{
+						return item.name===this.addTreeForm.materialName
+					})[0]
+					if(samples===undefined||samples===[]){
+						this.$message({
+          						message: '璇峰厛鍦ㄥ熀纭�鏁版嵁涓坊鍔犺銆�'+this.addTreeForm.materialName+'銆戞牱鍝�',
+          						type: 'warning'
+       					 });
+						 return false;
+					}
+				}
+				return true
+			},
+			oneSize(){},
+			twoSize(){
+				return true;
+			},
+			threeSize(){
+				return true;
+			},
+			async initSelect() {
+				this.options = [];
+				this.versionValue = "";
+				const response = await getVersion({
+					specificationsId: this.selectData.id,
+				});
+				if (response.code === 200 && response.data.length > 0) {
+					this.getTableByClick(this.selectData, response.data[0]);
+					for (let i = 0; i < response.data.length; i++) {
+						this.options.push({
+							value: response.data[i],
+							label: "V" + response.data[i],
+						});
+						this.versionValue = response.data[0];
+					}
+				}
+			},
+			changeSelect() {
+				this.tableData = [];
+				this.getTableByClick(this.selectData, this.versionValue);
+			},
+			async submitAdd(){
+				await addProduct({
+					father : this.form.father,
+					name : this.form.name,
+					specificationId: this.selectData.id,
+					unit : this.form.unit,
+					version : this.versionValue
+				}).then(res=>{
+					console.log(res);
+					this.$message.success(res.message);
+					this.centerDialogVisible = false;
+					this.getTableByClick(this.selectData, this.versionValue);
+				}).catch(error=>{
+					this.$message.error(error.message);
+				})
+			},
+			async insertVersion() {
+				const resp = await addVersion({
+					specificationsId: this.selectData.id,
+					version: this.versionValue
+				});
+				if (resp.code === 200) {
+					this.initSelect();
+					this.$message({
+						type: "success",
+						message: resp.message,
+					});
+				}
+			},
+			addVersionFun() {
+				this.$confirm("纭娣诲姞鏂扮殑鐗堟湰鍙峰悧?", "鎻愮ず", {
+						confirmButtonText: "纭畾",
+						cancelButtonText: "鍙栨秷",
+						type: "warning",
+					})
+					.then(() => {
+						this.insertVersion();
+					})
+					.catch(() => {});
+			},
+			filterNode(value, data,node) {
+				if (!value) return true;
+				return data.name.indexOf(value) !== -1;
+			},
+			// 鑾峰彇bom鏍戠殑鏍囧噯鏁版嵁
+			async getStandardTree() {
+				let {
+					data
+				} = await getMaterialList();
+				if (data.length < 2) {
+					if (data.length == 0) {
+						data = [{
+							type: 0
+						}, {
+							type: 1
+						}]
+					} else {
+						data[1] = {
+							type: data[0].type == 1 ? 0 : 1
+						}
+					}
+				}
+				this.standardTree = data.map((item) => {
+					let name = null;
+					switch (item.type) {
+						case 0:
+							name = "鍘熸潗鏂�";
+							break;
+						case 1:
+							name = "鎴愬搧";
+							break;
+					}
+					return {
+						...item,
+						id: item.type,
+						name,
+					};
+				});
+				// formTypeOptions
+				// 榛樿绗竴涓洓绾ц妭鐐规悳绱紝鏂板閰嶇疆椤�
+				const treeOptions = JSON.parse(JSON.stringify(this.standardTree));
+				this.getDefault(treeOptions, 0);
+				this.formTypeOptions = treeOptions;
+				this.$nextTick().then(() => {
+					const firstNode = document.querySelector(
+						".el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node .el-tree-node__children .el-tree-node"
+					);
+					try {
+						firstNode.click();
+					} catch (e) {
+						//TODO handle the exception
+					}
+				});
+
+			},
+			getDefault(arr, index) {
+				for (const item of arr) {
+					if (item.children && item.children?.length > 0) {
+						// 鏈夊瓙鑺傜偣
+						this.getDefault(item.children, index + 1);
+						if (index === 2) {
+							item.children = null;
+						}
+					}
+				}
+			},
+			// 鐐瑰嚮bom鏍戣妭鐐规柟娉�
+			async nodeClick(data, node, element) {
+				// 鏄瓙鑺傜偣
+				if (node.level === 4) {
+					this.getParentData(node.parent, node.data.name);
+					// 瀛樹笅閫変腑鑺傜偣
+					this.selectData = data;
+					this.getTableByClick(data, this.versionValue);
+					this.initSelect();
+				}
+				if (!("children" in data)) {
+					return;
+				}
+			},
+			// 鑾峰彇鏍戣矾寰�
+			getParentData(node, name) {
+				if (node !== null) {
+					if (node.data.name !== undefined) {
+						this.msg = node.data.name + " > " + name;
+					}
+					this.getParentData(node.parent, this.msg);
+				}
+			},
+			async getTableByClick(data, versionVal) {
+				await getProductList({
+					specificationsId: data.id,
+					version: versionVal,
+				}).then((res) => {
+					res.data.forEach((i) => {
+						if (i.name === undefined) {
+							i.name = i.children[0].name;
+							i.unit = i.children[0].unit;
+							i.id = i.children[0].id;
+							i.required = i.children[0].required;
+							i.internal = i.children[0].internal;
+							i.edit = true;
+							delete i.children;
+						}
+					});
+					this.tableData = res.data;
+					this.selectDataList();
+				});
+			},
+			specificationDetails(row) {
+				// 璺宠浆浜у搧瑙勬牸璇︽儏椤�
+				this.$router.push(`/standardLibrary/SpecificationDetails/${row.id}`);
+			},
+			renderContent(h, {
+				node,
+				data,
+				store
+			}) {
+				// 鍒ゆ柇鏄惁鏄埗鑺傜偣鎴栨枃浠跺す
+				const isFolder = "children" in data;
+				return ( <span class="tree-node"> {
+						isFolder ? ( <i class = {node.expanded ?"el-icon-folder-opened blue-folder" : "el-icon-folder blue-folder"} ></i>
+						) : ( <i class = "el-icon-document blue-folder" > </i>)
+					} <div class = "tree-lable" > [{node.level}] {data.name} </div> </span>
+				);
+			},
+			async subAddTreeForm() {
+				if(this.addTreeForm.addTypeArr.length==0){
+					this.$message({
+          						message: '璇峰厛閫夋嫨鏍囧噯绫诲瀷锛�',
+          						type: 'warning'
+       					 });
+					return
+				}
+				let handelerSample=this.changeSample()
+				if(!handelerSample){
+					return;
+				}
+				let res = null;
+				try {
+					switch (this.addTreeForm.addTypeArr.length) {
+						case 1:
+							res = await addMaterial({
+								...this.addTreeForm,
+								type: this.addTreeForm.addTypeArr[0],
+							});
+							break;
+						case 2:
+							res = await addStandards({
+								...this.addTreeForm,
+								materialId: this.addTreeForm.addTypeArr[1],
+							});
+							break;
+						case 3:
+							res = await addSpecifications({
+								...this.addTreeForm,
+								standardId: this.addTreeForm.addTypeArr[2],
+							});
+							break;
+					}
+				} catch (error) {
+					this.$message.error("娣诲姞澶辫触");
+				}
+				this.$message.success("娣诲姞鎴愬姛");
+				this.addTreeFormVisible = false;
+				this.getStandardTree();
+				this.getTableByClick(this.selectData, this.versionValue);
+				this.addTreeForm.addTypeArr=[];
+				this.addTreeForm.specificationsName=''
+				this.addTreeForm.materialName=''
+				this.addTreeForm.standardName=''
+				// console.log(this.addTreeForm);
+			},
+			changeCascader(data) {
+				this.addTreeForm.addTypeArr = data;
+			},
+			selectDataList() {
+				let i=0
+				this.tableData.forEach((a) => {
+					a.id="0"+i
+					a.code = "[1]";
+					i++;
+					if (a.children != undefined) {
+						a.children.forEach((b) => {
+							b.code = "[2]";
+						});
+					}
+				});
+			},
+			// 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆
+			// 鍏ㄩ��/鍙栨秷閫夋搷浣�
+			selectAll(val) {
+				this.isAllSelect = !this.isAllSelect;
+				let data = this.tableData;
+				this.toggleSelect(data, this.isAllSelect, "all");
+			},
+			//閫夋嫨鏌愯
+			selectTr(selection, row) {
+				this.$set(row, "isChecked", !row.isChecked);
+				this.$nextTick(() => {
+					this.isAllSelect = row.isChecked;
+					this.toggleSelect(row, row.isChecked, "tr");
+				});
+			},
+			//閫掑綊瀛愮骇
+			toggleSelect(data, flag, type) {
+				if (type === "all") {
+					if (data.length > 0) {
+						data.forEach((item) => {
+							this.toggleSelection(item, flag);
+							if (item.children && item.children.length > 0) {
+								this.toggleSelect(item.children, flag, type);
+							}
+						});
+					}
+				} else {
+					if (data.children && data.children.length > 0) {
+						data.children.forEach((item) => {
+							item.isChecked = !item.isChecked;
+							this.$refs.multipleTable.toggleRowSelection(item, flag);
+							this.toggleSelect(item, flag, type);
+						});
+					}
+				}
+			},
+			//鏀瑰彉閫変腑
+			toggleSelection(row, flag) {
+				this.$set(row, "isChecked", flag);
+				this.$nextTick(() => {
+					if (flag) {
+						this.$refs.multipleTable.toggleRowSelection(row, flag);
+					} else {
+						this.$refs.multipleTable.clearSelection();
+					}
+				});
+			},
+			handleSelectionChange(val) {
+				this.deleteList = [];
+				val.forEach((v) => {
+					if (v.id !== undefined) {
+						this.deleteList.push(v.id);
+					}
+				});
+			},
+			// 琛ㄦ牸鏍戝叏閮ㄩ�変腑閰嶇疆  缁撴潫
+			deleteListClick() {
+				if(this.deleteList.length==0){
+					this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑椤圭洰')
+					return
+				}
+				deleteListApi(this.deleteList).then((res) => {
+					this.$message({
+						message: res.message,
+						type: "success",
+					});
+					this.getTableByClick(this.selectData, this.versionValue);
+				});
+			},
+			async requiredOnfocus(scope) {
+				let obj = {
+					id: scope.row.id,
+					required: scope.row.required,
+					internal: scope.row.internal,
+				};
+
+				await blurUpdateApi(obj).then((res) => {
+					this.$message({
+						message: res.message,
+						type: "success",
+					});
+					this.getTableByClick(this.selectData, this.versionValue);
+				});
+			},
+		},
+	};
 </script>
 
 <style lang="scss" scoped>
-.standard-library-main{
-  width: 100%;
-  height: 100%;
-// 椤甸潰涓績鍐呭鍖哄煙
-  .content-main{
-    display: flex;
-    height: 100%;
-    min-height: calc(100vh - 88px);
-    padding: 15px;
-    >div{
-      padding: 20px;
-      background: #fff;
-    }
-    .library-bom{
-      flex: 2;
-      margin-right: 12px;
-      .el-tree {
-        margin-top: 12px;
-        ::v-deep .el-tree-node__content{
-          height: 24px !important;
-          font-size: 14px;
-          display: inline-block !important;
-          padding: 2px;
-          color: #333;
-        }
-        ::v-deep .el-tree-node__content:hover{
-          background: rgba(58,124,253,0.1) ;
-          // opacity: 0.31;
-          border-radius: 3px;
-          color: #333 !important;
-        }
-        ::v-deep .el-tree-node:focus>.el-tree-node__content{
-          background: rgba(58,124,253,0.1) ;
-          // opacity: 0.31;
-          border-radius: 3px;
-          color: #333 !important;
-        }
-      }
-    }
-    .library-table{
-      flex: 8;
-      margin-left: 12px;
-      display: flex;
-      flex-direction: column;
+	// el-table琛ㄦ牸瀵归綈
+	::v-deep .el-table__row:not([class*="el-table__row--level-"]) {
+		td:nth-child(2) {
+			padding-left: 23px !important;
+		}
+	}
 
-      .table-header{
-        display: flex;
-        justify-content: space-between;
-        .el-form-item{
-          margin-bottom: 30px !important;
-        }
-      }
-      .table-box{
-          flex: 1;
-          background: #fff;
-          // padding: 20px 20px 10px 20px;
-          display: flex;
-          flex-direction: column;
-          .el-table {
-            flex: 1;
-          }
-          >div:nth-child(2){
-            display: flex;
-            justify-content: end;
-            margin: 10px 0;
-          }
-      }
-    }
-  }
-}
-</style>
+	.standard-library-main {
+		width: 100vh;
+		height: 100%;
+
+		// 椤甸潰涓績鍐呭鍖哄煙
+		.content-main {
+			display: flex;
+			height: 100%;
+			min-height: calc(100vh - 88px);
+			max-height: calc(100vh - 88px);
+			padding: 15px;
+
+			>div {
+				padding: 20px;
+				background: #fff;
+			}
+
+			.library-bom {
+				// padding-right: 10px;
+				width: 300px;
+				overflow-y: auto;
+				// height: 100%;
+				max-height: 100%;
+
+				// margin-right: 12px;
+				// overflow-y: scroll;
+				.el-tree {
+					// margin-top:
+					width: 100%;
+
+					::v-deep .el-tree-node__content {
+						height: 24px !important;
+						font-size: 18px;
+						// display: inline-block !important;
+						padding: 2px;
+
+						// color: #333;
+						.tree-node {
+							display: flex;
+							align-items: center;
+							height: 20px;
+						}
+
+						.tree-lable {
+							height: 100%;
+							line-height: 23px;
+							font-size: 12px;
+							padding-left: 8px;
+						}
+
+						.blue-folder {
+							color: rgb(64, 158, 255);
+						}
+					}
+				}
+			}
+
+			.library-table {
+				// height: 100%;
+				width: 170vh;
+				max-height: 100%;
+				// flex: 8;
+				margin-left: 12px;
+				display: flex;
+				flex-direction: column;
+
+				// overflow-y: scroll;
+				.table-header {
+					display: flex;
+					justify-content: space-between;
+					width: 100%;
+
+					.el-form-item {
+						margin-bottom: 30px !important;
+					}
+				}
+
+				.table-box {
+					flex: 1;
+					background: #fff;
+					// padding: 20px 20px 10px 20px;
+					display: flex;
+					flex-direction: column;
+					justify-content: space-between;
+
+					>div:nth-child(3) {
+						// height: 20px;
+						display: flex;
+						justify-content: end;
+						margin: 10px 0;
+					}
+				}
+			}
+		}
+
+		.addTree {
+			.el-form-item {
+				margin-bottom: 10px;
+			}
+
+			.el-cascader {
+				width: 100%;
+			}
+		}
+	}
+
+	.search-bar {
+		.el-input {
+			position: relative;
+			font-size: 0.07292rem;
+			display: inline-block;
+			width: 70%;
+		}
+	}
+
+	.firstDiv {
+		float: left;
+		width: 20px;
+		height: 20px;
+		border-radius: 50%;
+		background-color: #eff5ff;
+		margin-top: 5px;
+		justify-content: center;
+		display: flex;
+		align-items: center;
+		margin-right: 8px;
+	}
+
+	.el-tag.el-tag {
+		border-color: transparent;
+		background-color: transparent;
+	}
+
+	.el-tag.el-tag:hover {
+		border-color: transparent;
+		background-color: transparent;
+	}
+
+	.serve-btn {
+		width: 100%;
+		padding-bottom: 6px;
+		text-align: right;
+
+		.el-select {
+			margin-right: 10px;
+		}
+	}
+
+	.tipMsg {
+		float: left;
+		font-size: 16px;
+		font-weight: 500;
+		color: #999999;
+	}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3