Explorar o código

新建模具、编辑模具的代理商,规则,启用的弹窗

Reiskuchen %!s(int64=5) %!d(string=hai) anos
pai
achega
24b0890502
Modificáronse 1 ficheiros con 73 adicións e 31 borrados
  1. 73 31
      ys_vue/src/views/base/allocation.vue

+ 73 - 31
ys_vue/src/views/base/allocation.vue

@@ -37,15 +37,16 @@
             <el-table-column prop="modelName" label="模具名称" sortable></el-table-column>
             <el-table-column prop="modelNo" label="模具编号" width="120" align="center" sortable></el-table-column>
             <el-table-column prop="companyName" label="公司名称" sortable></el-table-column>
-            <el-table-column label="云模盒状态" align="center" width="100" sortable>
+            <el-table-column label="代理商" width="120" sortable></el-table-column>
+            <el-table-column label="云模盒状态" align="center" width="120" sortable>
                 <template slot-scope="scope">
                     <span v-if="scope.row.isUse == 0">未启用</span>
                     <span v-else>已启用</span>
                 </template>
             </el-table-column>
-            <el-table-column label="操作" align="center" width="220" sortable>
+            <el-table-column label="操作" align="center" width="160" sortable>
                 <template slot-scope="scope">
-                    <el-button size="small" type="primary" @click="enable(scope.$index)" :disabled="scope.row.isUse == 1">启用</el-button>
+                    <el-button size="small" type="primary" @click="openEnable(scope.$index)" :disabled="scope.row.isUse == 1">启用</el-button>
                     <el-button size="small" @click="showEdit(scope.$index, scope.row)">修改</el-button>
                     <!-- <el-button type="danger" size="small">删除</el-button> -->
                 </template>
@@ -76,31 +77,38 @@
                 class="demo-form-inline"
             >
                 <el-form-item label="云模盒编号" prop="equipmentNo">
-                <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写"></el-input>
+                    <el-input v-model="newAllocation.equipmentNo" autocomplete="off" placeholder="请填写云模盒编号"></el-input>
                 </el-form-item>
                 <el-form-item label="所属公司" prop="belongCompanyId">
-                <el-select
-                    v-model="newAllocation.belongCompanyId"
-                    filterable
-                    clearable
-                    placeholder="请选择"
-                    style="width: 202px"
-                >
-                    <el-option
-                    v-for="item in companies"
-                    :key="item.id"
-                    :label="item.companyName"
-                    :value="item.id"
-                    ></el-option>
-                </el-select>
+                    <el-select
+                        v-model="newAllocation.belongCompanyId"
+                        filterable
+                        clearable
+                        placeholder="请选择所属公司"
+                        style="width: 202px"
+                    >
+                        <el-option
+                        v-for="item in companies"
+                        :key="item.id"
+                        :label="item.companyName"
+                        :value="item.id"
+                        ></el-option>
+                    </el-select>
                 </el-form-item>
                 <el-form-item label="使用年限" prop="useLife">
-                <el-input
-                    v-model.number="newAllocation.useLife"
-                    type="age"
-                    autocomplete="off"
-                    placeholder="请填写"
-                ></el-input>
+                    <el-input
+                        v-model.number="newAllocation.useLife"
+                        type="age"
+                        autocomplete="off"
+                        placeholder="请填写使用年限"
+                    ></el-input>
+                </el-form-item>
+                <el-form-item label="代理商" prop="agent">
+                    <el-input
+                        v-model="newAllocation.agent"
+                        autocomplete="off"
+                        placeholder="请填写代理商"
+                    ></el-input>
                 </el-form-item>
             </el-form>
             <div slot="footer" class="dialog-footer">
@@ -152,12 +160,28 @@
                     placeholder="请填写"
                 ></el-input>
                 </el-form-item>
+                <el-form-item label="代理商" prop="agent">
+                    <el-input
+                        v-model="newAllocation.agent"
+                        autocomplete="off"
+                        placeholder="请填写代理商"
+                    ></el-input>
+                </el-form-item>
             </el-form>
             <div slot="footer" class="dialog-footer">
                 <el-button @click.native="editFormVisible = false">取消</el-button>
                 <el-button type="primary" @click="editMould(newAllocation.id)">提交</el-button>
             </div>
         </el-dialog>
+
+        <!-- 启用弹窗 -->
+        <el-dialog title="启用" :visible.sync="operateDialogVisible" width="100" center>
+            <span>确定启用设备吗</span>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="operateDialogVisible = false">取消</el-button>
+                <el-button type="primary" @click="enable">启用</el-button>
+            </span>
+        </el-dialog>
     </section>
 </template>
 
@@ -173,7 +197,8 @@
                     useLife: "", //使用年限
                     equipmentName: "", //设备名称
                     id: "", //设备id
-                    belongCompanyId: "" //所属公司ID
+                    belongCompanyId: "", //所属公司ID
+                    agent: "" //代理商
                 },
                 filters: {
                     keyName: "",
@@ -189,6 +214,9 @@
                     ],
                     belongCompanyId: [
                         { required: true, message: "请选择所属公司", trigger: ["blur", "change"] }
+                    ],
+                    agent: [
+                        { required: true, message: "请填写代理商", trigger: "blur" }
                     ]
                 },
                 listLoading: false,
@@ -199,7 +227,9 @@
                 size: 20,
                 tableHeight: 0,
                 addFormVisible: false,
-                editFormVisible: false
+                editFormVisible: false,
+                operateDialogVisible: false,
+                activeIndex: 0
             };
         },
         methods: {
@@ -275,6 +305,7 @@
                     });
                 });
             },
+
             //添加界面
             showAllocation() {
                 this.addFormVisible = true;
@@ -282,7 +313,8 @@
                     id: "",
                     useLife: "",
                     equipmentNo: "",
-                    belongCompanyId: ""
+                    belongCompanyId: "",
+                    agent: ""
                 };
             },
            
@@ -297,6 +329,7 @@
                         equipmentNo: this.newAllocation.equipmentNo,
                         belongCompanyId: this.newAllocation.belongCompanyId,
                         useLife: this.newAllocation.useLife
+                        //这里应该有代理商agent
                         },
                         res => {
                             this.addLoading = false;
@@ -334,7 +367,8 @@
                     id: row.id,
                     useLife: row.useLife,
                     equipmentNo: row.equipmentNo,
-                    belongCompanyId: row.belongCompanyId
+                    belongCompanyId: row.belongCompanyId,
+                    agent: ""//这里应该有代理商agent
                 };
             },
 
@@ -349,6 +383,7 @@
                             equipmentName: this.newAllocation.equipmentName,
                             belongCompanyId: this.newAllocation.belongCompanyId,
                             useLife: this.newAllocation.useLife
+                            //这里应该有代理商agent
                         },
                         res => {
                             this.editLoading = false;
@@ -378,11 +413,18 @@
                 });
             },
 
+            //打开启用窗口
+            openEnable(index) {
+                this.operateDialogVisible = true;
+                this.activeIndex = index;
+            },
+
             //启用设备
-            enable(index) {
-                this.allocations[index].isUse = 1;
+            enable() {
+                this.operateDialogVisible = false;
+                this.allocations[this.activeIndex].isUse = 1;
                 this.http.post( this.port.base.enableMould, {
-                    id: this.allocations[index].id,
+                    id: this.allocations[this.activeIndex].id,
                     isUse: 1
                 },
                 res => {