|
@@ -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 => {
|