Browse Source

清除作为

CzRger 1 year ago
parent
commit
d0f36f0161
1 changed files with 47 additions and 2 deletions
  1. 47 2
      src/views/system/seat-manage/index.vue

+ 47 - 2
src/views/system/seat-manage/index.vue

@@ -121,6 +121,7 @@
           <div class="dept-title">
             <div class="dept-title-index">{{seatInfo.info.serialNumber}}</div>
             <div class="dept-title-name">{{seatInfo.info.name || '无单位'}}</div>
+            <div class="dept-title-button-del __hover" @click="onDel" v-if="seatInfo.info.name && $store.getters['app/isZBGL']">删除</div>
             <div class="dept-title-button __hover" @click="onEdit" v-if="$store.getters['app/isZBGL']">编辑</div>
           </div>
           <div class="dept-info">
@@ -293,6 +294,34 @@ export default defineComponent({
         state.loadingSeat = false
       })
     }
+    const onDel = () => {
+      ElMessageBox.confirm(`是否清空单位信息和值班人员?`, "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        state.loadingForm = true
+        that.$api.editSeatDutyUnitEdit({
+          id: state.seatInfo.info.id,
+          serialNumber: state.seatInfo.info.serialNumber,
+          deptId: '',
+          abbreviation: '',
+          name: '',
+          dutyUnitPersonList: []
+        }).then(res => {
+          if (res.code === 200) {
+            onSeatClick(state.currentSeatId)
+            initSeat()
+            ElMessage.success(res.message)
+          } else {
+            ElMessage.error(res.message)
+          }
+          state.loadingForm = false
+        }).catch(() => {
+          state.loadingForm = false
+        })
+      }).catch(() => {})
+    }
     const onEdit = () => {
       state.seatInfo.editDutyInfo.deptForm = JSON.parse(JSON.stringify(state.seatInfo.info))
       state.seatInfo.editDutyInfo.tableData = JSON.parse(JSON.stringify(state.seatInfo.dutyInfo.tableData))
@@ -417,7 +446,8 @@ export default defineComponent({
       dutyInfoTableDataCpt,
       handlePageDutyInfo,
       editDutyInfoTableDataCpt,
-      handlePageEditDutyInfo
+      handlePageEditDutyInfo,
+      onDel
     }
   },
 })
@@ -529,6 +559,7 @@ export default defineComponent({
       }
       .dept-title-name {
         margin-left: 10px;
+        margin-right: auto;
         font-size: 24px;
         font-family: Microsoft YaHei-Bold, Microsoft YaHei;
         font-weight: bold;
@@ -538,8 +569,22 @@ export default defineComponent({
         -webkit-background-clip: text;
         -webkit-text-fill-color: transparent;
       }
+      .dept-title-button-del {
+        width: 52px;
+        height: 30px;
+        border-radius: 4px;
+        border: 1px solid rgba(0, 133, 247, 0.5);
+        background-color: rgba(229, 0, 79, 0.4);
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        font-size: 16px;
+        font-family: PingFang SC-Regular, PingFang SC;
+        font-weight: 400;
+        color: #FFFFFF;
+      }
       .dept-title-button {
-        margin-left: auto;
+        margin-left: 6px;
         margin-right: 10px;
         width: 52px;
         height: 30px;