whx 3 ヶ月 前
コミット
d44721963d

+ 9 - 2
virgo.wzfrontend/console/src/assets/scss/index.scss

@@ -674,7 +674,14 @@
 				flex: 1;
 				width: 0;
 				display: flex;
-				align-items: center;
+				align-items: center;
+				
+				&.active{
+					color: $--color-primary;
+					.iconfont {
+						color: $--color-primary;
+					}
+				}
 			}
 		}
 
@@ -738,7 +745,7 @@
 			}
 
 			.iconfont {
-				color: $--color-common !important;
+				color: $--color-common;
 				margin-right: 6px;
 			}
 

+ 119 - 0
virgo.wzfrontend/console/src/components/work/property/levelTree.vue

@@ -0,0 +1,119 @@
+<template>
+	<div class="hui-left-tree">
+		<div class="hui-left-tree-title">
+			<svg-icon name="zhuangshi" width="16" height="20"></svg-icon>
+			<span class="hui-left-tree-sub">资产列表</span>
+		</div>
+		<div class="hui-left-tree-content">
+			<el-collapse>
+				<el-collapse-item v-for="item in treeData" :key="item.id">
+					<template slot="title">
+						<div :class="nowData.id === item.id ? 'collapse-title active':'collapse-title'"
+							@click.stop="filterDevice(item)">
+							<i class="iconfont huifont-shuzhuangcaidantubiao"></i>
+							<span class="el-collapse-name">{{item.name}}</span>
+						</div>
+					</template>
+					<div>
+						<el-tree :data="item.children" :props="defaultProps">
+							<div class="custom-tree-node" slot-scope="{ node, data }">
+								<div class="label">{{node.label}}</div>
+								<div :class="nowData.id === data.id ? 'active':''" @click.stop="filterDevice(data)">
+									<i
+										:class="'iconfont ' + (data.deviceId ? 'huifont-shebeiguanli' : 'huifont-xiangmuguanli')">
+									</i>
+								</div>
+							</div>
+						</el-tree>
+					</div>
+				</el-collapse-item>
+			</el-collapse>
+		</div>
+	</div>
+</template>
+
+<script>
+	import {
+		initDevicePartList,
+		getDevicePartList
+	} from '@/httpApi/property'
+	export default {
+		data() {
+			return {
+				treeData: [],
+				nowData: {},
+				defaultProps: {
+					children: 'children',
+					label: 'name'
+				},
+			}
+		},
+		mounted() {
+			this.initDeviceList();
+		},
+		methods: {
+			initDeviceList() {
+				getDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
+					if (res.state) {
+						if (res.data.length === 0) {
+							initDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id)
+								.then(res => {
+									if (res.state) this.initDeviceList();
+								})
+						} else {
+							this.treeData = res.data;
+							this.returnChildren(this.treeData);
+						}
+					}
+				})
+			},
+			returnChildren(data) {
+				data.forEach(item => {
+					if (item.children && item.children.length > 0) this.returnChildren(item.children);
+				});
+			},
+			filterDevice(data) {
+				let option = {};
+				if (this.nowData.id === data.id) {
+					this.nowData = {};
+				} else {
+					this.nowData = data;
+					if (this.nowData.deviceId) {
+						option['deviceId'] = this.nowData.deviceId;
+					} else {
+						option['deviceLevelIds'] = this.getStorageIds([data]);
+					}
+				}
+				this.$emit('filterDevice', option);
+			},
+			getStorageIds(array) {
+				//获取档案库id
+				let ids = [];
+
+				function getIds(array, ids) {
+					array.forEach(item => {
+						if (item.id) {
+							ids.push(item.id);
+						}
+						if (item.children) {
+							ids = getIds(item.children, ids);
+						}
+					})
+					return ids;
+				}
+				if (Array.isArray(array)) {
+					if (array.length == 0) {
+						return [];
+					}
+				} else {
+					return [];
+				}
+				ids = getIds(array, ids);
+				return ids;
+			},
+		},
+	}
+</script>
+
+<style>
+</style>

+ 186 - 256
virgo.wzfrontend/console/src/views/work/property/change.vue

@@ -1,257 +1,187 @@
-<template>
-	<div class="hui-flex">
-		<div class="hui-flex-box yui-tree-box">
-			<div class="hui-left-tree">
-				<div class="hui-left-tree-title">
-					<svg-icon name="zhuangshi" width="16" height="20"></svg-icon>
-					<span class="hui-left-tree-sub">资产列表</span>
-				</div>
-				<div class="hui-left-tree-content">
-					<el-collapse>
-						<el-collapse-item v-for="item in treeData" :key="item.id">
-							<template slot="title">
-								<i class="iconfont huifont-shuzhuangcaidantubiao"></i>
-								<span class="el-collapse-name">{{item.name}}</span>
-							</template>
-							<div>
-								<el-tree :data="item.children" :props="defaultProps">
-									<div class="custom-tree-node" slot-scope="{ node, data }">
-										<div class="label">{{node.label}}</div>
-										<div :class="nowData.id === data.id ? 'active':''"
-											@click.stop="filterDevice(data)">
-											<i
-												:class="'iconfont ' + (data.deviceId ? 'huifont-shebeiguanli' : 'huifont-xiangmuguanli')">
-											</i>
-										</div>
-									</div>
-								</el-tree>
-							</div>
-						</el-collapse-item>
-					</el-collapse>
-				</div>
-			</div>
-			<div class="hui-tree-content">
-				<div class="hui-flex hui-content box-background">
-					<div class="hui-content-title">
-						<div class="hui-title-item active">资产变更</div>
-					</div>
-					<div class="hui-flex-box hui-flex hui-table">
-						<div class="hui-content-insert">
-							<el-button type="primary" v-permission="'/work/property/change/add'" size="medium" @click="insert">新增变更</el-button>
-						</div>
-						<div class="hui-flex-box">
-							<el-table :data="tableData" row-key="id" border height="100%">
-								<el-table-column label="序号" width="50">
-									<template slot-scope="scope">
-										<div style="text-align: center;">{{scope.$index + 1}}</div>
-									</template>
-								</el-table-column>
-								<el-table-column label="资产名称" prop="name"></el-table-column>
-								<el-table-column label="变更类型" prop="type"></el-table-column>
-								<el-table-column label="资产编码" prop="assetNumber"></el-table-column>
-								<el-table-column label="单位建筑" prop="projectItemName"></el-table-column>
-								<el-table-column label="具体位置" prop="projectItemTargetName"></el-table-column>
-								<el-table-column label="创建者" prop="createdByUserName"></el-table-column>
-								<el-table-column label="状态">
-									<template slot-scope="scope">
-										<div v-if="!scope.row.state" class="hui-state">
-											<span class="hui-state-bage hui-state-primary"></span>
-											<span class="hui-state-label">待生成</span>
-										</div>
-										<div v-if="scope.row.state == -1 || scope.row.state == 1" class="hui-state">
-											<span class="hui-state-bage hui-state-primary"></span>
-											<span class="hui-state-label">待审核</span>
-										</div>
-										<div v-if="scope.row.state == 2" class="hui-state">
-											<span class="hui-state-bage hui-state-info"></span>
-											<span class="hui-state-label">审核中</span>
-										</div>
-										<div v-if="scope.row.state == 3" class="hui-state">
-											<span class="hui-state-bage hui-state-success"></span>
-											<span class="hui-state-label">通过</span>
-										</div>
-										<div v-if="scope.row.state == 4" class="hui-state">
-											<span class="hui-state-bage hui-state-error"></span>
-											<span class="hui-state-label">未通过</span>
-										</div>
-									</template>
-								</el-table-column>
-								<el-table-column label="操作" width="150">
-									<template slot-scope="scope">
-										<div class="hui-table-operation">
-											<span class="table-operation" v-permission="'/work/property/change/detail'" @click="lookFlow(scope.row)">
-												详情
-											</span>
-											<span class="table-operation" v-permission="'/work/property/change/update'" v-if="!scope.row.projectFlowId"
-												@click="updateFlow(scope.row)">
-												编辑
-											</span>
-											<span class="table-operation" v-permission="'/work/property/change/delete'" v-if="!scope.row.projectFlowId"
-												@click="deleteFlow(scope.row)">
-												删除
-											</span>
-										</div>
-									</template>
-								</el-table-column>
-								<template slot="empty">
-									<empty description="暂无数据"></empty>
-								</template>
-							</el-table>
-						</div>
-						<div class="hui-content-pagination">
-							<el-pagination :pager-count="9" layout="prev, pager, next" :total="totalCount"
-								@current-change="currentChange">
-							</el-pagination>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-		<el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="1200px"
-			:append-to-body="true">
-			<flow-form v-if="visible" :isUpdate="isUpdate" @callback="callback" :detailId="detailId"
-				:flowType="flowType">
-			</flow-form>
-		</el-dialog>
-		<el-drawer title="流程详情" :visible.sync="drawer" :size="400" :append-to-body="true">
-			<flow-detail v-if="drawer" @callback="callback" :detailId="detailId"></flow-detail>
-		</el-drawer>
-	</div>
-</template>
-
-<script>
-	import {
-		initDevicePartList,
-		getDevicePartList,
-		getFlowList,
-		deleteFlow
-	} from '@/httpApi/property'
-	import flowForm from '@/components/flow/flowForm'
-	import flowDetail from '@/components/flow/flowDetail'
-	export default {
-		data() {
-			return {
-				flowType: 2,
-				tableData: [],
-				currPage: 1,
-				pageSize: 10,
-				totalCount: 0,
-				treeData: [],
-				defaultProps: {
-					children: 'children',
-					label: 'name'
-				},
-				visible: false,
-				isUpdate: false,
-				detailId: '',
-				drawer: false,
-				nowData: {},
-				filterOption: {}
-			}
-		},
-		mounted() {
-			this.initDeviceList();
-			this.init();
-		},
-		methods: {
-			init() {
-				if (!this.auth('/work/property/change/list')) return;
-				let filterOption = {
-					projectId: this.$store.getters.project.id,
-					flowType: this.flowType
-				};
-				filterOption = Object.assign(filterOption, this.filterOption);
-				getFlowList(this.currPage, this.pageSize, filterOption).then(res => {
-					if (res.state) {
-						this.tableData = res.data.dataList.map(node => {
-							node = Object.assign(node, JSON.parse(node.flowData));
-							if (node.operateDevice) node['assetNumber'] = node.operateDevice.assetNumber;
-							return node;
-						});;
-						this.totalCount = res.data.totalCount;
-					}
-				})
-			},
-			initDeviceList() {
-				getDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
-					if (res.state) {
-						if (res.data.length === 0) {
-							initDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id)
-								.then(res => {
-									if (res.state) this.initDeviceList();
-								})
-						} else {
-							this.treeData = res.data;
-							this.returnChildren(this.treeData);
-						}
-					}
-				})
-			},
-			filterDevice(data) {
-				this.filterOption = {};
-				if (this.nowData.id === data.id) {
-					this.nowData = {};
-				} else {
-					this.nowData = data;
-					if (this.nowData.deviceId) {
-						this.filterOption['deviceId'] = this.nowData.deviceId;
-					} else {
-						this.filterOption['deviceLevelId'] = this.nowData.id;
-					}
-				}
-				this.currPage = 1;
-				this.init();
-			},
-			returnChildren(data) {
-				data.forEach(item => {
-					if (item.children && item.deviceList) {
-						let obj = item.deviceList.map(res => {
-							res['deviceId'] = res.id;
-							res['id'] = -res.id;
-							return res;
-						})
-						item.children = item.children.concat(obj);
-					}
-					if (item.children && item.children.length > 0) this.returnChildren(item.children);
-				});
-			},
-			currentChange(currPage) {
-				this.currPage = currPage;
-				this.init();
-			},
-			insert() {
-				this.visible = true;
-				this.isUpdate = false;
-			},
-			lookFlow(val) {
-				this.detailId = val.id;
-				this.drawer = true;
-			},
-			updateFlow(val) {
-				this.detailId = val.id;
-				this.isUpdate = true;
-				this.visible = true;
-			},
-			deleteFlow(val) {
-				this.$confirm('确定要删除该流程?', () => {
-					deleteFlow(val.id).then(res => {
-						if (res.state) {
-							this.$message.success('操作成功');
-							this.init();
-						}
-					})
-				});
-			},
-			callback(type) {
-				this.visible = false;
-				if (type === 'init') this.init();
-			}
-		},
-		components: {
-			flowForm,
-			flowDetail
-		},
-	}
-</script>
-
+<template>
+	<div class="hui-flex">
+		<div class="hui-flex-box yui-tree-box">
+			<level-tree @filterDevice="filterDevice"></level-tree>
+			<div class="hui-tree-content">
+				<div class="hui-flex hui-content box-background">
+					<div class="hui-content-title">
+						<div class="hui-title-item active">资产变更</div>
+					</div>
+					<div class="hui-flex-box hui-flex hui-table">
+						<div class="hui-content-insert">
+							<el-button type="primary" v-permission="'/work/property/change/add'" size="medium"
+								@click="insert">新增变更</el-button>
+						</div>
+						<div class="hui-flex-box">
+							<el-table :data="tableData" row-key="id" border height="100%">
+								<el-table-column label="序号" width="50">
+									<template slot-scope="scope">
+										<div style="text-align: center;">{{scope.$index + 1}}</div>
+									</template>
+								</el-table-column>
+								<el-table-column label="资产名称" prop="name"></el-table-column>
+								<el-table-column label="变更类型" prop="type"></el-table-column>
+								<el-table-column label="资产编码" prop="assetNumber"></el-table-column>
+								<el-table-column label="单位建筑" prop="projectItemName"></el-table-column>
+								<el-table-column label="具体位置" prop="projectItemTargetName"></el-table-column>
+								<el-table-column label="创建者" prop="createdByUserName"></el-table-column>
+								<el-table-column label="状态">
+									<template slot-scope="scope">
+										<div v-if="!scope.row.state" class="hui-state">
+											<span class="hui-state-bage hui-state-primary"></span>
+											<span class="hui-state-label">待生成</span>
+										</div>
+										<div v-if="scope.row.state == -1 || scope.row.state == 1" class="hui-state">
+											<span class="hui-state-bage hui-state-primary"></span>
+											<span class="hui-state-label">待审核</span>
+										</div>
+										<div v-if="scope.row.state == 2" class="hui-state">
+											<span class="hui-state-bage hui-state-info"></span>
+											<span class="hui-state-label">审核中</span>
+										</div>
+										<div v-if="scope.row.state == 3" class="hui-state">
+											<span class="hui-state-bage hui-state-success"></span>
+											<span class="hui-state-label">通过</span>
+										</div>
+										<div v-if="scope.row.state == 4" class="hui-state">
+											<span class="hui-state-bage hui-state-error"></span>
+											<span class="hui-state-label">未通过</span>
+										</div>
+									</template>
+								</el-table-column>
+								<el-table-column label="操作" width="150">
+									<template slot-scope="scope">
+										<div class="hui-table-operation">
+											<span class="table-operation" v-permission="'/work/property/change/detail'"
+												@click="lookFlow(scope.row)">
+												详情
+											</span>
+											<span class="table-operation" v-permission="'/work/property/change/update'"
+												v-if="!scope.row.projectFlowId" @click="updateFlow(scope.row)">
+												编辑
+											</span>
+											<span class="table-operation" v-permission="'/work/property/change/delete'"
+												v-if="!scope.row.projectFlowId" @click="deleteFlow(scope.row)">
+												删除
+											</span>
+										</div>
+									</template>
+								</el-table-column>
+								<template slot="empty">
+									<empty description="暂无数据"></empty>
+								</template>
+							</el-table>
+						</div>
+						<div class="hui-content-pagination">
+							<el-pagination :pager-count="9" layout="prev, pager, next" :total="totalCount"
+								@current-change="currentChange">
+							</el-pagination>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+		<el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="1200px"
+			:append-to-body="true">
+			<flow-form v-if="visible" :isUpdate="isUpdate" @callback="callback" :detailId="detailId"
+				:flowType="flowType">
+			</flow-form>
+		</el-dialog>
+		<el-drawer title="流程详情" :visible.sync="drawer" :size="400" :append-to-body="true">
+			<flow-detail v-if="drawer" @callback="callback" :detailId="detailId"></flow-detail>
+		</el-drawer>
+	</div>
+</template>
+
+<script>
+	import {
+		getFlowList,
+		deleteFlow
+	} from '@/httpApi/property'
+	import flowForm from '@/components/flow/flowForm'
+	import flowDetail from '@/components/flow/flowDetail'
+	import levelTree from '@/components/work/property/levelTree'
+	export default {
+		data() {
+			return {
+				flowType: 2,
+				tableData: [],
+				currPage: 1,
+				pageSize: 10,
+				totalCount: 0,
+				visible: false,
+				isUpdate: false,
+				detailId: '',
+				drawer: false,
+				nowData: {},
+				filterOption: {}
+			}
+		},
+		mounted() {
+			this.init();
+		},
+		methods: {
+			init() {
+				if (!this.auth('/work/property/change/list')) return;
+				let filterOption = {
+					projectId: this.$store.getters.project.id,
+					flowType: this.flowType
+				};
+				filterOption = Object.assign(filterOption, this.filterOption);
+				getFlowList(this.currPage, this.pageSize, filterOption).then(res => {
+					if (res.state) {
+						this.tableData = res.data.dataList.map(node => {
+							node = Object.assign(node, JSON.parse(node.flowData));
+							if (node.operateDevice) node['assetNumber'] = node.operateDevice.assetNumber;
+							return node;
+						});;
+						this.totalCount = res.data.totalCount;
+					}
+				})
+			},
+			filterDevice(data) {
+				this.filterOption = data;
+				this.currPage = 1;
+				this.init();
+			},
+			currentChange(currPage) {
+				this.currPage = currPage;
+				this.init();
+			},
+			insert() {
+				this.visible = true;
+				this.isUpdate = false;
+			},
+			lookFlow(val) {
+				this.detailId = val.id;
+				this.drawer = true;
+			},
+			updateFlow(val) {
+				this.detailId = val.id;
+				this.isUpdate = true;
+				this.visible = true;
+			},
+			deleteFlow(val) {
+				this.$confirm('确定要删除该流程?', () => {
+					deleteFlow(val.id).then(res => {
+						if (res.state) {
+							this.$message.success('操作成功');
+							this.init();
+						}
+					})
+				});
+			},
+			callback(type) {
+				this.visible = false;
+				if (type === 'init') this.init();
+			}
+		},
+		components: {
+			flowForm,
+			flowDetail,
+			levelTree
+		},
+	}
+</script>
+
 <style lang="scss"></style>

+ 8 - 80
virgo.wzfrontend/console/src/views/work/property/depreciation.vue

@@ -1,35 +1,7 @@
 <template>
 	<div class="hui-flex">
 		<div class="hui-flex-box yui-tree-box">
-			<div class="hui-left-tree">
-				<div class="hui-left-tree-title">
-					<svg-icon name="zhuangshi" width="16" height="20"></svg-icon>
-					<span class="hui-left-tree-sub">资产列表</span>
-				</div>
-				<div class="hui-left-tree-content">
-					<el-collapse>
-						<el-collapse-item v-for="item in treeData" :key="item.id">
-							<template slot="title">
-								<i class="iconfont huifont-shuzhuangcaidantubiao"></i>
-								<span class="el-collapse-name">{{item.name}}</span>
-							</template>
-							<div>
-								<el-tree :data="item.children" :props="defaultProps">
-									<div class="custom-tree-node" slot-scope="{ node, data }">
-										<div class="label">{{node.label}}</div>
-										<div :class="nowData.id === data.id ? 'active':''"
-											@click.stop="filterDevice(data)">
-											<i
-												:class="'iconfont ' + (data.deviceId ? 'huifont-shebeiguanli' : 'huifont-xiangmuguanli')">
-											</i>
-										</div>
-									</div>
-								</el-tree>
-							</div>
-						</el-collapse-item>
-					</el-collapse>
-				</div>
-			</div>
+			<level-tree @filterDevice="filterDevice"></level-tree>
 			<div class="hui-tree-content">
 				<div class="hui-flex hui-content box-background">
 					<div class="hui-content-title">
@@ -120,13 +92,12 @@
 
 <script>
 	import {
-		initDevicePartList,
-		getDevicePartList,
 		getFlowList,
 		deleteFlow
 	} from '@/httpApi/property'
 	import flowForm from '@/components/flow/flowForm'
 	import flowDetail from '@/components/flow/flowDetail'
+	import levelTree from '@/components/work/property/levelTree'
 	export default {
 		data() {
 			return {
@@ -135,11 +106,6 @@
 				currPage: 1,
 				pageSize: 10,
 				totalCount: 0,
-				treeData: [],
-				defaultProps: {
-					children: 'children',
-					label: 'name'
-				},
 				visible: false,
 				isUpdate: false,
 				detailId: '',
@@ -149,7 +115,6 @@
 			}
 		},
 		mounted() {
-			this.initDeviceList();
 			this.init();
 		},
 		methods: {
@@ -171,48 +136,10 @@
 					}
 				})
 			},
-			initDeviceList() {
-				getDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
-					if (res.state) {
-						if (res.data.length === 0) {
-							initDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id)
-								.then(res => {
-									if (res.state) this.initDeviceList();
-								})
-						} else {
-							this.treeData = res.data;
-							this.returnChildren(this.treeData);
-						}
-					}
-				})
-			},
-			filterDevice(data) {
-				this.filterOption = {};
-				if (this.nowData.id === data.id) {
-					this.nowData = {};
-				} else {
-					this.nowData = data;
-					if (this.nowData.deviceId) {
-						this.filterOption['deviceId'] = this.nowData.deviceId;
-					} else {
-						this.filterOption['deviceLevelId'] = this.nowData.id;
-					}
-				}
-				this.currPage = 1;
-				this.init();
-			},
-			returnChildren(data) {
-				data.forEach(item => {
-					if (item.children && item.deviceList) {
-						let obj = item.deviceList.map(res => {
-							res['deviceId'] = res.id;
-							res['id'] = -res.id;
-							return res;
-						})
-						item.children = item.children.concat(obj);
-					}
-					if (item.children && item.children.length > 0) this.returnChildren(item.children);
-				});
+			filterDevice(data) {
+				this.filterOption = data;
+				this.currPage = 1;
+				this.init();
 			},
 			currentChange(currPage) {
 				this.currPage = currPage;
@@ -248,7 +175,8 @@
 		},
 		components: {
 			flowForm,
-			flowDetail
+			flowDetail,
+			levelTree
 		},
 	}
 </script>

+ 197 - 263
virgo.wzfrontend/console/src/views/work/property/inventory.vue

@@ -1,264 +1,198 @@
-<template>
-	<div class="hui-flex">
-		<div class="hui-flex-box yui-tree-box">
-			<div class="hui-left-tree">
-				<div class="hui-left-tree-title">
-					<svg-icon name="zhuangshi" width="16" height="20"></svg-icon>
-					<span class="hui-left-tree-sub">资产列表</span>
-				</div>
-				<div class="hui-left-tree-content">
-					<el-collapse>
-						<el-collapse-item v-for="item in treeData" :key="item.id">
-							<template slot="title">
-								<i class="iconfont huifont-shuzhuangcaidantubiao"></i>
-								<span class="el-collapse-name">{{item.name}}</span>
-							</template>
-							<div>
-								<el-tree :data="item.children" :props="defaultProps">
-									<div class="custom-tree-node" slot-scope="{ node, data }">
-										<div class="label">{{node.label}}</div>
-										<div :class="nowData.id === data.id ? 'active':''"
-											@click.stop="filterDevice(data)">
-											<i
-												:class="'iconfont ' + (data.deviceId ? 'huifont-shebeiguanli' : 'huifont-xiangmuguanli')">
-											</i>
-										</div>
-									</div>
-								</el-tree>
-							</div>
-						</el-collapse-item>
-					</el-collapse>
-				</div>
-			</div>
-			<div class="hui-tree-content">
-				<div class="hui-flex hui-content box-background">
-					<div class="hui-content-title">
-						<div class="hui-title-item active">资产盘点</div>
-					</div>
-					<div class="hui-flex-box hui-flex hui-table">
-						<div class="hui-content-insert">
-							<el-button v-permission="'/work/property/inventory/add'" type="primary" size="medium" @click="insert">新增盘点</el-button>
-							<el-button v-permission="'/work/property/inventory/add'" type="info" size="medium"
-								@click="outputFile">
-								导出数据
-							</el-button>
-						</div>
-						<div class="hui-flex-box">
-							<el-table :data="tableData" row-key="id" border height="100%">
-								<el-table-column label="序号" width="50">
-									<template slot-scope="scope">
-										<div style="text-align: center;">{{scope.$index + 1}}</div>
-									</template>
-								</el-table-column>
-								<el-table-column label="资产名称" prop="name"></el-table-column>
-								<el-table-column label="资产编码" prop="assetNumber"></el-table-column>
-								<el-table-column label="盘点内容" prop="inventoryContent"></el-table-column>
-								<el-table-column label="盘点描述" prop="remark"></el-table-column>
-								<el-table-column label="创建者" prop="createdByUserName"></el-table-column>
-								<el-table-column label="状态">
-									<template slot-scope="scope">
-										<div v-if="!scope.row.state" class="hui-state">
-											<span class="hui-state-bage hui-state-primary"></span>
-											<span class="hui-state-label">待生成</span>
-										</div>
-										<div v-if="scope.row.state == -1 || scope.row.state == 1" class="hui-state">
-											<span class="hui-state-bage hui-state-primary"></span>
-											<span class="hui-state-label">待审核</span>
-										</div>
-										<div v-if="scope.row.state == 2" class="hui-state">
-											<span class="hui-state-bage hui-state-info"></span>
-											<span class="hui-state-label">审核中</span>
-										</div>
-										<div v-if="scope.row.state == 3" class="hui-state">
-											<span class="hui-state-bage hui-state-success"></span>
-											<span class="hui-state-label">通过</span>
-										</div>
-										<div v-if="scope.row.state == 4" class="hui-state">
-											<span class="hui-state-bage hui-state-error"></span>
-											<span class="hui-state-label">未通过</span>
-										</div>
-									</template>
-								</el-table-column>
-								<el-table-column label="操作" width="150">
-									<template slot-scope="scope">
-										<div class="hui-table-operation">
-											<span class="table-operation" v-permission="'/work/property/inventory/detail'" @click="lookFlow(scope.row)">
-												详情
-											</span>
-											<span class="table-operation" v-permission="'/work/property/inventory/update'" v-if="!scope.row.projectFlowId"
-												@click="updateFlow(scope.row)">
-												编辑
-											</span>
-											<span class="table-operation" v-permission="'/work/property/inventory/delete'" v-if="!scope.row.projectFlowId"
-												@click="deleteFlow(scope.row)">
-												删除
-											</span>
-										</div>
-									</template>
-								</el-table-column>
-								<template slot="empty">
-									<empty description="暂无数据"></empty>
-								</template>
-							</el-table>
-						</div>
-						<div class="hui-content-pagination">
-							<el-pagination :pager-count="9" layout="prev, pager, next" :total="totalCount"
-								@current-change="currentChange">
-							</el-pagination>
-						</div>
-					</div>
-				</div>
-			</div>
-		</div>
-		<el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="1200px"
-			:append-to-body="true">
-			<flow-form v-if="visible" :isUpdate="isUpdate" @callback="callback" :detailId="detailId"
-				:flowType="flowType">
-			</flow-form>
-		</el-dialog>
-		<el-drawer title="流程详情" :visible.sync="drawer" :size="400" :append-to-body="true">
-			<flow-detail v-if="drawer" @callback="callback" :detailId="detailId"></flow-detail>
-		</el-drawer>
-	</div>
-</template>
-
-<script>
-	import {
-		initDevicePartList,
-		getDevicePartList,
-		getFlowList,
-		deleteFlow
-	} from '@/httpApi/property'
-	import flowForm from '@/components/flow/flowForm'
-	import flowDetail from '@/components/flow/flowDetail'
-	import config from '@/config'
-	export default {
-		data() {
-			return {
-				flowType: 4,
-				tableData: [],
-				currPage: 1,
-				pageSize: 10,
-				totalCount: 0,
-				treeData: [],
-				defaultProps: {
-					children: 'children',
-					label: 'name'
-				},
-				visible: false,
-				isUpdate: false,
-				detailId: '',
-				drawer: false,
-				nowData: {},
-				filterOption: {}
-			}
-		},
-		mounted() {
-			this.initDeviceList();
-			this.init();
-		},
-		methods: {
-			init() {
-				if (!this.auth('/work/property/inventory/list')) return;
-				let filterOption = {
-					projectId: this.$store.getters.project.id,
-					flowType: this.flowType
-				};
-				filterOption = Object.assign(filterOption, this.filterOption);
-				getFlowList(this.currPage, this.pageSize, filterOption).then(res => {
-					if (res.state) {
-						this.tableData = res.data.dataList.map(node => {
-							node = Object.assign(node, JSON.parse(node.flowData));
-							if (node.operateDevice) node['assetNumber'] = node.operateDevice.assetNumber;
-							return node;
-						});;
-						this.totalCount = res.data.totalCount;
-					}
-				})
-			},
-			outputFile() {
-				window.location.href = `${config.baseURL}/api/operateDevice/exportStocktaking/${this.$store.getters.project.id}/0`;
-			},
-			initDeviceList() {
-				getDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
-					if (res.state) {
-						if (res.data.length === 0) {
-							initDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id)
-								.then(res => {
-									if (res.state) this.initDeviceList();
-								})
-						} else {
-							this.treeData = res.data;
-							this.returnChildren(this.treeData);
-						}
-					}
-				})
-			},
-			filterDevice(data) {
-				this.filterOption = {};
-				if (this.nowData.id === data.id) {
-					this.nowData = {};
-				} else {
-					this.nowData = data;
-					if (this.nowData.deviceId) {
-						this.filterOption['deviceId'] = this.nowData.deviceId;
-					} else {
-						this.filterOption['deviceLevelId'] = this.nowData.id;
-					}
-				}
-				this.currPage = 1;
-				this.init();
-			},
-			returnChildren(data) {
-				data.forEach(item => {
-					if (item.children && item.deviceList) {
-						let obj = item.deviceList.map(res => {
-							res['deviceId'] = res.id;
-							res['id'] = -res.id;
-							return res;
-						})
-						item.children = item.children.concat(obj);
-					}
-					if (item.children && item.children.length > 0) this.returnChildren(item.children);
-				});
-			},
-			currentChange(currPage) {
-				this.currPage = currPage;
-				this.init();
-			},
-			insert() {
-				this.visible = true;
-				this.isUpdate = false;
-			},
-			lookFlow(val) {
-				this.detailId = val.id;
-				this.drawer = true;
-			},
-			updateFlow(val) {
-				this.detailId = val.id;
-				this.isUpdate = true;
-				this.visible = true;
-			},
-			deleteFlow(val) {
-				this.$confirm('确定要删除该流程?', () => {
-					deleteFlow(val.id).then(res => {
-						if (res.state) {
-							this.$message.success('操作成功');
-							this.init();
-						}
-					})
-				});
-			},
-			callback(type) {
-				this.visible = false;
-				if (type === 'init') this.init();
-			}
-		},
-		components: {
-			flowForm,
-			flowDetail
-		},
-	}
-</script>
-
+<template>
+	<div class="hui-flex">
+		<div class="hui-flex-box yui-tree-box">
+			<level-tree @filterDevice="filterDevice"></level-tree>
+			<div class="hui-tree-content">
+				<div class="hui-flex hui-content box-background">
+					<div class="hui-content-title">
+						<div class="hui-title-item active">资产盘点</div>
+					</div>
+					<div class="hui-flex-box hui-flex hui-table">
+						<div class="hui-content-insert">
+							<el-button v-permission="'/work/property/inventory/add'" type="primary" size="medium"
+								@click="insert">新增盘点</el-button>
+							<el-button v-permission="'/work/property/inventory/add'" type="info" size="medium"
+								@click="outputFile">
+								导出数据
+							</el-button>
+						</div>
+						<div class="hui-flex-box">
+							<el-table :data="tableData" row-key="id" border height="100%">
+								<el-table-column label="序号" width="50">
+									<template slot-scope="scope">
+										<div style="text-align: center;">{{scope.$index + 1}}</div>
+									</template>
+								</el-table-column>
+								<el-table-column label="资产名称" prop="name"></el-table-column>
+								<el-table-column label="资产编码" prop="assetNumber"></el-table-column>
+								<el-table-column label="盘点内容" prop="inventoryContent"></el-table-column>
+								<el-table-column label="盘点描述" prop="remark"></el-table-column>
+								<el-table-column label="创建者" prop="createdByUserName"></el-table-column>
+								<el-table-column label="状态">
+									<template slot-scope="scope">
+										<div v-if="!scope.row.state" class="hui-state">
+											<span class="hui-state-bage hui-state-primary"></span>
+											<span class="hui-state-label">待生成</span>
+										</div>
+										<div v-if="scope.row.state == -1 || scope.row.state == 1" class="hui-state">
+											<span class="hui-state-bage hui-state-primary"></span>
+											<span class="hui-state-label">待审核</span>
+										</div>
+										<div v-if="scope.row.state == 2" class="hui-state">
+											<span class="hui-state-bage hui-state-info"></span>
+											<span class="hui-state-label">审核中</span>
+										</div>
+										<div v-if="scope.row.state == 3" class="hui-state">
+											<span class="hui-state-bage hui-state-success"></span>
+											<span class="hui-state-label">通过</span>
+										</div>
+										<div v-if="scope.row.state == 4" class="hui-state">
+											<span class="hui-state-bage hui-state-error"></span>
+											<span class="hui-state-label">未通过</span>
+										</div>
+									</template>
+								</el-table-column>
+								<el-table-column label="操作" width="150">
+									<template slot-scope="scope">
+										<div class="hui-table-operation">
+											<span class="table-operation"
+												v-permission="'/work/property/inventory/detail'"
+												@click="lookFlow(scope.row)">
+												详情
+											</span>
+											<span class="table-operation"
+												v-permission="'/work/property/inventory/update'"
+												v-if="!scope.row.projectFlowId" @click="updateFlow(scope.row)">
+												编辑
+											</span>
+											<span class="table-operation"
+												v-permission="'/work/property/inventory/delete'"
+												v-if="!scope.row.projectFlowId" @click="deleteFlow(scope.row)">
+												删除
+											</span>
+										</div>
+									</template>
+								</el-table-column>
+								<template slot="empty">
+									<empty description="暂无数据"></empty>
+								</template>
+							</el-table>
+						</div>
+						<div class="hui-content-pagination">
+							<el-pagination :pager-count="9" layout="prev, pager, next" :total="totalCount"
+								@current-change="currentChange">
+							</el-pagination>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+		<el-dialog :close-on-click-modal="false" :title="isUpdate?'编辑':'新增'" :visible.sync="visible" width="1200px"
+			:append-to-body="true">
+			<flow-form v-if="visible" :isUpdate="isUpdate" @callback="callback" :detailId="detailId"
+				:flowType="flowType">
+			</flow-form>
+		</el-dialog>
+		<el-drawer title="流程详情" :visible.sync="drawer" :size="400" :append-to-body="true">
+			<flow-detail v-if="drawer" @callback="callback" :detailId="detailId"></flow-detail>
+		</el-drawer>
+	</div>
+</template>
+
+<script>
+	import {
+		getFlowList,
+		deleteFlow
+	} from '@/httpApi/property'
+	import flowForm from '@/components/flow/flowForm'
+	import flowDetail from '@/components/flow/flowDetail'
+	import levelTree from '@/components/work/property/levelTree'
+	import config from '@/config'
+	export default {
+		data() {
+			return {
+				flowType: 4,
+				tableData: [],
+				currPage: 1,
+				pageSize: 10,
+				totalCount: 0,
+				visible: false,
+				isUpdate: false,
+				detailId: '',
+				drawer: false,
+				nowData: {},
+				filterOption: {}
+			}
+		},
+		mounted() {
+			this.init();
+		},
+		methods: {
+			init() {
+				if (!this.auth('/work/property/inventory/list')) return;
+				let filterOption = {
+					projectId: this.$store.getters.project.id,
+					flowType: this.flowType
+				};
+				filterOption = Object.assign(filterOption, this.filterOption);
+				getFlowList(this.currPage, this.pageSize, filterOption).then(res => {
+					if (res.state) {
+						this.tableData = res.data.dataList.map(node => {
+							node = Object.assign(node, JSON.parse(node.flowData));
+							if (node.operateDevice) node['assetNumber'] = node.operateDevice.assetNumber;
+							return node;
+						});;
+						this.totalCount = res.data.totalCount;
+					}
+				})
+			},
+			outputFile() {
+				window.location.href =
+					`${config.baseURL}/api/operateDevice/exportStocktaking/${this.$store.getters.project.id}/0`;
+			},
+			filterDevice(data) {
+				this.filterOption = data;
+				this.currPage = 1;
+				this.init();
+			},
+			currentChange(currPage) {
+				this.currPage = currPage;
+				this.init();
+			},
+			insert() {
+				this.visible = true;
+				this.isUpdate = false;
+			},
+			lookFlow(val) {
+				this.detailId = val.id;
+				this.drawer = true;
+			},
+			updateFlow(val) {
+				this.detailId = val.id;
+				this.isUpdate = true;
+				this.visible = true;
+			},
+			deleteFlow(val) {
+				this.$confirm('确定要删除该流程?', () => {
+					deleteFlow(val.id).then(res => {
+						if (res.state) {
+							this.$message.success('操作成功');
+							this.init();
+						}
+					})
+				});
+			},
+			callback(type) {
+				this.visible = false;
+				if (type === 'init') this.init();
+			}
+		},
+		components: {
+			flowForm,
+			flowDetail,
+			levelTree
+		},
+	}
+</script>
+
 <style lang="scss"></style>

+ 10 - 96
virgo.wzfrontend/console/src/views/work/property/register.vue

@@ -1,35 +1,7 @@
 <template>
 	<div class="hui-flex">
 		<div class="hui-flex-box yui-tree-box">
-			<div class="hui-left-tree">
-				<div class="hui-left-tree-title">
-					<svg-icon name="zhuangshi" width="16" height="20"></svg-icon>
-					<span class="hui-left-tree-sub">资产列表</span>
-				</div>
-				<div class="hui-left-tree-content">
-					<el-collapse>
-						<el-collapse-item v-for="item in treeData" :key="item.id">
-							<template slot="title">
-								<i class="iconfont huifont-shuzhuangcaidantubiao"></i>
-								<span class="el-collapse-name">{{item.name}}</span>
-							</template>
-							<div>
-								<el-tree :data="item.children" :props="defaultProps">
-									<div class="custom-tree-node" slot-scope="{ node, data }">
-										<div class="label">{{node.label}}</div>
-										<div :class="nowData.id === data.id ? 'active':''"
-											@click.stop="filterDevice(data)">
-											<i
-												:class="'iconfont ' + (data.deviceId ? 'huifont-shebeiguanli' : 'huifont-xiangmuguanli')">
-											</i>
-										</div>
-									</div>
-								</el-tree>
-							</div>
-						</el-collapse-item>
-					</el-collapse>
-				</div>
-			</div>
+			<level-tree @filterDevice="filterDevice"></level-tree>
 			<div class="hui-tree-content">
 				<div class="hui-flex hui-content box-background">
 					<div class="hui-content-title">
@@ -52,14 +24,14 @@
 							</el-button>
 						</div>
 						<div class="hui-flex-box">
-							<el-table :data="tableData" row-key="id" border height="100%">
+							<el-table :data="tableData" row-key="id" border height="100%" @sort-change="sortChange">
 								<el-table-column label="序号" width="50">
 									<template slot-scope="scope">
 										<div style="text-align: center;">{{scope.$index + 1}}</div>
 									</template>
 								</el-table-column>
 								<el-table-column label="资产名称" prop="name"></el-table-column>
-								<el-table-column label="资产类型">
+								<el-table-column label="设备类型">
 									<template slot-scope="scope">
 										<span>{{scope.row.type === 0?'普通设备':'物联网设备'}}</span>
 									</template>
@@ -69,7 +41,7 @@
 								<el-table-column label="具体位置" prop="projectItemTargetName"></el-table-column>
 								<el-table-column label="型号" prop="deviceModel"></el-table-column>
 								<el-table-column label="创建者" prop="createdByUserName"></el-table-column>
-								<el-table-column label="状态">
+								<el-table-column label="状态" sortable>
 									<template slot-scope="scope">
 										<div v-if="!scope.row.state" class="hui-state">
 											<span class="hui-state-bage hui-state-primary"></span>
@@ -143,14 +115,13 @@
 
 <script>
 	import {
-		initDevicePartList,
-		getDevicePartList,
 		getFlowList,
 		deleteFlow
 	} from '@/httpApi/property'
 	import batchForm from '@/components/flow/batchForm'
 	import flowForm from '@/components/flow/flowForm'
 	import flowDetail from '@/components/flow/flowDetail'
+	import levelTree from '@/components/work/property/levelTree'
 	import config from '@/config'
 	export default {
 		data() {
@@ -160,11 +131,6 @@
 				currPage: 1,
 				pageSize: 10,
 				totalCount: 0,
-				treeData: [],
-				defaultProps: {
-					children: 'children',
-					label: 'name'
-				},
 				visible: false,
 				isUpdate: false,
 				detailId: '',
@@ -175,7 +141,6 @@
 			}
 		},
 		mounted() {
-			this.initDeviceList();
 			this.init();
 		},
 		methods: {
@@ -196,38 +161,11 @@
 					}
 				})
 			},
-			initDeviceList() {
-				getDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id).then(res => {
-					if (res.state) {
-						if (res.data.length === 0) {
-							initDevicePartList(this.$store.getters.organization.id, this.$store.getters.project.id)
-								.then(res => {
-									if (res.state) this.initDeviceList();
-								})
-						} else {
-							this.treeData = res.data;
-							this.returnChildren(this.treeData);
-						}
-					}
-				})
-			},
-			returnChildren(data) {
-				data.forEach(item => {
-					if (item.children && item.children.length > 0) this.returnChildren(item.children);
-				});
+			sortChange(data) {
+				console.log(data.order);
 			},
 			filterDevice(data) {
-				this.filterOption = {};
-				if (this.nowData.id === data.id) {
-					this.nowData = {};
-				} else {
-					this.nowData = data;
-					if (this.nowData.deviceId) {
-						this.filterOption['deviceId'] = this.nowData.deviceId;
-					} else {
-						this.filterOption['deviceLevelIds'] = this.getStorageIds([data]);
-					}
-				}
+				this.filterOption = data;
 				this.currPage = 1;
 				this.init();
 			},
@@ -237,31 +175,6 @@
 			downloadFile() {
 				window.location.href = config.baseURL + '/api/operateDevice/exportTemplate';
 			},
-			getStorageIds(array) {
-				//获取档案库id
-				let ids = [];
-
-				function getIds(array, ids) {
-					array.forEach(item => {
-						if (item.id) {
-							ids.push(item.id);
-						}
-						if (item.children) {
-							ids = getIds(item.children, ids);
-						}
-					})
-					return ids;
-				}
-				if (Array.isArray(array)) {
-					if (array.length == 0) {
-						return [];
-					}
-				} else {
-					return [];
-				}
-				ids = getIds(array, ids);
-				return ids;
-			},
 			currentChange(currPage) {
 				this.currPage = currPage;
 				this.init();
@@ -299,7 +212,8 @@
 		components: {
 			flowForm,
 			flowDetail,
-			batchForm
+			batchForm,
+			levelTree
 		},
 	}
 </script>