From ea10117a46fbbe7dd831c3816217493d0da01bf9 Mon Sep 17 00:00:00 2001 From: yangys <y_ys79@sina.com> Date: 星期六, 13 一月 2024 22:46:44 +0800 Subject: [PATCH] 设备类型1 --- src/container/ledger/Manage-add-update.vue | 130 +++---------------------------------------- 1 files changed, 9 insertions(+), 121 deletions(-) diff --git a/src/container/ledger/Manage-add-update.vue b/src/container/ledger/Manage-add-update.vue index 20e5800..9cbfc72 100644 --- a/src/container/ledger/Manage-add-update.vue +++ b/src/container/ledger/Manage-add-update.vue @@ -268,9 +268,9 @@ </template> <script> - import { getUseDpts,accountCreate } from '@/api/Api' + import { accountUpdate,accountCreate } from '@/api/Api' export default { - props: ['addVisible','deviceType','departmentlist'], + props: ['addVisible','deviceType','departmentlist','row','isselectlist','deviceStatus','financePro'], data() { return { visible: false, @@ -306,28 +306,6 @@ workshoplist: [], // 杞﹂棿list oldworkshoplist: [], sectionlist: [], // 宸ユ - isselectlist: [ - { - label: '鏄�', - value: '1' - }, - { - label: '鍚�', - value: '0' - } - ], - // 璁惧鐘舵�� - deviceStatus: [ - { value: 'STOP', label: '鍏虫満' }, - { value: 'RUN', label: '杩愯' }, - { value: 'IDLE', label: '绌洪棽' }, - { value: 'ALARM', label: '鎶ヨ' } - ], - // 璐﹀姟灞炴�� - financePro: [ - { value: '甯愬唴', label: '甯愬唴' }, - { value: '甯愬', label: '甯愬' } - ], userNamelist: [], // 鐢ㄦ埛list imageUrl: '', // 鍥剧墖 fileList: []// 鏂囨。涓婁紶list @@ -342,6 +320,9 @@ }, immediate: true } + }, + created () { + this.init(this.row) }, methods: { init(row) { @@ -376,108 +357,15 @@ this.dataForm.remark = row.remark this.dataForm.managType = row.managType this.dataForm.classes = row.classes - } else { this.dataForm.id = 0 } - this.visible = true - this.getMachineList() - this.queryuserlist() - this.queryworkshoplist() + } else { this.dataForm.id = '' } }, /* 鏌ヨ浣跨敤閮ㄩ棬*/ cancel () { this.$emit('close') }, - // ----------------- - // 鑾峰彇鏈哄簥lists - getMachineList() { - // getMachineList(this.currentPage, this.keyWord).then(res => { - // this.machineNamelist = [] - // if (res.list.length > 0) { - // res.list.map(item => { - // this.machineNamelist.push({ - // value: item.name, - // label: item.name - // }) - // }) - // } - // }) - }, - - /* 鑾峰彇鐢ㄦ埛list*/ - queryuserlist() { - // queryuserlist().then(res => { - // this.userNamelist = [] - // if (res.list.length > 0) { - // res.list.map(item => { - // this.userNamelist.push({ - // value: item.name, - // label: item.name - // }) - // }) - // } - // }) - }, - /* 鑾峰彇杞﹂棿鍚峫ist*/ - queryworkshoplist() { - // queryworkshoplist().then(res => { - // this.workshoplist = [] - // if (res.workshopList.length > 0) { - // this.oldworkshoplist = res.workshopList - // res.workshopList.map(item => { - // this.workshoplist.push({ - // value: item.name, - // label: item.name - // }) - // }) - // } - // }) - }, - /* 杞﹂棿鍚嶆敼鍙� 鑾峰彇宸ユ*/ - workshopchange() { - var cjname = this.dataForm.workshop - this.sectionlist = [] - this.oldworkshoplist.map(item => { - if (item.name === cjname) { - item.sectionList.map(items => { - this.sectionlist.push({ - value: items.name, - label: items.name - }) - }) - } - }) - }, - - /* 鍥剧墖*/ - handleAvatarSuccess(res, file) { - this.imageUrl = URL.createObjectURL(file.raw) - }, - beforeAvatarUpload(file) { - const isJPG = file.type === 'image/jpeg' - const isLt2M = file.size / 1024 / 1024 < 2 - if (!isJPG) { - this.$message.error('涓婁紶澶村儚鍥剧墖鍙兘鏄� JPG 鏍煎紡!') - } - if (!isLt2M) { - this.$message.error('涓婁紶澶村儚鍥剧墖澶у皬涓嶈兘瓒呰繃 2MB!') - } - return isJPG && isLt2M - }, - /* 鏂囨。 */ - handleRemove(file, fileList) { - // console.log(file, fileList) - }, - handlePreview(file) { - // console.log(file) - }, - handleExceed(files, fileList) { - this.$message.warning(`褰撳墠闄愬埗閫夋嫨 3 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠讹紝鍏遍�夋嫨浜� ${files.length + fileList.length} 涓枃浠禶) - }, - beforeRemove(file, fileList) { - return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋) - }, /* 鎻愪氦*/ dataFormSubmit() { - if (this.dataForm.id === 0) { // 鏂板 + if (this.dataForm.id === '') { // 鏂板 accountCreate(this.dataForm).then(res => { this.$message({ message: '鏂板鎴愬姛', @@ -490,7 +378,7 @@ }) }) } else { - accountCreate(this.dataForm).then(res => { + accountUpdate(this.dataForm).then(res => { this.$message({ message: '淇敼鎴愬姛', type: 'success', @@ -509,7 +397,7 @@ <style lang="scss"> .el-form-item__content { - .el-select { + .el-select,.el-input { width: 100%; } } -- Gitblit v1.9.3