|
@@ -0,0 +1,539 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="pageIndexClass">
|
|
|
|
+ <div class="content">
|
|
|
|
+ <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
|
|
|
|
+ {
|
|
|
|
+ text: '添加',
|
|
|
|
+ action: () => openModal('add'),
|
|
|
|
+ },
|
|
|
|
+ ]" @get-list="getList">
|
|
|
|
+ </byTable>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <el-dialog :title="modalType == 'add' ? '添加' : '编辑'" v-if="dialogVisible" v-model="dialogVisible" width="50%">
|
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit" v-loading="loadingDialog">
|
|
|
|
+ <template #detail>
|
|
|
|
+ <div style="width:100%">
|
|
|
|
+ <el-button type="primary" @click="handleAdd()" plain style="margin-bottom: 16px">添加</el-button>
|
|
|
|
+ <el-table :data="formData.data.userSalaryDetailList" style="width: 100%;">
|
|
|
|
+ <el-table-column label="结构名称">
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
+ <el-form-item :prop="'userSalaryDetailList.' + $index + '.salaryStructureId'" :rules="rules.salaryStructureId"
|
|
|
|
+ :inline-message="true" class="margin-b-0">
|
|
|
|
+ <el-select v-model="row.salaryStructureId" placeholder="请选择" filterable style="width: 100%">
|
|
|
|
+ <el-option v-for="item in salaryStructureData" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="金额" width="130">
|
|
|
|
+ <template #default="{ row, $index }">
|
|
|
|
+ <div style="width: 100%">
|
|
|
|
+ <el-form-item :prop="'userSalaryDetailList.' + $index + '.money'" :rules="rules.money" :inline-message="true"
|
|
|
|
+ class="margin-b-0 wid100">
|
|
|
|
+ <el-input-number onmousewheel="return false;" v-model="row.money" placeholder="请输入" style="width: 100%" :precision="2"
|
|
|
|
+ :controls="false" :min="0" @change="handleChangeAmount" />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" width="60" align="center" fixed="right">
|
|
|
|
+ <template #default="{ $index }">
|
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </byForm>
|
|
|
|
+ <template #footer>
|
|
|
|
+ <el-button @click="dialogVisible = false" size="default">取 消</el-button>
|
|
|
|
+ <el-button type="primary" @click="submitForm()" size="default">确 定</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-dialog>
|
|
|
|
+
|
|
|
|
+ <el-dialog title="打印" v-if="openPrint" v-model="openPrint" width="920">
|
|
|
|
+ <SalaryConfirmationPDF :rowData="rowData"></SalaryConfirmationPDF>
|
|
|
|
+ </el-dialog>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script setup>
|
|
|
|
+import { computed, ref } from "vue";
|
|
|
|
+import byTable from "@/components/byTable/index";
|
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
|
+import moment from "moment";
|
|
|
|
+import SalaryConfirmationPDF from "@/components/PDF/SalaryConfirmationPDF.vue";
|
|
|
|
+
|
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
|
+const accountCurrency = ref([]);
|
|
|
|
+const employeeTypeData = ref([
|
|
|
|
+ {
|
|
|
|
+ label: "实习员工",
|
|
|
|
+ value: "10",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: "试用员工",
|
|
|
|
+ value: "20",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ label: "正式员工",
|
|
|
|
+ value: "30",
|
|
|
|
+ },
|
|
|
|
+]);
|
|
|
|
+const userList = ref([]);
|
|
|
|
+const salaryStructureData = ref([]);
|
|
|
|
+const deptData = ref([]);
|
|
|
|
+const contractorData = ref([]);
|
|
|
|
+const sourceList = ref({
|
|
|
|
+ data: [],
|
|
|
|
+ pagination: {
|
|
|
|
+ total: 0,
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10,
|
|
|
|
+ keyword: "",
|
|
|
|
+ },
|
|
|
|
+});
|
|
|
|
+const loading = ref(false);
|
|
|
|
+const config = computed(() => {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "员工姓名",
|
|
|
|
+ prop: "nickName",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "劳动关系",
|
|
|
|
+ prop: "employeeType",
|
|
|
|
+ },
|
|
|
|
+ render(val) {
|
|
|
|
+ return proxy.dictValueLabel(val, employeeTypeData.value);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "试用期薪资比例",
|
|
|
|
+ prop: "probationRatio",
|
|
|
|
+ },
|
|
|
|
+ render(val) {
|
|
|
|
+ if (val) {
|
|
|
|
+ return val + "%";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "实习期薪资比例",
|
|
|
|
+ prop: "internshipRatio",
|
|
|
|
+ },
|
|
|
|
+ render(val) {
|
|
|
|
+ if (val) {
|
|
|
|
+ return val + "%";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "合计金额",
|
|
|
|
+ prop: "amount",
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // attrs: {
|
|
|
|
+ // label: "修改时间",
|
|
|
|
+ // prop: "createTime",
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "操作",
|
|
|
|
+ width: "120",
|
|
|
|
+ align: "center",
|
|
|
|
+ },
|
|
|
|
+ renderHTML(row) {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "修改",
|
|
|
|
+ type: "primary",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ update(row);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attrs: {
|
|
|
|
+ label: "确认单",
|
|
|
|
+ type: "primary",
|
|
|
|
+ text: true,
|
|
|
|
+ },
|
|
|
|
+ el: "button",
|
|
|
|
+ click() {
|
|
|
|
+ clickPrint(row);
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // attrs: {
|
|
|
|
+ // label: "删除",
|
|
|
|
+ // type: "danger",
|
|
|
|
+ // text: true,
|
|
|
|
+ // },
|
|
|
|
+ // el: "button",
|
|
|
|
+ // click() {
|
|
|
|
+ // proxy
|
|
|
|
+ // .msgConfirm()
|
|
|
|
+ // .then((res) => {
|
|
|
|
+ // proxy
|
|
|
|
+ // .post("/userSalaryManage/delete", {
|
|
|
|
+ // id: row.userId,
|
|
|
|
+ // })
|
|
|
|
+ // .then((res) => {
|
|
|
|
+ // proxy.msgTip("操作成功", 1);
|
|
|
|
+ // getList();
|
|
|
|
+ // });
|
|
|
|
+ // })
|
|
|
|
+ // .catch((err) => {});
|
|
|
|
+ // },
|
|
|
|
+ // },
|
|
|
|
+ ];
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ];
|
|
|
|
+});
|
|
|
|
+const corporationList = ref([]);
|
|
|
|
+const getList = async (req) => {
|
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
|
+ loading.value = true;
|
|
|
|
+ proxy
|
|
|
|
+ .post("/userSalaryManage/page", sourceList.value.pagination)
|
|
|
|
+ .then((res) => {
|
|
|
|
+ sourceList.value.data = res.rows;
|
|
|
|
+ sourceList.value.pagination.total = res.total;
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ loading.value = false;
|
|
|
|
+ }, 200);
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+getList();
|
|
|
|
+
|
|
|
|
+const getDeptData = () => {
|
|
|
|
+ proxy
|
|
|
|
+ .get("/tenantUser/listAll", {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 10000,
|
|
|
|
+ tenantId: proxy.useUserStore().user.tenantId,
|
|
|
|
+ // companyId: proxy.useUserStore().user.companyId,
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ userList.value = res.rows.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ label: item.nickName,
|
|
|
|
+ value: item.userId,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ proxy
|
|
|
|
+ .post("/salaryStructure/page", {
|
|
|
|
+ pageNum: 1,
|
|
|
|
+ pageSize: 999,
|
|
|
|
+ })
|
|
|
|
+ .then((res) => {
|
|
|
|
+ salaryStructureData.value = res.rows.map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ label: item.name,
|
|
|
|
+ value: item.id,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+getDeptData();
|
|
|
|
+
|
|
|
|
+const modalType = ref("add");
|
|
|
|
+const dialogVisible = ref(false);
|
|
|
|
+const loadingDialog = ref(false);
|
|
|
|
+const submit = ref(null);
|
|
|
|
+const formOption = reactive({
|
|
|
|
+ inline: true,
|
|
|
|
+ labelWidth: 120,
|
|
|
|
+ itemWidth: 100,
|
|
|
|
+ rules: [],
|
|
|
|
+});
|
|
|
|
+const formConfig = computed(() => {
|
|
|
|
+ return [
|
|
|
|
+ {
|
|
|
|
+ type: "title1",
|
|
|
|
+ title: "基本信息",
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "select",
|
|
|
|
+ prop: "userId",
|
|
|
|
+ label: "员工姓名",
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ disabled: false,
|
|
|
|
+ data: userList.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "select",
|
|
|
|
+ prop: "employeeType",
|
|
|
|
+ label: "劳动关系",
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ disabled: false,
|
|
|
|
+ data: employeeTypeData.value,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "number",
|
|
|
|
+ prop: "probationRatio",
|
|
|
|
+ label: "试用期薪资比例",
|
|
|
|
+ precision: 2,
|
|
|
|
+ min: 0,
|
|
|
|
+ max: 100,
|
|
|
|
+ controls: false,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "number",
|
|
|
|
+ prop: "internshipRatio",
|
|
|
|
+ label: "实习期薪资比例",
|
|
|
|
+ precision: 2,
|
|
|
|
+ min: 0,
|
|
|
|
+ max: 100,
|
|
|
|
+ controls: false,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "date",
|
|
|
|
+ itemType: "date",
|
|
|
|
+ prop: "documentaryTime",
|
|
|
|
+ label: "入职日期",
|
|
|
|
+ disabled: false,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "date",
|
|
|
|
+ itemType: "date",
|
|
|
|
+ prop: "effectiveDate",
|
|
|
|
+ label: "生效日期",
|
|
|
|
+ disabled: false,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "date",
|
|
|
|
+ itemType: "date",
|
|
|
|
+ prop: "fullTimeDate",
|
|
|
|
+ label: "转正日期",
|
|
|
|
+ disabled: false,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ type: "number",
|
|
|
|
+ prop: "probationPeriod",
|
|
|
|
+ label: "试用期限(月)",
|
|
|
|
+ precision: 0,
|
|
|
|
+ min: 0,
|
|
|
|
+ max: 12,
|
|
|
|
+ controls: false,
|
|
|
|
+ itemWidth: 50,
|
|
|
|
+ },
|
|
|
|
+ // {
|
|
|
|
+ // type: "number",
|
|
|
|
+ // prop: "amount",
|
|
|
|
+ // label: "合计金额",
|
|
|
|
+ // precision: 2,
|
|
|
|
+ // controls: false,
|
|
|
|
+ // itemWidth: 50,
|
|
|
|
+ // disabled: true,
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // type: "title1",
|
|
|
|
+ // title: "薪资结构",
|
|
|
|
+ // },
|
|
|
|
+ // {
|
|
|
|
+ // type: "slot",
|
|
|
|
+ // slotName: "detail",
|
|
|
|
+ // },
|
|
|
|
+ ];
|
|
|
|
+});
|
|
|
|
+const rules = ref({
|
|
|
|
+ userId: [{ required: true, message: "请选择员工姓名", trigger: "change" }],
|
|
|
|
+ employeeType: [
|
|
|
|
+ { required: true, message: "请选择劳动关系", trigger: "change" },
|
|
|
|
+ ],
|
|
|
|
+ probationRatio: [
|
|
|
|
+ { required: true, message: "请输入试用期薪资比例", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ internshipRatio: [
|
|
|
|
+ { required: true, message: "请输入实习期薪资比例", trigger: "blur" },
|
|
|
|
+ ],
|
|
|
|
+ salaryStructureId: [
|
|
|
|
+ { required: true, message: "请选择结构名称", trigger: "change" },
|
|
|
|
+ ],
|
|
|
|
+ money: [{ required: true, message: "请输入金额", trigger: "blur" }],
|
|
|
|
+ fileList: [{ required: true, message: "请上传签字文件", trigger: "change" }],
|
|
|
|
+ // remark: [{ required: true, message: "请输入说明", trigger: "blur" }],
|
|
|
|
+});
|
|
|
|
+const formData = reactive({
|
|
|
|
+ data: {},
|
|
|
|
+});
|
|
|
|
+const openModal = (val) => {
|
|
|
|
+ modalType.value = val;
|
|
|
|
+ formData.data = {
|
|
|
|
+ userSalaryDetailList: [{ salaryStructureId: "", money: null }],
|
|
|
|
+ fileList: [],
|
|
|
|
+ };
|
|
|
|
+ loadingDialog.value = false;
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const handleAdd = () => {
|
|
|
|
+ formData.data.userSalaryDetailList.push({
|
|
|
|
+ salaryStructureId: "",
|
|
|
|
+ money: null,
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const handleChangeAmount = () => {
|
|
|
|
+ let money = 0;
|
|
|
|
+ if (
|
|
|
|
+ formData.data.userSalaryDetailList &&
|
|
|
|
+ formData.data.userSalaryDetailList.length > 0
|
|
|
|
+ ) {
|
|
|
|
+ for (let i = 0; i < formData.data.userSalaryDetailList.length; i++) {
|
|
|
|
+ if (formData.data.userSalaryDetailList[i].money) {
|
|
|
|
+ money = parseFloat(
|
|
|
|
+ Number(money) + Number(formData.data.userSalaryDetailList[i].money)
|
|
|
|
+ ).toFixed(2);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ formData.data.amount = money;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const handleRemove = (index) => {
|
|
|
|
+ formData.data.userSalaryDetailList.splice(index, 1);
|
|
|
|
+ handleChangeAmount();
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const clickBalance = () => {
|
|
|
|
+ if (
|
|
|
|
+ formData.data.accountRemainderList &&
|
|
|
|
+ formData.data.accountRemainderList.length > 0
|
|
|
|
+ ) {
|
|
|
|
+ formData.data.accountRemainderList.push({
|
|
|
|
+ currency: "",
|
|
|
|
+ remainder: undefined,
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ formData.data.accountRemainderList = [
|
|
|
|
+ { currency: "", remainder: undefined },
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const isRepeat = (arr) => {
|
|
|
|
+ var hash = {};
|
|
|
|
+ for (var i in arr) {
|
|
|
|
+ if (hash[arr[i].currency]) return true;
|
|
|
|
+ hash[arr[i].currency] = true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const submitForm = () => {
|
|
|
|
+ submit.value.handleSubmit(() => {
|
|
|
|
+ // if (
|
|
|
|
+ // !(
|
|
|
|
+ // formData.data.userSalaryDetailList &&
|
|
|
|
+ // formData.data.userSalaryDetailList.length > 0
|
|
|
|
+ // )
|
|
|
|
+ // ) {
|
|
|
|
+ // return proxy.msgTip("请添加薪资结构", 2);
|
|
|
|
+ // }
|
|
|
|
+ loadingDialog.value = true;
|
|
|
|
+ proxy.post("/userSalaryManage/edit", formData.data).then(
|
|
|
|
+ () => {
|
|
|
|
+ proxy.msgTip("操作成功", 1);
|
|
|
|
+ dialogVisible.value = false;
|
|
|
|
+ getList();
|
|
|
|
+ },
|
|
|
|
+ (err) => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ loadingDialog.value = false;
|
|
|
|
+ }
|
|
|
|
+ );
|
|
|
|
+ // if (
|
|
|
|
+ // formData.data.accountRemainderList &&
|
|
|
|
+ // formData.data.accountRemainderList.length > 0
|
|
|
|
+ // ) {
|
|
|
|
+ // if (isRepeat(formData.data.accountRemainderList)) {
|
|
|
|
+ // return ElMessage("请勿重复添加货币余额");
|
|
|
|
+ // } else {
|
|
|
|
+ // loadingDialog.value = true;
|
|
|
|
+ // proxy.post("/accountManagement/" + modalType.value, formData.data).then(
|
|
|
|
+ // () => {
|
|
|
|
+ // ElMessage({
|
|
|
|
+ // message: modalType.value == "add" ? "添加成功" : "编辑成功",
|
|
|
|
+ // type: "success",
|
|
|
|
+ // });
|
|
|
|
+ // dialogVisible.value = false;
|
|
|
|
+ // getList();
|
|
|
|
+ // },
|
|
|
|
+ // (err) => {
|
|
|
|
+ // console.log(err);
|
|
|
|
+ // loadingDialog.value = false;
|
|
|
|
+ // }
|
|
|
|
+ // );
|
|
|
|
+ // }
|
|
|
|
+ // } else {
|
|
|
|
+ // return ElMessage("请添加至少一条类型余额");
|
|
|
|
+ // }
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const update = (row) => {
|
|
|
|
+ loadingDialog.value = false;
|
|
|
|
+ modalType.value = "edit";
|
|
|
|
+ proxy.post("/userSalaryManage/detail", { userId: row.userId }).then((res) => {
|
|
|
|
+ formData.data = res;
|
|
|
|
+ proxy
|
|
|
|
+ .post("/fileInfo/getList", { businessIdList: [row.userId] })
|
|
|
|
+ .then((fileObj) => {
|
|
|
|
+ if (fileObj[row.userId] && fileObj[row.userId].length > 0) {
|
|
|
|
+ formData.data.fileList = fileObj[row.userId]
|
|
|
|
+ .filter((x) => x.businessType == "10")
|
|
|
|
+ .map((item) => {
|
|
|
|
+ return {
|
|
|
|
+ ...item,
|
|
|
|
+ name: item.fileName,
|
|
|
|
+ url: item.fileUrl,
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ } else {
|
|
|
|
+ formData.data.fileList = [];
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ dialogVisible.value = true;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const openPrint = ref(false);
|
|
|
|
+const rowData = ref({});
|
|
|
|
+const clickPrint = (row) => {
|
|
|
|
+ rowData.value = {
|
|
|
|
+ id: row.userId,
|
|
|
|
+ };
|
|
|
|
+ openPrint.value = true;
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.tenant {
|
|
|
|
+ padding: 20px;
|
|
|
|
+}
|
|
|
|
+::v-deep(.el-input-number .el-input__inner) {
|
|
|
|
+ text-align: left;
|
|
|
|
+}
|
|
|
|
+</style>
|