From 664db98c9e8595ce4dd636a27f480e3a08b81ff5 Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 21 二月 2025 11:13:51 +0800
Subject: [PATCH] 新增可忽略的维修时间
---
web/src/views/modules/basicInfo/ProductModelTree.vue | 260 +++++++++++++++++++++++++++++-----------------------
1 files changed, 145 insertions(+), 115 deletions(-)
diff --git a/web/src/views/modules/basicInfo/ProductModelTree.vue b/web/src/views/modules/basicInfo/ProductModelTree.vue
index 7069d48..5f67e14 100644
--- a/web/src/views/modules/basicInfo/ProductModelTree.vue
+++ b/web/src/views/modules/basicInfo/ProductModelTree.vue
@@ -1,127 +1,157 @@
<template>
- <div class="product-tree-container">
- <!-- <el-input
- placeholder="杈撳叆鍚嶇О杩涜杩囨护"
- style="width: 60%"
- v-model="filterText"
- size="small"
- clearable
- ></el-input>-->
- <el-button v-if="isShow" type="primary" @click="add()"
- style="margin: 10px 0 0 10px;padding: 9px 18px !important;">鏂板鍨嬪彿
- </el-button>
- <el-divider></el-divider>
- <el-tree
- style="height: 90%;overflow: auto"
- class="filter-tree"
- :data="productList"
- :props="defaultProps"
- default-expand-all
- node-key="id"
- :current-node-key="defaultId"
- :expand-on-click-node="false"
- :highlight-current="true"
- @node-click="handleNodeClick"
- :filter-node-method="filterNode"
- ref="tree"
- ></el-tree>
- <!-- 寮圭獥, 鏂板 / 淇敼 -->
- <add-or-update @refreshDataList="getProductList()" ref="AddOrUpdate"/>
- </div>
+ <div class="product-tree-container">
+ <!-- <el-input
+ placeholder="杈撳叆鍚嶇О杩涜杩囨护"
+ style="width: 60%"
+ v-model="filterText"
+ size="small"
+ clearable
+ ></el-input>-->
+ <el-button v-if="isShow" type="primary" size="mini" @click="add()"
+ style="margin: 10px 0 0 7px;padding: 8px 17px !important;">鏂板鍨嬪彿
+ </el-button>
+ <el-button v-if="isShow" type="primary" size="mini" @click="updateXh()"
+ style="margin: 10px 0 0 7px;padding: 8px 17px !important;">淇敼鍨嬪彿
+ </el-button>
+ <el-button v-if="isShow" type="primary" size="mini" @click="deleteXh()"
+ style="margin: 10px 0 0 7px;padding: 8px 17px !important;">鍒犻櫎鍨嬪彿
+ </el-button>
+ <el-divider></el-divider>
+ <el-tree
+ style="height: 90%;overflow: auto"
+ class="filter-tree"
+ :data="productList"
+ :props="defaultProps"
+ default-expand-all
+ node-key="id"
+ :current-node-key="defaultId"
+ :expand-on-click-node="false"
+ :highlight-current="true"
+ @node-click="handleNodeClick"
+ :filter-node-method="filterNode"
+ ref="tree"
+ ></el-tree>
+ <!-- 寮圭獥, 鏂板 / 淇敼 -->
+ <add-or-update @refreshDataList="getProductList()" ref="AddOrUpdate"/>
+ </div>
</template>
<script>
- import AddOrUpdate from './XhProductModel-AddOrUpdate'
+ import AddOrUpdate from './XhProductModel-AddOrUpdate'
- export default {
- name: 'ProductModelTree',
- props: {
- showXdy: {
- type: Boolean,
- default: true
- },
- isShow: {
- type: Boolean,
- default: true
- },
- basic: {
- type: Number,
- default: 1
- },
- productId: {
- type: Number,
- default: null
- },
- },
+ export default {
+ name: 'ProductModelTree',
+ props: {
+ showXdy: {
+ type: Boolean,
+ default: true
+ },
+ isShow: {
+ type: Boolean,
+ default: true
+ },
+ basic: {
+ type: Number,
+ default: 1
+ },
+ productId: {
+ type: Number,
+ default: null
+ },
+ },
- data() {
- return {
- filterText: '',
- productList: [],
- defaultId: '',
- defaultProps: {
- children: 'children',
- label: 'name'
+ data() {
+ return {
+ filterText: '',
+ productList: [],
+ defaultId: '',
+ id: '',
+ defaultProps: {
+ children: 'children',
+ label: 'name'
+ }
+ }
}
- }
- }
- ,
- watch: {
- filterText(val) {
- this.$refs.tree.filter(val)
- }
- }
- ,
- components: {
- AddOrUpdate
- }
- ,
- /* mounted() {
- this.getProductList()
- },*/
- methods: {
- // 鑾峰彇绯荤粺鍒楄〃
- async getProductList() {
- let params = {
- showXdy: this.showXdy,
- ztShow: this.basic,
- productId: this.productId
+ ,
+ watch: {
+ filterText(val) {
+ this.$refs.tree.filter(val)
+ }
}
- let res = await this.$http.get('/basicInfo/XhProductModel/tree', {params: params})
- this.productList = res.data
- if (this.basic === '3') {
- if (this.productList && this.productList[0].children) {
- this.defaultId = this.productList[0].children[0].id
- this.$nextTick(() => {
- this.$refs.tree.setCurrentKey(this.defaultId); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
- });
- this.$emit('on-default', this.defaultId)
- }
- } else{
- if (this.productList[0].id) {
- this.defaultId = this.productList[0].id
- this.$nextTick(() => {
- this.$refs.tree.setCurrentKey(this.defaultId); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
- });
- this.$emit('on-default', this.defaultId)
- }
+ ,
+ components: {
+ AddOrUpdate
}
- console.log(res.data, 'async getProductList()')
- },
- add() {
- this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'xh'})
- },
- filterNode(value, data) {
- if (!value) return true
- return data.name.indexOf(value) !== -1
- },
- handleNodeClick(data) {
- this.$emit('on-selected', data)
- },
+ ,
+ /* mounted() {
+ this.getProductList()
+ },*/
+ methods: {
+ // 鑾峰彇绯荤粺鍒楄〃
+ async getProductList() {
+ let params = {
+ showXdy: this.showXdy,
+ ztShow: this.basic,
+ productId: this.productId
+ }
+ let res = await this.$http.get('/basicInfo/XhProductModel/tree', {params: params})
+ this.productList = res.data
+ if (this.basic === 3) {
+ if (this.productList && this.productList[0].children) {
+ this.defaultId = this.productList[0].children[0].id
+ this.$nextTick(() => {
+ this.$refs.tree.setCurrentKey(this.defaultId); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
+ });
+ this.$emit('on-default', this.defaultId)
+ }
+ } else {
+ if (this.productList[0].id) {
+ this.defaultId = this.productList[0].id
+ this.$nextTick(() => {
+ this.$refs.tree.setCurrentKey(this.defaultId); //涓�瀹氳鍔犺繖涓�変腑浜嗗惁鍒欐牱寮忔病鏈夊嚭鏉�
+ });
+ this.$emit('on-default', this.defaultId)
+ }
+ }
+ console.log(res.data, 'async getProductList()')
+ },
+ add() {
+ this.$refs.AddOrUpdate.$refs.dialog.init(null, {id: null, type: 'xh'})
+ },
+ updateXh() {
+ this.$refs.AddOrUpdate.$refs.dialog.init(this.id, {id: null, type: 'xh'})
+ },
+ async deleteXh() {
+ if (this.id) {
+ this.$tip.alert(this.$t('prompt.deleteBatch'))
+ if (await this.$tip.confirm(this.$t('', {'handle': this.$t('delete')}))) {
+ let res = await this.$http.delete(
+ '/basicInfo/XhProductModel/',
+ {
+ 'data': [this.id]
+ }
+ )
+ if (res.success) {
+ await this.$tip.success()
+ await this.getProductList()
+ }
+ }
+ } else {
+ this.$tip.alert('鏈�夋嫨鍨嬪彿')
+ }
+ },
+ filterNode(value, data) {
+ if (!value) return true
+ return data.name.indexOf(value) !== -1
+ },
+ handleNodeClick(data) {
+ this.id = data.id
+ this.$emit('on-selected', data)
+ },
+ }
}
- }
</script>
<style>
- .product-tree-container {
- height: 100%;
- }
+ .product-tree-container {
+ height: 100%;
+ }
</style>
--
Gitblit v1.9.1