Browse Source

样式修改

asd26269546 2 years ago
parent
commit
b72d640cc9
1 changed files with 18 additions and 1 deletions
  1. 18 1
      src/views/warehouse/warehouseConfig/add.vue

+ 18 - 1
src/views/warehouse/warehouseConfig/add.vue

@@ -63,6 +63,9 @@
 				<van-button round block type="primary" native-type="submit">
 					提交
 				</van-button>
+                <van-button round block type="danger" style="margin-top:16px" @click="warehouseDelete" v-if="route.query.id">
+					删除
+				</van-button>
 			</div>
 		</van-form>
 	</div>
@@ -70,7 +73,7 @@
 
 <script setup>
 import { ref,getCurrentInstance,onMounted } from 'vue'
-import { showSuccessToast, showFailToast } from 'vant';
+import { showSuccessToast, showFailToast,showDialog,showConfirmDialog } from 'vant';
 import { useRoute } from 'vue-router'
 import { getUserInfo } from '@/utils/auth';
 const proxy = getCurrentInstance().proxy
@@ -134,6 +137,20 @@ const onConfirm = ({ selectedOptions }) => {
 
 const onClickLeft = () => history.back();
 
+const warehouseDelete = () => {
+    showConfirmDialog({
+        title: '提示',
+        message: '您确定删除本条数据吗?',
+    }).then(() => {
+        proxy.post('/warehouse/delete',{id:route.query.id}).then(res => {
+            setTimeout(() => {
+                showSuccessToast('删除成功')
+                proxy.$router.push('/main/warehouseConfig')
+            }, 500);
+        })
+    });
+    
+}
 
 const onSubmit = () => {
     proxy.post('/warehouse/' + (!route.query.id ? 'add' : 'edit'), formData.value).then(res => {