ly 1 rok pred
rodič
commit
90ae4119c8

+ 51 - 0
src/api/business/entrust/currentWorkOrder.js

@@ -92,4 +92,55 @@ export function transNextForFactory() {
     url: '/business/workOrderCurrent/transNextForFactory',
     method: 'get'
   })
+}
+
+
+
+export function listHistory(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
+  return request({
+    url: '/business/workOrderCurrent/history/list',
+    method: 'get',
+    params: query
+  })
+}
+export function exportStore(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
+  download(
+    "business/workOrderCurrent/exportStore",
+    {
+      ...query,
+    },
+    `本月工单导出_${new Date().getTime()}.xlsx`
+  )
+}
+export function exportNextStore(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
+  download(
+    "business/workOrderCurrent/exportNextStore",
+    {
+      ...query,
+    },
+    `下月工单导出_${new Date().getTime()}.xlsx`
+  )
+}
+export function exportFactory(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
+  download(
+    "business/workOrderCurrent/exportFactory",
+    {
+      ...query,
+    },
+    `本月工单导出_${new Date().getTime()}.xlsx`
+  )
+}
+export function exportNextFactory(query) {
+  request.defaults.baseURL = '/ezhizao-yzbh-entrust'
+  download(
+    "business/workOrderCurrent/exportNextFactory",
+    {
+      ...query,
+    },
+    `下月工单导出_${new Date().getTime()}.xlsx`
+  )
 }

+ 6 - 5
src/views/business/entrust/workOrder/currentMonth/index.vue

@@ -26,14 +26,15 @@
     <el-form class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
       label-width="68px">
       <el-form-item label="当前月:">{{
-        currentMonth == null
-        ? "未设定本月"
-        : moment().format("YYYY年MM月")
+        moment().format("YYYY年MM月")
         }}</el-form-item>
       <el-form-item label="客户名称:" prop="companyName">
         <el-input v-model="queryParams.companyName" style="width: 150px" placeholder="请输入客户名称" clearable
           @keyup.enter="handleQuery" />
       </el-form-item>
+      <el-form-item label="执行人:" prop="toAccountName">
+        <el-input v-model="queryParams.toAccountName" placeholder="请输入客户名称" clearable @keyup.enter="handleQuery" />
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
         <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -125,7 +126,7 @@
     exportCurrentWorkOrder,
     delEntrust,
     transNext,
-    addEntrust,
+    addEntrust,exportStore
   } from "@/api/business/entrust/currentWorkOrder";
   import SetEntrustDialog from "../setEntrustDialog";
   import useUserStore from "@/store/modules/user";
@@ -257,7 +258,7 @@
 
   /** 导出按钮操作 */
   function handleExport() {
-    exportCurrentWorkOrder(queryParams.value);
+    exportStore(queryParams.value);
   }
 
   function setCurrentMonth(month) {

+ 351 - 0
src/views/business/entrust/workOrder/historyMonth/index.vue

@@ -0,0 +1,351 @@
+<template>
+    <div class="page-container list-container">
+        <!-- 功能按钮区 -->
+        <div class="list-btns-container">
+
+        </div>
+        <!-- 搜索区 -->
+        <el-form class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
+            label-width="68px">
+            <el-form-item label="工作月:">
+                <!-- <el-date-picker v-model="queryParams.date" 
+                    format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="month" placeholder="请选择工作月"
+                    style="width: 150px" /> -->
+                <el-date-picker v-model="queryParams.date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="month"
+                    placeholder="请选择工作月" :disabled-date="disabledDate"></el-date-picker>
+            </el-form-item>
+            <el-form-item label="客户名称:" prop="companyName">
+                <el-input v-model="queryParams.companyName" style="width: 150px" placeholder="请输入客户名称" clearable
+                    @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item label="执行人:" prop="toAccountName">
+                <el-input v-model="queryParams.toAccountName" placeholder="请输入客户名称" clearable
+                    @keyup.enter="handleQuery" />
+            </el-form-item>
+            <el-form-item>
+                <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+                <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+            </el-form-item>
+        </el-form>
+
+        <!-- 列表区 -->
+        <el-table v-loading="loading" :data="list" size="small" border height="100%"
+            @selection-change="handleSelectionChange">
+            <el-table-column type="selection" width="55" align="center" />
+            <!-- <el-table-column label="工单号" align="center" prop="workOrderNo" width="200" /> -->
+            <el-table-column label="客户名称" align="center" min-width="250" prop="companyName" />
+            <el-table-column label="税号" align="center" prop="socialCreditCode" min-width="200" />
+            <el-table-column label="工单类型" align="center" prop="amount" min-width="80">
+                <template #default="scope">
+                    {{ scope.row.type === 1 ? "循环工单" : "代办工单" }}
+                </template>
+            </el-table-column>
+            <el-table-column label="项目" align="center" prop="taskTypeName" min-width="140">
+                <template #default="scope">
+                    {{ scope.row.taskTypeName }}
+                    {{
+                    scope.row.taskTypeDetailName
+                    ? `-${scope.row.taskTypeDetailName}`
+                    : ""
+                    }}
+                </template>
+            </el-table-column>
+            <el-table-column label="起始月" align="center" width="90" min-prop="startMonth">
+                <template #default="scope">
+                    {{
+                    scope.row.type === 1
+                    ? scope.row.startMonth
+                    ? moment(scope.row.startMonth).format("YYYY年MM月")
+                    : ""
+                    : "-"
+                    }}
+                </template>
+            </el-table-column>
+            <el-table-column label="结束月" align="center" min-width="90" prop="endMonth">
+                <template #default="scope">
+                    {{
+                    scope.row.type === 1
+                    ? scope.row.endMonth
+                    ? moment(scope.row.endMonth).format("YYYY年MM月")
+                    : ""
+                    : "-"
+                    }}
+                </template>
+            </el-table-column>
+            <el-table-column label="工单月数" align="center" min-width="80" prop="monthNum">
+                <template #default="scope">
+                    {{ scope.row.type === 1 ? scope.row.monthNum : "-" }}
+                </template>
+            </el-table-column>
+            <el-table-column label="工单执行人" align="center" min-width="100">
+                <template #default="scope">
+                    {{
+                    scope.row.toAccountName
+                    }}
+                </template>
+            </el-table-column>
+        </el-table>
+        <!-- <contract-form ref="contractRef" :get-list="getList" /> -->
+        <!-- 分页 -->
+        <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+            v-model:limit="queryParams.pageSize" @pagination="getList" />
+        <init-month-dialog ref="initMonthDialogRef" :get-list="checkCurrentMonthHandle"
+            :setCurrentMonth="setCurrentMonth" />
+
+        <set-entrust-dialog ref="setEntrustDialogRef" :get-list="getList" @submit="handleAddEntrust" />
+
+    </div>
+</template>
+
+<script setup name="Company">
+    import InitMonthDialog from "../initMonthDialog";
+    import { getToken, getTenant } from "@/utils/auth";
+    import {
+        listCurrentWorkOrder,
+        checkCurrent,
+        exportCurrentWorkOrder,
+        delEntrust,
+        transNext,
+        addEntrust, listHistory
+    } from "@/api/business/entrust/currentWorkOrder";
+    import SetEntrustDialog from "../setEntrustDialog";
+    import useUserStore from "@/store/modules/user";
+    // import { ca } from "element-plus/es/locale";
+    const { proxy } = getCurrentInstance();
+    const currentMonth = ref(null);
+    /** 字典数组区 */
+    /** 查询 对象 */
+
+    const list = ref([]);
+    const loading = ref(true);
+    const cancel = ref(true);
+    const multiple = ref(true);
+    const ids = ref([]);
+    const selections = ref([]);
+    const single = ref(false);
+    const total = ref(0);
+    const prev = ref([]);
+    const tenantId = ref(getTenant());
+    const permissions = useUserStore().permissions;
+    const all_permission = "*:*:*";
+
+    const initMonthDialogRef = ref(null);
+    const setEntrustDialogRef = ref(null);
+
+    const showInitMonth = ref(false);
+
+    const { contract_verify_status } = proxy.useDict("contract_verify_status");
+    const { contract_status } = proxy.useDict("contract_status");
+    /** 查询对象 */
+    const queryParams = ref({
+        pageNum: 1,
+        pageSize: 20,
+
+    });
+
+    const editStatus = {
+        startMonth: false,
+    };
+    function disabledDate(time) {
+        const currentMonth = new Date().getMonth();
+        const selectedMonth = time.getMonth();
+        const currentYear = new Date().getFullYear();
+        const selectedYear = time.getFullYear();
+
+        // 禁用当前年份之后的所有月份
+        if (selectedYear > currentYear) {
+            return true;
+        }
+
+        // 如果选择的是当前年份,只能选择当前月份之前的月份
+        return selectedYear === currentYear && selectedMonth >= currentMonth;
+    }
+
+    function checkCurrentMonthHandle() {
+        checkCurrent().then((res) => {
+            if (res.data.checkResult === true) {
+                setCurrentMonth(res.data.currentMonth);
+                getList();
+            } else {
+                showInitMonthDialog();
+            }
+        });
+    }
+
+    function showInitMonthDialog() {
+        initMonthDialogRef.value.open();
+    }
+
+    /***********************  方法区  ****************************/
+    // 禁用当前月及之后的月份
+    const beforeCurrentMonth = (time) => {
+        const currentMonth = new Date().getMonth();
+        const selectedMonth = time.getMonth();
+        return selectedMonth >= currentMonth;
+    };
+    /** 查询company列表 */
+    function getList() {
+        loading.value = true;
+        console.log(queryParams.value);
+
+        queryParams.value.currentMonth = currentMonth.value;
+        listHistory(queryParams.value).then((response) => {
+            list.value = response.rows;
+            console.log(response);
+            total.value = response.total;
+        }).finally(() => {
+            loading.value = false;
+        });
+    }
+
+    /** 取消委托按钮操作 */
+    function cancelEntrust() {
+        if (selections.value.length === 0) {
+            proxy.$modal.msgError("请选择要取消委托的数据");
+            return;
+        }
+        proxy.$modal
+            .confirm("是否确认取消委托?")
+            .then(function () {
+
+            });
+    }
+
+    //判断是否有权限
+    function viewAdviser(quer) {
+        return permissions.includes(all_permission) || permissions.includes(quer);
+    }
+
+    /** 搜索按钮操作 */
+    function handleQuery() {
+        queryParams.value.pageNum = 1;
+        getList();
+    }
+
+    /** 重置按钮操作 */
+    function resetQuery() {
+        proxy.resetForm("queryRef");
+        handleQuery();
+    }
+    /** 新增导入操作 */
+    function exportZero() {
+        proxy.$refs.exportRef.open();
+    }
+    // 多选框选中数据
+    function handleSelectionChange(selection) {
+        ids.value = selection.map((item) => item.id);
+        selections.value = selection;
+
+        //取消委托计数
+        let cancelNum = 0;
+        //设置委托计数
+        let multipleNum = 0;
+        //判断是否有执行人
+        selections.value.forEach((item) => {
+            if (item.entrust) {
+                //有执行人
+                if (item.entrust.toAccountName) {
+                    cancelNum++;
+                }
+            }
+            //没有执行人
+            if (!item.entrust) {
+                multipleNum++;
+            }
+        });
+
+        //判断是否有选中数据
+        if (!selections.value.length > 0) {
+            multiple.value = true;
+            cancel.value = true;
+        } //判断是否设置执行人和设置委托选中
+        else if (cancelNum > 0 && multipleNum > 0) {
+            cancel.value = cancelNum > 0;
+            multiple.value = multipleNum > 0;
+        } else {
+            cancel.value = !cancelNum > 0;
+            multiple.value = !multipleNum > 0;
+        }
+    }
+
+    /** 导出按钮操作 */
+    function handleExport() {
+        exportCurrentWorkOrder(queryParams.value);
+    }
+
+    function setCurrentMonth(month) {
+        currentMonth.value = month;
+    }
+
+    function setEntrustHandle() {
+        setEntrustDialogRef.value.open({
+            selections: selections.value,
+            optionCurrentMonth: currentMonth.value,
+        });
+    }
+
+    function delEntrustHandle() {
+        const entrust = {
+            workMonth: currentMonth.value,
+            workOrderIds: ids.value,
+        };
+        proxy.$modal.confirm("是否确认取消委托?").then(() => {
+            delEntrust(entrust).then((res) => {
+                proxy.$modal.msgSuccess("取消成功");
+                getList();
+            });
+        });
+    }
+
+    function transEntrustHandler() {
+        // proxy.$modal.confirm("确定流转到下一月?").then(() => {
+        //     transNext().then((res) => {
+        //       proxy.$modal.msgSuccess("流转成功");
+        //       checkCurrentMonthHandle();
+        //     });
+        //   });
+        let currentDate = new Date().getMonth() + 1;
+        let formattedMonth = currentDate.toString().padStart(2, '0');
+        let month = currentMonth.value.split('-')[1];
+        console.log(formattedMonth);
+        if (month < formattedMonth) {
+            proxy.$modal.confirm("确定流转到下一月?").then(() => {
+                transNext().then((res) => {
+                    proxy.$modal.msgSuccess("流转成功");
+                    checkCurrentMonthHandle();
+                });
+            });
+        } else {
+            // //真实月 != 当前月 
+            if (month != formattedMonth) {
+                proxy.$modal.msgError("每月只可流转一次");
+            } else {
+                let currentDay = new Date().getDate()
+                let cutoffDay = 20;
+                //如果当前月时间小于20号
+                if (currentDay < cutoffDay) {
+                    proxy.$modal.msgError("每月20号后才能流转");
+                } else {
+                    proxy.$modal.confirm("确定流转到下一月?").then(() => {
+                        transNext().then((res) => {
+                            proxy.$modal.msgSuccess("流转成功");
+                            checkCurrentMonthHandle();
+                        });
+                    });
+                }
+
+            }
+        }
+
+    }
+
+    function handleAddEntrust(data) {
+        addEntrust(data).then((response) => {
+            proxy.$modal.msgSuccess("设置完成!");
+            setEntrustDialogRef.value.cancel();
+            getList();
+        });
+    }
+
+    checkCurrentMonthHandle();
+</script>

+ 353 - 0
src/views/business/entrust/workOrder/nextMonth/export.vue

@@ -0,0 +1,353 @@
+<template>
+    <!-- 添加或修改菜单对话框 -->
+    <el-dialog
+      title="客户添加"
+      v-model="visible"
+      width="680px"
+      append-to-body
+      draggable
+      :close-on-click-modal = "false"
+    >
+      <el-form
+        ref="companyRef"
+        :model="form"
+        size="small"
+        :rules="rules"
+        label-width="100px"
+      >
+        <el-row>
+          <el-col v:span="24">
+            <el-form-item label="上传">
+              <el-upload
+                ref="uploadRef"
+                :limit="1"
+                accept=".xlsx, .xls"
+                :headers="upload.headers"
+                :action="upload.url + '?updateSupport=' + upload.updateSupport"
+                :disabled="upload.isUploading"
+                :on-progress="handleFileUploadProgress"
+                :on-success="handleFileSuccess"
+                :auto-upload="false"
+                drag
+              >
+                <el-icon class="el-icon--upload">
+                  <upload-filled />
+                </el-icon>
+                <div class="el-upload__text">
+                  将文件拖到此处,或<em>点击上传</em>
+                </div>
+                <template #tip>
+                  <div class="el-upload__tip text-center">
+                    <div class="el-upload__tip">
+                      <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据 -->
+                    </div>
+                    <span>仅允许导入xls、xlsx格式文件。</span>
+                    <el-link
+                      type="primary"
+                      :underline="false"
+                      style="font-size: 12px; vertical-align: baseline"
+                      @click="importTemplate()"
+                      >下载模板</el-link
+                    >
+                  </div>
+                </template>
+              </el-upload>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+      <template #footer>
+        <div class="dialog-footer">
+          <el-button
+            type="primary"
+            icon="Finished"
+            size="small"
+            @click="submitForm"
+            >确 定</el-button
+          >
+          <el-button @click="cancel" icon="close" size="small">取 消</el-button>
+        </div>
+      </template>
+    </el-dialog>
+  </template>
+  
+  
+  <script setup>
+  import { getToken, getTenant } from "@/utils/auth";
+  import CustomerFormCom from "@/components/CustomerFormCom";
+  import { listChannel } from "@/api/business/channel";
+  import useUserStore from "@/store/modules/user";
+  import { listUser } from "@/api/system/user";
+  import { listSource } from "@/api/settings/source";
+  import { deepClone } from "@/utils";
+  import { ref } from "vue";
+  import zTool from '@/utils/zTool'
+  // import { incomeDefault, taxTypes, confirmDefault } from "@/utils/default"
+  const { proxy } = getCurrentInstance();
+  /** 父组件传参 */
+  const props = defineProps({
+    getList: {
+      type: Function,
+      default: () => {},
+    },
+  });
+  const { getList } = toRefs(props);
+  /** 字典数组区 */
+  const { develop_type } = proxy.useDict("develop_type");
+  /** 表单抽屉 页变量 */
+  const title = ref("");
+  const loading = ref(false);
+  const multiple = ref(true);
+  const visible = ref(false);
+  
+  const editStatus = ref(false);
+  const sourceCategoryId = ref("");
+  const isFullscreen = ref(false);
+  const currentSource = ref({});
+  const addDetailNum = ref(1);
+  const currentMember = {};
+  const provinces = ref(proxy.region.getProvinces());
+  provinces.value.unshift({ code: "", name: "全部" });
+  const cities = ref([]);
+  const districts = ref([]);
+  
+  const sourceCategories = ref([]);
+  
+
+  
+  const webHost = import.meta.env.VITE_APP_BASE_API;
+  
+  const setHeaders = {
+    Authorization: getToken(),
+  };
+  const data = reactive({
+    form: {},
+    followData: {},
+    rules: {
+      name: [{ required: true, message: "客户名称不能为空", trigger: "blur" }],
+      sourceCategoryName: [
+        { validator: sourceValidator, trigger: "change" },
+        { required: true, message: "客户来源不能为空", trigger: "change" },
+      ],
+    },
+  });
+  const addComRef = ref(null);
+  
+  /*** 客户导入参数 */
+  const upload = reactive({
+    // 是否禁用上传
+    isUploading: false,
+    // 设置上传的请求头部
+    headers: { Authorization: "Bearer " + getToken(), tenantId: getTenant() },
+    // 上传的地址
+    url: "/ezhizao-yzbh-entrust/business/workOrderCurrent/importEntrustNext",
+  });
+  
+  function sourceValidator(rule, value, callback) {
+    console.log(form.value.reffererDataSource, form.value.sourceName);
+    if (form.value.sourceCategoryName === "") {
+      callback(new Error("来源类型不能为空"));
+      return;
+    }
+    if (
+      form.value.referrerDataSource !== "" &&
+      form.value.referrerDataSource != null &&
+      form.value.sourceName === ""
+    ) {
+      callback(new Error("来源不能为空"));
+      return;
+    }
+    return callback();
+  }
+  
+  //设置负责人
+  function handleSelectEmployee(item) {
+    form.value.leaderId = item.userId;
+    form.value.leaderName = item.nickName;
+  }
+  
+  //设置客服
+  function handleSelect(item) {
+    form.value.adviserId = item.userId;
+    form.value.adviserName = item.nickName;
+  }
+  
+  function handlerChangeCategory(value) {
+    form.value.sourceId = null;
+    form.value.sourceName = "";
+    handlerSelectCategory();
+  }
+  
+  function handlerSelectCategory() {
+    form.value.sourceCategoryId = sourceCategoryId.value;
+    // formData.value.referrerDataSource = currentSource.value.referrerDataSource
+    const index = sourceCategories.value.findIndex(
+      (l) => l.id === sourceCategoryId.value
+    );
+    currentSource.value = index >= 0 ? sourceCategories.value[index] : {};
+    var item = sourceCategories.value.find(
+      (emp) => emp.id === sourceCategoryId.value
+    );
+    if (item) {
+      form.value.sourceCategoryName = item.title;
+      form.value.referrerDataSource = item.referrerDataSource;
+    }
+  }
+  
+  /** 输入框输出建议 */
+  function querySearchAsync(queryString, cb) {
+    const query = { keyword: queryString };
+    listUser(query).then((res) => {
+      cb(res.rows);
+    });
+  }
+  
+  const contactorEmptyData = {
+    id: null,
+    name: "",
+    position: "",
+    gender: "男",
+    phone: "",
+    email: "",
+    isMain: "是",
+    remark: "",
+  };
+  
+  const companyEmptyData = {
+    id: null,
+    code: "",
+    name: "",
+    oldName: "",
+    shortName: "",
+    ownerId: "",
+    ownerName: "",
+    sourceCategoryId: "",
+    sourceCategoryName: "",
+    sourceId: "",
+    sourceName: "",
+    stageId: "",
+    stageName: "",
+    phone: "",
+    email: "",
+    contactAddress: "",
+    remark: "",
+    socialCreditCode: "",
+    mainBusinessId: "",
+    mainBusinessName: "",
+    typeId: "",
+    typeName: "",
+    legalRepresentative: "",
+    foundationDate: "",
+    licenceDate: "",
+    businessStartDate: "",
+    collectionMethod: "",
+    businessEndDate: "",
+    isPermanentlyEffective: "",
+    registerMoney: "",
+    registerMoneyUnitId: "",
+    registerMoneyUnitName: "",
+    provinceCode: "",
+    province: "",
+    cityCode: "",
+    city: "",
+    districtCode: "",
+    district: "",
+    address: "",
+    businessField: "",
+    taxTypeId: "",
+    taxTypeName: "",
+    taxDeclarationCategoryId: "",
+    taxDeclarationCategoryName: "",
+    isZero: "",
+    taxDishId: "",
+    taxDishName: "",
+    competentTaxAuthority: "",
+    annualIncome: "",
+    taxType: "",
+    taxCollectorName: "",
+    taxCollectorPhone: "",
+    taxMonth: "",
+    openingBank: "",
+    bankAccount: "",
+    companyTags: [],
+    companyTagIds: [],
+    contactors: [],
+    serviceTeams: [],
+    companyFiles: [],
+    stores: [],
+    creatorId: useUserStore().user.id,
+  };
+  
+  const followQuery = ref({});
+  const { form, rules, followData } = toRefs(data);
+  
+  /***********************  表单页方法 ****************************/
+  
+  /** 抽屉打开 */
+  function open() {
+    reset();
+    form.value.leaderName = useUserStore().user.nickName;
+    form.value.leaderId = useUserStore().user.userId;
+    visible.value = true;
+  }
+  
+  function init() {
+    listSource()
+      .then((res) => {
+        // console.log(res)
+        sourceCategories.value = res.rows;
+        // console.log(sourceCategories.value)
+      })
+      .catch((err) => {
+        console.log(err);
+      });
+  }
+  
+  function reset() {
+    form.value = deepClone(companyEmptyData);
+    // console.log(addComRef.value)
+    if (addComRef.value != null) addComRef.value.reset();
+  }
+  
+  function cancel() {
+    visible.value = false;
+  }
+  
+  function submitForm() {
+      submitFileForm();
+  }
+
+  function  importTemplate(){
+    zTool.zDownloadTemplate('委托导入模板.xlsx')
+  }
+  /**文件上传中处理 */
+  const handleFileUploadProgress = (event, file, fileList) => {
+    upload.isUploading = true;
+  };
+  /** 文件上传成功处理 */
+  const handleFileSuccess = (response, file, fileList) => {
+    upload.open = false;
+    upload.isUploading = false;
+    proxy.$refs["uploadRef"].handleRemove(file);
+    proxy.$alert(
+      "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+        response.msg +
+        "</div>",
+      "导入结果",
+      { dangerouslyUseHTMLString: true }
+    );
+    getList.value();
+  };
+  /** 提交上传文件 */
+  function submitFileForm() {
+    proxy.$refs["uploadRef"].submit();
+  }
+  
+  // 暴露给父组件的方法
+  defineExpose({
+    open,
+  });
+  init();
+  </script>
+  
+  <style></style>

+ 18 - 5
src/views/business/entrust/workOrder/nextMonth/index.vue

@@ -36,6 +36,7 @@
           </el-dropdown-menu>
         </template>
       </el-dropdown>
+      <el-button style="margin-left: 5px;" type="primary" size="small" icon="Plus" @click="exportZero">导入委托</el-button>
     </div>
     <!-- 搜索区 -->
     <el-form
@@ -47,9 +48,7 @@
       label-width="68px"
     >
       <el-form-item label="当前月:">{{
-        currentMonth == null
-          ? "未设定本月"
-          : moment(currentMonth).format("YYYY年MM月")
+       moment(currentMonth).format("YYYY年MM月")
       }}</el-form-item>
       <el-form-item label="客户名称:" prop="companyName">
         <el-input
@@ -60,6 +59,14 @@
           @keyup.enter="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="执行人:" prop="toAccountName">
+        <el-input
+          v-model="queryParams.toAccountName"
+          placeholder="请输入客户名称"
+          clearable
+          @keyup.enter="handleQuery"
+        />
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="Search" @click="handleQuery"
           >搜索</el-button
@@ -168,6 +175,7 @@
         </template>
       </el-table-column>
     </el-table>
+    <exports ref="exportRef" :get-list="getList"></exports>
     <!-- 分页 -->
     <pagination
       v-show="total > 0"
@@ -191,6 +199,7 @@
 
 <script setup name="Company">
 import InitMonthDialog from "../initMonthDialog";
+import exports from "./export.vue"
 import {
   listNextWorkORder,
   checkCurrent,
@@ -198,6 +207,7 @@ import {
   delEntrust,
   addEntrust,
 } from "@/api/business/entrust/nextWorkOrder";
+import{exportNextStore}   from "@/api/business/entrust/currentWorkOrder";
 import SetEntrustDialog from "../setEntrustDialog";
 import useUserStore from "@/store/modules/user";
 const { proxy } = getCurrentInstance();
@@ -253,7 +263,10 @@ function checkCurrentMonthHandle() {
 function viewAdviser(quer) {
   return permissions.includes(all_permission) || permissions.includes(quer);
 }
-
+  /** 新增导入操作 */
+  function exportZero() {
+    proxy.$refs.exportRef.open();
+  }
 function showInitMonthDialog() {
   initMonthDialogRef.value.open();
 }
@@ -322,7 +335,7 @@ function handleSelectionChange(selection) {
 
 /** 导出按钮操作 */
 function handleExport() {
-  exportNextWorkOrder(queryParams.value);
+  exportNextStore(queryParams.value);
 }
 
 function setCurrentMonth(month) {

+ 8 - 7
src/views/business/entrust/workOrderForFactory/currentMonth/index.vue

@@ -21,13 +21,14 @@
     <el-form class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
       label-width="68px">
       <el-form-item label="当前月:">{{
-        currentMonth == null
-        ? "未设定本月"
-        : moment().format("YYYY年MM月")
+       moment().format("YYYY年MM月")
         }}</el-form-item>
       <el-form-item label="客户名称:" prop="companyName">
         <el-input v-model="queryParams.companyName" placeholder="请输入客户名称" clearable @keyup.enter="handleQuery" />
       </el-form-item>
+      <el-form-item label="来源:" prop="fromCompanyName">
+        <el-input v-model="queryParams.fromCompanyName" placeholder="请输入来源" clearable @keyup.enter="handleQuery" />
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
         <el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -84,7 +85,7 @@
           {{ scope.row.type === 1 ? scope.row.monthNum : "-" }}
         </template>
       </el-table-column>
-      <el-table-column label="工单执行人" align="center" width="100">
+      <el-table-column label="工单执行人" align="center" width="150">
         <template #default="scope">
           {{
           scope.row.entrust != null
@@ -113,7 +114,7 @@
   } from "@/api/business/entrust/currentWorkOrder";
   import InitMonthDialog from "../initMonthDialog";
   import useUserStore from "@/store/modules/user";
-
+  import{exportFactory}   from "@/api/business/entrust/currentWorkOrder";
   const { proxy } = getCurrentInstance();
   const currentMonth = ref(null);
   /** 字典数组区 */
@@ -206,11 +207,11 @@
 
   /** 导出按钮操作 */
   function handleExport() {
-    exportCurrentWorkOrder(queryParams.value);
+    exportFactory(queryParams.value);
   }
 
   function setCurrentMonth(month) {
-    currentMonth.value = month;
+    currentMonth.value = proxy.moment().format("YYYY-MM")+"-01";
   }
 
   function setEntrustHandle() {

+ 351 - 0
src/views/business/entrust/workOrderForFactory/history/index.vue

@@ -0,0 +1,351 @@
+<template>
+  <div class="page-container list-container">
+      <!-- 功能按钮区 -->
+      <div class="list-btns-container">
+
+      </div>
+      <!-- 搜索区 -->
+      <el-form class="list-search-container" size="small" :model="queryParams" ref="queryRef" :inline="true"
+          label-width="68px">
+          <el-form-item label="工作月:">
+              <!-- <el-date-picker v-model="queryParams.date" 
+                  format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="month" placeholder="请选择工作月"
+                  style="width: 150px" /> -->
+              <el-date-picker v-model="queryParams.date" format="YYYY-MM-DD" value-format="YYYY-MM-DD" type="month"
+                  placeholder="请选择工作月" :disabled-date="disabledDate"></el-date-picker>
+          </el-form-item>
+          <el-form-item label="客户名称:" prop="companyName">
+              <el-input v-model="queryParams.companyName" style="width: 150px" placeholder="请输入客户名称" clearable
+                  @keyup.enter="handleQuery" />
+          </el-form-item>
+          <el-form-item label="来源:" prop="fromCompanyName">
+            <el-input v-model="queryParams.fromCompanyName" placeholder="请输入来源" clearable @keyup.enter="handleQuery" />
+          </el-form-item>
+          <el-form-item>
+              <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+              <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+          </el-form-item>
+      </el-form>
+
+      <!-- 列表区 -->
+      <el-table v-loading="loading" :data="list" size="small" border height="100%"
+          @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="55" align="center" />
+          <!-- <el-table-column label="工单号" align="center" prop="workOrderNo" width="200" /> -->
+          <el-table-column label="客户名称" align="center" min-width="250" prop="companyName" />
+          <el-table-column label="税号" align="center" prop="socialCreditCode" min-width="200" />
+          <el-table-column label="来源" align="center" width="100" prop="fromCompanyName" />
+          <el-table-column label="工单类型" align="center" prop="amount" min-width="80">
+              <template #default="scope">
+                  {{ scope.row.type === 1 ? "循环工单" : "代办工单" }}
+              </template>
+          </el-table-column>
+          <el-table-column label="项目" align="center" prop="taskTypeName" min-width="140">
+              <template #default="scope">
+                  {{ scope.row.taskTypeName }}
+                  {{
+                  scope.row.taskTypeDetailName
+                  ? `-${scope.row.taskTypeDetailName}`
+                  : ""
+                  }}
+              </template>
+          </el-table-column>
+          <el-table-column label="起始月" align="center" width="90" min-prop="startMonth">
+              <template #default="scope">
+                  {{
+                  scope.row.type === 1
+                  ? scope.row.startMonth
+                  ? moment(scope.row.startMonth).format("YYYY年MM月")
+                  : ""
+                  : "-"
+                  }}
+              </template>
+          </el-table-column>
+          <el-table-column label="结束月" align="center" min-width="90" prop="endMonth">
+              <template #default="scope">
+                  {{
+                  scope.row.type === 1
+                  ? scope.row.endMonth
+                  ? moment(scope.row.endMonth).format("YYYY年MM月")
+                  : ""
+                  : "-"
+                  }}
+              </template>
+          </el-table-column>
+          <el-table-column label="工单月数" align="center" min-width="80" prop="monthNum">
+              <template #default="scope">
+                  {{ scope.row.type === 1 ? scope.row.monthNum : "-" }}
+              </template>
+          </el-table-column>
+          <el-table-column label="工单执行人" align="center" min-width="100">
+              <template #default="scope">
+                  {{
+                  scope.row.toAccountName
+                  }}
+              </template>
+          </el-table-column>
+      </el-table>
+      <!-- <contract-form ref="contractRef" :get-list="getList" /> -->
+      <!-- 分页 -->
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+          v-model:limit="queryParams.pageSize" @pagination="getList" />
+      <init-month-dialog ref="initMonthDialogRef" :get-list="checkCurrentMonthHandle"
+          :setCurrentMonth="setCurrentMonth" />
+
+      <set-entrust-dialog ref="setEntrustDialogRef" :get-list="getList" @submit="handleAddEntrust" />
+
+  </div>
+</template>
+
+<script setup name="Company">
+  import InitMonthDialog from "../initMonthDialog";
+  import { getToken, getTenant } from "@/utils/auth";
+  import {
+      listCurrentWorkOrder,
+      checkCurrent,
+      exportCurrentWorkOrder,
+      delEntrust,
+      transNext,
+      addEntrust, listHistory
+  } from "@/api/business/entrust/currentWorkOrder";
+  import SetEntrustDialog from "../setEntrustDialog";
+  import useUserStore from "@/store/modules/user";
+  // import { ca } from "element-plus/es/locale";
+  const { proxy } = getCurrentInstance();
+  const currentMonth = ref(null);
+  /** 字典数组区 */
+  /** 查询 对象 */
+
+  const list = ref([]);
+  const loading = ref(true);
+  const cancel = ref(true);
+  const multiple = ref(true);
+  const ids = ref([]);
+  const selections = ref([]);
+  const single = ref(false);
+  const total = ref(0);
+  const prev = ref([]);
+  const tenantId = ref(getTenant());
+  const permissions = useUserStore().permissions;
+  const all_permission = "*:*:*";
+
+  const initMonthDialogRef = ref(null);
+  const setEntrustDialogRef = ref(null);
+
+  const showInitMonth = ref(false);
+
+  const { contract_verify_status } = proxy.useDict("contract_verify_status");
+  const { contract_status } = proxy.useDict("contract_status");
+  /** 查询对象 */
+  const queryParams = ref({
+      pageNum: 1,
+      pageSize: 20,
+
+  });
+
+  const editStatus = {
+      startMonth: false,
+  };
+  function disabledDate(time) {
+      const currentMonth = new Date().getMonth();
+      const selectedMonth = time.getMonth();
+      const currentYear = new Date().getFullYear();
+      const selectedYear = time.getFullYear();
+
+      // 禁用当前年份之后的所有月份
+      if (selectedYear > currentYear) {
+          return true;
+      }
+
+      // 如果选择的是当前年份,只能选择当前月份之前的月份
+      return selectedYear === currentYear && selectedMonth >= currentMonth;
+  }
+
+  function checkCurrentMonthHandle() {
+      checkCurrent().then((res) => {
+          if (res.data.checkResult === true) {
+              setCurrentMonth(res.data.currentMonth);
+              getList();
+          } else {
+              showInitMonthDialog();
+          }
+      });
+  }
+
+  function showInitMonthDialog() {
+      initMonthDialogRef.value.open();
+  }
+
+  /***********************  方法区  ****************************/
+  // 禁用当前月及之后的月份
+  const beforeCurrentMonth = (time) => {
+      const currentMonth = new Date().getMonth();
+      const selectedMonth = time.getMonth();
+      return selectedMonth >= currentMonth;
+  };
+  /** 查询company列表 */
+  function getList() {
+      loading.value = true;
+      console.log(queryParams.value);
+
+      queryParams.value.currentMonth = currentMonth.value;
+      listHistory(queryParams.value).then((response) => {
+          list.value = response.rows;
+          console.log(response);
+          total.value = response.total;
+      }).finally(() => {
+          loading.value = false;
+      });
+  }
+
+  /** 取消委托按钮操作 */
+  function cancelEntrust() {
+      if (selections.value.length === 0) {
+          proxy.$modal.msgError("请选择要取消委托的数据");
+          return;
+      }
+      proxy.$modal
+          .confirm("是否确认取消委托?")
+          .then(function () {
+
+          });
+  }
+
+  //判断是否有权限
+  function viewAdviser(quer) {
+      return permissions.includes(all_permission) || permissions.includes(quer);
+  }
+
+  /** 搜索按钮操作 */
+  function handleQuery() {
+      queryParams.value.pageNum = 1;
+      getList();
+  }
+
+  /** 重置按钮操作 */
+  function resetQuery() {
+      proxy.resetForm("queryRef");
+      handleQuery();
+  }
+  /** 新增导入操作 */
+  function exportZero() {
+      proxy.$refs.exportRef.open();
+  }
+  // 多选框选中数据
+  function handleSelectionChange(selection) {
+      ids.value = selection.map((item) => item.id);
+      selections.value = selection;
+
+      //取消委托计数
+      let cancelNum = 0;
+      //设置委托计数
+      let multipleNum = 0;
+      //判断是否有执行人
+      selections.value.forEach((item) => {
+          if (item.entrust) {
+              //有执行人
+              if (item.entrust.toAccountName) {
+                  cancelNum++;
+              }
+          }
+          //没有执行人
+          if (!item.entrust) {
+              multipleNum++;
+          }
+      });
+
+      //判断是否有选中数据
+      if (!selections.value.length > 0) {
+          multiple.value = true;
+          cancel.value = true;
+      } //判断是否设置执行人和设置委托选中
+      else if (cancelNum > 0 && multipleNum > 0) {
+          cancel.value = cancelNum > 0;
+          multiple.value = multipleNum > 0;
+      } else {
+          cancel.value = !cancelNum > 0;
+          multiple.value = !multipleNum > 0;
+      }
+  }
+
+  /** 导出按钮操作 */
+  function handleExport() {
+      exportCurrentWorkOrder(queryParams.value);
+  }
+
+  function setCurrentMonth(month) {
+      currentMonth.value = month;
+  }
+
+  function setEntrustHandle() {
+      setEntrustDialogRef.value.open({
+          selections: selections.value,
+          optionCurrentMonth: currentMonth.value,
+      });
+  }
+
+  function delEntrustHandle() {
+      const entrust = {
+          workMonth: currentMonth.value,
+          workOrderIds: ids.value,
+      };
+      proxy.$modal.confirm("是否确认取消委托?").then(() => {
+          delEntrust(entrust).then((res) => {
+              proxy.$modal.msgSuccess("取消成功");
+              getList();
+          });
+      });
+  }
+
+  function transEntrustHandler() {
+      // proxy.$modal.confirm("确定流转到下一月?").then(() => {
+      //     transNext().then((res) => {
+      //       proxy.$modal.msgSuccess("流转成功");
+      //       checkCurrentMonthHandle();
+      //     });
+      //   });
+      let currentDate = new Date().getMonth() + 1;
+      let formattedMonth = currentDate.toString().padStart(2, '0');
+      let month = currentMonth.value.split('-')[1];
+      console.log(formattedMonth);
+      if (month < formattedMonth) {
+          proxy.$modal.confirm("确定流转到下一月?").then(() => {
+              transNext().then((res) => {
+                  proxy.$modal.msgSuccess("流转成功");
+                  checkCurrentMonthHandle();
+              });
+          });
+      } else {
+          // //真实月 != 当前月 
+          if (month != formattedMonth) {
+              proxy.$modal.msgError("每月只可流转一次");
+          } else {
+              let currentDay = new Date().getDate()
+              let cutoffDay = 20;
+              //如果当前月时间小于20号
+              if (currentDay < cutoffDay) {
+                  proxy.$modal.msgError("每月20号后才能流转");
+              } else {
+                  proxy.$modal.confirm("确定流转到下一月?").then(() => {
+                      transNext().then((res) => {
+                          proxy.$modal.msgSuccess("流转成功");
+                          checkCurrentMonthHandle();
+                      });
+                  });
+              }
+
+          }
+      }
+
+  }
+
+  function handleAddEntrust(data) {
+      addEntrust(data).then((response) => {
+          proxy.$modal.msgSuccess("设置完成!");
+          setEntrustDialogRef.value.cancel();
+          getList();
+      });
+  }
+
+  checkCurrentMonthHandle();
+</script>

+ 15 - 6
src/views/business/entrust/workOrderForFactory/nextMonth/index.vue

@@ -29,9 +29,7 @@
       label-width="68px"
     >
       <el-form-item label="当前月:">{{
-        currentMonth == null
-          ? "未设定本月"
-          : moment(currentMonth).format("YYYY年MM月")
+     moment().add(1, 'month').format("YYYY年MM月")
       }}</el-form-item>
       <el-form-item label="客户名称:" prop="companyName">
         <el-input
@@ -41,6 +39,9 @@
           @keyup.enter="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="来源:" prop="fromCompanyName">
+        <el-input v-model="queryParams.fromCompanyName" placeholder="请输入来源" clearable @keyup.enter="handleQuery" />
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="Search" @click="handleQuery"
           >搜索</el-button
@@ -130,7 +131,7 @@
           {{ scope.row.type === 1 ? scope.row.monthNum : "-" }}
         </template>
       </el-table-column>
-      <el-table-column label="工单执行人" align="center" width="100">
+      <el-table-column label="工单执行人" align="center" width="150">
         <template #default="scope">
           {{
             scope.row.entrust != null
@@ -140,6 +141,7 @@
         </template>
       </el-table-column>
     </el-table>
+    <exports ref="exportRef" :get-list="getList"></exports>
     <!-- 分页 -->
     <pagination
       v-show="total > 0"
@@ -154,6 +156,7 @@
 <script setup name="Company">
 import { getToken, getTenant } from "@/utils/auth";
 import useUserStore from "@/store/modules/user";
+
 import {
   listFactoryNextWorkOrder,
   checkCurrent,
@@ -161,7 +164,10 @@ import {
   delEntrust,
   addEntrust,
 } from "@/api/business/entrust/nextWorkOrder";
+
+import{exportNextFactory} from  "@/api/business/entrust/currentWorkOrder";
 const { proxy } = getCurrentInstance();
+
 const currentMonth = ref(null);
 /** 字典数组区 */
 /** 查询 对象 */
@@ -202,6 +208,7 @@ function checkCurrentMonthHandle() {
   checkCurrent().then((res) => {
     if (res.data.checkResult === true) {
       setCurrentMonth(res.data.currentMonth);
+      
       getList();
     } else {
       proxy.$modal.msgError("未设置当前月,请设置本月");
@@ -253,11 +260,13 @@ function handleSelectionChange(selection) {
 
 /** 导出按钮操作 */
 function handleExport() {
-  exportNextWorkOrder(queryParams.value);
+  exportNextFactory(queryParams.value);
 }
 
 function setCurrentMonth(month) {
-  currentMonth.value = month;
+
+  
+  currentMonth.value = proxy.moment().add(1, 'month').format("YYYY-MM")+"-01";
 }
 
 function setEntrustHandle() {