From db6e95062dfb57bcd1fb1cacdbb3cb4372c576b0 Mon Sep 17 00:00:00 2001 From: chengxiangling <291105840@qq.com> Date: 星期三, 14 五月 2025 17:34:00 +0800 Subject: [PATCH] 钣金页面表格样式; --- src/views/basicData/calendar/index.vue | 1379 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 1,008 insertions(+), 371 deletions(-) diff --git a/src/views/basicData/calendar/index.vue b/src/views/basicData/calendar/index.vue index cdaef87..6f72c18 100644 --- a/src/views/basicData/calendar/index.vue +++ b/src/views/basicData/calendar/index.vue @@ -7,79 +7,56 @@ :inline="true" v-show="showSearch" label-width="68px" + label-position="left" > - <el-row type="flex" justify="right"> - <el-form-item label="鏃ュ巻鎻忚堪" prop="description"> - <el-input - style="width: 140px" - v-model="queryParams.description" - placeholder="璇疯緭鍏ユ弿杩板叧閿瘝" - clearable - @keyup.enter="handleQuery" - /> - </el-form-item> - <el-form-item label="鏃ュ巻绫诲瀷" prop="effectiveDate"> - <el-select clearable v-model="dateType" style="width: 90px"> - <el-option - v-for="(item, index) of dateTypeList" - :key="index" - :label="item.name" - :value="item.name" - >{{ item.name }}</el-option + <el-row type="flex" justify="left" :gutter="20"> + <el-col :span="5"> + <el-form-item label="鏃ュ巻鎻忚堪" prop="description"> + <el-input + style="width: 140px" + v-model="queryParams.description" + placeholder="璇疯緭鍏ユ弿杩板叧閿瘝" + clearable + @keyup.enter="handleQuery" + /> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="閫傜敤宸ュ巶" prop="plant"> + <el-select + style="width: 140px" + clearable + v-model="queryParams.plant" + placeholder="閫傜敤宸ュ巶" > - </el-select> - </el-form-item> - <el-form-item label="鐢熸晥鏃ユ湡" prop="effectiveDate"> - <el-date-picker - clearable - v-model="queryParams.effectiveDate" - type="date" - value-format="YYYY-MM-DD" - placeholder="閫夋嫨鏃ユ湡" - > - </el-date-picker> - </el-form-item> - <el-form-item label="閫傜敤宸ュ巶" prop="expiringDate"> - <!-- <el-date-picker clearable - v-model="queryParams.expiringDate" - type="date" - value-format="YYYY-MM-DD" - placeholder="璇烽�夋嫨澶辨晥鏃ユ湡"> - </el-date-picker> --> - <el-input - style="width: 180px" - v-model="queryParams.description" - placeholder="璇疯緭鍏ュ伐鍘傚叧閿瘝" - clearable - @keyup.enter="handleQuery" - /> - </el-form-item> - </el-row> - <el-row type="flex" justify="end"> - <el-form-item class="column-with-margin"> - <el-button type="primary" icon="Search" @click="handleQuery" - >鏌ヨ</el-button - > - <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> - <el-button - type="success" - icon="Plus" - @click="handleAdd" - v-hasPermi="['core:calendar:add']" - >鏂板鏃ュ巻</el-button - > - </el-form-item> + <el-option + v-for="item in aps_factory" + :key="item.value" + :label="item.label" + :value="item.value" + /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="13" style="text-align: right"> + <el-form-item class="column-with-margin"> + <el-button type="primary" icon="Search" @click="handleQuery" + >鏌ヨ</el-button + > + <el-button icon="Refresh" @click="resetQuery">閲嶇疆</el-button> + </el-form-item> + </el-col> </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" plain icon="Plus" @click="handleAdd" - v-hasPermi="['core:calendar:add']" + v-hasPermi="['aps:calendar:add']" >鏂板</el-button > </el-col> @@ -90,7 +67,7 @@ icon="Edit" :disabled="single" @click="handleUpdate" - v-hasPermi="['core:calendar:edit']" + v-hasPermi="['aps:calendar:update']" >淇敼</el-button > </el-col> @@ -101,11 +78,11 @@ icon="Delete" :disabled="multiple" @click="handleDelete" - v-hasPermi="['core:calendar:remove']" + v-hasPermi="['aps:calendar:remove']" >鍒犻櫎</el-button > </el-col> - <el-col :span="1.5"> + <!-- <el-col :span="1.5"> <el-button type="warning" plain @@ -114,121 +91,97 @@ v-hasPermi="['core:calendar:export']" >瀵煎嚭</el-button > - </el-col> + </el-col> --> <right-toolbar 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" + ref="tableRef" + :page="page" + @changePageNo="changePageNo" + @changePageSize="changePageSize" + @on-checkbox="handleCheckboxChange" + class="auto-height-grid" > - <!-- <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 #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 #mark="{ row }"> + <div v-if="row.type === '1'"> + <span + v-for="(item, index) in JSON.parse(row.content.value).weekdays" + :key="index" + > + <span v-if="item.work === 'y'" status="success" class="mart5" + >{{ item.chineseName }}: 宸ヤ綔鏃�; </span + > + <span v-if="item.work === 'n'" status="info" class="mart5" + >{{ item.chineseName }}: 闈炲伐浣滄棩; </span + > + </span> + <!-- <div v-for="(item, index) in JSON.parse(row.content.value).weekdays" :key="index"> + <vxe-tag v-if="item.work==='y'" status="success" class="mart5">{{item.chineseName}}: 宸ヤ綔鏃�; </vxe-tag> + <vxe-tag v-if="item.work==='n'" status="info" class="mart5">{{item.chineseName}}: 闈炲伐浣滄棩; </vxe-tag> + </div> --> + </div> + <div v-if="row.type === '2'"> + <div> + {{ JSON.parse(row.content.value).holidays.startdate }}鑷硔{ + JSON.parse(row.content.value).holidays.enddate + }} + </div> + </div> + </template> + <template #buttons="{ row }"> + <el-button + type="primary" + size="small" + @click="handleUpdate(row)" + v-hasPermi="['aps:calendar:update']" + >淇敼</el-button > - </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" - /> + <el-button + type="warning" + size="small" + @click="handleSetHolidays(row)" + v-hasPermi="['aps:calendar:remove']" + >璁剧疆鑺傚亣鏃�</el-button + > + <el-button + type="danger" + size="small" + @click="handleDelete(row)" + v-hasPermi="['aps:calendar:remove']" + >鍒犻櫎</el-button + > + </template> + </HxlhTable> <!-- 娣诲姞鎴栦慨鏀规棩鍘嗙鐞嗗璇濇 --> - <el-dialog :title="title" v-model="open" width="500px" append-to-body> + <el-dialog :title="title" v-model="open" width="80%" append-to-body> <el-form 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 :label="1">鍛ㄥ伐浣�</el-radio> - <el-radio :label="2">鑺傚亣鏃�</el-radio> - </el-radio-group> + <!-- <el-radio-group v-model="form.type" @change="handleSwitchType"> + <el-radio :label="'1'">鍛ㄥ伐浣�</el-radio> + <el-radio :label="'2'">鑺傚亣鏃�</el-radio> + </el-radio-group> --> + <el-tag type="primary">鍛ㄥ伐浣�</el-tag> </el-form-item> <el-form-item label="鐢熸晥鏃堕棿" prop="effectiveDate"> <el-date-picker @@ -250,172 +203,158 @@ > </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> + <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"> + <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 + <!-- <el-form-item label="閫傜敤宸ュ巶" prop="applicableFactory" class="factory_use_item" + > --> + <div class="select_factory select_factory_dis">閫傜敤宸ュ巶/杞﹂棿/宸ュ簭</div> + <!-- <el-row :gutter="20" class="select_factory"> --> + <div + class="select_factory_dis" + v-for="(item, index) in applicableSettingList" + :key="index" > + <!-- <el-col :span="7"> --> <el-select + class="select_content" clearable - v-model="dateType" + v-model="item.factory" 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 aps_factory" + :key="plant.value" + :label="plant.label" + :value="`${plant.value};${plant.label}`" > + </el-option> </el-select> - </el-form-item> - <el-form-item + <!-- </el-col> + <el-col :span="7"> --> + <el-select + class="select_content" + clearable + v-model="item.workshop" + style="width: 160px" + placeholder="璇疯緭鍏ラ�傜敤杞﹂棿" + @change="changeWorkshop($event)" + > + <el-option + v-for="shop in shopList" + :key="shop.id" + :label="shop.shopName" + :value="`${shop.id};${shop.shopName}`" + > + </el-option> + </el-select> + <!-- </el-col> + <el-col :span="7"> --> + <el-select + class="select_content" + clearable + v-model="item.process" + style="width: 160px" + placeholder="璇疯緭鍏ラ�傜敤宸ュ簭" + > + <el-option + v-for="process in processList" + :key="process.processNumber" + :label="process.processName" + :value="`${process.processNumber};${process.processName}`" + > + </el-option> + </el-select> + <!-- </el-col> + <el-col :span="3"> --> + <el-button + class="select_content" + type="primary" + icon="Plus" + @click="handleAddFactory(item)" + circle + size="small" + /> + <el-button + v-if="applicableSettingList.length > 1" + class="select_content" + type="primary" + icon="Minus" + @click="handleMinusFactory(item)" + circle + size="small" + /> + <!-- </el-col> --> + </div> + <!-- </el-row> --> + <!-- </el-form-item> --> + <!-- <el-form-item label="閫傜敤杞﹂棿" prop="applicableWorkshop" class="factory_use_item" > - <el-select - clearable - v-model="dateType" - style="width: 160px" - placeholder="璇疯緭鍏ラ�傜敤杞﹂棿" - > - <el-option - v-for="(item, index) of dateTypeList" - :key="index" - :label="item.name" - :value="item.name" - >{{ item.name }}</el-option - > - </el-select> </el-form-item> <el-form-item label="閫傜敤宸ュ簭" prop="applicableProcess" class="factory_use_item" > - <el-select - clearable - v-model="dateType" - style="width: 160px" - placeholder="璇疯緭鍏ラ�傜敤宸ュ簭" - > - <el-option - v-for="(item, index) of dateTypeList" - :key="index" - :label="item.name" - :value="item.name" - >{{ item.name }}</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-item> --> </el-form> <template #footer> <div class="dialog-footer"> @@ -424,10 +363,213 @@ </div> </template> </el-dialog> + <el-dialog + title="璁剧疆鑺傚亣鏃�" + v-model="openSetHolidays" + width="80%" + style="height: 570px" + append-to-body + > + <div class="height_dialog"> + <div class="height_dialog_scroll"> + <div class="grey_bg"> + <div v-if="expand"> + <div class="flex_item"> + <div>宸ヤ綔鏃ュ巻锛� </div> + <div>{{ form.description }}</div> + </div> + <div class="flex_item"> + <div>鐢熸晥鏃堕棿锛� </div> + <div>{{ form.effectiveDate }}</div> + </div> + <div class="flex_item"> + <div>澶辨晥鏃堕棿锛� </div> + <div>{{ form.expiringDate }}</div> + </div> + <div class="flex_item"> + <div>閫傜敤宸ュ巶锛� </div> + <div class="flex_item_dis"> + <div + v-for="(item, index) in form.applicableTranslate" + :key="index" + > + {{ item.factory }} - {{ item.workshop }} - + {{ item.process }} + </div> + </div> + </div> + </div> + <div class="flex_item_expand_end" @click="handleToggleExpand"> + <el-icon :size="18" v-if="expand"><ArrowUpBold /></el-icon> + <el-icon v-else><ArrowDownBold /></el-icon> + </div> + </div> + <div class="title_flex"> + <div class="holiday_title">鑺傚亣鏃ュ垪琛�</div> + <el-button type="primary" size="small" @click="hanldeAddHolidays" + >娣诲姞鑺傚亣鏃�</el-button + > + </div> + <div class="grey_bg"> + <div + class="flex_holidays_set" + v-for="(item, index) in formHolidays.holidays" + :key="index" + > + <div class="dis_error_wrap"> + <div class="flex_item"> + <div class="flex_item_title"> + <span class="error_require">*</span><span>鑺傚亣鏃ユ弿杩�</span> + </div> + <div> + <el-input + style="width: 130px" + v-model="item.describe" + placeholder="璇疯緭鍏ユ弿杩�" + /> + </div> + </div> + <div class="error_text" v-if="item.describe == ''"> + 璇疯緭鍏ヨ妭鍋囨棩鎻忚堪 + </div> + </div> + <div class="dis_error_wrap"> + <div class="flex_item"> + <div class="flex_item_title"> + <span class="error_require">*</span><span>寮�濮嬫椂闂�</span> + </div> + <div> + <el-date-picker + style="width: 130px" + clearable + v-model="item.startdate" + type="date" + :disabled-date="handleDisabledDate" + :default-value="form.effectiveDate" + placeholder="閫夋嫨鏃ユ湡" + > + </el-date-picker> + </div> + </div> + <div class="error_text" v-if="item.startdate == ''"> + 璇疯緭鍏ュ紑濮嬫椂闂� + </div> + </div> + <div class="dis_error_wrap"> + <div class="flex_item"> + <div class="flex_item_title"> + <span class="error_require">*</span><span>缁撴潫鏃堕棿</span> + </div> + <div> + <el-date-picker + style="width: 130px" + clearable + v-model="item.enddate" + type="date" + :disabled-date="handleDisabledDate" + :default-value="form.expiringDate" + placeholder="閫夋嫨鏃ユ湡" + > + </el-date-picker> + </div> + </div> + <div class="error_text" v-if="item.enddate == ''"> + 璇疯緭鍏ョ粨鏉熸椂闂� + </div> + </div> + <div class="dis_error_wrap"> + <div class="flex_item"> + <el-button + v-if="formHolidays.length > 1" + type="danger" + size="small" + @click="handleDelSettingHolidays(item)" + >鍒犻櫎</el-button + > + </div> + </div> + </div> + <!-- <el-form + class="mart10" + ref="holidaysRef" + :model="item" + :rules="holidayRules" + :inline="true" + label-width="105px" + > + <div v-for="(item, index) in formHolidays.holidays" :key="index"> + <el-form-item + label="鑺傚亣鏃ユ弿杩�" + :prop="'holidays.' + index + '.describe'" + :rules="{ required: true, message: '璇疯緭鍏ヨ妭鍋囨棩鎻忚堪', trigger: 'blur' }" + > + <el-input + style="width: 130px" + v-model="item.describe" + placeholder="璇疯緭鍏ユ弿杩�" + /> + </el-form-item> + <el-form-item + label="寮�濮嬫椂闂�" + :prop="'holidays.' + index + '.startdate'" + :rules="{ required: true, message: '璇疯緭鍏ュ紑濮嬫椂闂�', trigger: 'blur' }" + > + <el-date-picker + style="width: 130px" + clearable + v-model="item.startdate" + type="date" + :disabled-date="handleDisabledDate" + :default-value="form.effectiveDate" + placeholder="閫夋嫨鏃ユ湡" + > + </el-date-picker> + </el-form-item> + <el-form-item + label="缁撴潫鏃堕棿" + :prop="'holidays.' + index + '.enddate'" + :rules="{ required: true, message: '璇疯緭鍏ョ粨鏉熸椂闂�', trigger: 'blur' }" + > + <el-date-picker + style="width: 130px" + clearable + v-model="item.enddate" + type="date" + placeholder="閫夋嫨鏃ユ湡" + :disabled-date="handleDisabledDate" + :default-value="form.expiringDate" + > + </el-date-picker> + </el-form-item> + <el-form-item label="" prop=""> + <el-button + v-if="formHolidays.length > 1" + type="danger" + size="small" + @click="handleDelSettingHolidays(item)" + >鍒犻櫎</el-button + > + </el-form-item> + </div> + </el-form> --> + </div> + </div> + </div> + <template #footer> + <div class="dialog-footer"> + <el-button @click="openSetHolidays = false">鍙� 娑�</el-button> + <el-button type="primary" @click="handleSaveHolidaysForm" + >淇濆瓨</el-button + > + </div> + </template> + </el-dialog> </div> </template> <script setup name="Calendar"> +import moment from "moment"; +import HxlhTable from "@/components/HxlhTable"; import { listCalendar, getCalendar, @@ -435,11 +577,19 @@ addCalendar, updateCalendar, } from "@/api/basicData/calendar"; - +import axios from "axios"; +import { listAll_plant, listByWorkShop } from "@/api/basicData/plant"; +import { listAll_shop, listAps_shop } from "@/api/basicData/shop"; +import { selectProcessNameList } from "@/api/basicData/processRoute.js"; +import { ElMessage } from "element-plus"; const { proxy } = getCurrentInstance(); - +const holidaysRef = ref(null); +const { aps_factory } = proxy.useDict("aps_factory"); +const tableRef = ref(); const calendarList = ref([]); const open = ref(false); +const openSetHolidays = ref(false); +const expand = ref(true); const loading = ref(true); const showSearch = ref(true); const ids = ref([]); @@ -447,13 +597,31 @@ const multiple = ref(true); const total = ref(0); const title = ref(""); - const data = reactive({ - form: {}, + form: { + type: "1", + applicable: [ + { + factory: "", + workshop: "", + process: "", + }, + ], + }, + formHolidays: { + holidays: [ + { + enddate: "", + startdate: "", + describe: "", + }, + ], + }, queryParams: { pageNum: 1, pageSize: 10, description: null, + plant: null, type: null, effectiveDate: null, expiringDate: null, @@ -470,13 +638,13 @@ trigger: "blur", }, ], - type: [ - { - required: true, - message: "璇烽�夋嫨鏃ュ巻绫诲瀷", - trigger: "blur", - }, - ], + // type: [ + // { + // required: true, + // message: "璇烽�夋嫨鏃ュ巻绫诲瀷", + // trigger: "blur", + // }, + // ], effectiveDate: [ { required: true, @@ -491,97 +659,225 @@ trigger: "blur", }, ], - applicableFactory: [ - { - required: true, - message: "璇烽�夋嫨閫傜敤宸ュ巶", - trigger: "blur", - }, - ], }, + // holidayRules: { + // describe: [ + // { + // required: true, + // message: "璇疯緭鍏ヨ妭鍋囨棩鎻忚堪", + // trigger: "blur", + // }, + // ], + // startdate: [ + // { + // required: true, + // message: "璇疯緭鍏ュ紑濮嬫椂闂�", + // trigger: "blur", + // }, + // ], + // enddate: [ + // { + // required: true, + // message: "璇疯緭鍏ョ粨鏉熸椂闂�", + // trigger: "blur", + // }, + // ], + // }, }); -const { queryParams, form, rules } = toRefs(data); +const holidayRules = { + holidays: [{ required: true, message: "鑺傚亣鏃ユ槸蹇呭~椤�", trigger: "blur" }], +}; +const { queryParams, form, rules, formHolidays } = toRefs(data); const dateType = ref("鍛ㄥ伐浣�"); const dateTypeList = ref([ { name: "鍛ㄥ伐浣�", + label: "1", }, { name: "鑺傚亣鏃�", + label: "2", }, ]); const typeRadioNumber = ref(1); +const applicableSettingList = ref([ + { factory: "", workshop: "", process: "", id: 0 }, +]); const weekDaysSettingList = ref([ { day: "Monday", chineseName: "鏄熸湡涓�", - work:"y" + work: "y", }, { - day: "TuesDay", + 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 - 220 + "px;"); +// 琛ㄦ牸閰嶇疆-鍒楄〃 +const columns = ref([ + { type: "checkbox", width: 60, align: "center" }, + { + title: "鏃ュ巻鎻忚堪", + field: "description", + width: 150, + align: "center", + }, + { + title: "鏃ュ巻绫诲瀷", + field: "type", + width: 200, + align: "center", + slots: { default: "status" }, + }, + { + title: "鏃ュ巻鐢熸晥鏃堕棿", + field: "effectiveDate", + width: 200, + align: "center", + }, + { + title: "鏃ュ巻澶辨晥鏃堕棿", + field: "expiringDate", + width: 200, + align: "center", + }, + { + title: "鏃ュ巻鍐呭", + field: "content", + width: 230, + align: "center", + slots: { default: "mark" }, + }, + // { + // title: "閫傜敤宸ュ巶", + // field: "applicableFactory", + // width: 200, + // align: "center", + // formatter: ({ cellValue, row, column }) => { + // if (cellValue) { + // for (let i = 0; i < plantList.value.length; i++) { + // if (cellValue === plantList.value[i].plantCode) { + // return plantList.value[i].plantName; + // } + // } + // } + // }, + // }, + // { + // title: "閫傜敤杞﹂棿", + // field: "applicableWorkshop", + // width: 200, + // align: "center", + // formatter: ({ cellValue, row, column }) => { + // if (cellValue) { + // for (let i = 0; i < shopList.value.length; i++) { + // if (cellValue === shopList.value[i].id) { + // return shopList.value[i].shopName; + // } + // } + // } + // return ""; + // }, + // }, + // { + // title: "閫傜敤宸ュ簭", + // field: "applicableProcess", + // width: 200, + // align: "center", + // }, + { + title: "鍒涘缓鑰�", + field: "createBy", + width: 200, + align: "center", + }, + { + title: "鍒涘缓鏃堕棿", + field: "createTime", + width: 200, + align: "center", + }, + { + title: "鎿嶄綔", + width: 270, + fixed: "right", + slots: { default: "buttons" }, + align: "center", + }, +]); +// 鍒嗛〉灞炴�� +const page = ref({ + total: 0, + current: 1, + size: 10, +}); + /** 鏌ヨ鏃ュ巻绠$悊鍒楄〃 */ function getList() { loading.value = true; listCalendar(queryParams.value).then((response) => { calendarList.value = response.rows; - total.value = response.total; + page.value.total = response.total; loading.value = false; }); + axios + .all([ + /** 鏌ヨ宸ュ巶鍒楄〃 */ + listAll_plant({}), + /** 鏌ヨ杞﹂棿鍒楄〃 */ + listAll_shop({}), + ]) + .then( + axios.spread((response1, response2) => { + plantList.value = response1.data; + shopList.value = response2.data; + loading.value = false; + }) + ) + .catch((error) => { + console.error("璇锋眰鍑洪敊:", error); + }); } // 鍙栨秷鎸夐挳 function cancel() { open.value = false; - reset(); -} - -// 琛ㄥ崟閲嶇疆 -function reset() { - form.value = { - id: null, - description: null, - type: null, - effectiveDate: null, - expiringDate: null, - content: null, - applicableFactory: null, - applicableWorkshop: null, - applicableProcess: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - }; - proxy.resetForm("calendarRef"); } /** 鎼滅储鎸夐挳鎿嶄綔 */ @@ -604,39 +900,260 @@ } /** 鏂板鎸夐挳鎿嶄綔 */ -function handleAdd() { - reset(); +async function handleAdd() { open.value = true; + form.value = { + applicable: [ + { + factory: "", + workshop: "", + process: "", + }, + ], + }; title.value = "娣诲姞鏃ュ巻绠$悊"; } - +/** 閫夋嫨宸ュ巶鍚庝簨浠� 鍔犺浇杞﹂棿 鍜� 宸ュ簭 **/ +function changePlant(plant) { + console.log(plant); + listAps_shop({ plantCode: plant.split(";")[0] }).then((response) => { + shopList.value = response.rows; + }); + // selectProcessNameList({ orgCode: plant }).then((response) => { + // processList.value = response.rows; + // }); +} +function changeWorkshop(workShop) { + console.log(workShop.split(";")[0]); + listByWorkShop({ workShop: "姘旀煖" }).then((res) => { + console.log(res, "workShop"); + processList.value = res.rows; + }); +} +function handleAddFactory(row) { + console.log(row); + applicableSettingList.value.push({ ...row, id: ++row.id }); +} +function handleMinusFactory(row) { + applicableSettingList.value = applicableSettingList.value.filter( + (item, index) => item !== row + ); +} /** 淇敼鎸夐挳鎿嶄綔 */ function handleUpdate(row) { - reset(); const _id = row.id || ids.value; getCalendar(_id).then((response) => { form.value = response.data; + // form.value.content = JSON.parse(response.data.content.value); + if (form.value.type === "1") { + weekDaysSettingList.value = JSON.parse( + response.data.content.value + ).weekdays; + } else if (form.value.type === "2") { + holidays.value = JSON.parse(response.data.content.value).holidays; + } + open.value = true; title.value = "淇敼鏃ュ巻绠$悊"; }); } - +// 璁剧疆鑺傚亣鏃� +function handleSetHolidays(row) { + form.value = { + ...row, + applicableTranslate: JSON.parse(row.applicableTranslate), + }; + if (!row.holidays) { + formHolidays.value = { + holidays: [ + { + enddate: "", + startdate: "", + describe: "", + }, + ], + }; + } else { + formHolidays.value.holidays = JSON.parse(row.holidays.value); + } + console.log(formHolidays.value.holidays, "formHolidays.value"); + openSetHolidays.value = true; +} +// 绂佺敤鏃ユ湡 +function handleDisabledDate(date) { + const targetDate = moment(date).valueOf(); + const startDate = moment(form.value.effectiveDate).valueOf(); + const endDate = moment(form.value.expiringDate).valueOf(); + return targetDate < startDate || targetDate > endDate; +} +// 鍒犻櫎鑺傚亣鏃ヨ缃� +function handleDelSettingHolidays(row) { + formHolidays.value.holidays = formHolidays.value.holidays.filter((item) => { + return item != row; + }); +} +// 娣诲姞鑺傚亣鏃� +function hanldeAddHolidays() { + formHolidays.value.holidays.push({ + enddate: "", + startdate: "", + describe: "", + }); +} +function handleToggleExpand() { + expand.value = !expand.value; +} +// const confirmClick = () => { +// let formList = [predictionFormRef] +// let resultArr = []; +// let validate = (form) => { +// let result = new Promise((resolve, reject) => { +// form.value.validate(valid => { +// if (valid) { +// resolve() +// } else { +// reject() +// } +// }) +// }) +// resultArr.push(result) +// } +// formList.forEach(item => { +// validate(item) +// }) +// Promise.all(resultArr).then(() => { +// saveRule() // 鏍¢獙鎴愬姛涔嬪悗 淇濆瓨鏁版嵁鐨勬柟娉� +// }) +// } +// const submitForm = () => { +// formRef.value.validate((valid) => { +// if (valid) { +// alert('submit!'); +// } else { +// alert('Form is not valid.'); +// return false; +// } +// }); +// }; +// 鎻愪氦鑺傚亣鏃� +function handleSaveHolidaysForm() { + const hasValidDates = formHolidays.value.holidays.some( + (item) => item.enddate && item.startdate && item.describe + ); + console.log(hasValidDates, "hasValidDates"); + // holidaysRef.value.validate((valid) => { + // if (!valid) { + // proxy.$modal.msgSuccess("蹇呭~椤逛笉鑳戒负绌�"); + // } + //if (valid) { + if (!hasValidDates) { + updateCalendar({ + id: form.value.id, + holidays: formHolidays.value.holidays.map((item) => { + return { + startdate: moment(item.startdate).format("YYYY-MM-DD"), + enddate: moment(item.enddate).format("YYYY-MM-DD"), + describe: item.describe, + }; + }), + }).then((response) => { + proxy.$modal.msgSuccess("鏂板鎴愬姛"); + open.value = false; + getList(); + }); + } + // }); +} /** 鎻愪氦鎸夐挳 */ function submitForm() { proxy.$refs["calendarRef"].validate((valid) => { if (valid) { + if (applicableSettingList.value[0].factory === "") { + ElMessage({ + type: "error", + message: "鑷冲皯閫夋嫨涓�涓�傜敤宸ュ巶", + }); + return; + } if (form.value.id != null) { - updateCalendar(form.value).then((response) => { + // if (form.value.type === "1") { + // updateCalendar({ + // ...form.value, + // content: { + // weekdays: weekDaysSettingList.value, + // }, + // applicableWorkshop: form.value.applicableWorkshop, + // applicableProcess: form.value.applicableProcess, + // }).then((response) => { + // proxy.$modal.msgSuccess("淇敼鎴愬姛"); + // open.value = false; + // getList(); + // }); + // } else if (form.value.type === "2") { + updateCalendar({ + ...form.value, + content: { + holidays: holidays.value, + }, + applicableWorkshop: form.value.applicableWorkshop.map((item) => { + return { + factory: item.factory.split(";")[0], + process: item.process.split(";")[0], + workshop: item.workshop.split(";")[0], + }; + }), + applicableProcess: form.value.applicableProcess, + type: "1", + }).then((response) => { proxy.$modal.msgSuccess("淇敼鎴愬姛"); open.value = false; getList(); }); + // } } else { - addCalendar(form.value).then((response) => { + // if (form.value.type === "1") { + // addCalendar({ + // ...form.value, + // content: { + // weekdays: weekDaysSettingList.value, + // }, + // }).then((response) => { + // proxy.$modal.msgSuccess("鏂板鎴愬姛"); + // open.value = false; + // getList(); + // }); + // } else if (form.value.type === "2") { + addCalendar({ + ...form.value, + content: { + weekdays: weekDaysSettingList.value, + }, + // holidays: holidays.value, + applicable: applicableSettingList.value.map((item) => { + return { + factory: item.factory.split(";")[0], + process: item.process.split(";")[0], + workshop: item.workshop.split(";")[0], + }; + }), + applicableTranslate: JSON.stringify( + applicableSettingList.value.map((item) => { + return { + factory: item.factory.split(";")[1], + process: item.process.split(";")[1], + workshop: item.workshop.split(";")[1], + }; + }) + ), + type: "1", + // applicableCn: + //}, + }).then((response) => { proxy.$modal.msgSuccess("鏂板鎴愬姛"); open.value = false; getList(); }); + // } } } }); @@ -668,8 +1185,8 @@ ); } function handleSwitchType(e) { - console.log(e, "鏃ユ湡绫诲瀷鍒囨崲"); typeRadioNumber.value = e; + form.value.type = e; form.value.effectiveDate = null; form.value.expiringDate = null; form.value.content = null; @@ -677,11 +1194,26 @@ form.value.applicableWorkshop = null; form.value.applicableProcess = null; } -// 璁剧疆鍛ㄥ伐浣滄棩 -function handleSetWorkDays(e) { - console.log(weekDaysSettingList.value,"璁剧疆鍛ㄥ伐浣滄棩") +function changePageNo(currentPage) { + queryParams.value.pageNum = currentPage; + page.value.current = currentPage; + getList(); } -getList(); +function changePageSize(pageSize) { + page.value.current = 1; + queryParams.value.pageNum = 1; + queryParams.value.pageSize = pageSize; + getList(); +} +// 澶氶�夋閫変腑鏁版嵁 +const handleCheckboxChange = (data) => { + ids.value = data.records.map((item) => item.id); + single.value = data.records.length !== 1; + multiple.value = !data.records.length; +}; +onMounted(() => { + getList(); +}); </script> <style lang="scss" scoped> .column-with-margin { @@ -710,8 +1242,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; @@ -724,4 +1261,104 @@ .factory_use_item { margin-top: 10px; } +.select_factory { + font-weight: 800; + font-size: 14px; + color: #606266; +} +.select_factory_dis { + margin-left: 34px; +} +.select_content { + margin-right: 10px; + margin-top: 20px; + // &:nth-child(1) { + // margin-left:34px; + // } +} +.mart5 { + margin-top: 5px; +} +.custom-height { + height: 200px; /* 鎴栬�呬娇鐢� min-height */ +} +.auto-height-grid .xe-body .xe-body--row { + height: auto; /* 鎴栬�呬娇鐢� min-height */ +} +.mart10 { + margin-top: 20px; +} +.h300 { +} +.height_dialog { + height: 400px; + overflow: hidden; + .height_dialog_scroll { + height: 100%; + overflow: auto; + } +} +.dis_error_wrap { + .error_text { + margin-left: 20px; + font-size: 12px; + color: #f56c6c; + margin-left: 120px; + } +} +.grey_bg { + background: #f1f1f1; + width: 100%; + padding: 10px; + box-sizing: border-box; + .flex_holidays_set { + display: flex; + justify-content: flex-start; + align-items: center; + } + .flex_item { + display: flex; + justify-content: flex-start; + align-items: center; + margin-top: 10px; + .flex_item_title { + width: 85px; + color: #606266; + font-size: 14px; + font-weight: 600; + margin-left: 20px; + margin-right: 10px; + .error_require { + color: #f56c6c; + margin-right: 5px; + } + } + .flex_item_dis { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + & div { + margin-bottom: 5px; + } + } + } + .flex_item_expand_end { + display: flex; + justify-content: flex-end; + align-items: center; + cursor: pointer; + } +} +.title_flex { + margin-top: 20px; + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; + .holiday_title { + font-size: 15px; + font-weight: 500; + } +} </style> -- Gitblit v1.9.3