| | |
| | | // 绩æç®¡ç-çæ¬¡-å页æ¥è¯¢ |
| | | export function page(query) { |
| | | return request({ |
| | | url: "/performanceShift/page", |
| | | url: "/personalShift/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | |
| | | // 绩æç®¡ç-çæ¬¡-年份å页æ¥è¯¢ |
| | | export function pageYear(query) { |
| | | return request({ |
| | | url: "/performanceShift/pageYear", |
| | | url: "/personalShift/pageYear", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | |
| | | // 绩æç®¡ç-çæ¬¡-æç |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/performanceShift/add", |
| | | url: "/personalShift/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | |
| | | // 绩æç®¡ç-çæ¬¡-å¯¼åº |
| | | export function exportFile(query) { |
| | | return request({ |
| | | url: "/performanceShift/export", |
| | | url: "/personalShift/export", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | |
| | | // 绩æç®¡ç-çæ¬¡-çæ¬¡ç¶æä¿®æ¹ |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/performanceShift/update", |
| | | url: "/personalShift/update", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | |
| | | url: '/system/user/userListNoPage', |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢å¨èåå·¥å°è´¦ |
| | | export function staffOnJobListPage(query) { |
| | | return request({ |
| | | url: '/staff/staffOnJob/listPage', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | // éè´éè´§å |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function findPurchaseReturnOrderListPage(query) { |
| | | return request({ |
| | | url: "/purchaseReturnOrders/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ°å¢ |
| | | export function createPurchaseReturnOrder(data) { |
| | | return request({ |
| | | url: "/purchaseReturnOrders/add", |
| | | method: "post", |
| | | data |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from "@/utils/request"; |
| | | |
| | | |
| | | // éå®éè´§-æ¥è¯¢ |
| | | // /returnManagement/listPage |
| | | export function returnManagementList(query) { |
| | | return request({ |
| | | url: "/returnManagement/listPage", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // éå®éè´§-æ·»å |
| | | // /returnManagement/add |
| | | export function returnManagementAdd(data) { |
| | | return request({ |
| | | url: "/returnManagement/add", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // éå®éè´§-ä¿®æ¹ |
| | | // /returnManagement/update |
| | | export function returnManagementUpdate(data) { |
| | | return request({ |
| | | url: "/returnManagement/update", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | // éå®éè´§-å é¤ |
| | | // /returnManagement/del |
| | | export function returnManagementDel(query) { |
| | | return request({ |
| | | url: "/returnManagement/del", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // éå®éè´§-æ¥è¯¢ |
| | | // /returnManagement/getById |
| | | export function returnManagementGetById(query) { |
| | | return request({ |
| | | url: "/returnManagement/getById", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // éå®éè´§-æ ¹æ®åºåºåæ¥è¯¢éå®è®¢å以å产åä¿¡æ¯ |
| | | // /returnManagement/getByShippingId |
| | | export function returnManagementGetByShippingId(query) { |
| | | return request({ |
| | | url: "/returnManagement/getByShippingId", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // éè¿å®¢æ·åç§°æ¥è¯¢ |
| | | // /shippingInfo/getByCustomerName |
| | | export function getSalesLedger(query) { |
| | | return request({ |
| | | url: '/shippingInfo/getByCustomerName', |
| | | method: 'get', |
| | | params: query, |
| | | }) |
| | | } |
| | | |
| | | // å¤ç |
| | | // /returnManagement/handle |
| | | export function returnManagementHandle(data) { |
| | | return request({ |
| | | url: "/returnManagement/handle", |
| | | method: "get", |
| | | params: data, |
| | | }); |
| | | } |
| | |
| | | :disabled="operationType === 'view'" /> |
| | | </el-form-item> --> |
| | | <!-- æå¡èå´ --> |
| | | <el-form-item label="çæ¬¡" |
| | | prop="shift"> |
| | | <el-select v-model="form.shift" |
| | | placeholder="è¯·éæ©çæ¬¡" |
| | | :disabled="operationType === 'view'" |
| | | style="width: 100%"> |
| | | <el-option v-for="item in shifts_list" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æå¡èå´(m)" |
| | | prop="radius"> |
| | | <el-input-number v-model="form.radius" |
| | |
| | | import { Position } from "@element-plus/icons-vue"; |
| | | import { deptTreeSelect } from "@/api/system/user.js"; |
| | | import { addAttendanceRule } from "@/api/personnelManagement/attendanceRules.js"; |
| | | import { useDict } from "@/utils/dict"; |
| | | |
| | | const props = defineProps({ |
| | | modelValue: { |
| | |
| | | return "æ¥ççæ¬¡"; |
| | | }); |
| | | |
| | | // è·åçæ¬¡åå
¸å¼ |
| | | const { shifts_list } = useDict("shifts_list"); |
| | | |
| | | // è¡¨åæ°æ® |
| | | const formRef = ref(); |
| | | const form = reactive({ |
| | |
| | | radius: 100, |
| | | startAt: "09:00", |
| | | endAt: "18:00", |
| | | shift: "", |
| | | }); |
| | | |
| | | // 表åéªè¯è§å |
| | |
| | | ], |
| | | longitude: [{ required: true, message: "è¯·éæ©æå¡ä½ç½®", trigger: "blur" }], |
| | | latitude: [{ required: true, message: "è¯·éæ©æå¡ä½ç½®", trigger: "blur" }], |
| | | shift: [{ required: true, message: "è¯·éæ©çæ¬¡", trigger: "change" }], |
| | | radius: [{ required: true, message: "请è¾å
¥æå¡èå´", trigger: "blur" }], |
| | | startAt: [{ required: true, message: "è¯·éæ©ä¸çæ¶é´", trigger: "change" }], |
| | | endAt: [ |
| | |
| | | radius: 100, |
| | | startAt: "09:00", |
| | | endAt: "18:00", |
| | | shift: "", |
| | | }); |
| | | |
| | | // 妿æ¯ç¼è¾ææ¥çï¼å¡«å
æ°æ® |
| | |
| | | {{ getDeptNameById(scope.row.sysDeptId) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="çæ¬¡"> |
| | | <template #default="scope"> |
| | | {{ getShiftNameByValue(scope.row.shift) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="locationName" |
| | | label="å°ç¹åç§°" /> |
| | | <el-table-column prop="longitude" |
| | |
| | | <script setup> |
| | | import { ref, reactive, onMounted } from "vue"; |
| | | import { ElMessage, ElMessageBox } from "element-plus"; |
| | | import { Plus, Edit, Delete, Search, Refresh } from "@element-plus/icons-vue"; |
| | | import { |
| | | Plus, |
| | | Edit, |
| | | Delete, |
| | | Search, |
| | | Refresh, |
| | | ArrowLeft, |
| | | } from "@element-plus/icons-vue"; |
| | | import Pagination from "@/components/Pagination/index.vue"; |
| | | import RuleForm from "./components/form.vue"; |
| | | import { deptTreeSelect } from "@/api/system/user.js"; |
| | |
| | | getAttendanceRules, |
| | | deleteAttendanceRule, |
| | | } from "@/api/personnelManagement/attendanceRules.js"; |
| | | import { useDict } from "@/utils/dict"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | |
| | | |
| | | // é¨é¨é项 |
| | | const deptOptions = ref([]); |
| | | // è·åçæ¬¡åå
¸å¼ |
| | | const { shifts_list } = useDict("shifts_list"); |
| | | |
| | | // å¼¹çªæ§å¶ |
| | | const dialogVisible = ref(false); |
| | |
| | | ).padStart(2, "0")}`; |
| | | }; |
| | | |
| | | // æ ¹æ®ç次å¼è·åçæ¬¡åç§° |
| | | const getShiftNameByValue = value => { |
| | | if (!value) return ""; |
| | | const shift = shifts_list.value.find(item => item.value === value); |
| | | return shift ? shift.label : value; |
| | | }; |
| | | |
| | | // è·åé¨é¨å表 |
| | | const fetchDeptOptions = () => { |
| | | deptTreeSelect().then(response => { |
| | |
| | | </el-descriptions> |
| | | </el-card> --> |
| | | <div class="attendance-operation"> |
| | | <el-button @click="handleBack" |
| | | type="default" |
| | | size="small" |
| | | style="margin-right: 16px"> |
| | | <el-icon> |
| | | <ArrowLeft /> |
| | | </el-icon> |
| | | è¿åæç管ç |
| | | </el-button> |
| | | <!-- æ¥è¯¢æ¡ä»¶ï¼ç®¡çåè夿¥æ¥ï¼ --> |
| | | <el-form :model="searchForm" |
| | | :inline="true" |
| | |
| | | fetchTodayData(); |
| | | fetchDeptOptions(); |
| | | }); |
| | | |
| | | // è¿åæç管çé¡µé¢ |
| | | const handleBack = () => { |
| | | router.push({ |
| | | path: "/personnelManagement/classsSheduling/index", |
| | | }); |
| | | }; |
| | | |
| | | onBeforeUnmount(() => { |
| | | if (timer) { |
| | |
| | | @keyup.enter="refreshTable()" /> |
| | | </div> |
| | | <div class="search-item"> |
| | | <el-tree-select v-model="query.deptId" |
| | | <el-tree-select v-model="query.sysDeptId" |
| | | :data="deptOptions" |
| | | :props="{ value: 'id', label: 'label', children: 'children' }" |
| | | value-key="id" |
| | |
| | | class="shift-dropdown"> |
| | | <div class="shift-box" |
| | | :class="{ |
| | | 'shift-box-early': m.shift === '0', |
| | | 'shift-box-mid': m.shift === '1', |
| | | 'shift-box-night': m.shift === '2', |
| | | 'shift-box-rest': m.shift === '3', |
| | | 'shift-box-leave': m.shift === '4', |
| | | 'shift-box-other': m.shift === '5', |
| | | 'shift-box-business': m.shift === '6', |
| | | 'shift-box-early': m.shift === 'æ©ç', |
| | | 'shift-box-mid': m.shift === 'ä¸ç', |
| | | 'shift-box-night': m.shift === 'å¤ç', |
| | | 'shift-box-rest': m.shift === '伿¯', |
| | | 'shift-box-leave': m.shift === '请å', |
| | | 'shift-box-other': m.shift === 'å¤11', |
| | | 'shift-box-business': m.shift === 'å¤12', |
| | | }"> |
| | | <span class="shift-text">{{ getShiftByDic(m.shift) || 'â' }}</span> |
| | | <span class="shift-text">{{ getShiftNameByValue(m.shift) || 'â' }}</span> |
| | | </div> |
| | | <template #dropdown> |
| | | <el-dropdown-menu> |
| | | <el-dropdown-item v-for="(n, j) in classType" |
| | | :key="'h' + j" |
| | | :command="n.id">{{ n.locationName |
| | | :command="n.id">{{ n.shift || 'â' |
| | | }}</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </template> |
| | |
| | | clearable |
| | | collapse-tags> |
| | | <el-option v-for="item in personList" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId"> |
| | | :key="item.id" |
| | | :label="item.staffName" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | | </div> |
| | |
| | | style="width: 100%"> |
| | | <el-option v-for="item in classType" |
| | | :key="item.id" |
| | | :label="item.locationName" |
| | | :label="getShiftNameByValue(item.shift)" |
| | | :value="item.id"> |
| | | </el-option> |
| | | </el-select> |
| | |
| | | add, |
| | | exportFile, |
| | | update, |
| | | selectUserCondition, |
| | | staffOnJobListPage, |
| | | } from "@/api/personnelManagement/class"; |
| | | import { deptTreeSelect } from "@/api/system/user.js"; |
| | | import { getAttendanceRules } from "@/api/personnelManagement/attendanceRules.js"; |
| | | import { useDict } from "@/utils/dict"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const router = useRouter(); |
| | | |
| | | // æ¥è¯¢æ¡ä»¶ |
| | | const query = reactive({ |
| | | userName: "", |
| | | deptId: "", |
| | | sysDeptId: "", |
| | | year: new Date(), |
| | | month: new Date().getMonth() + 1, |
| | | }); |
| | | |
| | | // è·åçæ¬¡åå
¸å¼ |
| | | const { shifts_list } = useDict("shifts_list"); |
| | | // æä»½é项 |
| | | const monthOptions = [ |
| | | { value: 1, label: "1æ" }, |
| | |
| | | const deptOptions = ref([]); |
| | | |
| | | // å¨å表 |
| | | const weeks = ref([ |
| | | { weekNum: 1, week: "å¨ä¸", day: "01" }, |
| | | { weekNum: 1, week: "å¨äº", day: "02" }, |
| | | { weekNum: 1, week: "å¨ä¸", day: "03" }, |
| | | { weekNum: 1, week: "å¨å", day: "04" }, |
| | | { weekNum: 1, week: "å¨äº", day: "05" }, |
| | | { weekNum: 1, week: "å¨å
", day: "06" }, |
| | | { weekNum: 2, week: "卿¥", day: "07" }, |
| | | { weekNum: 2, week: "å¨ä¸", day: "08" }, |
| | | { weekNum: 2, week: "å¨äº", day: "09" }, |
| | | { weekNum: 2, week: "å¨ä¸", day: "10" }, |
| | | { weekNum: 2, week: "å¨å", day: "11" }, |
| | | { weekNum: 2, week: "å¨äº", day: "12" }, |
| | | { weekNum: 2, week: "å¨å
", day: "13" }, |
| | | { weekNum: 3, week: "卿¥", day: "14" }, |
| | | { weekNum: 3, week: "å¨ä¸", day: "15" }, |
| | | { weekNum: 3, week: "å¨äº", day: "16" }, |
| | | { weekNum: 3, week: "å¨ä¸", day: "17" }, |
| | | { weekNum: 3, week: "å¨å", day: "18" }, |
| | | { weekNum: 3, week: "å¨äº", day: "19" }, |
| | | { weekNum: 3, week: "å¨å
", day: "20" }, |
| | | { weekNum: 4, week: "卿¥", day: "21" }, |
| | | { weekNum: 4, week: "å¨ä¸", day: "22" }, |
| | | { weekNum: 4, week: "å¨äº", day: "23" }, |
| | | { weekNum: 4, week: "å¨ä¸", day: "24" }, |
| | | { weekNum: 4, week: "å¨å", day: "25" }, |
| | | { weekNum: 4, week: "å¨äº", day: "26" }, |
| | | { weekNum: 4, week: "å¨å
", day: "27" }, |
| | | { weekNum: 5, week: "卿¥", day: "28" }, |
| | | { weekNum: 5, week: "å¨ä¸", day: "29" }, |
| | | { weekNum: 5, week: "å¨äº", day: "30" }, |
| | | ]); |
| | | const weeks = ref([]); |
| | | |
| | | // çæ¬¡ç±»å |
| | | const classType = ref([]); |
| | |
| | | }); |
| | | |
| | | // åè¡¨æ°æ® |
| | | const listForm = ref([ |
| | | { |
| | | id: 1, |
| | | name: "å¼ ä¸", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | æ©ç: 10, |
| | | ä¸ç: 8, |
| | | å¤ç: 4, |
| | | 伿¯: 6, |
| | | 请å: 0, |
| | | åºå·®: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: "æå", |
| | | monthlyAttendance: { |
| | | totalAttendance: 20, |
| | | æ©ç: 8, |
| | | ä¸ç: 6, |
| | | å¤ç: 6, |
| | | 伿¯: 8, |
| | | 请å: 2, |
| | | åºå·®: 0, |
| | | }, |
| | | day0: 8, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 31, shift: "1" }, |
| | | { id: 32, shift: "1" }, |
| | | { id: 33, shift: "2" }, |
| | | { id: 34, shift: "2" }, |
| | | { id: 35, shift: "3" }, |
| | | { id: 36, shift: "0" }, |
| | | { id: 37, shift: "0" }, |
| | | { id: 38, shift: "1" }, |
| | | { id: 39, shift: "1" }, |
| | | { id: 40, shift: "2" }, |
| | | { id: 41, shift: "2" }, |
| | | { id: 42, shift: "3" }, |
| | | { id: 43, shift: "0" }, |
| | | { id: 44, shift: "0" }, |
| | | { id: 45, shift: "1" }, |
| | | { id: 46, shift: "1" }, |
| | | { id: 47, shift: "2" }, |
| | | { id: 48, shift: "2" }, |
| | | { id: 49, shift: "3" }, |
| | | { id: 50, shift: "0" }, |
| | | { id: 51, shift: "0" }, |
| | | { id: 52, shift: "4" }, |
| | | { id: 53, shift: "4" }, |
| | | { id: 54, shift: "1" }, |
| | | { id: 55, shift: "1" }, |
| | | { id: 56, shift: "2" }, |
| | | { id: 57, shift: "2" }, |
| | | { id: 58, shift: "3" }, |
| | | { id: 59, shift: "0" }, |
| | | { id: 60, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: "çäº", |
| | | monthlyAttendance: { |
| | | totalAttendance: 23, |
| | | æ©ç: 9, |
| | | ä¸ç: 9, |
| | | å¤ç: 5, |
| | | 伿¯: 5, |
| | | 请å: 0, |
| | | åºå·®: 2, |
| | | }, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | list: [ |
| | | { id: 61, shift: "2" }, |
| | | { id: 62, shift: "2" }, |
| | | { id: 63, shift: "3" }, |
| | | { id: 64, shift: "0" }, |
| | | { id: 65, shift: "0" }, |
| | | { id: 66, shift: "1" }, |
| | | { id: 67, shift: "1" }, |
| | | { id: 68, shift: "2" }, |
| | | { id: 69, shift: "2" }, |
| | | { id: 70, shift: "3" }, |
| | | { id: 71, shift: "0" }, |
| | | { id: 72, shift: "0" }, |
| | | { id: 73, shift: "1" }, |
| | | { id: 74, shift: "1" }, |
| | | { id: 75, shift: "2" }, |
| | | { id: 76, shift: "2" }, |
| | | { id: 77, shift: "3" }, |
| | | { id: 78, shift: "0" }, |
| | | { id: 79, shift: "0" }, |
| | | { id: 80, shift: "1" }, |
| | | { id: 81, shift: "1" }, |
| | | { id: 82, shift: "6" }, |
| | | { id: 83, shift: "6" }, |
| | | { id: 84, shift: "2" }, |
| | | { id: 85, shift: "2" }, |
| | | { id: 86, shift: "3" }, |
| | | { id: 87, shift: "0" }, |
| | | { id: 88, shift: "0" }, |
| | | { id: 89, shift: "1" }, |
| | | { id: 90, shift: "1" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: "å¼ ä¸", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | æ©ç: 10, |
| | | ä¸ç: 8, |
| | | å¤ç: 4, |
| | | 伿¯: 6, |
| | | 请å: 0, |
| | | åºå·®: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: "å¼ ä¸", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | æ©ç: 10, |
| | | ä¸ç: 8, |
| | | å¤ç: 4, |
| | | 伿¯: 6, |
| | | 请å: 0, |
| | | åºå·®: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 6, |
| | | name: "å¼ ä¸", |
| | | monthlyAttendance: { |
| | | totalAttendance: 22, |
| | | æ©ç: 10, |
| | | ä¸ç: 8, |
| | | å¤ç: 4, |
| | | 伿¯: 6, |
| | | 请å: 0, |
| | | åºå·®: 0, |
| | | }, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | list: [ |
| | | { id: 1, shift: "0" }, |
| | | { id: 2, shift: "0" }, |
| | | { id: 3, shift: "1" }, |
| | | { id: 4, shift: "1" }, |
| | | { id: 5, shift: "2" }, |
| | | { id: 6, shift: "2" }, |
| | | { id: 7, shift: "3" }, |
| | | { id: 8, shift: "0" }, |
| | | { id: 9, shift: "0" }, |
| | | { id: 10, shift: "1" }, |
| | | { id: 11, shift: "1" }, |
| | | { id: 12, shift: "2" }, |
| | | { id: 13, shift: "2" }, |
| | | { id: 14, shift: "3" }, |
| | | { id: 15, shift: "0" }, |
| | | { id: 16, shift: "0" }, |
| | | { id: 17, shift: "1" }, |
| | | { id: 18, shift: "1" }, |
| | | { id: 19, shift: "2" }, |
| | | { id: 20, shift: "2" }, |
| | | { id: 21, shift: "3" }, |
| | | { id: 22, shift: "0" }, |
| | | { id: 23, shift: "0" }, |
| | | { id: 24, shift: "1" }, |
| | | { id: 25, shift: "1" }, |
| | | { id: 26, shift: "2" }, |
| | | { id: 27, shift: "2" }, |
| | | { id: 28, shift: "3" }, |
| | | { id: 29, shift: "0" }, |
| | | { id: 30, shift: "0" }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const listForm = ref([]); |
| | | |
| | | // å½å页 |
| | | const currentPage = ref(1); |
| | |
| | | const monthList = ref([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); |
| | | |
| | | // 年度å表 |
| | | const yearList = ref([ |
| | | { |
| | | id: 1, |
| | | name: "å¼ ä¸", |
| | | work_time: 260, |
| | | day0: 98, |
| | | day1: 78, |
| | | day2: 46, |
| | | day3: 74, |
| | | day4: 14, |
| | | day6: 10, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 4, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 7, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 9, |
| | | day4: 3, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 0, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 4, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 0, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 5, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: "æå", |
| | | work_time: 252, |
| | | day0: 90, |
| | | day1: 72, |
| | | day2: 50, |
| | | day3: 76, |
| | | day4: 18, |
| | | day6: 8, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 9, |
| | | day1: 7, |
| | | day2: 5, |
| | | day3: 7, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 10, |
| | | day4: 4, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 8, |
| | | day1: 8, |
| | | day2: 6, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 8, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 17, |
| | | day0: 5, |
| | | day1: 5, |
| | | day2: 7, |
| | | day3: 9, |
| | | day4: 5, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 8, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 9, |
| | | day4: 3, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: "çäº", |
| | | work_time: 268, |
| | | day0: 102, |
| | | day1: 82, |
| | | day2: 48, |
| | | day3: 70, |
| | | day4: 10, |
| | | day6: 14, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 24, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 4, |
| | | day4: 0, |
| | | day6: 3, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 24, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 4, |
| | | day4: 0, |
| | | day6: 3, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: "èµµå
", |
| | | work_time: 248, |
| | | day0: 88, |
| | | day1: 70, |
| | | day2: 50, |
| | | day3: 78, |
| | | day4: 20, |
| | | day6: 6, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 8, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 3, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 17, |
| | | day0: 5, |
| | | day1: 5, |
| | | day2: 7, |
| | | day3: 10, |
| | | day4: 5, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 7, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 9, |
| | | day4: 2, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 16, |
| | | day0: 4, |
| | | day1: 4, |
| | | day2: 8, |
| | | day3: 10, |
| | | day4: 6, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 19, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 7, |
| | | day3: 9, |
| | | day4: 2, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 18, |
| | | day0: 6, |
| | | day1: 6, |
| | | day2: 6, |
| | | day3: 9, |
| | | day4: 4, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 7, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 5, |
| | | name: "é±ä¸", |
| | | work_time: 266, |
| | | day0: 100, |
| | | day1: 84, |
| | | day2: 46, |
| | | day3: 72, |
| | | day4: 12, |
| | | day6: 12, |
| | | monthList: [ |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 21, |
| | | day0: 8, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 9, |
| | | day1: 9, |
| | | day2: 5, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 2, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 22, |
| | | day0: 9, |
| | | day1: 8, |
| | | day2: 5, |
| | | day3: 6, |
| | | day4: 1, |
| | | day6: 1, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 20, |
| | | day0: 7, |
| | | day1: 7, |
| | | day2: 6, |
| | | day3: 8, |
| | | day4: 2, |
| | | day6: 0, |
| | | }, |
| | | { |
| | | totalMonthAttendance: 23, |
| | | day0: 10, |
| | | day1: 9, |
| | | day2: 4, |
| | | day3: 5, |
| | | day4: 0, |
| | | day6: 0, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const yearList = ref([]); |
| | | |
| | | // 导åºå è½½ç¶æ |
| | | const downLoading = ref(false); |
| | |
| | | JSON.parse(JSON.stringify(response.data)) |
| | | ); |
| | | }); |
| | | }; |
| | | |
| | | // æ ¹æ®ç次å¼è·åçæ¬¡åç§° |
| | | const getShiftNameByValue = value => { |
| | | if (!value) return ""; |
| | | const shift = shifts_list.value.find(item => item.value === value); |
| | | return shift ? shift.label : value; |
| | | }; |
| | | |
| | | // è¿æ»¤ç¦ç¨çé¨é¨ |
| | |
| | | yearList.value = []; |
| | | currentPage.value = 1; |
| | | query.userName = ""; |
| | | query.deptId = ""; |
| | | query.sysDeptId = ""; |
| | | query.year = new Date(); |
| | | query.month = new Date().getMonth() + 1; |
| | | if (query.month) { |
| | |
| | | current: currentPage.value, |
| | | time: year + "-" + month + "-01 00:00:00", |
| | | userName: query.userName, |
| | | deptId: query.deptId, |
| | | sysDeptId: query.sysDeptId, |
| | | }) |
| | | .then(res => { |
| | | pageLoading.value = false; |
| | |
| | | current: currentPage.value, |
| | | time: year + "-01-01 00:00:00", |
| | | userName: query.userName, |
| | | deptId: query.deptId, |
| | | sysDeptId: query.sysDeptId, |
| | | }).then(res => { |
| | | pageLoading.value = false; |
| | | total.value = res.data.total; |
| | |
| | | add({ |
| | | startWeek, |
| | | endWeek, |
| | | userId: schedulingQuery.userId.join(","), |
| | | shift: schedulingQuery.shift, |
| | | staffOnJobId: schedulingQuery.userId.join(","), |
| | | personalAttendanceLocationConfigId: schedulingQuery.shift, |
| | | }) |
| | | .then(res => { |
| | | loading.value = false; |
| | |
| | | exportFile({ |
| | | time, |
| | | userName: query.userName, |
| | | deptId: query.deptId, |
| | | sysDeptId: query.sysDeptId, |
| | | isMonth: query.month ? true : false, |
| | | }) |
| | | .then(res => { |
| | |
| | | }; |
| | | // å¤çå½ä»¤ |
| | | const handleCommand = (e, m) => { |
| | | if (e != m.shift) { |
| | | update({ |
| | | id: m.id, |
| | | shift: e, |
| | | }).then(res => { |
| | | proxy.$modal.msgSuccess("æä½æå"); |
| | | m.shift = e; |
| | | }); |
| | | } |
| | | // if (e != m.shift) { |
| | | update({ |
| | | id: m.id, |
| | | personalAttendanceLocationConfigId: e, |
| | | }).then(res => { |
| | | proxy.$modal.msgSuccess("æä½æå"); |
| | | // m.shift = e; |
| | | if (query.month) { |
| | | init(); |
| | | } else { |
| | | initYear(); |
| | | } |
| | | }); |
| | | // } |
| | | }; |
| | | // æ¥è¯¢è§åå表 |
| | | const fetchData = () => { |
| | |
| | | // let arr = res.data; |
| | | // personList.value = arr; |
| | | // }); |
| | | selectUserCondition().then(res => { |
| | | let arr = res.data; |
| | | staffOnJobListPage({ |
| | | current: -1, |
| | | size: -1, |
| | | staffState: 1, |
| | | }).then(res => { |
| | | let arr = res.data.records; |
| | | personList.value = arr; |
| | | }); |
| | | }; |
| | | |
| | | // æ ¹æ®åå
¸è·åæ¥æ |
| | | const getDayByDic = e => { |
| | | let obj = classType.value.find(m => m.locationName == e); |
| | | let obj = classType.value.find(m => m.shift == e); |
| | | if (obj) { |
| | | return obj.id; |
| | | } |
| | |
| | | |
| | | // æ ¹æ®åå
¸è·åçæ¬¡ |
| | | const getShiftByDic = e => { |
| | | let obj = classType.value.find(m => m.id == e); |
| | | let obj = classType.value.find(m => m.shift == e); |
| | | if (obj) { |
| | | return obj.locationName; |
| | | return obj.shift; |
| | | } |
| | | return "æ "; |
| | | }; |
| | |
| | | .user-stats { |
| | | /* display: flex; */ |
| | | /* flex-wrap: wrap; |
| | | gap: 10px; */ |
| | | gap: 10px; */ |
| | | margin-bottom: 4px; |
| | | } |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="æ°å¢éè´éè´§" |
| | | width="1200" |
| | | @close="closeModal" |
| | | > |
| | | <el-form label-width="140px" :model="formState" label-position="top" ref="formRef" :inline="true"> |
| | | <el-form-item |
| | | label="éæåå·" |
| | | prop="no" |
| | | :rules="[ |
| | | { |
| | | required: !formState.isDefaultNo, |
| | | message: '请è¾å
¥éæåå·', |
| | | trigger: 'blur', |
| | | } |
| | | ]" |
| | | > |
| | | <el-input |
| | | v-model="formState.no" |
| | | :placeholder="formState.isDefaultNo ? '使ç¨ç³»ç»ç¼å·' : '请è¾å
¥éæåå·'" |
| | | :disabled="formState.isDefaultNo" |
| | | > |
| | | <template #append> |
| | | <el-checkbox v-model="formState.isDefaultNo" size="large" @change="handleChangeIsDefaultNo" /> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="éè´§æ¹å¼" |
| | | prop="returnType" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©éè´§æ¹å¼', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.returnType" |
| | | placeholder="è¯·éæ©éè´§æ¹å¼" |
| | | style="width: 240px" |
| | | > |
| | | <el-option label="éè´§éæ¬¾" :value="0" /> |
| | | <el-option label="ææ¶" :value="1" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="ä¾åºååç§°" |
| | | prop="supplierId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©ä¾åºå', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.supplierId" |
| | | placeholder="è¯·éæ©ä¾åºå" |
| | | style="width: 240px" |
| | | @focus="fetchSupplierOptions" |
| | | @change="handleChangeSupplierId" |
| | | > |
| | | <el-option |
| | | v-for="item in supplierOptions" |
| | | :key="item.id" |
| | | :label="item.supplierName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="项ç®" |
| | | prop="projectId" |
| | | > |
| | | <el-select |
| | | v-model="formState.projectId" |
| | | placeholder="è¯·éæ©é¡¹ç®" |
| | | style="width: 240px" |
| | | @focus="fetchProjectOptions" |
| | | > |
| | | <el-option |
| | | v-for="item in projectOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="项ç®é¶æ®µ" |
| | | prop="projectPhase" |
| | | > |
| | | <el-select |
| | | v-model="formState.projectPhase" |
| | | placeholder="è¯·éæ©é¡¹ç®é¶æ®µ" |
| | | style="width: 240px" |
| | | > |
| | | <el-option |
| | | v-for="item in projectStageOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="å¶ä½æ¥æ" |
| | | prop="preparedAt" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©å¶ä½æ¥æ', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-date-picker |
| | | v-model="formState.preparedAt" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="è¯·éæ©å¶ä½æ¥æ" |
| | | style="width: 240px" |
| | | clearable /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="å¶å人ï¼" |
| | | prop="preparedUserId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©å¶å人', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.preparedUserId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | filterable |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | style="width: 240px" |
| | | @focus="fetchUserOptions" |
| | | > |
| | | <el-option |
| | | v-for="item in userOptions" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="éæäººï¼" |
| | | prop="returnUserId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©éæäºº', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.returnUserId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | filterable |
| | | default-first-option |
| | | style="width: 240px" |
| | | :reserve-keyword="false" |
| | | @focus="fetchUserOptions" |
| | | > |
| | | <el-option |
| | | v-for="item in userOptions" |
| | | :key="item.userId" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="éè´ååå·ï¼" |
| | | prop="purchaseLedgerId" |
| | | :rules="[ |
| | | { |
| | | required: true, |
| | | message: 'è¯·éæ©éè´ååå·', |
| | | trigger: 'change', |
| | | } |
| | | ]" |
| | | > |
| | | <el-select |
| | | v-model="formState.purchaseLedgerId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | filterable |
| | | default-first-option |
| | | style="width: 240px" |
| | | :reserve-keyword="false" |
| | | @change="handleChangePurchaseLedgerId" |
| | | > |
| | | <el-option |
| | | v-for="item in purchaseLedgerOptions" |
| | | :key="item.id" |
| | | :label="item.purchaseContractNumber" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | label="夿³¨ï¼" |
| | | prop="remark" |
| | | > |
| | | <el-input v-model="formState.remark" type="textarea" placeholder="请è¾å
¥å¤æ³¨"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-button type="primary" size="small" @click="isShowProductsModal = true" :disabled="!formState.purchaseLedgerId">æ·»å 产å</el-button> |
| | | <el-table :data="products" border> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55" /> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" /> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="70" /> |
| | | <el-table-column label="æ°é" |
| | | prop="quantity" |
| | | width="70" /> |
| | | <el-table-column label="åºåé¢è¦æ°é" |
| | | prop="warnNum" |
| | | width="120" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" |
| | | prop="taxRate" |
| | | width="80" /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="æ¯å¦è´¨æ£" |
| | | prop="isChecked" |
| | | width="150"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isChecked ? 'success' : 'info'"> |
| | | {{ scope.row.isChecked ? 'æ¯' : 'å¦' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" |
| | | label="æä½" |
| | | width="120" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | > |
| | | ç¼è¾ |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | type="danger" |
| | | size="small" |
| | | @click="delProduct(scope.$index)" |
| | | > |
| | | å é¤ |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <ProductList |
| | | v-if="isShowProductsModal" |
| | | v-model:visible="isShowProductsModal" |
| | | :purchase-ledger-id="formState.purchaseLedgerId" |
| | | @completed="handleAddProduct" |
| | | /> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {ref, computed, getCurrentInstance} from "vue"; |
| | | import {createPurchaseReturnOrder} from "@/api/procurementManagement/purchase_return_order.js"; |
| | | import {getOptions, purchaseList} from "@/api/procurementManagement/procurementLedger.js"; |
| | | import {userListNoPageByTenantId} from "@/api/system/user.js"; |
| | | const ProductList = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/ProductList.vue")); |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | } |
| | | }); |
| | | let { proxy } = getCurrentInstance() |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | // ååºå¼æ°æ®ï¼æ¿ä»£é项å¼ç dataï¼ |
| | | const formState = ref({ |
| | | no: '', |
| | | isDefaultNo: true, |
| | | returnType: 0, |
| | | remark: '', |
| | | supplierId: undefined, |
| | | projectId: undefined, |
| | | projectPhase: undefined, |
| | | preparedAt: undefined, |
| | | preparedUserId: undefined, |
| | | returnUserId: undefined, |
| | | purchaseLedgerId: undefined, |
| | | }); |
| | | // ä¾åºåé项 |
| | | const supplierOptions = ref([]) |
| | | // 项ç®é项 |
| | | const projectOptions = ref([]) |
| | | // 项ç®é¶æ®µé项 |
| | | const projectStageOptions = ref([ |
| | | { |
| | | label: 'ç«é¡¹', |
| | | value: 0, |
| | | }, |
| | | { |
| | | label: '设计', |
| | | value: 1, |
| | | }, |
| | | { |
| | | label: 'éè´', |
| | | value: 2, |
| | | }, |
| | | { |
| | | label: 'ç产', |
| | | value: 3, |
| | | }, |
| | | { |
| | | label: 'åºè´§', |
| | | value: 4, |
| | | } |
| | | ]) |
| | | // ç¨æ·é项 |
| | | const userOptions = ref([]) |
| | | // éè´å°è´¦é项 |
| | | const purchaseLedgerOptions = ref([]) |
| | | // 产ååè¡¨æ°æ® |
| | | const products = ref([]) |
| | | // æ¯å¦å±ç¤ºäº§ååè¡¨æ°æ® |
| | | const isShowProductsModal = ref(false) |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | // è·åä¾åºåé项 |
| | | const fetchSupplierOptions = () => { |
| | | if (supplierOptions.value.length > 0) { |
| | | return |
| | | } |
| | | getOptions().then((res) => { |
| | | supplierOptions.value = res.data; |
| | | }); |
| | | } |
| | | |
| | | // è·å项ç®é项 |
| | | const fetchProjectOptions = () => { |
| | | if (projectOptions.value.length > 0) { |
| | | return |
| | | } |
| | | // todo 项ç®é项 |
| | | } |
| | | |
| | | // è·åç¨æ·é项 |
| | | const fetchUserOptions = () => { |
| | | if (userOptions.value.length > 0) { |
| | | return |
| | | } |
| | | userListNoPageByTenantId().then((res) => { |
| | | userOptions.value = res.data; |
| | | }); |
| | | } |
| | | |
| | | // å¤çæ¹åä¾åºåæ°æ® |
| | | const handleChangeSupplierId = () => { |
| | | formState.value.purchaseLedgerId = undefined |
| | | fetchPurchaseLedgerOptions() |
| | | } |
| | | |
| | | // è·åéè´å°è´¦é项 |
| | | const fetchPurchaseLedgerOptions = () => { |
| | | purchaseLedgerOptions.value = [] |
| | | if (formState.value.supplierId) { |
| | | purchaseList({supplierId: formState.value.supplierId}).then((res) => { |
| | | purchaseLedgerOptions.value = res.rows; |
| | | }); |
| | | } |
| | | } |
| | | |
| | | // å¤çæ¹åéè´å°è´¦æ°æ® |
| | | const handleChangePurchaseLedgerId = () => { |
| | | products.value = [] |
| | | } |
| | | |
| | | // å¤çæ¹åæ¯å¦é»è®¤ç¼å· |
| | | const handleChangeIsDefaultNo = (checked) => { |
| | | if (checked) { |
| | | formState.value.no = '' |
| | | } |
| | | } |
| | | |
| | | // å¢å 产å |
| | | const handleAddProduct = (selectedRows) => { |
| | | products.value.push(...selectedRows) |
| | | } |
| | | |
| | | // å é¤å项产å |
| | | const delProduct = (index) => { |
| | | products.value.splice(index, 1) |
| | | } |
| | | |
| | | // æäº¤è¡¨å |
| | | const handleSubmit = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (valid) { |
| | | createPurchaseReturnOrder(formState.value).then(res => { |
| | | // å
³éæ¨¡ææ¡ |
| | | isShow.value = false; |
| | | // åç¥ç¶ç»ä»¶å·²å®æ |
| | | emit('completed'); |
| | | proxy.$modal.msgSuccess("æäº¤æå"); |
| | | }) |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | defineExpose({ |
| | | closeModal, |
| | | handleSubmit, |
| | | isShow, |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <template> |
| | | <div> |
| | | <el-dialog |
| | | v-model="isShow" |
| | | title="æ°å¢äº§å" |
| | | width="1200" |
| | | @close="closeModal" |
| | | > |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" |
| | | border |
| | | @selection-change="handleChangeSelection"> |
| | | <el-table-column align="center" |
| | | type="selection" |
| | | width="55" /> |
| | | <el-table-column align="center" |
| | | label="åºå·" |
| | | type="index" |
| | | width="60" /> |
| | | <el-table-column label="产å大类" |
| | | prop="productCategory" /> |
| | | <el-table-column label="è§æ ¼åå·" |
| | | prop="specificationModel" /> |
| | | <el-table-column label="åä½" |
| | | prop="unit" |
| | | width="70" /> |
| | | <el-table-column label="æ°é" |
| | | prop="quantity" |
| | | width="70" /> |
| | | <el-table-column label="åºåé¢è¦æ°é" |
| | | prop="warnNum" |
| | | width="120" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="ç¨ç(%)" |
| | | prop="taxRate" |
| | | width="80" /> |
| | | <el-table-column label="å«ç¨åä»·(å
)" |
| | | prop="taxInclusiveUnitPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="å«ç¨æ»ä»·(å
)" |
| | | prop="taxInclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="ä¸å«ç¨æ»ä»·(å
)" |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="æ¯å¦è´¨æ£" |
| | | prop="isChecked" |
| | | width="150"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isChecked ? 'success' : 'info'"> |
| | | {{ scope.row.isChecked ? 'æ¯' : 'å¦' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" :disabled="selectedRows.length === 0" @click="handleSubmit">确认</el-button> |
| | | <el-button @click="closeModal">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import {computed, reactive, ref} from "vue"; |
| | | import {productList} from "@/api/procurementManagement/procurementLedger.js"; |
| | | import {ElMessage} from "element-plus"; |
| | | |
| | | const props = defineProps({ |
| | | visible: { |
| | | type: Boolean, |
| | | required: true, |
| | | }, |
| | | |
| | | purchaseLedgerId: { |
| | | type: Number, |
| | | required: true, |
| | | } |
| | | }); |
| | | |
| | | const emit = defineEmits(['update:visible', 'completed']); |
| | | |
| | | const isShow = computed({ |
| | | get() { |
| | | return props.visible; |
| | | }, |
| | | set(val) { |
| | | emit('update:visible', val); |
| | | }, |
| | | }); |
| | | |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | const formattedNumber = (row, column, cellValue) => { |
| | | return parseFloat(cellValue).toFixed(2); |
| | | }; |
| | | |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | |
| | | const handleChangeSelection = (val) => { |
| | | selectedRows.value = val; |
| | | } |
| | | |
| | | const fetchData = () => { |
| | | tableLoading.value = true; |
| | | productList({salesLedgerId: props.purchaseLedgerId, type: 2}).then((res) => { |
| | | tableData.value = res.data; |
| | | }).finally(() => { |
| | | tableLoading.value = false; |
| | | }) |
| | | } |
| | | |
| | | const handleSubmit = () => { |
| | | if (selectedRows.value.length === 0) { |
| | | ElMessage.warning("è¯·éæ©ä¸æ¡äº§å"); |
| | | return; |
| | | } |
| | | |
| | | emit('completed', selectedRows.value); |
| | | } |
| | | |
| | | const closeModal = () => { |
| | | isShow.value = false; |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | fetchData() |
| | | }) |
| | | |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="éæåå·ï¼"> |
| | | <el-input v-model="searchForm.no" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery"> æç´¢ </el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <div> |
| | | <el-button type="primary" @click="isShowNewModal = true">æ°å¢</el-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table_list"> |
| | | <el-table :data="tableData" border v-loading="tableLoading" @selection-change="handleSelectionChange" :row-key="row => row.id" style="width: 100%" height="calc(100vh - 18.5em)"> |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" label="åºå·" type="index" width="60" /> |
| | | <el-table-column label="éæåå·" prop="no" show-overflow-tooltip /> |
| | | <el-table-column label="éè´§æ¹å¼" prop="returnType" show-overflow-tooltip /> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" show-overflow-tooltip /> |
| | | <el-table-column label="å
³èåå·" prop="purchaseContractNumber" show-overflow-tooltip /> |
| | | <el-table-column label="éæäºº" prop="returnUserName" show-overflow-tooltip /> |
| | | <el-table-column label="夿³¨" prop="remark" show-overflow-tooltip /> |
| | | <el-table-column label="å建人" prop="createUserName" show-overflow-tooltip /> |
| | | <el-table-column label="å建æ¶é´" prop="createTime" show-overflow-tooltip /> |
| | | <el-table-column label="æè¿æ´æ°æ¶é´" prop="updateTime" show-overflow-tooltip /> |
| | | <el-table-column fixed="right" label="æä½" min-width="60" align="center"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" size="small">详æ
</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper" |
| | | :page="page.current" :limit="page.size" @pagination="paginationChange" /> |
| | | </div> |
| | | <new v-if="isShowNewModal" |
| | | v-model:visible="isShowNewModal" |
| | | @completed="handleQuery" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import pagination from '@/components/PIMTable/Pagination.vue' |
| | | import { ref, reactive, toRefs, onMounted } from 'vue' |
| | | import {findPurchaseReturnOrderListPage} from "@/api/procurementManagement/purchase_return_order.js"; |
| | | const New = defineAsyncComponent(() => import("@/views/procurementManagement/purchaseReturnOrder/New.vue")); |
| | | const tableData = ref([]) |
| | | const selectedRows = ref([]) |
| | | const tableLoading = ref(false) |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | }) |
| | | const total = ref(0) |
| | | // æ¯å¦æ¾ç¤ºæ°å¢å¼¹æ¡ |
| | | const isShowNewModal = ref(false) |
| | | const data = reactive({ |
| | | searchForm: { |
| | | no: '', |
| | | } |
| | | }) |
| | | const { searchForm } = toRefs(data) |
| | | |
| | | // æ¥è¯¢å表 |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | const paginationChange = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList() |
| | | } |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true |
| | | findPurchaseReturnOrderListPage({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false |
| | | tableData.value = res.data.records |
| | | total.value = res.data.total |
| | | }).catch(() => { |
| | | tableLoading.value = false |
| | | }) |
| | | } |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = (selection) => { |
| | | // è¿æ»¤æåæ°æ® |
| | | selectedRows.value = selection.filter(item => item.id); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | }) |
| | | </script> |
| | | |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <el-dialog v-model="dialogFormVisible" :title="operationType === 'edit' ? 'ç¼è¾éè´§å' : 'æ°å¢éè´§å'" width="90%" @close="closeDia"> |
| | | <div> |
| | | <span class="descriptions">åºæ¬ä¿¡æ¯</span> |
| | | <el-form :model="form" label-width="140px" label-position="top" :rules="rules" ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="4"> |
| | | <el-form-item label="éè´§åå·ï¼" prop="returnNo"> |
| | | <el-input |
| | | :disabled="operationType === 'edit' || form.returnNoCheckbox" |
| | | v-model="form.returnNo" |
| | | placeholder="使ç¨ç³»ç»ç¼å·" |
| | | class="input-with-select" |
| | | > |
| | | <template v-if="operationType !== 'edit'" #append> |
| | | <el-checkbox v-model="form.returnNoCheckbox" @change="handleReturnNoCheckboxChange"></el-checkbox> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="客æ·åç§°ï¼" prop="customerId"> |
| | | <el-select v-model="form.customerId" filterable placeholder="è¯·éæ©å®¢æ·" @change="customerNameChange"> |
| | | <el-option |
| | | v-for="item in customerNameOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="å
³èåºåºåå·ï¼" prop="shippingId"> |
| | | <el-select v-model="form.shippingId" filterable placeholder="è¯·éæ©åºåºåå·" @change="outboundNoChange"> |
| | | <el-option |
| | | v-for="item in outboundOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="项ç®é¶æ®µï¼" prop="projectStage"> |
| | | <el-input v-model="form.projectStage" placeholder="项ç®é¶æ®µ" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="å¶å人ï¼" prop="maker"> |
| | | <el-select v-model="form.maker" filterable placeholder="è¯·éæ©å¶å人"> |
| | | <el-option v-for="u in userOptions" :key="u.value" :label="u.label" :value="u.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="å¶åæ¶é´ï¼" prop="makeTime"> |
| | | <el-date-picker v-model="form.makeTime" type="datetime" style="width:100%" value-format="YYYY-MM-DD HH:mm:ss" format="YYYY-MM-DD HH:mm:ss" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="ç»ç®äººï¼" prop="settler"> |
| | | <el-select v-model="form.settler" filterable placeholder="è¯·éæ©ç»ç®äºº"> |
| | | <el-option v-for="u in userOptions" :key="u.value" :label="u.label" :value="u.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item label="ç¶æï¼" prop="status"> |
| | | <el-select v-model="form.status" placeholder="è¯·éæ©ç¶æ"> |
| | | <el-option label="å¾
å®¡æ ¸" :value="0" /> |
| | | <el-option label="å®¡æ ¸ä¸" :value="1" /> |
| | | <el-option label="å·²å®¡æ ¸" :value="2" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <hr> |
| | | <div style="padding-top: 20px"> |
| | | <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px"> |
| | | <span class="descriptions" style="margin-bottom:0">产åå表</span> |
| | | <el-button type="primary" @click="openProductSelection" :disabled="!form.shippingId">æ·»å 产å</el-button> |
| | | </div> |
| | | <PIMTable :isShowPagination="false" rowKey="id" :column="tableColumn" :tableData="tableData"> |
| | | <template #returnQuantity="{ row }"> |
| | | <el-input |
| | | v-model="row.returnQuantity" |
| | | style="width:100px" |
| | | placeholder="请è¾å
¥" |
| | | type="number" |
| | | @input="(val) => handleReturnQuantityChange(val, row)" |
| | | /> |
| | | </template> |
| | | <template #action="{ row, index }"> |
| | | <el-button type="danger" link @click="deleteRow(index)">å é¤</el-button> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | </div> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">确认</el-button> |
| | | <el-button @click="closeDia">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <el-dialog v-model="productSelectionVisible" title="éæ©äº§å" width="70%" append-to-body> |
| | | <el-table |
| | | :data="availableProducts" |
| | | style="width: 100%" |
| | | @selection-change="handleSelectionChange" |
| | | ref="productTableRef" |
| | | row-key="id" |
| | | > |
| | | <el-table-column align="center" type="selection" width="55" /> |
| | | <el-table-column align="center" prop="productCategory" label="产å大类" /> |
| | | <el-table-column align="center" prop="specificationModel" label="è§æ ¼åå·" /> |
| | | <el-table-column align="center" prop="unit" label="åä½" /> |
| | | <el-table-column align="center" prop="quantity" label="æ»æ°é" /> |
| | | <el-table-column align="center" prop="unQuantity" label="æªéè´§æ°é" /> |
| | | <el-table-column align="center" label="å·²éè´§æ°é"> |
| | | <template #default="{ row }">{{ calcAlreadyReturned(row) }}</template> |
| | | </el-table-column> |
| | | |
| | | </el-table> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button type="primary" @click="confirmProductSelection">确认添å </el-button> |
| | | <el-button @click="productSelectionVisible = false">åæ¶</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { reactive, ref, toRefs, getCurrentInstance } from "vue"; |
| | | import { returnManagementAdd, returnManagementUpdate, returnManagementGetByShippingId, getSalesLedger, returnManagementGetById } from "@/api/salesManagement/returnOrder.js"; |
| | | import { getAllCustomerList } from "@/api/customerService/index.js"; |
| | | import useUserStore from "@/store/modules/user.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { listProject } from "@/api/oaSystem/projectManagement.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const emit = defineEmits(['close']) |
| | | const dialogFormVisible = ref(false); |
| | | const operationType = ref(''); |
| | | const formRef = ref(null); |
| | | const userStore = useUserStore(); |
| | | |
| | | const data = reactive({ |
| | | form: { |
| | | returnNoCheckbox: true, |
| | | returnNo: "", |
| | | customerId: "", |
| | | shippingId: "", |
| | | projectId: "", |
| | | projectStage: "", |
| | | maker: "", |
| | | makeTime: "", |
| | | settler: "", |
| | | status: 0, |
| | | }, |
| | | rules: { |
| | | returnNo: [{ |
| | | validator: (rule, value, callback) => { |
| | | if (form.value.returnNoCheckbox) return callback(); |
| | | if (!value) return callback(new Error("请è¾å
¥éè´§åå·")); |
| | | callback(); |
| | | }, trigger: "blur" |
| | | }], |
| | | customerId: [{ required: true, message: "è¯·éæ©å®¢æ·", trigger: "change" }], |
| | | shippingId: [{ required: true, message: "è¯·éæ©å
³èåºåºåå·", trigger: "change" }], |
| | | } |
| | | }); |
| | | const { form, rules } = toRefs(data); |
| | | |
| | | const calcAlreadyReturned = (row) => { |
| | | const total = Number(row?.quantity ?? row?.totalQuantity ?? row?.totalReturnNum ?? 0); |
| | | const un = Number(row?.unQuantity ?? 0); |
| | | if (!Number.isFinite(total) || !Number.isFinite(un)) return 0; |
| | | return Math.max(total - un, 0); |
| | | }; |
| | | |
| | | const tableColumn = ref([ |
| | | {align: "center", label: "产å大类", prop: "productCategory" }, |
| | | {align: "center", label: "è§æ ¼åå·", prop: "specificationModel" }, |
| | | {align: "center", label: "åä½", prop: "unit", width: 80 }, |
| | | {align: "center", label: "æ»æ°é", prop: "quantity", width: 120 }, |
| | | {align: "center", label: "å·²éè´§æ°é", prop: "totalReturnNum", width: 120 }, |
| | | {align: "center", label: "æªéè´§æ°é", prop: "unQuantity", width: 120 }, |
| | | {align: "center", label: "éè´§æ°é", prop: "returnQuantity", dataType: "slot", slot: "returnQuantity", width: 120 }, |
| | | {align: "center", label: "æä½" , prop: "action", dataType: "slot", slot: "action", width: 120 }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const customerNameOptions = ref([]); |
| | | const outboundOptions = ref([]); |
| | | const userOptions = ref([]); |
| | | const projectOptions = ref([]); |
| | | |
| | | const deleteRow = (index) => { |
| | | tableData.value.splice(index, 1); |
| | | }; |
| | | |
| | | const normalizeDetailRow = (raw) => { |
| | | const productId = raw?.returnSaleLedgerProductId ?? raw?.saleLedgerProductId ?? raw?.id; |
| | | const returnSaleProductId = raw?.returnSaleProductId ?? raw?.id; |
| | | const num = Number(raw?.num ?? raw?.returnQuantity ?? 0); |
| | | return { |
| | | ...raw, |
| | | id: productId, |
| | | returnSaleProductId, |
| | | returnSaleLedgerProductId: productId, |
| | | num, |
| | | returnQuantity: Number.isFinite(num) ? num : 0, |
| | | }; |
| | | }; |
| | | |
| | | const setFormForEdit = async (row) => { |
| | | const res = await returnManagementGetById({ returnManagementId: row?.id }); |
| | | console.log("res", res); |
| | | const detail = res?.data ?? res ?? {}; |
| | | |
| | | Object.assign(form.value, detail); |
| | | form.value.returnNoCheckbox = true; |
| | | |
| | | if (form.value.customerId) { |
| | | await customerNameChange(form.value.customerId, false); |
| | | } |
| | | if (form.value.shippingId) { |
| | | await outboundNoChange(form.value.shippingId, false); |
| | | } |
| | | |
| | | const list = |
| | | detail?.returnSaleProducts || |
| | | detail?.returnSaleProductList || |
| | | detail?.returnSaleProductDtoData || |
| | | []; |
| | | |
| | | tableData.value = Array.isArray(list) |
| | | ? list.map((raw) => { |
| | | const normalized = normalizeDetailRow(raw); |
| | | const product = availableProducts.value.find((p) => p.id === normalized.id); |
| | | return product ? { ...product, ...normalized } : normalized; |
| | | }) |
| | | : []; |
| | | }; |
| | | |
| | | const openDialog = async (type, row) => { |
| | | operationType.value = type; |
| | | dialogFormVisible.value = true; |
| | | proxy.resetForm("formRef"); |
| | | await Promise.all([initCustomers(), initUsers(), initProjects()]); |
| | | if (type === "edit") { |
| | | await setFormForEdit(row); |
| | | } else { |
| | | tableData.value = []; |
| | | Object.assign(form.value, { |
| | | returnNoCheckbox: true, |
| | | returnNo: "", |
| | | customerId: "", |
| | | shippingId: "", |
| | | projectId: "", |
| | | projectStage: "", |
| | | maker: "", |
| | | makeTime: "", |
| | | settler: "", |
| | | status: 0, |
| | | }); |
| | | form.value.maker = userStore.nickName || userStore.name || ""; |
| | | form.value.makeTime = new Date().toISOString().replace('T', ' ').split('.')[0]; // Default to now |
| | | form.value.status = 0; // Default status |
| | | } |
| | | }; |
| | | |
| | | const submitForm = () => { |
| | | proxy.$refs["formRef"].validate(valid => { |
| | | if (!valid) return; |
| | | const returnSaleProducts = (tableData.value || []).map(el => ({ |
| | | returnSaleLedgerProductId: el.returnSaleLedgerProductId ?? el.id, |
| | | num: Number(el.num ?? el.returnQuantity ?? 0), |
| | | id: operationType.value === "edit" ? (el.returnSaleProductId ?? "") : "" |
| | | })); |
| | | const payload = { ...form.value, returnSaleProducts }; |
| | | delete payload.returnNoCheckbox; |
| | | if (operationType.value === "add" && form.value.returnNoCheckbox) delete payload.returnNo; |
| | | if (operationType.value === "add") { |
| | | returnManagementAdd(payload).then(() => { |
| | | proxy.$modal.msgSuccess("æ°å¢æå"); |
| | | closeDia(); |
| | | }); |
| | | } else { |
| | | returnManagementUpdate(payload).then(() => { |
| | | proxy.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | closeDia(); |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const closeDia = () => { |
| | | proxy.resetForm("formRef"); |
| | | dialogFormVisible.value = false; |
| | | emit('close'); |
| | | }; |
| | | |
| | | const initCustomers = async () => { |
| | | const res = await getAllCustomerList({}); |
| | | if (res?.records) { |
| | | customerNameOptions.value = res.records.map(item => ({ |
| | | label: item.customerName, |
| | | value: item.customerName, // Keep value as name if needed for other logic, but request says customerId |
| | | id: item.id, |
| | | code: item.customerCode |
| | | })); |
| | | } |
| | | }; |
| | | |
| | | const initUsers = async () => { |
| | | const res = await userListNoPageByTenantId(); |
| | | if (res?.data) { |
| | | userOptions.value = res.data.map(u => ({ label: u.nickName || u.userName, value: u.nickName || u.userName })); |
| | | } |
| | | }; |
| | | |
| | | const initProjects = async () => { |
| | | try { |
| | | const res = await listProject({ pageSize: 1000 }); |
| | | if (res?.rows) { |
| | | projectOptions.value = res.rows.map(p => ({ label: p.projectName, value: p.id })); |
| | | } |
| | | } catch (e) { |
| | | console.error("Failed to load projects", e); |
| | | } |
| | | }; |
| | | |
| | | const handleReturnNoCheckboxChange = (checked) => { |
| | | if (checked) form.value.returnNo = ""; |
| | | formRef.value?.validateField('returnNo'); |
| | | }; |
| | | |
| | | const customerNameChange = async (val, clearDownstream = true) => { |
| | | // val is customerId now |
| | | if (clearDownstream) { |
| | | form.value.shippingId = ""; |
| | | outboundOptions.value = []; |
| | | } |
| | | |
| | | // Find customer name for getSalesLedger if it requires name |
| | | const customer = customerNameOptions.value.find(c => c.id === val); |
| | | if (!customer) return; |
| | | |
| | | // Assuming getSalesLedger takes customerName. If it takes ID, adjust accordingly. |
| | | // Previous code used customerName. Let's try passing customerName. |
| | | getSalesLedger({ |
| | | customerName: customer.label, |
| | | }).then(res => { |
| | | if(res.code === 200){ |
| | | outboundOptions.value = res.data.map(item => ({ |
| | | label: item.salesContractNo, // Or whatever the outbound number field is |
| | | value: item.id, |
| | | })) |
| | | } |
| | | }) |
| | | }; |
| | | |
| | | const outboundNoChange = async (val, clearTable = true) => { |
| | | // val is shippingId |
| | | let res = await returnManagementGetByShippingId({ shippingId: val }); |
| | | if(res.code === 200){ |
| | | // If backend returns project info, set it |
| | | if (res.data.projectId) form.value.projectId = res.data.projectId; |
| | | if (res.data.projectStage) form.value.projectStage = res.data.projectStage; |
| | | |
| | | // Store available products for selection |
| | | availableProducts.value = res.data.productDtoData || []; |
| | | if (clearTable) tableData.value = []; |
| | | } |
| | | }; |
| | | |
| | | const handleReturnQuantityChange = (val, row) => { |
| | | if (val === "" || val === null) return; |
| | | const max = row.unQuantity === undefined || row.unQuantity === null ? Infinity : Number(row.unQuantity || 0); |
| | | const current = Number(val); |
| | | |
| | | if (current > max) { |
| | | // Need nextTick to ensure update if user typed too fast or pasted |
| | | proxy.$nextTick(() => { |
| | | row.returnQuantity = max; |
| | | row.num = max; |
| | | }); |
| | | proxy.$modal.msgWarning(`éè´§æ°éä¸è½è¶
è¿æªéè´§æ°é(${max})`); |
| | | } else if (current < 0) { |
| | | proxy.$nextTick(() => { |
| | | row.returnQuantity = 0; |
| | | row.num = 0; |
| | | }); |
| | | } else { |
| | | row.num = current; |
| | | } |
| | | }; |
| | | |
| | | const availableProducts = ref([]); |
| | | const productSelectionVisible = ref(false); |
| | | const selectedProducts = ref([]); |
| | | |
| | | const openProductSelection = () => { |
| | | productSelectionVisible.value = true; |
| | | // Pre-select items already in tableData |
| | | proxy.$nextTick(() => { |
| | | if (proxy.$refs.productTableRef) { |
| | | proxy.$refs.productTableRef.clearSelection(); |
| | | availableProducts.value.forEach(row => { |
| | | if (tableData.value.some(item => item.id === row.id)) { |
| | | proxy.$refs.productTableRef.toggleRowSelection(row, true); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | const handleSelectionChange = (val) => { |
| | | selectedProducts.value = val; |
| | | }; |
| | | |
| | | // Removed checkSelectable to allow toggling existing items |
| | | const confirmProductSelection = () => { |
| | | // Rebuild tableData based on selection, preserving existing data (returnQuantity) |
| | | const newTableData = []; |
| | | |
| | | selectedProducts.value.forEach(product => { |
| | | // Check if product was already in tableData to preserve user input |
| | | const existing = tableData.value.find(item => item.id === product.id); |
| | | if (existing) { |
| | | newTableData.push(existing); |
| | | } else { |
| | | // Create new entry |
| | | newTableData.push({ |
| | | ...product, // Keep all product display fields (productName, model, unit, etc.) |
| | | |
| | | // Map to backend entity structure for submission |
| | | returnSaleLedgerProductId: product.id, |
| | | returnQuantity: 0, // Default input |
| | | num: 0, // Backend quantity field |
| | | |
| | | // Ensure display fields are available if they come from 'product' |
| | | // If product has different field names than tableColumn expects, map them here |
| | | productName: product.productName, |
| | | specificationModel: product.specificationModel, |
| | | unit: product.unit, |
| | | quantity: product.quantity, |
| | | totalReturnNum: product.totalReturnNum, |
| | | unQuantity: product.unQuantity |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | tableData.value = newTableData; |
| | | productSelectionVisible.value = false; |
| | | }; |
| | | |
| | | defineExpose({ openDialog }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .descriptions { |
| | | margin-bottom: 20px; |
| | | display: inline-block; |
| | | font-size: 1rem; |
| | | font-weight: 600; |
| | | padding-left: 12px; |
| | | position: relative; |
| | | } |
| | | .descriptions::before { |
| | | content: ""; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 4px; |
| | | height: 1rem; |
| | | background-color: #002FA7; |
| | | border-radius: 2px; |
| | | } |
| | | </style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search-wrapper"> |
| | | <el-form :model="searchForm" class="demo-form-inline"> |
| | | <el-row :gutter="20"> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-input v-model="searchForm.returnNo" placeholder="请è¾å
¥éè´§åå·" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-input v-model="searchForm.customerName" placeholder="客æ·åç§°" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-input v-model="searchForm.salesContractNo" placeholder="éå®åå·" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-input v-model="searchForm.shippingNo" placeholder="å
³èåºåºåå·" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="4"> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery">æç´¢</el-button> |
| | | <el-button @click="handleReset">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div class="table_header" style="display:flex;justify-content:space-between;align-items:center;"> |
| | | <div> |
| | | <el-button type="primary" @click="openForm('add')">æ°å»ºéå®éè´§</el-button> |
| | | </div> |
| | | <div> |
| | | <el-button type="danger" plain @click="handleDelete">å é¤</el-button> |
| | | <el-button @click="columnsDialogVisible = true">åè¡¨åæ®µ</el-button> |
| | | </div> |
| | | </div> |
| | | <PIMTable |
| | | rowKey="id" |
| | | :column="visibleColumns" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | @selection-change="handleSelectionChange" |
| | | :tableLoading="tableLoading" |
| | | @pagination="pagination" |
| | | /> |
| | | </div> |
| | | <form-dia ref="formDia" @close="handleQuery" /> |
| | | |
| | | <el-dialog v-model="columnsDialogVisible" title="èªå®ä¹æ¾ç¤ºå项" width="600px"> |
| | | <div class="columns-tip">注ï¼å表项æ¾ç¤ºä¸å¾å°äº5é¡¹ï¼æå¨å³ä¾§ææå¯è°æ´æ¾ç¤ºé¡ºåº</div> |
| | | <ul class="columns-list"> |
| | | <li v-for="(col, idx) in allColumns" :key="col.prop" |
| | | class="columns-item" |
| | | draggable="true" |
| | | @dragstart="onDragStart(idx)" |
| | | @dragover.prevent |
| | | @drop="onDrop(idx)"> |
| | | <el-checkbox v-model="col.selected">{{ col.label }}</el-checkbox> |
| | | <span class="drag-handle">â¡</span> |
| | | </li> |
| | | </ul> |
| | | <template #footer> |
| | | <el-button @click="resetColumns">æ¢å¤é»è®¤</el-button> |
| | | <el-button type="primary" @click="saveColumns">ä¿å</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { reactive, ref, toRefs, computed, getCurrentInstance, nextTick, onMounted } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import FormDia from "./components/formDia.vue"; |
| | | import { returnManagementList, returnManagementDel, returnManagementHandle } from "@/api/salesManagement/returnOrder.js"; |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const formDia = ref(); |
| | | const openForm = (type, row) => { |
| | | nextTick(() => formDia.value?.openDialog(type, row)); |
| | | }; |
| | | |
| | | const handleRowDelete = (row) => { |
| | | if (!row?.id) return; |
| | | ElMessageBox.confirm("该éè´§åå°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | returnManagementDel({ ids: String(row.id) }).then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | const handleRowHandle = (row) => { |
| | | if (!row?.id) return; |
| | | ElMessageBox.confirm("æ¯å¦å¤ç该éè´§åï¼å¤çåå°æ æ³ä¿®æ¹", "å¤çæç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | returnManagementHandle({ returnManagementId: String(row.id) }).then(() => { |
| | | proxy.$modal.msgSuccess("å¤çæå"); |
| | | getList(); |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | returnNo: "", |
| | | status: "", |
| | | customerName: "", |
| | | salesContractNo: "", |
| | | salesman: "", |
| | | shippingNo: "", |
| | | projectName: "", |
| | | salesLedgerId: "", |
| | | makeTime: "" |
| | | } |
| | | }); |
| | | const { searchForm } = toRefs(data); |
| | | |
| | | const documentStatusOptions = ref([ |
| | | { label: "å¾
å®¡æ ¸", value: 0 }, |
| | | { label: "å®¡æ ¸ä¸", value: 1 }, |
| | | { label: "å·²å®¡æ ¸", value: 2 } |
| | | ]); |
| | | |
| | | const defaultColumns = [ |
| | | { label: "éè´§åå·", prop: "returnNo", minWidth: 160 }, |
| | | { label: "åæ®ç¶æ", prop: "status", minWidth: 120, formatData: (v) => ({ "0": "å¾
å®¡æ ¸", "1": "å®¡æ ¸ä¸", "2": "å·²å®¡æ ¸" }[String(v)] ?? v) }, |
| | | { label: "å¶åæ¶é´", prop: "makeTime", minWidth: 170 }, |
| | | { label: "客æ·åç§°", prop: "customerName", minWidth: 220 }, |
| | | { label: "éå®åå·", prop: "salesContractNo", minWidth: 160 }, |
| | | { label: "ä¸å¡å", prop: "salesman", minWidth: 120 }, |
| | | { label: "å
³èåºåºåå·", prop: "shippingNo", minWidth: 170 }, |
| | | { label: "项ç®åç§°", prop: "projectName", minWidth: 180 }, |
| | | { label: "项ç®é¶æ®µ", prop: "projectStage", minWidth: 120 }, |
| | | { label: "å¶å人", prop: "maker", minWidth: 120 }, |
| | | { label: "ç»ç®äºº", prop: "settler", minWidth: 120 }, |
| | | { |
| | | label: "æä½", |
| | | prop: "operation", |
| | | dataType: "action", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 160, |
| | | operation: [ |
| | | { name: "ç¼è¾", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => openForm("edit", row) }, |
| | | { name: "å¤ç", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => handleRowHandle(row) }, |
| | | { name: "å é¤", disabled: (row) => row.status !== 0, type: "text", clickFun: (row) => handleRowDelete(row) }, |
| | | ], |
| | | }, |
| | | ]; |
| | | const COLUMNS_KEY = "return_order_columns_v2"; |
| | | const columnsDialogVisible = ref(false); |
| | | const allColumns = ref([]); |
| | | |
| | | const initColumns = () => { |
| | | const saved = localStorage.getItem(COLUMNS_KEY); |
| | | if (saved) { |
| | | try { |
| | | const parsed = JSON.parse(saved); |
| | | // åå¹¶é»è®¤åä¸å·²ä¿åé
ç½®ï¼é¿å
åç»æ°å¢å丢失 |
| | | const map = new Map(parsed.map(c => [c.prop, c])); |
| | | allColumns.value = defaultColumns.map(d => { |
| | | const found = map.get(d.prop); |
| | | return { ...d, selected: found ? !!found.selected : true }; |
| | | }); |
| | | // 以ä¿åç顺åºä¸ºå |
| | | const order = parsed.map(p => p.prop); |
| | | allColumns.value.sort((a, b) => order.indexOf(a.prop) - order.indexOf(b.prop)); |
| | | return; |
| | | } catch {} |
| | | } |
| | | allColumns.value = defaultColumns.map(c => ({ ...c, selected: true })); |
| | | }; |
| | | initColumns(); |
| | | |
| | | const visibleColumns = computed(() => allColumns.value.filter(c => c.selected)); |
| | | |
| | | let dragFrom = -1; |
| | | const onDragStart = (idx) => { |
| | | dragFrom = idx; |
| | | }; |
| | | const onDrop = (to) => { |
| | | if (dragFrom < 0 || dragFrom === to) return; |
| | | const arr = [...allColumns.value]; |
| | | const [moved] = arr.splice(dragFrom, 1); |
| | | arr.splice(to, 0, moved); |
| | | allColumns.value = arr; |
| | | dragFrom = -1; |
| | | }; |
| | | |
| | | const resetColumns = () => { |
| | | allColumns.value = defaultColumns.map(c => ({ ...c, selected: true })); |
| | | localStorage.removeItem(COLUMNS_KEY); |
| | | }; |
| | | const saveColumns = () => { |
| | | const toSave = allColumns.value.map(({ label, prop, width, selected }) => ({ label, prop, width, selected })); |
| | | localStorage.setItem(COLUMNS_KEY, JSON.stringify(toSave)); |
| | | columnsDialogVisible.value = false; |
| | | }; |
| | | |
| | | const tableData = ref([]); |
| | | const tableLoading = ref(false); |
| | | const page = reactive({ current: 1, size: 10, total: 0 }); |
| | | const selectedRows = ref([]); |
| | | const tableHeight = computed(() => "calc(100% - 80px)"); |
| | | |
| | | const handleReset = () => { |
| | | Object.keys(searchForm.value).forEach(k => searchForm.value[k] = ""); |
| | | }; |
| | | const handleSelectionChange = (selection) => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const pagination = (obj) => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | returnManagementList({ ...searchForm.value, ...page }).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res?.data?.records || []; |
| | | page.total = res?.data?.total || 0; |
| | | }).finally(() => tableLoading.value = false); |
| | | }; |
| | | const handleOut = () => { |
| | | ElMessageBox.alert("导åºåè½å¾
æ¥å
¥æ¥å£", "æç¤º"); |
| | | }; |
| | | const handleDelete = () => { |
| | | let ids = []; |
| | | if (selectedRows.value.length === 0) { |
| | | proxy.$modal.msgWarning("è¯·éæ©æ°æ®"); |
| | | return; |
| | | } |
| | | ids = selectedRows.value.map(i => i.id); |
| | | ElMessageBox.confirm("éä¸çå
容å°è¢«å é¤ï¼æ¯å¦ç¡®è®¤å é¤ï¼", "å é¤æç¤º", { |
| | | confirmButtonText: "确认", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning", |
| | | }).then(() => { |
| | | returnManagementDel({ ids: ids.join(",") }).then(() => { |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | .search-wrapper { |
| | | background: white; |
| | | padding: 1rem 1rem 0 1rem; |
| | | border: 8px; |
| | | border-radius: 16px; |
| | | } |
| | | .table_list { |
| | | height: calc(100vh - 230px); |
| | | min-height: 360px; |
| | | background: #fff; |
| | | margin-top: 20px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | .columns-tip{color:#909399;margin-bottom:10px;font-size:12px;} |
| | | .columns-list{list-style:none;padding:0;margin:0;max-height:360px;overflow:auto;} |
| | | .columns-item{display:flex;justify-content:space-between;align-items:center;padding:8px 10px;border:1px solid #f0f0f0;border-radius:6px;margin-bottom:8px;cursor:move;background:#fff;} |
| | | .columns-item .drag-handle{color:#909399;padding-left:12px;user-select:none;} |
| | | .table_header { |
| | | margin-bottom: 15px; |
| | | } |
| | | </style> |