feat(生产排产): 新增车间、班组、排产管理模块并联动工单报工;修复空path菜单导致的路由注册报错
| | |
| | | <link rel="icon" href="/favicon.ico" />
|
| | | <title>%VITE_APP_TITLE%</title>
|
| | | <!-- é«å¾·å°å¾API -->
|
| | | <script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=6af5d2639adbbabf95eddfbf2bae5739"></script>
|
| | | <script type="text/javascript" defer src="https://webapi.amap.com/maps?v=2.0&key=6af5d2639adbbabf95eddfbf2bae5739"></script>
|
| | | <!-- é«å¾·å°å¾æç´¢æä»¶ -->
|
| | | <script type="text/javascript" src="https://webapi.amap.com/loca?v=2.0.0&key=6af5d2639adbbabf95eddfbf2bae5739"></script>
|
| | | <script type="text/javascript" defer src="https://webapi.amap.com/loca?v=2.0.0&key=6af5d2639adbbabf95eddfbf2bae5739"></script>
|
| | | <!--[if lt IE 11
|
| | | ]><script>
|
| | | window.location.href = "/html/ie.html";
|
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // ç产æçæ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/productionScheduling/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢çç»ä»æ¥æç |
| | | export function today(teamId) { |
| | | return request({ |
| | | url: "/productionScheduling/today", |
| | | method: "get", |
| | | params: { teamId }, |
| | | }); |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/productionScheduling", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/productionScheduling", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: `/productionScheduling/${ids}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // çç»ç®¡çæ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/productionTeam/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢å
¨é¨çç»ï¼ä¸æç¨ï¼å¯æè½¦é´è¿æ»¤ï¼ |
| | | export function listAll(workshopId) { |
| | | return request({ |
| | | url: "/productionTeam/listAll", |
| | | method: "get", |
| | | params: { workshopId }, |
| | | }); |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/productionTeam", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/productionTeam", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: `/productionTeam/${ids}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | // 车é´ç®¡çæ¥å£ |
| | | import request from "@/utils/request"; |
| | | |
| | | // å页æ¥è¯¢ |
| | | export function listPage(query) { |
| | | return request({ |
| | | url: "/workshop/page", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | // æ¥è¯¢å
¨é¨è½¦é´ï¼ä¸æç¨ï¼ |
| | | export function listAll() { |
| | | return request({ |
| | | url: "/workshop/listAll", |
| | | method: "get", |
| | | }); |
| | | } |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: "/workshop", |
| | | method: "post", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function update(data) { |
| | | return request({ |
| | | url: "/workshop", |
| | | method: "put", |
| | | data: data, |
| | | }); |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: `/workshop/${ids}`, |
| | | method: "delete", |
| | | }); |
| | | } |
| | |
| | | usePermissionStore().generateRoutes().then(accessRoutes => {
|
| | | // æ ¹æ®rolesæéçæå¯è®¿é®çè·¯ç±è¡¨
|
| | | accessRoutes.forEach(route => {
|
| | | if (!isHttp(route.path)) {
|
| | | // å端èåæ°æ®ç¼ºå¤± path æ¶ï¼å¦ä»
å¡« https:// çå
é¾èåï¼è·³è¿ï¼é¿å
addRoute æé塿»æ´ä¸ªç»å½æµç¨
|
| | | if (route.path && !isHttp(route.path)) {
|
| | | router.addRoute(route) // å¨ææ·»å å¯è®¿é®è·¯ç±è¡¨
|
| | | }
|
| | | })
|
| | |
| | | return new Promise(resolve => {
|
| | | // åå端请æ±è·¯ç±æ°æ®
|
| | | getRouters().then(res => {
|
| | | const sdata = JSON.parse(JSON.stringify(res.data))
|
| | | const rdata = JSON.parse(JSON.stringify(res.data))
|
| | | const defaultData = JSON.parse(JSON.stringify(res.data))
|
| | | const data = filterBadRoutes(JSON.parse(JSON.stringify(res.data)))
|
| | | const sdata = JSON.parse(JSON.stringify(data))
|
| | | const rdata = JSON.parse(JSON.stringify(data))
|
| | | const defaultData = JSON.parse(JSON.stringify(data))
|
| | | const sidebarRoutes = filterAsyncRouter(sdata)
|
| | | const rewriteRoutes = filterAsyncRouter(rdata, false, true)
|
| | | const defaultRoutes = filterAsyncRouter(defaultData)
|
| | |
| | | }
|
| | | })
|
| | |
|
| | | // åé¤å端è¿åçæ path èåï¼å¦å°ååªå¡« https:// çå
é¾èåï¼ï¼é¿å
addRoute ä¸ä¾§è¾¹æ æ¸²ææ¥é
|
| | | function filterBadRoutes(routes) {
|
| | | return routes.filter(route => {
|
| | | if (!route.path) {
|
| | | return false
|
| | | }
|
| | | if (route.children && route.children.length) {
|
| | | route.children = filterBadRoutes(route.children)
|
| | | }
|
| | | return true
|
| | | })
|
| | | }
|
| | |
|
| | | // éååå°ä¼ æ¥çè·¯ç±å符串ï¼è½¬æ¢ä¸ºç»ä»¶å¯¹è±¡
|
| | | function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
|
| | | return asyncRouterMap.filter(route => {
|
| | |
| | | @input="handleScrapQtyInput" /> |
| | | </el-form-item> |
| | | <el-form-item label="çç»ä¿¡æ¯"> |
| | | <el-select v-model="reportForm.userId" |
| | | <el-select v-model="reportForm.teamId" |
| | | style="width: 300px" |
| | | placeholder="è¯·éæ©çç»ä¿¡æ¯" |
| | | clearable |
| | | filterable |
| | | @change="handleUserChange"> |
| | | <el-option v-for="user in userOptions" |
| | | :key="user.userId" |
| | | :label="user.nickName" |
| | | :value="user.userId" /> |
| | | @change="handleTeamChange"> |
| | | <el-option v-for="team in teamOptions" |
| | | :key="team.id" |
| | | :label="team.teamName" |
| | | :value="team.id" /> |
| | | </el-select> |
| | | <div v-if="teamScheduleText" |
| | | style="width: 300px; margin-top: 5px; color: #909399; font-size: 12px; line-height: 1.5;"> |
| | | {{ teamScheduleText }} |
| | | </div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | |
| | | import { onMounted, ref, nextTick } from "vue"; |
| | | import { ElMessageBox } from "element-plus"; |
| | | import dayjs from "dayjs"; |
| | | import { useDict } from "@/utils/dict.js"; |
| | | import { |
| | | productWorkOrderPage, |
| | | addProductMain, |
| | | downProductWorkOrder, |
| | | } from "@/api/productionManagement/workOrder.js"; |
| | | import { getUserProfile, userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | import { getUserProfile } from "@/api/system/user.js"; |
| | | import { listAll as teamListAll } from "@/api/productionScheduling/team.js"; |
| | | import { today as getTeamToday } from "@/api/productionScheduling/scheduling.js"; |
| | | import QRCode from "qrcode"; |
| | | import { getCurrentInstance, reactive, toRefs } from "vue"; |
| | | import FilesDia from "./components/filesDia.vue"; |
| | |
| | | const reportDialogVisible = ref(false); |
| | | const workOrderFilesRef = ref(null); |
| | | const reportFormRef = ref(null); |
| | | const userOptions = ref([]); |
| | | const teamOptions = ref([]); |
| | | const teamScheduleText = ref(""); |
| | | const { shift_type, schedule_status } = useDict("shift_type", "schedule_status"); |
| | | const reportForm = reactive({ |
| | | planQuantity: 0, |
| | | quantity: null, |
| | |
| | | reportWork: "", |
| | | productProcessRouteItemId: "", |
| | | userId: "", |
| | | teamId: null, |
| | | productMainId: null, |
| | | }); |
| | | |
| | |
| | | reportForm.productMainId = row.productMainId; |
| | | reportForm.scrapQty = |
| | | row.scrapQty !== undefined && row.scrapQty !== null ? row.scrapQty : null; |
| | | reportForm.teamId = null; |
| | | teamScheduleText.value = ""; |
| | | nextTick(() => { |
| | | reportFormRef.value?.clearValidate(); |
| | | }); |
| | |
| | | }); |
| | | }; |
| | | |
| | | const handleUserChange = val => { |
| | | const user = userOptions.value.find(item => item.userId === val); |
| | | reportForm.userName = user ? user.nickName : ""; |
| | | const handleTeamChange = val => { |
| | | teamScheduleText.value = ""; |
| | | if (!val) return; |
| | | // éä¸çç»åï¼æ¥å·¥äººé»è®¤ä¸ºçç»é¿ |
| | | const team = teamOptions.value.find(item => item.id === val); |
| | | if (team && team.leaderUserId) { |
| | | reportForm.userId = team.leaderUserId; |
| | | reportForm.userName = team.leaderName; |
| | | } |
| | | // å±ç¤ºè¯¥çç»ä»æ¥æçä¿¡æ¯ |
| | | getTeamToday(val).then(res => { |
| | | const schedule = res.data; |
| | | if (schedule && schedule.shiftType !== null && schedule.shiftType !== undefined) { |
| | | const shift = shift_type.value.find(item => item.value === String(schedule.shiftType)); |
| | | const status = schedule_status.value.find(item => item.value === String(schedule.status)); |
| | | teamScheduleText.value = `仿¥æçï¼${shift ? shift.label : ""}${status ? "ï¼" + status.label + "ï¼" : ""}`; |
| | | } else { |
| | | teamScheduleText.value = "仿¥æªæç"; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | // è·åç¨æ·å表 |
| | | userListNoPageByTenantId().then(res => { |
| | | if (res.code === 200) { |
| | | userOptions.value = res.data; |
| | | } |
| | | // è·åçç»å表 |
| | | teamListAll().then(res => { |
| | | teamOptions.value = res.data || []; |
| | | }); |
| | | }); |
| | | </script> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="工使¥æ:"> |
| | | <el-date-picker v-model="searchForm.dateRange" |
| | | type="daterange" |
| | | range-separator="è³" |
| | | start-placeholder="å¼å§æ¥æ" |
| | | end-placeholder="ç»ææ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 260px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå±è½¦é´:"> |
| | | <el-select v-model="searchForm.workshopId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 180px;" |
| | | @change="handleSearchWorkshopChange"> |
| | | <el-option v-for="item in workshopOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çç»:"> |
| | | <el-select v-model="searchForm.teamId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 180px;" |
| | | @change="handleQuery"> |
| | | <el-option v-for="item in searchTeamOptions" |
| | | :key="item.id" |
| | | :label="item.teamName" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ:"> |
| | | <el-select v-model="searchForm.status" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 140px;" |
| | | @change="handleQuery"> |
| | | <el-option v-for="item in schedule_status" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showNewModal">æ°å¢æç</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | :disabled="selectedRows.length === 0" |
| | | @click="handleDelete">å 餿ç</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :tableLoading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="pagination"> |
| | | <template #shiftType="{ row }"> |
| | | <el-tag :type="shiftTag(row.shiftType)"> |
| | | {{ shiftLabel(row.shiftType) }} |
| | | </el-tag> |
| | | </template> |
| | | <template #status="{ row }"> |
| | | <el-tag :type="statusTag(row.status)"> |
| | | {{ statusLabel(row.status) }} |
| | | </el-tag> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="form.id ? 'ç¼è¾æç' : 'æ°å¢æç'" |
| | | width="600px"> |
| | | <el-form ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px"> |
| | | <el-form-item label="工使¥æ" |
| | | prop="workDate"> |
| | | <el-date-picker v-model="form.workDate" |
| | | type="date" |
| | | placeholder="è¯·éæ©å·¥ä½æ¥æ" |
| | | format="YYYY-MM-DD" |
| | | value-format="YYYY-MM-DD" |
| | | style="width: 100%;" /> |
| | | </el-form-item> |
| | | <el-form-item label="çæ¬¡" |
| | | prop="shiftType"> |
| | | <el-select v-model="form.shiftType" |
| | | placeholder="è¯·éæ©çæ¬¡" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in shift_type" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="æå±è½¦é´" |
| | | prop="workshopId"> |
| | | <el-select v-model="form.workshopId" |
| | | placeholder="è¯·éæ©æå±è½¦é´" |
| | | style="width: 100%;" |
| | | @change="handleFormWorkshopChange"> |
| | | <el-option v-for="item in workshopOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çç»" |
| | | prop="teamId"> |
| | | <el-select v-model="form.teamId" |
| | | placeholder="è¯·éæ©çç»" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in formTeamOptions" |
| | | :key="item.id" |
| | | :label="item.teamName" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" |
| | | prop="status"> |
| | | <el-select v-model="form.status" |
| | | placeholder="è¯·éæ©ç¶æ" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in schedule_status" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | maxlength="500" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleSubmit">ç¡®å®</el-button> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { |
| | | onMounted, |
| | | ref, |
| | | reactive, |
| | | computed, |
| | | getCurrentInstance, |
| | | } from "vue"; |
| | | import dayjs from "dayjs"; |
| | | import { useDict } from "@/utils/dict.js"; |
| | | import { |
| | | listPage, |
| | | add, |
| | | update, |
| | | del, |
| | | } from "@/api/productionScheduling/scheduling.js"; |
| | | import { listAll as workshopListAll } from "@/api/productionScheduling/workshop.js"; |
| | | import { listAll as teamListAll } from "@/api/productionScheduling/team.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | // åå
¸ |
| | | const { shift_type, schedule_status } = useDict("shift_type", "schedule_status"); |
| | | |
| | | const findDictItem = (dict, val) => { |
| | | return dict.value.find(item => item.value === String(val)); |
| | | }; |
| | | const shiftLabel = val => { |
| | | const item = findDictItem(shift_type, val); |
| | | return item ? item.label : val; |
| | | }; |
| | | const shiftTag = val => { |
| | | const item = findDictItem(shift_type, val); |
| | | return item ? item.elTagType : "info"; |
| | | }; |
| | | const statusLabel = val => { |
| | | const item = findDictItem(schedule_status, val); |
| | | return item ? item.label : val; |
| | | }; |
| | | const statusTag = val => { |
| | | const item = findDictItem(schedule_status, val); |
| | | return item ? item.elTagType : "info"; |
| | | }; |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "工使¥æ", |
| | | prop: "workDate", |
| | | width: "120", |
| | | }, |
| | | { |
| | | label: "çæ¬¡", |
| | | prop: "shiftType", |
| | | dataType: "slot", |
| | | slot: "shiftType", |
| | | width: "100", |
| | | }, |
| | | { |
| | | label: "æå±è½¦é´", |
| | | prop: "workshopName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "çç»", |
| | | prop: "teamName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "status", |
| | | dataType: "slot", |
| | | slot: "status", |
| | | width: "100", |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | }, |
| | | { |
| | | label: "æ´æ°æ¶é´", |
| | | prop: "updateTime", |
| | | width: "160", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 100, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showEditModal(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const dialogVisible = ref(false); |
| | | const formRef = ref(null); |
| | | const workshopOptions = ref([]); |
| | | const allTeams = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | dateRange: [], |
| | | workshopId: null, |
| | | teamId: null, |
| | | status: null, |
| | | }, |
| | | }); |
| | | const { searchForm } = data; |
| | | |
| | | const form = reactive({ |
| | | id: null, |
| | | workDate: "", |
| | | shiftType: "", |
| | | workshopId: null, |
| | | teamId: null, |
| | | status: "1", |
| | | remark: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | workDate: [{ required: true, message: "è¯·éæ©å·¥ä½æ¥æ", trigger: "change" }], |
| | | shiftType: [{ required: true, message: "è¯·éæ©çæ¬¡", trigger: "change" }], |
| | | workshopId: [{ required: true, message: "è¯·éæ©æå±è½¦é´", trigger: "change" }], |
| | | teamId: [{ required: true, message: "è¯·éæ©çç»", trigger: "change" }], |
| | | }; |
| | | |
| | | // æç´¢çç»ä¸æï¼ææé车é´èå¨ |
| | | const searchTeamOptions = computed(() => { |
| | | if (searchForm.workshopId) { |
| | | return allTeams.value.filter(item => item.workshopId === searchForm.workshopId); |
| | | } |
| | | return allTeams.value; |
| | | }); |
| | | |
| | | // å¼¹çªçç»ä¸æï¼ææé车é´èå¨ |
| | | const formTeamOptions = computed(() => { |
| | | if (form.workshopId) { |
| | | return allTeams.value.filter(item => item.workshopId === form.workshopId); |
| | | } |
| | | return allTeams.value; |
| | | }); |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const handleSearchWorkshopChange = () => { |
| | | searchForm.teamId = null; |
| | | handleQuery(); |
| | | }; |
| | | |
| | | const handleFormWorkshopChange = () => { |
| | | form.teamId = null; |
| | | }; |
| | | |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const { dateRange, ...rest } = searchForm; |
| | | const params = { |
| | | ...rest, |
| | | ...(dateRange && dateRange.length === 2 |
| | | ? { startDate: dateRange[0], endDate: dateRange[1] } |
| | | : {}), |
| | | ...page, |
| | | }; |
| | | listPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const resetForm = () => { |
| | | form.id = null; |
| | | form.workDate = dayjs().format("YYYY-MM-DD"); |
| | | form.shiftType = ""; |
| | | form.workshopId = null; |
| | | form.teamId = null; |
| | | form.status = "1"; |
| | | form.remark = ""; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | resetForm(); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const showEditModal = row => { |
| | | resetForm(); |
| | | form.id = row.id; |
| | | form.workDate = row.workDate; |
| | | form.shiftType = row.shiftType !== null && row.shiftType !== undefined ? String(row.shiftType) : ""; |
| | | form.workshopId = row.workshopId; |
| | | form.teamId = row.teamId; |
| | | form.status = row.status !== null && row.status !== undefined ? String(row.status) : "1"; |
| | | form.remark = row.remark; |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate(valid => { |
| | | if (!valid) return; |
| | | const payload = { |
| | | id: form.id, |
| | | workDate: form.workDate, |
| | | shiftType: form.shiftType !== "" ? Number(form.shiftType) : null, |
| | | workshopId: form.workshopId, |
| | | teamId: form.teamId, |
| | | status: form.status !== "" ? Number(form.status) : null, |
| | | remark: form.remark, |
| | | }; |
| | | const request = payload.id ? update(payload) : add(payload); |
| | | request.then(() => { |
| | | proxy.$modal.msgSuccess(payload.id ? "ä¿®æ¹æå" : "æ°å¢æå"); |
| | | dialogVisible.value = false; |
| | | getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleDelete = () => { |
| | | const rows = selectedRows.value; |
| | | const ids = rows.map(item => item.id); |
| | | const firstDesc = `${rows[0].workDate} ${rows[0].teamName || ""}`; |
| | | proxy.$modal |
| | | .confirm( |
| | | `æ¯å¦ç¡®è®¤å é¤"${firstDesc}"${rows.length > 1 ? `ç${rows.length}æ¡æ°æ®` : ""}ï¼` |
| | | ) |
| | | .then(function () { |
| | | return del(ids.join(",")); |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const getWorkshopOptions = () => { |
| | | workshopListAll().then(res => { |
| | | workshopOptions.value = res.data || []; |
| | | }); |
| | | }; |
| | | |
| | | const getTeamOptions = () => { |
| | | teamListAll().then(res => { |
| | | allTeams.value = res.data || []; |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getWorkshopOptions(); |
| | | getTeamOptions(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="çç»åç§°:"> |
| | | <el-input v-model="searchForm.teamName" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå±è½¦é´:"> |
| | | <el-select v-model="searchForm.workshopId" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 200px;" |
| | | @change="handleQuery"> |
| | | <el-option v-for="item in workshopOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ:"> |
| | | <el-select v-model="searchForm.status" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 160px;" |
| | | @change="handleQuery"> |
| | | <el-option v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showNewModal">æ°å¢çç»</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | :disabled="selectedRows.length === 0" |
| | | @click="handleDelete">å é¤çç»</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :tableLoading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="pagination"> |
| | | <template #status="{ row }"> |
| | | <el-tag :type="row.status === 0 ? 'success' : 'info'"> |
| | | {{ row.status === 0 ? "å¯ç¨" : "åç¨" }} |
| | | </el-tag> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="form.id ? 'ç¼è¾çç»' : 'æ°å¢çç»'" |
| | | width="600px"> |
| | | <el-form ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px"> |
| | | <el-form-item label="çç»åç§°" |
| | | prop="teamName"> |
| | | <el-input v-model="form.teamName" |
| | | placeholder="请è¾å
¥çç»åç§°" |
| | | maxlength="100" /> |
| | | </el-form-item> |
| | | <el-form-item label="çç»ç¼ç " |
| | | prop="teamCode"> |
| | | <el-input v-model="form.teamCode" |
| | | placeholder="请è¾å
¥çç»ç¼ç " |
| | | maxlength="50" /> |
| | | </el-form-item> |
| | | <el-form-item label="æå±è½¦é´" |
| | | prop="workshopId"> |
| | | <el-select v-model="form.workshopId" |
| | | placeholder="è¯·éæ©æå±è½¦é´" |
| | | style="width: 100%;"> |
| | | <el-option v-for="item in workshopOptions" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="çç»é¿" |
| | | prop="leaderUserId"> |
| | | <el-select v-model="form.leaderUserId" |
| | | placeholder="è¯·éæ©çç»é¿" |
| | | clearable |
| | | filterable |
| | | style="width: 100%;" |
| | | @change="handleLeaderChange"> |
| | | <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="contactPhone"> |
| | | <el-input v-model="form.contactPhone" |
| | | placeholder="请è¾å
¥èç³»çµè¯" |
| | | maxlength="20" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" |
| | | prop="status"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :value="item.value">{{ item.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | maxlength="500" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleSubmit">ç¡®å®</el-button> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, getCurrentInstance } from "vue"; |
| | | import { |
| | | listPage, |
| | | add, |
| | | update, |
| | | del, |
| | | } from "@/api/productionScheduling/team.js"; |
| | | import { listAll as workshopListAll } from "@/api/productionScheduling/workshop.js"; |
| | | import { userListNoPageByTenantId } from "@/api/system/user.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const statusOptions = [ |
| | | { label: "å¯ç¨", value: 0 }, |
| | | { label: "åç¨", value: 1 }, |
| | | ]; |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "çç»åç§°", |
| | | prop: "teamName", |
| | | }, |
| | | { |
| | | label: "çç»ç¼ç ", |
| | | prop: "teamCode", |
| | | width: "120", |
| | | }, |
| | | { |
| | | label: "æå±è½¦é´", |
| | | prop: "workshopName", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "çç»é¿", |
| | | prop: "leaderName", |
| | | width: "100", |
| | | }, |
| | | { |
| | | label: "èç³»çµè¯", |
| | | prop: "contactPhone", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "status", |
| | | dataType: "slot", |
| | | slot: "status", |
| | | width: "90", |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | }, |
| | | { |
| | | label: "æ´æ°æ¶é´", |
| | | prop: "updateTime", |
| | | width: "160", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 100, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showEditModal(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const dialogVisible = ref(false); |
| | | const formRef = ref(null); |
| | | const workshopOptions = ref([]); |
| | | const userOptions = ref([]); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | teamName: "", |
| | | workshopId: null, |
| | | status: null, |
| | | }, |
| | | }); |
| | | const { searchForm } = data; |
| | | |
| | | const form = reactive({ |
| | | id: null, |
| | | teamName: "", |
| | | teamCode: "", |
| | | workshopId: null, |
| | | leaderUserId: null, |
| | | leaderName: "", |
| | | contactPhone: "", |
| | | status: 0, |
| | | remark: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | teamName: [{ required: true, message: "请è¾å
¥çç»åç§°", trigger: "blur" }], |
| | | workshopId: [{ required: true, message: "è¯·éæ©æå±è½¦é´", trigger: "change" }], |
| | | }; |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm, ...page }; |
| | | listPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const resetForm = () => { |
| | | form.id = null; |
| | | form.teamName = ""; |
| | | form.teamCode = ""; |
| | | form.workshopId = null; |
| | | form.leaderUserId = null; |
| | | form.leaderName = ""; |
| | | form.contactPhone = ""; |
| | | form.status = 0; |
| | | form.remark = ""; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | resetForm(); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const showEditModal = row => { |
| | | resetForm(); |
| | | Object.assign(form, JSON.parse(JSON.stringify(row))); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleLeaderChange = val => { |
| | | const user = userOptions.value.find(item => item.userId === val); |
| | | form.leaderName = user ? user.nickName : ""; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate(valid => { |
| | | if (!valid) return; |
| | | const request = form.id ? update(form) : add(form); |
| | | request.then(() => { |
| | | proxy.$modal.msgSuccess(form.id ? "ä¿®æ¹æå" : "æ°å¢æå"); |
| | | dialogVisible.value = false; |
| | | getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleDelete = () => { |
| | | const names = selectedRows.value.map(item => item.teamName); |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | proxy.$modal |
| | | .confirm( |
| | | `æ¯å¦ç¡®è®¤å é¤çç»"${names[0]}"${names.length > 1 ? `ç${names.length}æ¡æ°æ®` : ""}ï¼` |
| | | ) |
| | | .then(function () { |
| | | return del(ids.join(",")); |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | const getWorkshopOptions = () => { |
| | | workshopListAll().then(res => { |
| | | workshopOptions.value = res.data || []; |
| | | }); |
| | | }; |
| | | |
| | | const getUserOptions = () => { |
| | | userListNoPageByTenantId().then(res => { |
| | | if (res.code === 200) { |
| | | userOptions.value = res.data; |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | getWorkshopOptions(); |
| | | getUserOptions(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <div class="search_form"> |
| | | <el-form :model="searchForm" |
| | | :inline="true"> |
| | | <el-form-item label="车é´åç§°:"> |
| | | <el-input v-model="searchForm.name" |
| | | placeholder="请è¾å
¥" |
| | | clearable |
| | | prefix-icon="Search" |
| | | style="width: 200px;" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ:"> |
| | | <el-select v-model="searchForm.status" |
| | | placeholder="è¯·éæ©" |
| | | clearable |
| | | style="width: 160px;" |
| | | @change="handleQuery"> |
| | | <el-option v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" |
| | | @click="handleQuery">æç´¢</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | | <div class="table_list"> |
| | | <div style="text-align: right" |
| | | class="mb10"> |
| | | <el-button type="primary" |
| | | @click="showNewModal">æ°å¢è½¦é´</el-button> |
| | | <el-button type="danger" |
| | | plain |
| | | :disabled="selectedRows.length === 0" |
| | | @click="handleDelete">å é¤è½¦é´</el-button> |
| | | </div> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | | :tableData="tableData" |
| | | :page="page" |
| | | :isSelection="true" |
| | | :tableLoading="tableLoading" |
| | | @selection-change="handleSelectionChange" |
| | | @pagination="pagination"> |
| | | <template #status="{ row }"> |
| | | <el-tag :type="row.status === 0 ? 'success' : 'info'"> |
| | | {{ row.status === 0 ? "å¯ç¨" : "åç¨" }} |
| | | </el-tag> |
| | | </template> |
| | | </PIMTable> |
| | | </div> |
| | | |
| | | <!-- æ°å¢/ç¼è¾å¼¹çª --> |
| | | <el-dialog v-model="dialogVisible" |
| | | :title="form.id ? 'ç¼è¾è½¦é´' : 'æ°å¢è½¦é´'" |
| | | width="600px"> |
| | | <el-form ref="formRef" |
| | | :model="form" |
| | | :rules="rules" |
| | | label-width="100px"> |
| | | <el-form-item label="车é´åç§°" |
| | | prop="name"> |
| | | <el-input v-model="form.name" |
| | | placeholder="请è¾å
¥è½¦é´åç§°" |
| | | maxlength="100" /> |
| | | </el-form-item> |
| | | <el-form-item label="车é´ç¼ç " |
| | | prop="code"> |
| | | <el-input v-model="form.code" |
| | | placeholder="请è¾å
¥è½¦é´ç¼ç " |
| | | maxlength="50" /> |
| | | </el-form-item> |
| | | <el-form-item label="è´è´£äºº" |
| | | prop="principal"> |
| | | <el-input v-model="form.principal" |
| | | placeholder="请è¾å
¥è´è´£äºº" |
| | | maxlength="50" /> |
| | | </el-form-item> |
| | | <el-form-item label="èç³»çµè¯" |
| | | prop="contactPhone"> |
| | | <el-input v-model="form.contactPhone" |
| | | placeholder="请è¾å
¥èç³»çµè¯" |
| | | maxlength="20" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç¶æ" |
| | | prop="status"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio v-for="item in statusOptions" |
| | | :key="item.value" |
| | | :value="item.value">{{ item.label }}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨" |
| | | prop="remark"> |
| | | <el-input v-model="form.remark" |
| | | type="textarea" |
| | | :rows="3" |
| | | placeholder="请è¾å
¥å¤æ³¨" |
| | | maxlength="500" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <template #footer> |
| | | <span class="dialog-footer"> |
| | | <el-button type="primary" |
| | | @click="handleSubmit">ç¡®å®</el-button> |
| | | <el-button @click="dialogVisible = false">åæ¶</el-button> |
| | | </span> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, getCurrentInstance } from "vue"; |
| | | import { |
| | | listPage, |
| | | add, |
| | | update, |
| | | del, |
| | | } from "@/api/productionScheduling/workshop.js"; |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | |
| | | const statusOptions = [ |
| | | { label: "å¯ç¨", value: 0 }, |
| | | { label: "åç¨", value: 1 }, |
| | | ]; |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "车é´åç§°", |
| | | prop: "name", |
| | | }, |
| | | { |
| | | label: "车é´ç¼ç ", |
| | | prop: "code", |
| | | width: "120", |
| | | }, |
| | | { |
| | | label: "è´è´£äºº", |
| | | prop: "principal", |
| | | width: "100", |
| | | }, |
| | | { |
| | | label: "èç³»çµè¯", |
| | | prop: "contactPhone", |
| | | width: "140", |
| | | }, |
| | | { |
| | | label: "ç¶æ", |
| | | prop: "status", |
| | | dataType: "slot", |
| | | slot: "status", |
| | | width: "90", |
| | | }, |
| | | { |
| | | label: "夿³¨", |
| | | prop: "remark", |
| | | }, |
| | | { |
| | | label: "æ´æ°æ¶é´", |
| | | prop: "updateTime", |
| | | width: "160", |
| | | }, |
| | | { |
| | | dataType: "action", |
| | | label: "æä½", |
| | | align: "center", |
| | | fixed: "right", |
| | | width: 100, |
| | | operation: [ |
| | | { |
| | | name: "ç¼è¾", |
| | | type: "text", |
| | | clickFun: row => { |
| | | showEditModal(row); |
| | | }, |
| | | }, |
| | | ], |
| | | }, |
| | | ]); |
| | | const tableData = ref([]); |
| | | const selectedRows = ref([]); |
| | | const tableLoading = ref(false); |
| | | const dialogVisible = ref(false); |
| | | const formRef = ref(null); |
| | | const page = reactive({ |
| | | current: 1, |
| | | size: 100, |
| | | total: 0, |
| | | }); |
| | | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | name: "", |
| | | status: null, |
| | | }, |
| | | }); |
| | | const { searchForm } = data; |
| | | |
| | | const form = reactive({ |
| | | id: null, |
| | | name: "", |
| | | code: "", |
| | | principal: "", |
| | | contactPhone: "", |
| | | status: 0, |
| | | remark: "", |
| | | }); |
| | | |
| | | const rules = { |
| | | name: [{ required: true, message: "请è¾å
¥è½¦é´åç§°", trigger: "blur" }], |
| | | }; |
| | | |
| | | /** æç´¢æé®æä½ */ |
| | | const handleQuery = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | |
| | | const pagination = obj => { |
| | | page.current = obj.page; |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const params = { ...searchForm, ...page }; |
| | | listPage(params) |
| | | .then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }) |
| | | .catch(() => { |
| | | tableLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | // è¡¨æ ¼éæ©æ°æ® |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | | }; |
| | | |
| | | const resetForm = () => { |
| | | form.id = null; |
| | | form.name = ""; |
| | | form.code = ""; |
| | | form.principal = ""; |
| | | form.contactPhone = ""; |
| | | form.status = 0; |
| | | form.remark = ""; |
| | | }; |
| | | |
| | | // æå¼æ°å¢å¼¹æ¡ |
| | | const showNewModal = () => { |
| | | resetForm(); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const showEditModal = row => { |
| | | resetForm(); |
| | | Object.assign(form, JSON.parse(JSON.stringify(row))); |
| | | dialogVisible.value = true; |
| | | }; |
| | | |
| | | const handleSubmit = () => { |
| | | formRef.value.validate(valid => { |
| | | if (!valid) return; |
| | | const request = form.id ? update(form) : add(form); |
| | | request.then(() => { |
| | | proxy.$modal.msgSuccess(form.id ? "ä¿®æ¹æå" : "æ°å¢æå"); |
| | | dialogVisible.value = false; |
| | | getList(); |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | // æ¹éå é¤ |
| | | const handleDelete = () => { |
| | | const names = selectedRows.value.map(item => item.name); |
| | | const ids = selectedRows.value.map(item => item.id); |
| | | proxy.$modal |
| | | .confirm( |
| | | `æ¯å¦ç¡®è®¤å é¤è½¦é´"${names[0]}"${names.length > 1 ? `ç${names.length}æ¡æ°æ®` : ""}ï¼` |
| | | ) |
| | | .then(function () { |
| | | return del(ids.join(",")); |
| | | }) |
| | | .then(() => { |
| | | getList(); |
| | | proxy.$modal.msgSuccess("å 餿å"); |
| | | }) |
| | | .catch(() => {}); |
| | | }; |
| | | |
| | | onMounted(() => { |
| | | getList(); |
| | | }); |
| | | </script> |
| | | |
| | | <style scoped></style> |