From 0efb10e3999d1bcb7cc65008b067836ddd71c82c Mon Sep 17 00:00:00 2001 From: 唐耀东 <18861537@qq.com> Date: 星期一, 07 二月 2022 17:47:35 +0800 Subject: [PATCH] 设备、外设单元修改 --- src/views/device/peripheralUnit/index.vue | 66 ++++++++++++++++++-------------- 1 files changed, 37 insertions(+), 29 deletions(-) diff --git a/src/views/device/peripheralUnit/index.vue b/src/views/device/peripheralUnit/index.vue index 287644f..0de5611 100644 --- a/src/views/device/peripheralUnit/index.vue +++ b/src/views/device/peripheralUnit/index.vue @@ -119,19 +119,19 @@ <span>{{ scope.$index + (queryParams.pageNum - 1) * queryParams.pageSize + 1 }} </span> </template> </el-table-column> - <el-table-column label="澶栬浠g爜" align="center" prop="code"/> - <el-table-column label="澶栬鍚嶇О" align="center" prop="name"/> - <el-table-column label="瑙勬牸鍨嬪彿" align="center" prop="model"/> + <el-table-column label="澶栬浠g爜" width="80" align="center" prop="code"/> + <el-table-column label="澶栬鍚嶇О" align="center" prop="name" show-overflow-tooltip/> + <el-table-column label="瑙勬牸鍨嬪彿" align="center" prop="model" min-width="120"/> <el-table-column label="鐢熶骇鍘傚晢" align="center" prop="manufacturer_dictText"/> - <el-table-column label="鍘傚晢浠g爜" align="center" prop="vendorCode_dictText"/> - <el-table-column label="娉㈢壒鐜�" align="center" prop="baudRate"> + <el-table-column label="鍘傚晢浠g爜" width="100" align="center" prop="vendorCode_dictText"/> + <el-table-column label="娉㈢壒鐜�" width="100" align="center" prop="baudRate"> <template slot-scope="scope"> <dict-tag :options="dict.type.DICT103" :value="scope.row.baudRate"/> </template> </el-table-column> - <el-table-column label="璇绘暟鎸囦护" align="center" width="180" prop="readInstruction"/> - <el-table-column label="鍥炴暟闀垮害" align="center" prop="loopLength"/> - <el-table-column label="鍔熻兘鎻忚堪" align="center" min-width="180" show-overflow-tooltip prop="description"/> + <el-table-column label="闂鎸囦护" align="center" width="180" prop="readInstruction"/> + <el-table-column label="杩斿洖闀垮害" width="80" align="center" prop="loopLength"/> + <el-table-column label="鍔熻兘鎻忚堪" align="center" min-width="300" show-overflow-tooltip prop="description"/> <el-table-column label="鎿嶄綔" align="center" fixed="right" width="240" class-name="small-padding fixed-width"> <template slot-scope="scope"> <el-button @@ -179,7 +179,7 @@ /> <!-- 娣诲姞鎴栦慨鏀瑰璁惧崟鍏冨璇濇 --> - <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="500px" append-to-body> + <Dialog :title="title" :visible.sync="open" width="50%" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="澶栬浠g爜" prop="code"> <el-input v-model="form.code" placeholder="璇疯緭鍏ュ璁句唬鐮�" :disabled="disabled"/> @@ -213,11 +213,11 @@ ></el-option> </el-select> </el-form-item> - <el-form-item label="璇绘暟鎸囦护" prop="readInstruction"> - <el-input v-model="form.readInstruction" placeholder="璇疯緭鍏ヨ鏁版寚浠�" :disabled="disabled"/> + <el-form-item label="闂鎸囦护" prop="readInstruction"> + <el-input v-model="form.readInstruction" placeholder="璇疯緭鍏ラ棶璇㈡寚浠�" :disabled="disabled"/> </el-form-item> - <el-form-item label="鍥炴暟闀垮害" prop="loopLength"> - <el-input v-model="form.loopLength" placeholder="璇疯緭鍏ュ洖鏁伴暱搴�" :disabled="disabled"/> + <el-form-item label="杩斿洖闀垮害" prop="loopLength"> + <el-input v-model="form.loopLength" placeholder="璇疯緭鍏ヨ繑鍥為暱搴�" :disabled="disabled"/> </el-form-item> <el-form-item label="鍔熻兘鎻忚堪" prop="description"> <el-input v-model="form.description" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" :disabled="disabled"/> @@ -227,23 +227,23 @@ </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> - <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button :loading="buttonLoading" type="primary" @click="submitForm" :disabled="disabled">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> </div> - </el-dialog> + </Dialog> <!-- 闄勪欢绐椾綋 --> - <el-dialog :title="title" :close-on-click-modal="false" :visible.sync="uploadFlag" width="500px" append-to-body> + <Dialog :title="title" :visible.sync="uploadFlag" width="500px" append-to-body> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="闄勪欢"> - <fileUpload v-model="form.filePath" limit="1"/> + <fileUpload v-model="form.filePath" :limit="1"/> </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button> <el-button @click="cancel">鍙� 娑�</el-button> </div> - </el-dialog> + </Dialog> </div> </template> @@ -271,10 +271,10 @@ callback(new Error('鏈�澶氳緭鍏�32涓瓧绗�')); return } - if (!(/^[A-Za-z]+$/.test(value))) { - callback(new Error('鍙兘杈撳叆鑻辨枃瀛楃')); - return - } + // if (!(/^[A-Za-z]+$/.test(value))) { + // callback(new Error('鍙兘杈撳叆鑻辨枃瀛楃')); + // return + // } callback(); }; return { @@ -338,11 +338,11 @@ {required: true, message: "娉㈢壒鐜囦笉鑳戒负绌�", trigger: "change"} ], readInstruction: [ - {required: true, message: "璇绘暟鎸囦护涓嶈兘涓虹┖", trigger: "blur"}, + {required: true, message: "闂鎸囦护涓嶈兘涓虹┖", trigger: "blur"}, {max: 128, message: '鏈�澶氳緭鍏�128涓瓧绗�', trigger: 'blur' } ], loopLength: [ - {required: true, message: "鍥炴暟闀垮害涓嶈兘涓虹┖", trigger: "blur"} + {required: true, message: "杩斿洖闀垮害涓嶈兘涓虹┖", trigger: "blur"} ], filePath: [ {required: true, message: "闄勪欢涓嶈兘涓虹┖", trigger: "blur"} @@ -358,12 +358,12 @@ }, created() { this.getList(); - this.getManufacturerList(); + }, methods: { getManufacturerList() { listManufacturer().then(res => { - this.manufacturerList = res.data + this.manufacturerList = res.data; }) }, /** 鏌ヨ澶栬鍗曞厓鍒楄〃 */ @@ -373,6 +373,7 @@ this.peripheralUnitList = response.rows; this.total = response.total; this.loading = false; + this.getManufacturerList(); }); }, // 鍙栨秷鎸夐挳 @@ -440,7 +441,7 @@ this.loading = false; this.form = response.data; this.open = true; - this.title = "淇敼澶栬鍗曞厓"; + this.title = "鏌ョ湅澶栬鍗曞厓"; }); }, /** 淇敼鎸夐挳鎿嶄綔 */ @@ -448,11 +449,12 @@ this.loading = true; this.disabled = false this.reset(); - this.getManufacturerList(); + //this.getManufacturerList(); const id = row.id || this.ids getPeripheralUnit(id).then(response => { this.loading = false; this.form = response.data; + this.form.manufacturer = parseInt(this.form.manufacturer); this.open = true; this.title = "淇敼澶栬鍗曞厓"; }); @@ -461,6 +463,12 @@ submitForm() { this.$refs["form"].validate(valid => { if (valid) { + if(this.uploadFlag){ + if(!this.form.filePath){ + this.$modal.msgWarning("璇烽�夋嫨涓婁紶闄勪欢"); + return; + } + } this.buttonLoading = true; if (this.form.id != null) { updatePeripheralUnit(this.form).then(response => { @@ -486,7 +494,7 @@ /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { const ids = row.id || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎锛�').then(() => { + this.$modal.confirm(`鏄惁纭鍒犻櫎澶栬浠g爜涓�${row.code}鐨勫璁惧崟鍏冿紵`).then(() => { this.loading = true; return delPeripheralUnit(ids); }).then(() => { -- Gitblit v1.9.1