From d7dca690cedd12e271f0ee0b9050679d73796f5c Mon Sep 17 00:00:00 2001 From: MrShi <1878285526@qq.com> Date: 星期一, 06 一月 2025 09:28:10 +0800 Subject: [PATCH] 1 --- admin/src/views/operation/components/deviceEdit.vue | 97 ++++++++++++++++++++++++++++-------------------- 1 files changed, 56 insertions(+), 41 deletions(-) diff --git a/admin/src/views/operation/components/deviceEdit.vue b/admin/src/views/operation/components/deviceEdit.vue index 185fbdc..4c5c8f7 100644 --- a/admin/src/views/operation/components/deviceEdit.vue +++ b/admin/src/views/operation/components/deviceEdit.vue @@ -1,6 +1,6 @@ <template> - <GlobalWindow :title="param.id ? '缂栬緫璁惧' : '鏂板缓璁惧'" :confirmWorking="subLoading" :visible.sync="isShowModal" width="600px" @close="close" - @confirm="handleSub"> + <GlobalWindow :title="param.id ? '缂栬緫璁惧' : '鏂板缓璁惧'" :confirmWorking="subLoading" :visible.sync="isShowModal" + width="600px" @close="close" @confirm="handleSub"> <el-form :model="param" ref="paramRef" :rules="rules"> <el-form-item label="璁惧缂栫爜" prop="code"> <el-input v-model="param.code" placeholder="璇疯緭鍏�" v-trim /> @@ -11,18 +11,17 @@ <el-form-item label="璁惧鍨嬪彿" prop=""> <el-input v-model="param.modelNo" placeholder="璇疯緭鍏�" v-trim /> </el-form-item> - <el-form-item label="璁惧鍒嗙被" prop=""> - <el-cascader v-model="param.areaIds" @change="changeSel" placeholder="璇烽�夋嫨宸℃鍖哄煙" clearable :options="cateList" + <el-form-item label="璁惧鍒嗙被" prop="cateId"> + <el-cascader v-model="param.cateIds" @change="changeSel" placeholder="璇烽�夋嫨璁惧鍒嗙被" clearable :options="cateList" :props="{ label: 'name', value: 'id', - children: 'childCategoryList', - checkStrictly: true + children: 'childCategoryList' }"></el-cascader> </el-form-item> <el-form-item label="璁惧绠$悊鍛�" prop=""> - <el-select v-model="param.realName" filterable clearable> - <el-option value="0" label="xxx"></el-option> + <el-select v-model="param.userId" clearable filterable> + <el-option v-for="item in staffList" :label="item.realname" :value="item.id"></el-option> </el-select> </el-form-item> <el-form-item label="鎵�鍦ㄤ綅缃�" prop=""> @@ -30,27 +29,23 @@ </el-form-item> <el-form-item label="渚涘簲鍟�" prop=""> - <el-input v-model="param.company" placeholder="璇疯緭鍏�" v-trim /> - + <el-input v-model="param.supplier" placeholder="璇疯緭鍏�" v-trim /> </el-form-item> <el-form-item label="杩愮淮鍐呭" prop=""> <el-input type="textarea" :rows="4" v-model="param.content" placeholder="璇疯緭鍏�" /> </el-form-item> <el-form-item label="璁惧鐘舵��" prop=""> - <el-select v-model="param.status" filterable clearable> - <el-option value="0" label="姝e父"></el-option> - <el-option value="1" label="鎹熷潖"></el-option> - <el-option value="2" label="鎶ュ簾"></el-option> + <el-select v-model="param.status" filterable> + <el-option :value="0" label="姝e父"></el-option> + <el-option :value="1" label="鎹熷潖"></el-option> + <el-option :value="2" label="鎶ュ簾"></el-option> </el-select> </el-form-item> <el-form-item label="鐓х墖" prop=""> - <UploadAvatarImage :file="{ 'imgurlfull': param.imgurlfull, 'imgurl': param.imgurl }" - :uploadData="{ folder: 'projects' }" @uploadSuccess="uploadAvatarSuccess" @uploadEnd="isUploading = false" + <UploadAvatarImage :file="{ 'imgurlfull': param.fileFullUrl, 'imgurl': param.fileUrl }" + :uploadData="{ folder: 'ywDevice/' }" @uploadSuccess="uploadAvatarSuccess" @uploadEnd="isUploading = false" @uploadBegin="isUploading = true" /> </el-form-item> - - - </el-form> </GlobalWindow> </template> @@ -59,7 +54,8 @@ import GlobalWindow from '@/components/common/GlobalWindow' import UploadAvatarImage from '@/components/common/UploadAvatarImage' import { fetchList } from '@/api/business/category' -import { create, updateById } from '@/api/Inspection/device' +import { create, updateById, detailById } from '@/api/Inspection/device' +import { getUserList } from '@/api/system/user' import { Message } from 'element-ui' export default { components: { GlobalWindow, UploadAvatarImage }, @@ -67,12 +63,16 @@ return { isShowModal: false, subLoading: false, - param: {}, + param: { + status: 0 + }, cateList: [], rules: { name: [{ required: true, message: '璇疯緭鍏�' }], - code: [{ required: true, message: '璇疯緭鍏�' }] + code: [{ required: true, message: '璇疯緭鍏�' }], + cateId: [{ required: true, message: '璇烽�夋嫨' }], }, + staffList: [] } }, @@ -87,16 +87,39 @@ let fn = param.id ? updateById : create this.subLoading = true fn(param).then(res => { - if (res.code == 200) { - this.subLoading = false - this.$emit('success') - Message.success('淇濆瓨鎴愬姛') - this.close() - } + this.subLoading = false + this.$emit('success') + Message.success('淇濆瓨鎴愬姛') + this.close() }).catch(() => { this.subLoading = false }) } + }) + }, + getDetail(id) { + detailById(id).then(res => { + this.param = res + const cateId = this.param.cateId || '' + setTimeout(() => { + if (cateId) { + this.cateList.forEach(item => { + if (item.childCategoryList) { + item.childCategoryList.forEach(item2 => { + if (item2.id == cateId) { + this.$set(this.param, 'cateIds', [item.id, item2.id]) + console.log('cateId', this.form) + } + }) + } + }) + } + },1000) + }) + }, + getStaff() { + getUserList({}).then(res => { + this.staffList = res }) }, initData() { @@ -107,24 +130,18 @@ }).then(res => { this.cateList = res.records || [] }) - + this.getStaff() }, changeSel(e) { - if (e && e.length == 1) { - this.$set(this.param, 'catePId', e[0]) - this.$set(this.param, 'cateId', '') - } else if (e && e.length == 2) { - this.$set(this.param, 'catePId', e[0]) + if (e && e.length == 2) { this.$set(this.param, 'cateId', e[1]) } else { - this.$set(this.param, 'catePId', '') this.$set(this.param, 'cateId', '') } - this.search() }, uploadAvatarSuccess(file) { - this.$set(this.param, 'imgurl', file.imgurl) - this.$set(this.param, 'imgurlfull', file.imgurlfull) + this.$set(this.param, 'fileUrl', file.imgurl) + this.$set(this.param, 'fileFullUrl', file.imgurlfull) }, close() { this.isShowModal = false @@ -132,6 +149,4 @@ } } } -</script> - -<style lang="scss" scoped></style> \ No newline at end of file +</script> \ No newline at end of file -- Gitblit v1.9.3