Kaynağa Gözat

task-70 设备管理添加 关联煎药区 字段

cc12458 10 ay önce
ebeveyn
işleme
64fbc35c7b
1 değiştirilmiş dosya ile 14 ekleme ve 1 silme
  1. 14 1
      src/views/decoct/device/components/edit.vue

+ 14 - 1
src/views/decoct/device/components/edit.vue

@@ -18,6 +18,13 @@
       <el-form-item label="设备地址:">
         <el-input v-model="formInline.deviceIp" placeholder="设备地址"></el-input>
       </el-form-item>
+      <el-form-item label="关联煎药区" prop="decoctionAreaCode">
+        <el-select v-model="formInline.decoctionAreaCode" placeholder="请选择备用煎药区" filterable>
+          <el-option v-for="item in stationOptions" :key="item.id"
+                     :label="item.areaName" :value="item.areaCode" :disabled="item.state !== 0"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item label="启用状态:" required>
         <el-radio-group v-model="formInline.status">
           <el-radio :label="0">开启</el-radio>
@@ -30,6 +37,7 @@
 
 <script>
 import { getDeviceDetail, addDevice, updateDevice } from "@/api/decoct/device";
+import { getDecoctStationOptions } from '@/api/decoct';
 export default {
   props: {
     disabled: {
@@ -41,6 +49,7 @@ export default {
   data() {
     return {
       formInline: {
+        decoctionAreaCode: void 0,
         deviceName: '',
         deviceType: '',
         deviceCode: '',
@@ -49,6 +58,8 @@ export default {
         status: 0,
       },
       loading: false,
+      // 煎药区
+      stationOptions: [],
       typeOptions: []
     }
   },
@@ -56,6 +67,7 @@ export default {
     this.getDicts("device_type").then((response) => {
       this.typeOptions = response.data;
     });
+    getDecoctStationOptions().then((response) => {this.stationOptions = response.data;}, () => []);
   },
   methods: {
     openDialog() {
@@ -80,6 +92,7 @@ export default {
     // 修改
     toUpdate() {
       this.loading = true;
+      this.formInline.decoctionAreaName = this.formInline.decoctionAreaCode == null ? '' : (this.stationOptions.find(option => option.areaCode === this.formInline.decoctionAreaCode) || {}).areaName || '';
       updateDevice(this.formInline).then((response) => {
         this.msgSuccess('修改成功')
         this.$emit('success')
@@ -90,6 +103,7 @@ export default {
     // 新增
     toAdd() {
       this.loading = true;
+      this.formInline.decoctionAreaName = this.formInline.decoctionAreaCode == null ? '' : (this.stationOptions.find(option => option.areaCode === this.formInline.decoctionAreaCode) || {}).areaName || '';
       addDevice(this.formInline).then((response) => {
         this.msgSuccess('新增成功')
         this.$emit('success')
@@ -103,7 +117,6 @@ export default {
 
 <style lang="scss" scoped>
 .edit-dialog {
-  height: 400px;
   overflow: auto;
   &-formInline{
     width: 330px;