From 0109f273556b57c703677cf2198b05adb4974990 Mon Sep 17 00:00:00 2001 From: CD配唱片 <CD配唱片> Date: 星期三, 23 四月 2025 14:42:36 +0800 Subject: [PATCH] 提交日历管理 --- src/views/basicData/calendar/index.vue | 530 +++++++++++++++++++++++++++++++--------------------------- 1 files changed, 286 insertions(+), 244 deletions(-) diff --git a/src/views/basicData/calendar/index.vue b/src/views/basicData/calendar/index.vue index cdaef87..456114a 100644 --- a/src/views/basicData/calendar/index.vue +++ b/src/views/basicData/calendar/index.vue @@ -61,18 +61,18 @@ >鏌ヨ</el-button > <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> - <el-button + <!-- <el-button type="success" icon="Plus" @click="handleAdd" v-hasPermi="['core:calendar:add']" >鏂板鏃ュ巻</el-button - > + > --> </el-form-item> </el-row> </el-form> - <!-- <el-row :gutter="10" class="mb8"> + <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> <el-button type="primary" @@ -119,99 +119,26 @@ v-model:showSearch="showSearch" @queryTable="getList" ></right-toolbar> - </el-row> --> - - <el-table - v-loading="loading" + </el-row> + <HxlhTable + style="width: 100%" + :columns="columns" :data="calendarList" - @selection-change="handleSelectionChange" + :loading="loading" + :height="height" + :page="page" + @changePageNo="changePageNo" + @changePageSize="changePageSize" + @on-checkbox="handleCheckboxChange" > - <!-- <el-table-column type="selection" width="55" align="center" /> --> - <!-- <el-table-column label="${comment}" align="center" prop="id" /> --> - <el-table-column label="鏃ュ巻鎻忚堪" align="center" prop="description" /> - <el-table-column label="鏃ュ巻绫诲瀷" align="center" prop="type"> - <template #default="scope"> - <!-- <dict-tag :options="sys_normal_disable" :value="scope.row.status" /> --> - <el-tag - :type="scope.row.type === '1' ? '' : 'success'" - disable-transitions - >{{ scope.row.type }}</el-tag - > - </template> - </el-table-column> - <el-table-column - label="鏃ュ巻鐢熸晥鏃堕棿" - align="center" - prop="effectiveDate" - width="180" - > - <template #default="scope"> - <span>{{ parseTime(scope.row.effectiveDate, "{y}-{m}-{d}") }}</span> - </template> - </el-table-column> - <el-table-column - label="鏃ュ巻澶辨晥鏃堕棿" - align="center" - prop="expiringDate" - width="180" - > - <template #default="scope"> - <span>{{ parseTime(scope.row.expiringDate, "{y}-{m}-{d}") }}</span> - </template> - </el-table-column> - <el-table-column label="鏃ュ巻鍐呭" align="center" prop="content" /> - <el-table-column - label="閫傜敤宸ュ巶" - align="center" - prop="applicableFactory" - /> - <!-- 閫傜敤杞﹂棿 --> - <el-table-column - label="閫傜敤杞﹂棿" - align="center" - prop="applicableWorkshop" - /> - <!-- 閫傜敤宸ュ簭 --> - <el-table-column - label="閫傜敤宸ュ簭" - align="center" - prop="applicableProcess" - /> - <el-table-column label="鍒涘缓鑰�" align="center" prop="createBy" /> - <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime" /> - <el-table-column - label="鎿嶄綔" - align="center" - class-name="small-padding fixed-width" - > - <template #default="scope"> - <el-button - link - type="primary" - icon="Edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['core:calendar:edit']" - >淇敼</el-button - > - <el-button - link - type="danger" - icon="Delete" - @click="handleDelete(scope.row)" - v-hasPermi="['core:calendar:remove']" - >鍒犻櫎</el-button - > - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total > 0" - :total="total" - v-model:page="queryParams.pageNum" - v-model:limit="queryParams.pageSize" - @pagination="getList" - /> + <template #status="{ row }"> + <vxe-tag v-if="row.type === '1'" status="primary">鍛ㄥ伐浣滄棩</vxe-tag> + <vxe-tag v-if="row.type === '2'" status="success">鑺傚亣鏃�</vxe-tag> + </template> + <template #content="{ row }"> + <vxe-tag>鍛ㄥ伐浣滄棩</vxe-tag> + </template> + </HxlhTable> <!-- 娣诲姞鎴栦慨鏀规棩鍘嗙鐞嗗璇濇 --> <el-dialog :title="title" v-model="open" width="500px" append-to-body> @@ -219,13 +146,13 @@ ref="calendarRef" :model="form" :rules="rules" - label-width="80px" + label-width="105px" > <el-form-item label="鏃ュ巻鎻忚堪" prop="description"> <el-input v-model="form.description" placeholder="璇疯緭鍏ユ弿杩�" /> </el-form-item> <el-form-item label="鏃ュ巻绫诲瀷" prop="type"> - <el-radio-group v-model="typeRadioNumber" @change="handleSwitchType"> + <el-radio-group v-model="form.type" @change="handleSwitchType"> <el-radio :label="1">鍛ㄥ伐浣�</el-radio> <el-radio :label="2">鑺傚亣鏃�</el-radio> </el-radio-group> @@ -250,78 +177,59 @@ > </el-date-picker> </el-form-item> - <div class="title_bar_line"> - <div class="line_short"></div> - <div>鍛ㄥ伐浣滆缃�</div> - <div class="line_long"></div> - </div> - <div - class="week_flex" - v-for="(item, index) in weekDaysSettingList" - :key="index" - > - <div class="week_flex_item">{{item.chineseName}}</div> - <div class="week_flex_item"> - <el-radio-group v-model="item.work" @change="handleSetWorkDays"> - <el-radio :label="'y'">宸ヤ綔鏃�</el-radio> - <el-radio :label="'n'">闈炲伐浣滄棩</el-radio> - </el-radio-group> + <div v-if="form.type === 1"> + <div class="title_bar_line"> + <div class="line_short"></div> + <div>鍛ㄥ伐浣滆缃�</div> + <div class="line_long"></div> + </div> + <div + class="week_flex" + v-for="(item, index) in weekDaysSettingList" + :key="index" + > + <div class="week_flex_item">{{ item.chineseName }}</div> + <div class="week_flex_item"> + <el-radio-group v-model="item.work" @change="handleSetWorkDays"> + <el-radio :label="'y'">宸ヤ綔鏃�</el-radio> + <el-radio :label="'n'">闈炲伐浣滄棩</el-radio> + </el-radio-group> + </div> </div> </div> - <!-- <div class="week_flex"> - <div class="week_flex_item">鏄熸湡浜�</div> - <div class="week_flex_item"> - <el-radio-group v-model="tueType"> - <el-radio :label="1">宸ヤ綔鏃�</el-radio> - <el-radio :label="2">闈炲伐浣滄棩</el-radio> - </el-radio-group> + <div v-if="form.type === 2"> + <div class="title_bar_line"> + <div class="line_short"></div> + <div>鑺傚亣鏃ヨ缃�</div> + <div class="line_long"></div> + </div> + <div class="week_flex mt20"> + <div class="week_flex_item">鑺傛棩寮�濮嬫椂闂�</div> + <div class="week_flex_item"> + <el-date-picker + clearable + v-model="holidays.startdate" + type="date" + value-format="YYYY-MM-DD" + placeholder="閫夋嫨鏃ユ湡" + > + </el-date-picker> + </div> + </div> + <div class="week_flex mt20"> + <div class="week_flex_item">鑺傛棩缁撴潫鏃堕棿</div> + <div class="week_flex_item"> + <el-date-picker + clearable + v-model="holidays.enddate" + type="date" + value-format="YYYY-MM-DD" + placeholder="閫夋嫨鏃ユ湡" + > + </el-date-picker> + </div> </div> </div> - <div class="week_flex"> - <div class="week_flex_item">鏄熸湡涓�</div> - <div class="week_flex_item"> - <el-radio-group v-model="wedType"> - <el-radio :label="1">宸ヤ綔鏃�</el-radio> - <el-radio :label="2">闈炲伐浣滄棩</el-radio> - </el-radio-group> - </div> - </div> - <div class="week_flex"> - <div class="week_flex_item">鏄熸湡鍥�</div> - <div class="week_flex_item"> - <el-radio-group v-model="thuType"> - <el-radio :label="1">宸ヤ綔鏃�</el-radio> - <el-radio :label="2">闈炲伐浣滄棩</el-radio> - </el-radio-group> - </div> - </div> - <div class="week_flex"> - <div class="week_flex_item">鏄熸湡浜�</div> - <div class="week_flex_item"> - <el-radio-group v-model="friType"> - <el-radio :label="1">宸ヤ綔鏃�</el-radio> - <el-radio :label="2">闈炲伐浣滄棩</el-radio> - </el-radio-group> - </div> - </div> - <div class="week_flex"> - <div class="week_flex_item">鏄熸湡鍏�</div> - <div class="week_flex_item"> - <el-radio-group v-model="satType"> - <el-radio :label="1">宸ヤ綔鏃�</el-radio> - <el-radio :label="2">闈炲伐浣滄棩</el-radio> - </el-radio-group> - </div> - </div> - <div class="week_flex"> - <div class="week_flex_item">鏄熸湡鏃�</div> - <div class="week_flex_item"> - <el-radio-group v-model="sunType"> - <el-radio :label="1">宸ヤ綔鏃�</el-radio> - <el-radio :label="2">闈炲伐浣滄棩</el-radio> - </el-radio-group> - </div> - </div> --> <el-form-item label="閫傜敤宸ュ巶" prop="applicableFactory" @@ -329,17 +237,18 @@ > <el-select clearable - v-model="dateType" + v-model="form.applicableFactory" style="width: 160px" placeholder="璇疯緭鍏ラ�傜敤宸ュ巶" + @change="changePlant($event)" > <el-option - v-for="(item, index) of dateTypeList" - :key="index" - :label="item.name" - :value="item.name" - >{{ item.name }}</el-option + v-for="plant in plantList" + :key="plant.id" + :label="plant.plantName" + :value="plant.plantCode" > + </el-option> </el-select> </el-form-item> <el-form-item @@ -349,17 +258,17 @@ > <el-select clearable - v-model="dateType" + v-model="form.applicableWorkshop" style="width: 160px" placeholder="璇疯緭鍏ラ�傜敤杞﹂棿" > <el-option - v-for="(item, index) of dateTypeList" - :key="index" - :label="item.name" - :value="item.name" - >{{ item.name }}</el-option + v-for="shop in shopList" + :key="shop.id" + :label="shop.shopName" + :value="shop.id" > + </el-option> </el-select> </el-form-item> <el-form-item @@ -369,52 +278,18 @@ > <el-select clearable - v-model="dateType" + v-model="form.applicableProcess" style="width: 160px" placeholder="璇疯緭鍏ラ�傜敤宸ュ簭" > <el-option - v-for="(item, index) of dateTypeList" - :key="index" - :label="item.name" - :value="item.name" - >{{ item.name }}</el-option + v-for="process in processList" + :key="process.id" + :label="process.processName" + :value="process.processName" > + </el-option> </el-select> - </el-form-item> - <el-form-item label="鍒涘缓鑰�" prop="createBy" class="factory_use_item"> - <el-input type="text" v-model="form.createBy" placeholder="鍒涘缓鑰�" /> - </el-form-item> - <el-form-item - label="鍒涘缓鏃堕棿" - prop="createTime" - class="factory_use_item" - > - <el-date-picker - clearable - v-model="form.createTime" - type="date" - value-format="YYYY-MM-DD" - placeholder="閫夋嫨鏃ユ湡" - > - </el-date-picker> - </el-form-item> - <el-form-item label="鏇存柊鑰�" prop="updateBy" class="factory_use_item"> - <el-input type="text" v-model="form.updateBy" placeholder="鍒涘缓鑰�" /> - </el-form-item> - <el-form-item - label="鏇存柊鏃堕棿" - prop="updateTime" - class="factory_use_item" - > - <el-date-picker - clearable - v-model="form.updateTime" - type="date" - value-format="YYYY-MM-DD" - placeholder="閫夋嫨鏃ユ湡" - > - </el-date-picker> </el-form-item> </el-form> <template #footer> @@ -428,6 +303,7 @@ </template> <script setup name="Calendar"> +import HxlhTable from "@/components/HxlhTable"; import { listCalendar, getCalendar, @@ -435,9 +311,10 @@ addCalendar, updateCalendar, } from "@/api/basicData/calendar"; - +import { listAll_plant } from "@/api/basicData/plant"; +import { listAll_shop, listAps_shop } from "@/api/basicData/shop"; +import { selectProcessNameList } from "@/api/basicData/processRoute.js"; const { proxy } = getCurrentInstance(); - const calendarList = ref([]); const open = ref(false); const loading = ref(true); @@ -447,7 +324,6 @@ const multiple = ref(true); const total = ref(0); const title = ref(""); - const data = reactive({ form: {}, queryParams: { @@ -515,47 +391,157 @@ { day: "Monday", chineseName: "鏄熸湡涓�", - work:"y" + work: "y", }, { day: "TuesDay", chineseName: "鏄熸湡浜�", - work:"y" + work: "y", }, { day: "Wednesday", chineseName: "鏄熸湡涓�", - work:"y" + work: "y", }, { day: "Thursday", chineseName: "鏄熸湡鍥�", - work:"y" + work: "y", }, { - day:"Friday", - chineseName:"鏄熸湡浜�", - work:"y" + day: "Friday", + chineseName: "鏄熸湡浜�", + work: "y", }, { - day:"Saturday", - chineseName:"鏄熸湡鍏�", - work:"y" + day: "Saturday", + chineseName: "鏄熸湡鍏�", + work: "y", }, { - day:"Sunday", - chineseName:"鏄熸湡鏃�", - work:"y" - } + day: "Sunday", + chineseName: "鏄熸湡鏃�", + work: "y", + }, ]); +const holidays = ref({ + startdate: "", + enddate: "", +}); +const plantList = ref([]); +const shopList = ref([]); +const allShopList = ref([]); +const processList = ref([]); +const height = ref(document.documentElement.clientHeight - 260 + "px;"); +// 琛ㄦ牸閰嶇疆-鍒楄〃 +const columns = ref([ + { type: "checkbox", width: 60, align: "center" }, + { + title: "鏃ュ巻鎻忚堪", + field: "description", + width: 150, + align: "center", + }, + { + title: "鏃ュ巻绫诲瀷", + field: "type", + width: 150, + align: "center", + slots: { default: "status" }, + }, + { + title: "鏃ュ巻鐢熸晥鏃堕棿", + field: "effectiveDate", + width: 100, + align: "center", + }, + { + title: "鏃ュ巻澶辨晥鏃堕棿", + field: "expiringDate", + width: 150, + align: "center", + }, + { + title: "鏃ュ巻鍐呭", + field: "content", + width: 200, + align: "center", + slots: { default: "content" }, + }, + { + title: "閫傜敤宸ュ巶", + field: "applicableFactory", + width: 200, + align: "center", + formatter: ({ cellValue, row, column }) => { + console.log(cellValue, "000hsudhwhuwhuhwu"); + for (let i = 0; i < plantList.value.length; i++) { + console.log( + cellValue, + plantList.value[i].plantCode, + plantList.value[i].plantName, + "111hsudhwhuwhuhwu" + ); + if (cellValue === plantList.value[i].plantCode) { + return plantList.value[i].plantName; + } + } + }, + }, + { + title: "閫傜敤杞﹂棿", + field: "applicableWorkshop", + width: 90, + align: "center", + formatter: ({ cellValue, row, column }) => { + console.log(row.applicableFactory, "llll"); + listAps_shop({ plantCode: row.applicableFactory }).then((response) => { + console.log(response.rows, "閫傜敤杞﹂棿"); + shopList.value = response.rows; + }); + for (let i = 0; i < shopList.value.length; i++) { + if (cellValue === shopList.value[i].id) { + return shopList.value[i].shopName; + } + } + }, + }, + { + title: "閫傜敤宸ュ簭", + field: "applicableProcess", + width: 90, + align: "center", + }, + { + title: "鍒涘缓鑰�", + field: "createBy", + width: 90, + align: "center", + }, + { + title: "鍒涘缓鏃堕棿", + field: "createTime", + width: 90, + align: "center", + }, +]); +// 鍒嗛〉灞炴�� +const page = ref({ + total: 0, + current: 1, + size: 10, +}); + /** 鏌ヨ鏃ュ巻绠$悊鍒楄〃 */ -function getList() { +async function getList() { loading.value = true; listCalendar(queryParams.value).then((response) => { calendarList.value = response.rows; total.value = response.total; loading.value = false; }); + const res = await listAll_plant({}); + plantList.value = res.data; } // 鍙栨秷鎸夐挳 @@ -604,12 +590,25 @@ } /** 鏂板鎸夐挳鎿嶄綔 */ -function handleAdd() { +async function handleAdd() { reset(); open.value = true; title.value = "娣诲姞鏃ュ巻绠$悊"; -} + const res = await listAll_plant({}); + plantList.value = res.data; + console.log(res, "sjchhscwhciwhcwi"); +} +/** 閫夋嫨宸ュ巶鍚庝簨浠� 鍔犺浇杞﹂棿 鍜� 宸ュ簭 **/ +function changePlant(plant) { + listAps_shop({ plantCode: plant }).then((response) => { + console.log(response, "sbcsuhcuhscschsc"); + shopList.value = response.rows; + }); + selectProcessNameList({ orgCode: plant }).then((response) => { + processList.value = response.rows; + }); +} /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { reset(); @@ -632,11 +631,29 @@ getList(); }); } else { - addCalendar(form.value).then((response) => { - proxy.$modal.msgSuccess("鏂板鎴愬姛"); - open.value = false; - getList(); - }); + if (typeRadioNumber.value === 1) { + addCalendar({ + ...form.value, + content: { + weekdays: weekDaysSettingList.value, + }, + }).then((response) => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + }else if(typeRadioNumber.value === 2){ + addCalendar({ + ...form.value, + content: { + holidays: holidays.value, + }, + }).then((response) => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + } } } }); @@ -679,9 +696,29 @@ } // 璁剧疆鍛ㄥ伐浣滄棩 function handleSetWorkDays(e) { - console.log(weekDaysSettingList.value,"璁剧疆鍛ㄥ伐浣滄棩") + console.log(weekDaysSettingList.value, "璁剧疆鍛ㄥ伐浣滄棩"); } -getList(); +function changePageNo(currentPage) { + queryParams.value.pageNum = currentPage; + page.value.current = currentPage; + getList(); +} +function changePageSize(pageSize) { + page.value.current = 1; + queryParams.value.pageNum = 1; + queryParams.value.pageSize = pageSize; + getList(); +} +// function formatType(type) { +// if(type===1){ +// return "鍛ㄥ伐浣�" +// }else{ +// return "鑺傚亣鏃�" +// } +// } +onMounted(() => { + getList(); +}); </script> <style lang="scss" scoped> .column-with-margin { @@ -710,8 +747,13 @@ display: flex; justify-content: flex-start; align-content: center; - color: #333; + color: #606266; + font-weight: 700; margin-left: 20px; + &.mt20 { + margin-top: 20px; + margin-left: 0 !important; + } .week_flex_item { &:nth-child(1) { margin-top: 5px; -- Gitblit v1.9.3