| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="年份:" style="margin-left: 20px"> |
| | | <el-select |
| | | <el-date-picker |
| | | v-model="data.queryParams.year" |
| | | placeholder="请选择年份" |
| | | style="width: 240px" |
| | | filterable |
| | | allow-create |
| | | default-first-option |
| | | :reserve-keyword="false" |
| | | @change="handleChangeNum" |
| | | > |
| | | <el-option |
| | | v-for="item in data.yearList" |
| | | :key="item.value" |
| | | :label="item.label" |
| | | :value="item.label" |
| | | /> |
| | | </el-select> |
| | | type="year" |
| | | value-format="YYYY" |
| | | /> |
| | | <!-- <el-select--> |
| | | <!-- v-model="data.queryParams.year"--> |
| | | <!-- placeholder="请选择年份"--> |
| | | <!-- style="width: 240px"--> |
| | | <!-- filterable--> |
| | | <!-- allow-create--> |
| | | <!-- default-first-option--> |
| | | <!-- :reserve-keyword="false"--> |
| | | <!-- @change="handleChangeNum"--> |
| | | <!-- >--> |
| | | <!-- <el-option--> |
| | | <!-- v-for="item in data.yearList"--> |
| | | <!-- :key="item.value"--> |
| | | <!-- :label="item.label"--> |
| | | <!-- :value="item.label"--> |
| | | <!-- />--> |
| | | <!-- </el-select>--> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" style="margin-left: 30px" @click="searchClick">查询</el-button> |
| | | <el-button plain @click="reset">重置</el-button> |
| | | |
| | | </el-form-item> |
| | | <el-form-item style="margin-left: 15px"> |
| | | <el-button |
| | | type="primary" |
| | | @click="exportData" |
| | | >导出</el-button> |
| | | <el-button type="primary" plain @click="copy">复制</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </div> |
| | |
| | | /> |
| | | </div> |
| | | <editDialog ref="noticeRef" @getList = "getList"></editDialog> |
| | | <el-dialog |
| | | v-model="copyVisible" |
| | | width="500px" |
| | | :before-close="handleCloseCopy" |
| | | :close-on-press-escape="false" |
| | | :close-on-click-modal="false" |
| | | > |
| | | <div v-if="data.isAdmin"> |
| | | <span style="display:block;margin-bottom: 8px">单位名称:</span> |
| | | <el-select |
| | | v-model="queryParams.companyId" |
| | | filterable |
| | | style="width: 100%;margin-bottom: 8px" |
| | | > |
| | | <el-option |
| | | v-for="item in data.companyList" |
| | | :key="item.id" |
| | | :label="item.name" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | </div> |
| | | <span style="display:block;margin-bottom: 8px">将以下年份数据:</span> |
| | | <el-date-picker |
| | | v-model="data.copyYear" |
| | | type="year" |
| | | value-format="YYYY" |
| | | style="margin-bottom: 8px;width: 100%;" |
| | | placeholder="请选择" |
| | | /> |
| | | <span style="display:block;margin-bottom: 8px">复制到:</span> |
| | | <el-date-picker |
| | | v-model="data.targetYear" |
| | | type="year" |
| | | value-format="YYYY" |
| | | style="margin-bottom: 8px;width: 100%" |
| | | placeholder="请选择" |
| | | /> |
| | | <div class="dialog-footer" style="display: flex;justify-content: right"> |
| | | <el-button @click="handleCloseCopy" size="default">取 消</el-button> |
| | | <el-button type="primary" @click="onSubmitCopy" size="default" v-preReClick>确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import {generateWordDocument} from "@/utils/exportWord"; |
| | | import {delTable, getTable} from "@/api/qualityObjectives/table"; |
| | | import {delRiskControl, getRiskControl} from "@/api/riskManage/risk"; |
| | | import {copySysClause} from "@/api/staffManage/staff"; |
| | | import {copyControl} from "@/api/environment/factors"; |
| | | const { proxy } = getCurrentInstance(); |
| | | const loading = ref(false); |
| | | const noticeRef = ref(); |
| | |
| | | year: '', |
| | | type: '' |
| | | }, |
| | | copyVisible: false, |
| | | targetYear:'', |
| | | copyYear:'', |
| | | companyList: [], |
| | | isAdmin: false, |
| | | dialogVisible: false, |
| | |
| | | const dataList = ref([]); |
| | | const total = ref(0); |
| | | |
| | | const { queryParams } = toRefs(data); |
| | | const { queryParams,copyVisible,chooseYearId } = toRefs(data); |
| | | |
| | | onMounted(() => { |
| | | const userInfo = JSON.parse(Cookies.get('userInfo')) |
| | |
| | | }else { |
| | | data.queryParams.companyId = userInfo.companyId |
| | | } |
| | | getNowYear() |
| | | getList(); |
| | | if(data.isAdmin){ |
| | | getCompanyList() |
| | | } |
| | | }); |
| | | const getNowYear = () =>{ |
| | | data.queryParams.year = new Date().getFullYear().toString() |
| | | } |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | const res = await getRiskControl(data.queryParams); |
| | |
| | | type: '' |
| | | } |
| | | } |
| | | getNowYear() |
| | | getList(); |
| | | |
| | | } |
| | |
| | | data.yearList.push({ value, label: value }); // 添加新选项(这里简单地将值和标签设为相同) |
| | | } |
| | | } |
| | | const copy = () => { |
| | | |
| | | data.copyVisible = true |
| | | } |
| | | |
| | | const onSubmitCopy = async () => { |
| | | if(data.isAdmin && !data.queryParams.companyId){ |
| | | ElMessage.warning('请先选择单位') |
| | | return |
| | | } |
| | | if(!data.copyYear){ |
| | | ElMessage.warning('请先选择要复制的年份') |
| | | return |
| | | } |
| | | if(!data.targetYear){ |
| | | ElMessage.warning('请选择目标年份') |
| | | return |
| | | } |
| | | ElMessageBox.confirm( |
| | | '该操作将覆盖目标年份的数据,是否继续?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then( async() => { |
| | | const param = { |
| | | companyId: data.queryParams.companyId, |
| | | copyYear: data.copyYear, |
| | | targetYear: data.targetYear |
| | | } |
| | | const res = await copyControl(param); |
| | | if(res.code === 200){ |
| | | ElMessage({ |
| | | type: 'success', |
| | | message: res.data |
| | | }); |
| | | await handleCloseCopy() |
| | | await getList(); |
| | | |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | }).catch(err => { |
| | | }) |
| | | } |
| | | const handleCloseCopy = () => { |
| | | data.targetYear='' |
| | | data.copyYear='' |
| | | data.copyVisible = false |
| | | } |
| | | |
| | | </script> |
| | | <style lang="scss"> |