Procházet zdrojové kódy

任务管理-页面功能实现修改

Liudijing před 11 měsíci
rodič
revize
a5781a2c0f

+ 93 - 11
src/main/java/com/hz/employmentsite/controller/taskAndLog/DotaskController.java

@@ -1,17 +1,26 @@
 package com.hz.employmentsite.controller.taskAndLog;
 
 import com.github.pagehelper.PageInfo;
+import com.hz.employmentsite.filter.exception.BaseErrorEnum;
+import com.hz.employmentsite.filter.exception.BaseException;
 import com.hz.employmentsite.filter.exception.BaseResponse;
 import com.hz.employmentsite.filter.exception.RespGenerstor;
+import com.hz.employmentsite.services.service.AccountService;
 import com.hz.employmentsite.services.service.companyService.PostService;
 import com.hz.employmentsite.services.service.taskAndLog.DotaskService;
+import com.hz.employmentsite.util.DateUtils;
+import com.hz.employmentsite.util.ExcelHelper;
 import com.hz.employmentsite.vo.taskAndLog.DoTaskUserVo;
 import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
 import com.hz.employmentsite.vo.taskAndLog.SiteUserVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.UUID;
 
 @RestController
 @RequestMapping(value = "/api/taskAndLog/dotask")
@@ -19,30 +28,103 @@ public class DotaskController {
     @Autowired
     private DotaskService dotaskService;
 
+    @Autowired
+    private AccountService accountService;
+
+    @Autowired
+    private DateUtils dateUtils;
+
     @ResponseBody
     @GetMapping("/getList")
     public BaseResponse getList(@RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
-                                @RequestParam(required = false) String name,  @RequestParam(required = false) String startTime,
-                                @RequestParam(required = false) String endTime,  @RequestParam(required = false) String finishStartTime,
-                                @RequestParam(required = false) String finishEndTime,  @RequestParam(required = false) String regionCode,
-                                @RequestParam(required = false) String streetCode,  @RequestParam(required = false) String workTypeId
-                                ){
-        PageInfo<DotaskVo> result = dotaskService.getList(pageIndex, pageSize,name, startTime, endTime,finishStartTime,finishEndTime,regionCode,streetCode,workTypeId);
+                                @RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
+                                @RequestParam(required = false) String endTime, @RequestParam(required = false) String finishStartTime,
+                                @RequestParam(required = false) String finishEndTime, @RequestParam(required = false) String regionCode,
+                                @RequestParam(required = false) String streetCode, @RequestParam(required = false) String workTypeId
+    ) {
+        PageInfo<DotaskVo> result = dotaskService.getList(pageIndex, pageSize, name, startTime, endTime, finishStartTime, finishEndTime, regionCode, streetCode, workTypeId);
+        return RespGenerstor.success(result);
+    }
+
+    @ResponseBody
+    @GetMapping("/getDataById")
+    public BaseResponse getDataById(String id) {
+        var result = dotaskService.getDataById(id);
+        if (result == null) {
+            result = new DotaskVo();
+            result.setDotaskID(UUID.randomUUID().toString());
+        }
+        return RespGenerstor.success(result);
+    }
+
+    @ResponseBody
+    @PostMapping("/save")
+    public BaseResponse save(@RequestBody DotaskVo data) {
+        var result = dotaskService.save(data, accountService.getLoginUserID());
         return RespGenerstor.success(result);
     }
 
     @ResponseBody
     @GetMapping("/getWorkUserList")
-    public  BaseResponse getWorkUserList(@RequestParam(required = false) String dotaskID){
-            List<DoTaskUserVo> list=dotaskService.getWorkUserList(dotaskID);
-            return RespGenerstor.success(list);
+    public BaseResponse getWorkUserList(@RequestParam(required = false) String id) {
+        if (id == null)
+            return null;
+        List<DoTaskUserVo> list = dotaskService.getWorkUserList(id);
+        return RespGenerstor.success(list);
     }
 
     @ResponseBody
     @GetMapping("/getUserList")
-    public  BaseResponse  getUserList(){
-        List<SiteUserVo> list=dotaskService.getUserList();
+    public BaseResponse getUserList() {
+        List<SiteUserVo> list = dotaskService.getUserList();
         return RespGenerstor.success(list);
     }
 
+    @ResponseBody
+    @PostMapping("/delete")
+    public BaseResponse delete(@RequestBody List<String> ids) {
+        int result = dotaskService.delete(ids);
+        if (result <= 0)
+            throw new BaseException(BaseErrorEnum.DELETE_NOT_DATA_ERROR);
+        return RespGenerstor.success(result);
+    }
+
+    @GetMapping("/export")
+    public BaseResponse export(HttpServletResponse response, @RequestParam(required = false) Boolean isExport,
+                               @RequestParam("pageIndex") int pageIndex, @RequestParam("pageSize") int pageSize,
+                               @RequestParam(required = false) String name, @RequestParam(required = false) String startTime,
+                               @RequestParam(required = false) String endTime, @RequestParam(required = false) String finishStartTime,
+                               @RequestParam(required = false) String finishEndTime, @RequestParam(required = false) String regionCode,
+                               @RequestParam(required = false) String streetCode, @RequestParam(required = false) String workTypeId) throws Exception {
+
+        PageInfo<DotaskVo> result = dotaskService.getList(pageIndex, pageSize, name, startTime, endTime, finishStartTime, finishEndTime, regionCode, streetCode, workTypeId);
+        if (isExport == null || !isExport) {
+            return RespGenerstor.success(result);
+        } else {
+            ExcelHelper excelHelper = new ExcelHelper();
+            ExcelHelper.ExcelData data = excelHelper.new ExcelData();
+            data.setTitles(Arrays.asList(new String[]{"序号", "任务名称", "任务类型", "任务完成时间", "所属县区", "所属街道", "执行用户数", "下达时间", "下达人"}));
+            int i = 0;
+            List<List<Object>> rowDatas = new ArrayList();
+            for (DotaskVo item : result.getList()) {
+                List<Object> row = new ArrayList();
+                ++i;
+                row.add(i);
+                row.add(item.dotaskName);
+                row.add(item.workTypeName);
+                row.add(dateUtils.dateToStr(item.finishTime));
+                row.add(item.regionName);
+                row.add(item.streetName);
+                row.add(item.userCount);
+                row.add(dateUtils.dateToStr(item.createTime));
+                row.add(item.createName);
+                rowDatas.add(row);
+            }
+            data.setRows(rowDatas);
+            excelHelper.exportExcel(response, data);
+
+            return null;
+        }
+    }
+
 }

+ 1 - 1
src/main/java/com/hz/employmentsite/mapper/cquery/DotaskCQuery.java

@@ -9,7 +9,7 @@ import java.util.List;
 import java.util.Date;
 
 public interface DotaskCQuery {
-    List<DotaskVo> getList(@Param("name") String name, @Param("startTime") String startTime, @Param("endTime") String endTime,
+    List<DotaskVo> getList(@Param("id") String id,@Param("name") String name, @Param("startTime") String startTime, @Param("endTime") String endTime,
                            @Param("finishStartTime") String finishStartTime, @Param("finishEndTime") String finishEndTime,
                            @Param("regionCode") String regionCode, @Param("streetCode") String streetCode, @Param("workTypeId") String workTypeId);
 

+ 99 - 1
src/main/java/com/hz/employmentsite/services/impl/taskAndLog/DotaskImpl.java

@@ -1,9 +1,13 @@
 package com.hz.employmentsite.services.impl.taskAndLog;
 
 import com.github.pagehelper.PageInfo;
+import com.hz.employmentsite.mapper.PcDotaskMapper;
+import com.hz.employmentsite.mapper.PcDotaskUserMapper;
 import com.hz.employmentsite.mapper.cquery.DotaskCQuery;
 import com.hz.employmentsite.mapper.cquery.PostCQuery;
+import com.hz.employmentsite.model.*;
 import com.hz.employmentsite.services.service.taskAndLog.DotaskService;
+import com.hz.employmentsite.util.StringUtils;
 import com.hz.employmentsite.vo.companyService.PostVo;
 import com.hz.employmentsite.vo.taskAndLog.DoTaskUserVo;
 import com.hz.employmentsite.vo.taskAndLog.DotaskVo;
@@ -14,6 +18,7 @@ import org.springframework.stereotype.Service;
 import java.sql.SQLException;
 import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 @Service("DotaskService")
 public class DotaskImpl implements DotaskService {
@@ -21,10 +26,19 @@ public class DotaskImpl implements DotaskService {
     @Autowired
     private DotaskCQuery dotaskCQuery;
 
+    @Autowired
+    private StringUtils stringUtils;
+
+    @Autowired
+    private PcDotaskMapper dotaskMapper;
+
+    @Autowired
+    private PcDotaskUserMapper dotaskUserMapper;
+
     @Override
     public PageInfo<DotaskVo> getList(Integer page, Integer rows, String name, String startTime, String endTime, String finishStartTime, String finishEndTime, String regionCode, String streetCode, String workTypeId) {
         try {
-            List<DotaskVo> list = dotaskCQuery.getList(name, startTime, endTime, finishStartTime, finishEndTime, regionCode, streetCode, workTypeId);
+            List<DotaskVo> list = dotaskCQuery.getList(null, name, startTime, endTime, finishStartTime, finishEndTime, regionCode, streetCode, workTypeId);
             PageInfo<DotaskVo> result = new PageInfo(list);
             return result;
         } catch (Exception e) {
@@ -44,5 +58,89 @@ public class DotaskImpl implements DotaskService {
         return list;
     }
 
+    @Override
+    public DotaskVo getDataById(String id) {
+        if (stringUtils.IsNullOrEmpty(id)) {
+            return null;
+        }
+        return dotaskCQuery.getList(id, null, null, null, null, null, null, null, null).stream().findFirst().orElse(null);
+    }
+
+    @Override
+    public int save(DotaskVo data, String userId) {
+        int result = 0;
+        PcDotask dbData = dotaskMapper.selectByPrimaryKey(data.getDotaskID());
+        PcDotaskUserExample exp = new PcDotaskUserExample();
+        PcDotaskUserExample.Criteria cro = exp.createCriteria();
+        cro.andDotaskIDEqualTo(data.getDotaskID());
+        PcDotaskUser taskUser = dotaskUserMapper.selectByExample(exp).stream().findFirst().orElse(null);
+        if (dbData == null) {
+            dbData = new PcDotask();
+            dbData.setDotaskID(data.getDotaskID());
+            dbData.setWorkTypeID(data.getWorkTypeID());
+            dbData.setContent(data.getContent());
+            dbData.setDotaskName(data.getDotaskName());
+            dbData.setRegionCode(data.getRegionCode());
+            dbData.setStreetCode(data.getStreetCode());
+            dbData.setSiteID(data.getSiteID());
+            dbData.setFinishTime(data.getFinishTime());
+            dbData.setCreateTime(new Date());
+            dbData.setCreateUserID(userId);
+            result = dotaskMapper.insert(dbData);
+        } else {
+            dbData.setWorkTypeID(data.getWorkTypeID());
+            dbData.setContent(data.getContent());
+            dbData.setDotaskName(data.getDotaskName());
+            dbData.setRegionCode(data.getRegionCode());
+            dbData.setStreetCode(data.getStreetCode());
+            dbData.setSiteID(data.getSiteID());
+            dbData.setFinishTime(data.getFinishTime());
+            dbData.setModifyTime(new Date());
+            dbData.setModifyUserID(userId);
+            result = dotaskMapper.updateByPrimaryKeySelective(dbData);
+        }
+        if (result == 1) {
+            String dotaskId = dbData.getDotaskID();
+            if (taskUser == null) {
+                data.getDotaskUser().stream().forEach(x -> {
+                    PcDotaskUser user = new PcDotaskUser();
+                    user.setDotaskUserID(UUID.randomUUID().toString());
+                    user.setDotaskID(dotaskId);
+                    user.setSiteUserID(x.get("siteUserID").toString());
+                    dotaskUserMapper.insert(user);
+                });
+            } else {
+                PcDotaskUserExample example = new PcDotaskUserExample();
+                example.or().andDotaskIDEqualTo(data.getDotaskID());
+                dotaskUserMapper.deleteByExample(example);
+                data.getDotaskUser().stream().forEach(x -> {
+                    PcDotaskUser user = new PcDotaskUser();
+                    user.setDotaskUserID(UUID.randomUUID().toString());
+                    user.setDotaskID(dotaskId);
+                    user.setSiteUserID(x.get("siteUserID").toString());
+                    dotaskUserMapper.insert(user);
+                });
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public int delete(List<String> ids) {
+        int result = 0;
+
+        PcDotaskUserExample expUser = new PcDotaskUserExample();
+        PcDotaskUserExample.Criteria croUser = expUser.or();
+        croUser.andDotaskIDIn(ids);
+        int userRows = dotaskUserMapper.deleteByExample(expUser);
+        if (userRows > 0) {
+            PcDotaskExample exp = new PcDotaskExample();
+            PcDotaskExample.Criteria cro = exp.or();
+            cro.andDotaskIDIn(ids);
+            result = dotaskMapper.deleteByExample(exp);
+        }
+        return result;
+    }
+
 
 }

+ 6 - 0
src/main/java/com/hz/employmentsite/services/service/taskAndLog/DotaskService.java

@@ -16,4 +16,10 @@ public interface DotaskService {
 
     List<SiteUserVo> getUserList();
 
+    DotaskVo getDataById(String id);
+
+    int save(DotaskVo data,String userId);
+
+    int delete(List<String> ids);
+
 }

+ 11 - 2
src/main/java/com/hz/employmentsite/vo/taskAndLog/DotaskVo.java

@@ -1,8 +1,12 @@
 package com.hz.employmentsite.vo.taskAndLog;
 
+import com.hz.employmentsite.model.PcDotaskUser;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
 @Data
 public class DotaskVo {
 
@@ -14,9 +18,9 @@ public class DotaskVo {
 
     public String dotaskName;
 
-    public String finishTime;
+    public Date finishTime;
 
-    public String createTime;
+    public Date createTime;
 
     public  String createName;
 
@@ -31,4 +35,9 @@ public class DotaskVo {
     public String regionCode;
 
     public String streetCode;
+
+    public String siteID;
+
+    public List<HashMap<String,Object>> dotaskUser;
+
 }

+ 1 - 1
src/main/java/com/hz/employmentsite/vo/taskAndLog/SiteUserVo.java

@@ -2,5 +2,5 @@ package com.hz.employmentsite.vo.taskAndLog;
 
 public class SiteUserVo {
     public String siteUserID;
-    public String Name;
+    public String name;
 }

+ 1 - 0
src/main/resources/generatorConfig.xml

@@ -100,6 +100,7 @@
         <table schema="" tableName="pc_post"><property name="useActualColumnNames" value="true"/></table>
         <table schema="" tableName="pc_post"><property name="useActualColumnNames" value="true"/></table>
         <table schema="" tableName="pc_company"><property name="useActualColumnNames" value="true"/></table>
+        <table schema="" tableName="pc_dotask_user"><property name="useActualColumnNames" value="true"/></table>
         -->
 
 

+ 7 - 6
src/main/resources/mapping/PcDotaskUserMapper.xml

@@ -87,12 +87,6 @@
       <include refid="Example_Where_Clause" />
     </if>
   </delete>
-  <insert id="insert" parameterType="com.hz.employmentsite.model.PcDotaskUser">
-    insert into pc_dotask_user (DotaskUserID, DotaskID, SiteUserID
-      )
-    values (#{dotaskUserID,jdbcType=VARCHAR}, #{dotaskID,jdbcType=VARCHAR}, #{siteUserID,jdbcType=VARCHAR}
-      )
-  </insert>
   <insert id="insertSelective" parameterType="com.hz.employmentsite.model.PcDotaskUser">
     insert into pc_dotask_user
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -141,6 +135,13 @@
       <include refid="Update_By_Example_Where_Clause" />
     </if>
   </update>
+
+  <insert id="insert" parameterType="com.hz.employmentsite.model.PcDotaskUser">
+    insert into pc_dotask_user (DotaskUserID, DotaskID, SiteUserID
+      )
+    values (#{dotaskUserID,jdbcType=VARCHAR}, #{dotaskID,jdbcType=VARCHAR}, #{siteUserID,jdbcType=VARCHAR}
+      )
+  </insert>
   <update id="updateByExample" parameterType="map">
     update pc_dotask_user
     set DotaskUserID = #{row.dotaskUserID,jdbcType=VARCHAR},

+ 7 - 2
src/main/resources/mapping/cquery/DotaskCQuery.xml

@@ -3,7 +3,8 @@
 <mapper namespace="com.hz.employmentsite.mapper.cquery.DotaskCQuery">
     <select id="getList" resultType="com.hz.employmentsite.vo.taskAndLog.DotaskVo">
         select task.dotaskID,task.workTypeID,task.content,task.dotaskName,u.`Name` as createName,
-        task.finishTime,task.createTime,(select count(*) from pc_dotask_user du where du.DotaskID = task.DotaskID)as userCount,
+        task.finishTime,task.createTime,(select count(*) from pc_dotask_user du where du.DotaskID = task.DotaskID)as
+        userCount,
         city.`name` as regionName,area.`name` as streetName,item.`Name` as workTypeName,task.regionCode,task.streetCode
         from pc_dotask task
         left join sys_dictionary_item item
@@ -15,6 +16,9 @@
         join area_code area
         on area.`code` = task.StreetCode
         where item.DictionaryCode='TaskType'
+        <if test="id != '' and id != null">
+            and task.dotaskID = #{id}
+        </if>
         <if test="name != '' and name != null">
             and task.dotaskName like Concat('%',#{name},'%')
         </if>
@@ -55,6 +59,7 @@
 
     </select>
     <select id="getUserList" resultType="com.hz.employmentsite.vo.taskAndLog.SiteUserVo">
-        select SiteUserID,`Name` from pc_site_user;
+        select SiteUserID, `Name`
+        from pc_site_user;
     </select>
 </mapper>

+ 43 - 0
vue/src/api/taskAndLog/dotask.ts

@@ -14,6 +14,19 @@ export function getList(params: any) {
   );
 }
 
+export function getDataById(id: any) {
+  return request<object>(
+    {
+      url: "taskAndLog/dotask/getDataById",
+      method: 'get',
+      params: {id},
+    },
+    {
+      isNew: true,
+    },
+  );
+}
+
 export function getWorkUserList(id: any) {
   return request(
     {
@@ -39,3 +52,33 @@ export function getUserList() {
     },
   );
 }
+
+export function save(data: any) {
+  return request(
+    {
+      url: "taskAndLog/dotask/save",
+      method: 'post',
+      data: data
+    },
+    {
+      isNew: true,
+      successMsg: '提交成功!',
+      errorMsg: '提交失败!'
+    },
+  );
+}
+
+
+export function del(data: any) {
+  return request({
+      url: 'taskAndLog/dotask/delete',
+      method: 'post',
+      data: data
+    },
+    {
+      isNew: true,
+      successMsg: '删除成功!',
+      errorMsg: '删除失败!'
+    }
+  )
+}

+ 1 - 0
vue/src/views/companyService/post/edit.vue

@@ -300,6 +300,7 @@ export default defineComponent(
 
       get('companyService/company/getList', {pageIndex: 1, pageSize: 999}).then(result => {
         companyList.value = result.list;
+        console.log(companyList);
       })
 
       const onClose = () => {

+ 47 - 24
vue/src/views/taskAndLog/dotask/edit.vue

@@ -14,10 +14,10 @@
           </a-form-item>
         </a-col>
         <a-col :span="8">
-          <a-form-item label="任务类型" :label-col="{span:6}" name="workTypeId">
+          <a-form-item label="任务类型" :label-col="{span:6}" name="workTypeID">
             <a-select
               ref="select"
-              v-model:value="dataModel.workTypeId"
+              v-model:value="dataModel.workTypeID"
               :options="taskTypeList"
               :field-names="{ label: 'name', value: 'value' }"
               :allow-clear="true"
@@ -69,8 +69,8 @@
       </a-row>
       <a-row>
         <a-col class="table-bottom-a1">
-          <a-form-item :label-col="{span:6}" label="" name="Content">
-            <a-textarea v-model:value="dataModel.Content" placeholder="任务内容" :rows="4"/>
+          <a-form-item :label-col="{span:6}" label="" name="content">
+            <a-textarea v-model:value="dataModel.content" placeholder="任务内容" :rows="4"/>
           </a-form-item>
         </a-col>
       </a-row>
@@ -94,12 +94,14 @@
             <template #bodyCell="{ column ,index}">
               <template v-if="column.key === 'siteUserID'">
                 <div>
-                  <a-input v-if="isEdit"
-                           v-model:value="userData[index][column.key]" style="width: 200px"
-                  />
-                  <template v-else>
-                    {{ userData[index][column.key] }}
-                  </template>
+                  <a-select
+                    ref="select"
+                    v-model:value="userData[index][column.key]"
+                    :options="siteuserList"
+                    :field-names="{ label: 'name', value: 'siteUserID' }"
+                    :allow-clear="true" style="width: 200px"
+                  >
+                  </a-select>
                 </div>
               </template>
               <template v-if="column.key === 'operation'">
@@ -112,7 +114,7 @@
 
       <a-divider orientation="left">其他信息</a-divider>
       <b-upload-file
-        :file-ref-id="dataModel.DotaskID"
+        :file-ref-id="dataModel.dotaskID"
         :readonly="false"
         :multiple="true"
         :set-file-list="setFileList"
@@ -128,12 +130,12 @@
 
 <script lang="ts">
 import {defineComponent, reactive, ref, toRefs} from 'vue';
-import {useRouter} from 'vue-router';
+// import {useRouter} from 'vue-router';
 import type {SelectProps, TableColumnsType} from 'ant-design-vue';
 import {useTabsViewStore} from '@/store/modules/tabsView';
 import BUploadFile from '@/components/file/uploadFile.vue';
 import {get} from "@/api/common";
-import {getUserList, getWorkUserList} from '@/api/taskAndLog/dotask'
+import {getUserList, getWorkUserList, getDataById, save} from '@/api/taskAndLog/dotask'
 
 interface FormState {
   dataModel: any;
@@ -149,14 +151,15 @@ export default defineComponent(
         pageIndex: 1,
         pageSize: 99
       });
-      const router = useRouter();
-      const siteuserList = ref<SelectProps['options']>();
+      // const router = useRouter();
+      const siteuserList = ref([]);
       const regionList = ref<SelectProps['options']>();
       const streetList = ref<SelectProps['options']>();
       const taskTypeList = ref<SelectProps['options']>();
       // const fullpath = router.currentRoute.value.fullPath;
       const tabsViewStore = useTabsViewStore();
       const isEdit = true;
+
       const fileList = ref();
       const setFileList = (files) => {
         fileList.value = files;
@@ -181,20 +184,20 @@ export default defineComponent(
         get('system/area/getAreaList', {code: formState.dataModel.regionCode}).then(data => {
           streetList.value = data;
         })
-        loadData();
       }
 
       const userData = ref([]);
 
       const loadUserData = (id: any) => {
         getWorkUserList(id).then(data => {
-          userData.value = data;
+          if (data)
+            userData.value = data;
         });
       }
 
       const addUser = () => {
-        console.log('新增');
         (userData.value as any[]).push({dotaskUserID: null, dotaskID: null, siteUserID: null, userName: ''});
+
       }
       const deleteUser = (record) => {
         (userData.value as any[]).splice(record, 1);
@@ -206,18 +209,30 @@ export default defineComponent(
       const onDel = () => {
 
       };
-      const onClose = () => {
+      const onClose = (reload: any) => {
         tabsViewStore.closeCurrentTabByPath('/taskAndLog/dotask/add');
         tabsViewStore.closeCurrentTabByPath('/taskAndLog/dotask/edit');
-        router.push({name: '/taskAndLog/dotask/index'});
+        // router.push({name: '/taskAndLog/dotask/index'});
+        tabsViewStore.openTab('/taskAndLog/dotask/index', {reload: reload});
       };
 
       const onFinish = () => {
-
+        formState.dataModel.dotaskUser = userData.value;
+        save(formState.dataModel).then(result => {
+          if (result) {
+            onClose(1)
+          }
+        });
       }
 
-      const loadData = () => {
-
+      const loadData = (id: any) => {
+        getDataById(id).then(data => {
+          formState.dataModel = data
+          console.log(formState.dataModel);
+          if (formState.dataModel.regionCode) {
+            changeCity();
+          }
+        });
       };
 
       const columns: TableColumnsType = [
@@ -228,7 +243,13 @@ export default defineComponent(
           width: 120,
           customRender: item => `${searchParams.pageSize * (searchParams.pageIndex - 1) + item.index + 1}`
         },
-        {title: '姓名', dataIndex: 'Name', key: 'Name', align: "center", width: 120},
+        {
+          title: '人员',
+          dataIndex: 'siteUserID',
+          key: 'siteUserID',
+          align: "center",
+          width: 120
+        },
         {title: '操作', key: 'operation', fixed: 'right', width: 120, align: "center"},
       ]
 
@@ -247,6 +268,7 @@ export default defineComponent(
         formTableState,
         setFileList,
         regionList,
+        userData,
         streetList,
         taskTypeList,
         siteuserList,
@@ -259,6 +281,7 @@ export default defineComponent(
       const id = history.state.params?.id;
       console.log(id);
       this.loadUserData(id);
+      this.loadData(id);
       this.getSiteUserList();
     }
   })

+ 31 - 11
vue/src/views/taskAndLog/dotask/index.vue

@@ -65,7 +65,10 @@
       <a-row class="edit-operation">
         <a-col :span="24" style="text-align: right">
           <a-button type="primary" html-type="submit" @click='onAdd'>新增</a-button>
-          <a-button type="primary" html-type="submit" @click='exportPost()'>导出</a-button>
+<!--          <a-button type="primary" html-type="submit" @click='exportPost()'>导出</a-button>-->
+          <BExportExcel :title="'导出'" :filename="'任务信息'"
+                        :url="'taskAndLog/dotask/export'"
+                        :params="{...searchParams, isExport: true, rows:10000}"></BExportExcel>
         </a-col>
       </a-row>
     </a-form>
@@ -91,14 +94,14 @@
 
 <script lang="ts">
 import {get} from '@/api/common';
-import {reactive, ref, computed, defineComponent} from 'vue';
-import {DownOutlined, UpOutlined} from '@ant-design/icons-vue';
+import {reactive, ref, computed, defineComponent,createVNode} from 'vue';
+import {DownOutlined, UpOutlined,ExclamationCircleOutlined} from '@ant-design/icons-vue';
 import type {FormInstance,SelectProps} from 'ant-design-vue';
 import type {TableColumnsType, TableProps} from 'ant-design-vue';
-import {getList} from '@/api/taskAndLog/dotask';
+import {getList,del} from '@/api/taskAndLog/dotask';
 import BExportExcel from "@/components/basic/excel/exportExcel/exportExcel.vue";
 import {getPaginationTotalTitle} from "@/utils/common";
-import {message} from "ant-design-vue";
+import {message, Modal} from "ant-design-vue";
 import dayjs from 'dayjs';
 import {useTabsViewStore} from "@/store/modules/tabsView";
 
@@ -181,11 +184,11 @@ export default defineComponent({
     });
 
     const changeCity=()=>{
-      get('system/area/getAreaList',{code:searchParams.regionCode}).then(data=>{
-        console.log(data);
-        streetList.value=data;
-        console.log(streetList.value);
-      })
+      if(searchParams.regionCode) {
+        get('system/area/getAreaList', {code: searchParams.regionCode}).then(data => {
+          streetList.value = data;
+        })
+      }
       loadData();
     }
 
@@ -226,13 +229,30 @@ export default defineComponent({
 
     const onDel = (item: any) => {
       if (item) {
-        formState.selectedRowKeys.push(item.InstitutionID as never)
+        formState.selectedRowKeys.push(item.dotaskID as never)
       }
 
       if (formState.selectedRowKeys.length <= 0) {
         message.warning('请选择需要删除的数据!');
         return false;
       }
+      Modal.confirm({
+        title: '确认删除选中的数据?',
+        icon: createVNode(ExclamationCircleOutlined),
+        content: '',
+        okText: '确认删除',
+        okType: 'danger',
+        okButtonProps: {},
+        cancelText: '取消',
+        onOk() {
+          del(formState.selectedRowKeys).then(() => {
+            loadData();
+          });
+        },
+        onCancel() {
+
+        },
+      });
 
     };