소스 검색

食堂与设备解绑

yanliming 4 년 전
부모
커밋
b3117a4416
2개의 변경된 파일15개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 1
      src/api/base/canteenDeviceRelation.js
  2. 7 3
      src/views/base/canteenDeviceRelation-list.vue

+ 8 - 1
src/api/base/canteenDeviceRelation.js

@@ -45,8 +45,15 @@ function isUnbindDeviceList(formData) {
     return request.post(constant.serverUrl + "/base/canteenDeviceRelation/isUnbindDeviceList", formData);
 }
 
+function unbindDevice(formModel) {
+  return request.post(constant.serverUrl + "/base/canteenDeviceRelation/unbindDevice", formModel, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
 
 
 export default {
-  create, edit, add, update, remove, batchRemove, pageList,isUnbindDeviceList
+  create, edit, add, update, remove, batchRemove, pageList,isUnbindDeviceList,unbindDevice
 }

+ 7 - 3
src/views/base/canteenDeviceRelation-list.vue

@@ -69,9 +69,9 @@
             <span v-if="row.isBind == 0">
               <el-button size="mini" type="success" @click="handleBound(row)">关联设备</el-button>
             </span>
-            <!-- <span v-else>
+            <span v-else>
               <el-button size="mini" type="danger" @click="handleDelete(row)">解除关联</el-button>
-            </span>-->
+            </span>
           </template>
         </el-table-column>
       </el-table>
@@ -197,7 +197,11 @@ export default {
         .then(() => {
           self.loading = true;
 
-          canteenDeviceRelationApi.remove(record.id).then(function(response) {
+          self.formModel.canteenId = self.canteenId;
+          self.formModel.deviceId = record.id;
+          self.formModel.isWrite = true;
+
+          canteenDeviceRelationApi.unbindDevice(self.formModel).then(function(response) {
             var jsonData = response.data;
             self.loading = false;
             if (jsonData.result) {