Browse Source

批量删除

zhuangyunsheng 1 tháng trước cách đây
mục cha
commit
987437006c

+ 4 - 2
.env.development

@@ -7,10 +7,12 @@ VUE_APP_TITLE = EasyDo智能生产运营平台
 # 接口地址
 VUE_APP_ZEROAPI_BASEURL = http://www.qdeasydo.com
 # VUE_APP_MES_BASEURL = http://www.qdeasydo.com/mes
-VUE_APP_MES_BASEURL = http://192.168.101.93:8200
+# VUE_APP_MES_BASEURL = http://192.168.101.93:8200
+VUE_APP_MES_BASEURL = http://192.168.101.93:8080  #go
 
 # 本地端口
-VUE_APP_PORT = 4400
+# VUE_APP_PORT = 4400
+VUE_APP_PORT = 1200
 
 # 是否开启代理
 VUE_APP_PROXY = true

+ 5 - 4
src/components/scTable/index.vue

@@ -183,7 +183,7 @@ const gridOptions = reactive({
         pageSize: config.pageSize,
         total: 0,
         slots: {
-            left: params => props.batchDel && h(pagerBatchDel, { params, onSuccess: ids => table_batch_del(ids) })
+            left: params => props.batchDel && h(pagerBatchDel, { params, onSuccess: table_batch_del })
         },
         ...props.pagerConfig
     },
@@ -309,13 +309,14 @@ const getTableData = () => xGrid.value.getTableData();
 
 const reloadData = data => xGrid.value.reloadData(data);
 
-const table_batch_del = ids => {
-    ElMessageBox.confirm("是否确认删除已选择的数据?", "删除警告", {
+const table_batch_del = () => {
+    const deleteIdList = XEUtils.map(getSelectRows(), item => item.id);
+    ElMessageBox.confirm("是否确认删除所有已选数据(不局限本页)?", "删除警告", {
         type: "warning",
         confirmButtonText: "确定",
         cancelButtonText: "取消"
     }).then(() => {
-        props.apiObj.batchDel({ deleteIdList: ids }).then(() => {
+        props.apiObj.batchDel({ deleteIdList }).then(() => {
             ElMessage.success("操作成功");
             getData();
         });

+ 5 - 3
src/components/scTable/renderer/pager-batch-del.vue

@@ -1,5 +1,5 @@
 <template>
-    <el-button type="danger" plain :disabled="!ids || !ids.length" @click="$emit('success', ids)">
+    <el-button type="danger" plain :disabled="(!checkedRows || !checkedRows.length) && (!checkedReserveRows || !checkedReserveRows.length)" @click="$emit('success')">
         <sc-iconify icon="ant-design:delete-outlined"></sc-iconify>
     </el-button>
 </template>
@@ -13,8 +13,10 @@ const props = defineProps({
     apiObj: { type: Object, default: () => ({}) }
 })
 
-const ids = ref([]);
-watch(() => props.params.$grid?.getCheckboxRecords(), val => ids.value = XEUtils.map(val, item => item.id))
+const checkedRows = ref([]);
+const checkedReserveRows = ref([]);
+watch(() => props.params.$grid?.getCheckboxRecords(), val => checkedRows.value = val);
+watch(() => props.params.$grid?.getCheckboxReserveRecords(), val => checkedReserveRows.value = val);
 </script>
 
 <style scoped>