9
0

3 Коммиты 7f14ec96c9 ... d222cd0900

Автор SHA1 Сообщение Дата
  gongtianxiao d222cd0900 新增删除功能 1 месяц назад
  gongtianxiao b7ffaeac9e 新增danger类型按钮 1 месяц назад
  gongtianxiao fca2788e1a 修改按钮样式 1 месяц назад

+ 7 - 1
src/components/base/BaseButton.vue

@@ -22,7 +22,7 @@ const props = defineProps({
   variant: {
     type: String,
     default: 'default',
-    validator: (v) => ['default', 'primary', 'warning', 'outline'].includes(v),
+    validator: (v) => ['default', 'primary', 'warning', 'outline', 'danger'].includes(v),
   },
   size: {
     type: String,
@@ -79,6 +79,12 @@ const rootClass = computed(() => [
   border: 1px solid rgba(255, 204, 51, 0.6);
 }
 
+.nav-tab-item--danger {
+  background-color: #fff;
+  color: rgba(220, 50, 30, 1);
+  border-color: rgba(220, 50, 30, 0.4);
+}
+
 .nav-tab-item--outline {
   background: var(--color-surface);
   border: 1px solid var(--color-input-border);

+ 2 - 9
src/components/layout/NotificationModal.vue

@@ -24,8 +24,7 @@
               v-if="displayList.length > 0"
               text="全部删除"
               size="sm"
-              variant="outline"
-              class="notify-btn--danger"
+              variant="danger"
               @click="handleDeleteAll"
             />
             <BaseButton text="刷新" size="sm" variant="outline" :disabled="loading" @click="refresh" />
@@ -80,8 +79,7 @@
                 <BaseButton
                   text="删除"
                   size="sm"
-                  variant="outline"
-                  class="notify-btn--danger"
+                  variant="danger"
                   @click="handleDeleteOne(item.id)"
                 />
               </span>
@@ -283,11 +281,6 @@ watch(
   flex-shrink: 0;
 }
 
-.notify-btn--danger {
-  color: rgba(220, 50, 30, 1);
-  border-color: rgba(220, 50, 30, 0.4);
-}
-
 .notify-empty {
   min-height: 120px;
   display: flex;

+ 33 - 11
src/components/manage/asset/PickAssetModal.vue

@@ -10,7 +10,7 @@
             <input
               v-model="keyword"
               type="search"
-              placeholder="企业 / 编号"
+              placeholder="编号 / 地址"
             />
           </label>
         </div>
@@ -28,7 +28,8 @@
               <span style="width: 140px">编号</span>
               <span style="width: 120px">集团</span>
               <span style="width: 180px">名称</span>
-              <span style="width: 140px">建筑面积㎡</span>
+              <span style="width: 140px">坐落具体地址</span>
+              <span style="width: 140px">操作</span>
             </div>
             <div v-if="loading" class="pick-modal__empty">加载中…</div>
             <div v-else-if="displayRows.length === 0" class="pick-modal__empty">暂无匹配资产</div>
@@ -49,7 +50,10 @@
               <span style="width: 140px">{{ row.code }}</span>
               <span style="width: 120px">{{ row.group }}</span>
               <span style="width: 180px">{{ row.name }}</span>
-              <span style="width: 140px">{{ row.buildArea }}</span>
+              <span style="width: 140px">{{ row.address }}</span>
+              <span style="width: 140px">
+                <BaseButton text="删除" variant="danger" @click="handleDelete(row)" />
+              </span>
             </div>
           </div>
         </div>
@@ -64,12 +68,13 @@
 </template>
 
 <script setup>
-import { showWarning } from '@/utils/message';
-import { computed, ref, watch } from 'vue';
+import { showConfirm, showError, showSuccess, showWarning } from '@/utils/message';
+import { computed, ref, watch, defineProps, defineEmits } from 'vue';
 import BaseButton from '@/components/base/BaseButton.vue';
 import { useEnterpriseStore, REPORT_STATE } from '@/store/enterprise';
 import { assetBelongsToManageScope } from '@/utils/manageContext';
-import { defineProps, defineEmits } from 'vue';
+import { updateAudit } from '@/api/enterpriseList';
+import { COLUMN_ID } from '@/config';
 
 const props = defineProps({
   visible: {
@@ -113,13 +118,11 @@ const pickableList = computed(() => {
   return list;
 });
 
-const formatArea = (val) => Number(val || 0).toLocaleString('zh-CN');
-
 const normalizeCode = (raw) => String(raw ?? '').trim().toLowerCase();
 
 const matchKeyword = (item, kw) => {
   const code = normalizeCode(item.c_bh);
-  const enterprise = String(item.c_qymc ?? item.c_ssjt ?? '').trim().toLowerCase();
+  const address = String(item.c_zljtdz ?? '').trim().toLowerCase();
 
   if (/^\d+$/.test(kw)) {
     if (kw.length === 6) {
@@ -128,7 +131,7 @@ const matchKeyword = (item, kw) => {
     return code.startsWith(kw);
   }
 
-  return code.includes(kw) || enterprise.includes(kw);
+  return code.includes(kw) || address.includes(kw);
 };
 
 const scopedList = computed(() =>
@@ -152,7 +155,7 @@ const displayRows = computed(() => {
         code: item.c_bh || '暂无',
         group: (item.c_ssjt ?? '').trim() || '暂无',
         name: item.c_qymc || '暂无',
-        buildArea: formatArea(item.c_sjjzmj),
+        address: item.c_zljtdz || '暂无',
         raw: item,
         inQueue: props.excludeIds.includes(rowKey),
       };
@@ -182,6 +185,25 @@ const toggleSelectAll = (event) => {
   }
 };
 
+const handleDelete = async (row) => {
+  const confirmed = await showConfirm('确定删除该资产吗?');
+  if (!confirmed) return;
+  try {
+    await updateAudit({
+      id: row.raw.id,
+      columnId: COLUMN_ID,
+      state: 4,
+    });
+    showSuccess('资产已删除');
+    await Promise.all([
+      enterpriseStore.fetchList(true),
+      enterpriseStore.fetchByState(REPORT_STATE.REJECTED, { force: true }),
+    ]);
+  } catch (e) {
+    showError(e?.message || e?.msg || '删除失败,请稍后重试');
+  }
+};
+
 const handleCancel = () => {
   emit('update:visible', false);
 };