From c3aaf28f7316cce12eec007a9f85a96cbcddeec2 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 07 五月 2025 10:34:20 +0800
Subject: [PATCH] 最新版本541200007
---
admin/src/components/business/OperaCarsWindow.vue | 223 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 177 insertions(+), 46 deletions(-)
diff --git a/admin/src/components/business/OperaCarsWindow.vue b/admin/src/components/business/OperaCarsWindow.vue
index 3e70371..376a3da 100644
--- a/admin/src/components/business/OperaCarsWindow.vue
+++ b/admin/src/components/business/OperaCarsWindow.vue
@@ -1,41 +1,71 @@
<template>
- <GlobalWindow
- :title="title"
- width="500px"
- :visible.sync="visible"
- :confirm-working="isWorking"
- @confirm="confirm"
- >
- <el-form :model="form" ref="form" :rules="rules">
- <el-form-item label="杞︾墝鍙�" prop="code">
- <el-input v-model="form.code" placeholder="璇疯緭鍏ヨ溅鐗屽彿" v-trim/>
- </el-form-item>
- <el-form-item label="杞﹁締绫诲瀷" prop="type">
- <el-radio-group v-model="form.type" >
- <el-radio :label="0" >鍛樺伐杞﹁締</el-radio>
- <el-radio :label="1" >瀹夋嘲鍏姟杞�</el-radio>
- <el-radio :label="2" >瀹夋嘲鐗╂祦杞�</el-radio>
- <el-radio :label="3" >甯傚叕鍙稿叕杞�</el-radio>
- </el-radio-group>
- </el-form-item>
- <el-form-item label="閫夋嫨杞︿富锛�" prop="memberId">
- <el-select v-model="form.memberId" filterable placeholder="璇烽�夋嫨">
- <el-option
- v-for="item in memberList"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-form>
- </GlobalWindow>
+ <GlobalWindow :title="title" width="500px" @close="close" :visible.sync="visible" :confirm-working="isWorking"
+ @confirm="confirm">
+ <el-form :model="form" ref="form" :rules="rules">
+ <el-form-item label="杞︾墝鍙�" prop="code">
+ <el-input v-model="form.code" placeholder="璇疯緭鍏ヨ溅鐗屽彿" v-trim />
+ </el-form-item>
+<!-- <el-form-item label="澶囨敞" prop="type">
+ <el-radio-group v-model="form.type">
+ <el-radio :label="0">瀹夋嘲鍏姟杞�</el-radio>
+ <el-radio :label="1">瀹夋嘲鐗╂祦杞�</el-radio>
+ <el-radio :label="2">鍏朵粬</el-radio>
+ </el-radio-group>
+ </el-form-item>-->
+ <el-form-item label="閫夋嫨鍒嗙被锛�" prop="cateId">
+<!-- <el-cascader v-model="form.cateId" @change="changeSel" :options="cateList" :props="{
+ label: 'name',
+ value: 'id',
+ children: 'childCategoryList',
+ checkStrictly: true
+ }"></el-cascader>-->
+ <treeselect
+ @select="cateChange"
+ v-model="form.cateId"
+ placeholder="璇烽�夋嫨"
+ :options="cateList"
+ :normalizer="normalizeOptions1"
+ :default-expand-level="1"
+ noChildrenText="娌℃湁瀛愰�夐」"
+ noOptionsText="娌℃湁鍙�夐」"
+ noResultsText="娌℃湁鍖归厤鐨勭粨鏋�" />
+ </el-form-item>
+ <el-form-item label="閫夋嫨缁勭粐锛�" prop="groupId">
+ <treeselect
+ @input="changeSel"
+ v-model="form.groupId"
+ placeholder="璇烽�夋嫨"
+ :options="companyTree"
+ :normalizer="normalizeOptions"
+ :default-expand-level="1"
+ noChildrenText="娌℃湁瀛愰�夐」"
+ noOptionsText="娌℃湁鍙�夐」"
+ noResultsText="娌℃湁鍖归厤鐨勭粨鏋�" />
+<!-- <el-select v-model="form.groupId" @change="changeSel" clearable filterable placeholder="璇烽�夋嫨">
+ <template v-for="item in companyList">
+ <el-option v-if="item.countNum && item.countNum>0" :key="item.id" :label="item.name" :value="item.id">
+ </el-option>
+ </template>
+ </el-select>-->
+ </el-form-item>
+ <el-form-item label="閫夋嫨杞︿富锛�" prop="memberId">
+ <el-select v-model="form.memberId" clearable filterable placeholder="璇烽�夋嫨">
+ <el-option v-for="item in memberList" :key="item.id" :label="item.name" :value="item.id">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ </el-form>
+ </GlobalWindow>
</template>
<script>
import BaseOpera from '@/components/base/BaseOpera'
import GlobalWindow from '@/components/common/GlobalWindow'
import { allList } from '@/api/business/member'
+import { fetchList } from '@/api/business/category.js'
+import { create, updateById } from '@/api/business/cars'
+import { companyGetList, fetchList as companyTree } from '@/api/business/company'
+import { Message } from 'element-ui'
export default {
name: 'OperaInternalCompanyWindow',
extends: BaseOpera,
@@ -48,16 +78,21 @@
id: null,
code: null,
memberId: null,
- type: 0
+ // type: 0,
+ groupId: null,
+ cateId: null
},
+ selectCate: null,
+ cateList: [],
+ companyList: [],
+ companyTree: [],
// 楠岃瘉瑙勫垯
rules: {
- code: [
- { required: true, message: '璇疯緭鍏ヨ溅鐗屽彿' }
- ],
- type: [
- { required: true, message: '璇烽�夋嫨杞﹁締绫诲瀷' }
- ]
+ code: [{ required: true, message: '璇疯緭鍏ヨ溅鐗屽彿' }],
+ groupId: [{ required: true, message: '璇烽�夋嫨缁勭粐' }]
+ /* type: [
+ { required: true, message: '璇烽�夋嫨澶囨敞' }
+ ] */
}
}
},
@@ -71,32 +106,128 @@
open (title, target) {
this.title = title
this.visible = true
- this.loadMember()
+ this.getCate()
+ this.getfindCompanyTreePage()
// 鏂板缓缁勭粐
if (target == null) {
this.$nextTick(() => {
this.$refs.form.resetFields()
this.form[this.configData['field.id']] = null
- this.form.type=0
+ this.form.type = 0
})
- return
}
// 缂栬緫
- this.$nextTick(() => {
- for (const key in this.form) {
- this.form[key] = target[key]
+ // this.$nextTick(() => {
+ // for (const key in this.form) {
+ // this.form[key] = target[key]
+ // }
+ // })
+ },
+ cateChange(node){
+ this.selectCate = node
+ },
+ // 瑙勮寖鍖栭�夐」鏁版嵁鐨勬柟娉�
+ normalizeOptions1 (node) {
+ if (!node.childCategoryList || !node.childCategoryList.length) {
+ // 鍘绘帀children=[]鐨刢hildren灞炴��
+ delete node.childCategoryList
+ }
+ var node1 = {
+ id: node.id,
+ label: node.name,
+ parentId: node.parentId,
+ children: node.childCategoryList,
+ }
+ return node1
+ },
+ normalizeOptions (node) {
+ if (!node.childList || !node.childList.length) {
+ // 鍘绘帀children=[]鐨刢hildren灞炴��
+ delete node.childList
+ }
+ return {
+ id: node.id,
+ label: node.name,
+ children: node.childList
+ }
+ },
+ changeSel () {
+ const { form } = this
+ if (form.groupId) {
+ this.loadMember()
+ }
+ this.form.memberId = ''
+ },
+ confirm () {
+ console.log('form', this.form.cateId)
+ const { form } = this
+ if(this.selectCate && this.selectCate.childCategoryList && this.selectCate.childCategoryList.length) {
+ return Message.error('璇烽�夋嫨浜岀骇鍒嗙被')
+ }
+ this.$refs.form.validate((valid) => {
+ if (valid) {
+ const fn = form.id ? updateById : create
+ fn({
+ ...form
+ // cateId: form.cateId[1]
+ }).then(res => {
+ Message.success('淇濆瓨鎴愬姛')
+ this.visible = false
+ this.$emit('success')
+ })
}
})
},
+ close () {
+ this.visible = false
+ this.$emit('close')
+ },
+ handleChange (val) {
+
+ },
+ getCate () {
+ fetchList({
+ model: {},
+ capacity: 1000,
+ page: 1
+ }).then(res => {
+ if (res && res.records && res.records.length > 0) {
+ res.records[0].fsStatus = 1
+ this.cateList = res.records || []
+
+ }
+ })
+ },
+ getCompany () {
+ companyGetList({
+ model: { }, // 鏈夊憳宸ョ殑鏁版嵁
+ capacity: 10000,
+ page: 1
+ }).then(res => {
+ this.companyList = res.records || []
+ })
+ },
+ getfindCompanyTreePage () {
+ companyTree()
+ .then(res => {
+ if (res && res.length > 0) {
+ res[0].fsStatus = 1
+ this.companyTree = res
+ }
+ })
+ },
loadMember () {
+ const { form } = this
allList({
- type: 2
+ type: 2,
+ companyId: form.groupId
+
})
.then(res => {
this.memberList = res
})
.catch(e => {
- this.$tip.apiFailed(e)
+ // this.$tip.apiFailed(e)
})
.finally(() => {
this.isWorking = false
--
Gitblit v1.9.3