CD配唱片
2025-04-24 6566fbf8b6a78296e81540731d5c10c97ee97857
日历管理新增,修改,删除,分页,查询功能提交
已修改3个文件
506 ■■■■ 文件已修改
src/components/HxlhTable/index.vue 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicData/calendar/index.vue 215 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mainPlan/platePlan/index.vue 286 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/HxlhTable/index.vue
@@ -16,6 +16,7 @@
            :pager-config="tablePage"
            :form-config="tableForm"
            :columns="columns"
            :column-config="{resizable: true}"
            :data.sync="data"
            :checkbox-config="checkboxConfig"
            :height="height"
@@ -26,6 +27,7 @@
            :footer-cell-class-name="footerCellClassName"
            :scroll-x="{enabled: true}"
            :scroll-y="{enabled: true}"
            row-height="auto"
            :expand-config="expandConfig"
            :tree-config="treeConfig"
            :row-style="rowStyle"
@@ -45,6 +47,9 @@
            <template v-slot:status="row" >
              <slot name="status" v-bind="row"/>
          </template>
            <template v-slot:mark="row" >
              <slot name="mark" v-bind="row"/>
            </template>
        </vxe-grid>
    </div>
  </template>
src/views/basicData/calendar/index.vue
@@ -8,7 +8,8 @@
      v-show="showSearch"
      label-width="68px"
    >
      <el-row type="flex" justify="right">
      <el-row type="flex" justify="left">
        <el-col :span="6">
        <el-form-item label="日历描述" prop="description">
          <el-input
            style="width: 140px"
@@ -18,57 +19,15 @@
            @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-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-col>
        <el-col :span="18" 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-button
            type="success"
            icon="Plus"
            @click="handleAdd"
            v-hasPermi="['core:calendar:add']"
            >新增日历</el-button
          > -->
        </el-form-item>
        </el-col>
      </el-row>
    </el-form>
@@ -79,7 +38,7 @@
          plain
          icon="Plus"
          @click="handleAdd"
          v-hasPermi="['core:calendar:add']"
          v-hasPermi="['aps:calendar:update']"
          >新增</el-button
        >
      </el-col>
@@ -90,7 +49,7 @@
          icon="Edit"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['core:calendar:edit']"
          v-hasPermi="['aps:calendar:update']"
          >修改</el-button
        >
      </el-col>
@@ -101,11 +60,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,7 +73,7 @@
          v-hasPermi="['core:calendar:export']"
          >导出</el-button
        >
      </el-col>
      </el-col> -->
      <right-toolbar
        v-model:showSearch="showSearch"
        @queryTable="getList"
@@ -126,17 +85,31 @@
      :data="calendarList"
      :loading="loading"
      :height="height"
      ref="tableRef"
      :page="page"
      @changePageNo="changePageNo"
      @changePageSize="changePageSize"
      @on-checkbox="handleCheckboxChange"
      class="auto-height-grid"
    >
      <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 #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}}: 工作日;&nbsp;</span>
              <span v-if="item.work==='n'" status="info" class="mart5">{{item.chineseName}}: 非工作日;&nbsp;</span>
            </span>
        </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}">
        <vxe-button mode="text" @click="handleUpdate(row)" v-hasPermi="['aps:calendar:update']" >修改</vxe-button>
        <vxe-button mode="text" @click="handleDelete(row)" v-hasPermi="['aps:calendar:remove']" >删除</vxe-button>
      </template>
    </HxlhTable>
@@ -153,8 +126,8 @@
        </el-form-item>
        <el-form-item label="日历类型" prop="type">
          <el-radio-group v-model="form.type" @change="handleSwitchType">
            <el-radio :label="1">周工作</el-radio>
            <el-radio :label="2">节假日</el-radio>
            <el-radio :label="'1'">周工作</el-radio>
            <el-radio :label="'2'">节假日</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="生效时间" prop="effectiveDate">
@@ -177,7 +150,7 @@
          >
          </el-date-picker>
        </el-form-item>
        <div v-if="form.type === 1">
        <div v-if="form.type === '1'">
          <div class="title_bar_line">
            <div class="line_short"></div>
            <div>周工作设置</div>
@@ -197,7 +170,7 @@
            </div>
          </div>
        </div>
        <div v-if="form.type === 2">
        <div v-if="form.type === '2'">
          <div class="title_bar_line">
            <div class="line_short"></div>
            <div>节假日设置</div>
@@ -311,10 +284,12 @@
  addCalendar,
  updateCalendar,
} from "@/api/basicData/calendar";
import axios from "axios";
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 tableRef = ref()
const calendarList = ref([]);
const open = ref(false);
const loading = ref(true);
@@ -325,7 +300,9 @@
const total = ref(0);
const title = ref("");
const data = reactive({
  form: {},
  form: {
    type: "1",
  },
  queryParams: {
    pageNum: 1,
    pageSize: 10,
@@ -381,9 +358,11 @@
const dateTypeList = ref([
  {
    name: "周工作",
    label: "1",
  },
  {
    name: "节假日",
    label: "2",
  },
]);
const typeRadioNumber = ref(1);
@@ -466,7 +445,7 @@
    field: "content",
    width: 200,
    align: "center",
    slots: { default: "content" },
    slots: { default: "mark" },
  },
  {
    title: "适用工厂",
@@ -489,22 +468,22 @@
    },
  },
  {
    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;
      });
    title: '适用车间',
    field: 'applicableWorkshop',
    width: 150,
    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;
             console.log(cellValue,'cellValue')
            return shopList.value[i].shopName
        }
      }
    },
      }
      return '';
    })
  },
  {
    title: "适用工序",
@@ -524,6 +503,7 @@
    width: 90,
    align: "center",
  },
  { title: '操作', width: 100, fixed:"right", slots: { default: 'buttons' }, align: 'center' }
]);
// 分页属性
const page = ref({
@@ -533,15 +513,28 @@
});
/** 查询日历管理列表 */
async function getList() {
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;
  });
  const res = await listAll_plant({});
  plantList.value = res.data;
  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);
  });
}
// 取消按钮
@@ -555,7 +548,7 @@
  form.value = {
    id: null,
    description: null,
    type: null,
    type: "1",
    effectiveDate: null,
    expiringDate: null,
    content: null,
@@ -594,8 +587,8 @@
  reset();
  open.value = true;
  title.value = "添加日历管理";
  const res = await listAll_plant({});
  plantList.value = res.data;
  // const res = await listAll_plant({});
  // plantList.value = res.data;
  console.log(res, "sjchhscwhciwhcwi");
}
@@ -615,6 +608,20 @@
  const _id = row.id || ids.value;
  getCalendar(_id).then((response) => {
    form.value = response.data;
    console.log(
      form.value,
      JSON.parse(response.data.content.value),
      "hushchsuch"
    );
    // 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 = "修改日历管理";
  });
@@ -625,13 +632,36 @@
  proxy.$refs["calendarRef"].validate((valid) => {
    if (valid) {
      if (form.value.id != null) {
        updateCalendar(form.value).then((response) => {
        console.log(form.value, "修改日历===");
        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,
            applicableProcess: form.value.applicableProcess,
          }).then((response) => {
            proxy.$modal.msgSuccess("修改成功");
            open.value = false;
            getList();
          });
        }
      } else {
        if (typeRadioNumber.value === 1) {
        if (form.value.type === "1") {
          addCalendar({
            ...form.value,
            content: {
@@ -642,7 +672,7 @@
            open.value = false;
            getList();
          });
        }else if(typeRadioNumber.value === 2){
        } else if (form.value.type === "2") {
          addCalendar({
            ...form.value,
            content: {
@@ -687,6 +717,7 @@
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;
@@ -709,13 +740,12 @@
  queryParams.value.pageSize = pageSize;
  getList();
}
// function formatType(type) {
//   if(type===1){
//     return "周工作"
//   }else{
//     return "节假日"
//   }
// }
// 多选框选中数据
const handleCheckboxChange = (data) => {
  ids.value = data.records.map((item) => item.id);
  single.value = data.records.length !== 1;
  multiple.value = !data.records.length;
};
onMounted(() => {
  getList();
});
@@ -766,4 +796,13 @@
.factory_use_item {
  margin-top: 10px;
}
.mart5{
  margin-top:5px;
}
.custom-height {
  height: 200px; /* 或者使用 min-height */
}
.auto-height-grid .xe-body .xe-body--row {
  height: auto; /* 或者使用 min-height */
}
</style>
src/views/mainPlan/platePlan/index.vue
@@ -433,46 +433,46 @@
  { field: 'expand', type: 'expand', width: 60, align: 'center', slots: { content: 'expandContent' } },
  { type: 'checkbox', width: 60, align:"center"},
  { type: 'seq', title: '序号', width: 60 },
  {
    title: '主计划员',
    field: 'masterPlanner',
    width: 100,
  },
  {
    title: '周日',
    field: 'weekDay',
    width: 100,
    formatter: (({ cellValue, row, column }) => {
      if (cellValue) {
        const weekDay = new Date(cellValue);
        const year = weekDay.getFullYear();
        const month = String(weekDay.getMonth() + 1).padStart(2, '0');
        const day = String(weekDay.getDate()).padStart(2, '0');
        return `${month}-${day}`;
      }
      return '';
    })
  },
  {
    title: '周度',
    field: 'weekCycle',
    width: 80,
  },
  // {
  //   title: '主计划员',
  //   field: 'masterPlanner',
  //   width: 100,
  // },
  // {
  //   title: '周日',
  //   field: 'weekDay',
  //   width: 100,
  //   formatter: (({ cellValue, row, column }) => {
  //     if (cellValue) {
  //       const weekDay = new Date(cellValue);
  //       const year = weekDay.getFullYear();
  //       const month = String(weekDay.getMonth() + 1).padStart(2, '0');
  //       const day = String(weekDay.getDate()).padStart(2, '0');
  //       return `${month}-${day}`;
  //     }
  //     return '';
  //   })
  // },
  // {
  //   title: '周度',
  //   field: 'weekCycle',
  //   width: 80,
  // },
  {
    title: '主件料号',
    field: 'mainPartNumber',
    width: 150,
  },
  {
    title: '主件图号',
    field: 'mainPartDrawingNumber',
    width: 150,
  },
  {
    title: '客户名称',
    field: 'customer',
    width: 200,
  },
  // {
  //   title: '主件图号',
  //   field: 'mainPartDrawingNumber',
  //   width: 150,
  // },
  // {
  //   title: '客户名称',
  //   field: 'customer',
  //   width: 200,
  // },
  {
    title: '业务类型',
    field: 'businessType',
@@ -503,21 +503,21 @@
    field: 'drawingNo',
    width: 100,
  },
  {
    title: '版本号',
    field: 'versionNumber',
    width: 100,
  },
  // {
  //   title: '版本号',
  //   field: 'versionNumber',
  //   width: 100,
  // },
  {
    title: '生产数量',
    field: 'productionQuantity',
    width: 100,
  },
  {
    title: '良品数量',
    field: 'goodProductsQuantity',
    width: 100,
  },
  // {
  //   title: '良品数量',
  //   field: 'goodProductsQuantity',
  //   width: 100,
  // },
  {
    title: '工序号',
    field: 'processNumber',
@@ -528,91 +528,91 @@
    field: 'workCenter',
    width: 180,
  },
  {
    title: '所属部门',
    field: 'department',
    width: 100,
  },
  {
    title: '计划开工日',
    field: 'planStartDay',
    width: 100,
  },
  // {
  //   title: '所属部门',
  //   field: 'department',
  //   width: 100,
  // },
  // {
  //   title: '计划开工日',
  //   field: 'planStartDay',
  //   width: 100,
  // },
  {
    title: '计划完工日',
    field: 'planEndDay',
    width: 100,
  },
  {
    title: '备料料号',
    field: 'standbyNumber',
    width: 100,
  },
  {
    title: '备料名称',
    field: 'standbyName',
    width: 100,
  },
  {
    title: '备料库存',
    field: 'standbyStock',
    width: 100,
  },
  {
    title: '下道工序所属部门',
    field: 'nextProcessDeparment',
    width: 160,
  },
  {
    title: '是否挂起',
    field: 'isSuspended',
    width: 100,
  },
  {
    title: '外协标识',
    field: 'isOutsourcing',
    width: 100,
  },
  {
    title: '账套',
    field: 'account',
    width: 100,
  },
  {
    title: '上阶物料',
    field: 'advancedMaterials',
    width: 100,
  },
  {
    title: '上阶单据号',
    field: 'advancedDocumentNumber',
    width: 100,
  },
  {
    title: '上阶需求日期',
    field: 'advancedRequirementDay',
    width: 100,
  },
  {
    title: '计划齐套',
    field: 'isPlanComplete',
    width: 100,
  },
  {
    title: '库存齐套',
    field: 'isStockComplete',
    width: 100,
  },
  {
    title: '是否有折返工序',
    field: 'hasTurnback',
    width: 120,
  },
  {
    title: '风险标识',
    field: 'hasRisk',
    width: 100,
  },
  // {
  //   title: '备料料号',
  //   field: 'standbyNumber',
  //   width: 100,
  // },
  // {
  //   title: '备料名称',
  //   field: 'standbyName',
  //   width: 100,
  // },
  // {
  //   title: '备料库存',
  //   field: 'standbyStock',
  //   width: 100,
  // },
  // {
  //   title: '下道工序所属部门',
  //   field: 'nextProcessDeparment',
  //   width: 160,
  // },
  // {
  //   title: '是否挂起',
  //   field: 'isSuspended',
  //   width: 100,
  // },
  // {
  //   title: '外协标识',
  //   field: 'isOutsourcing',
  //   width: 100,
  // },
  // {
  //   title: '账套',
  //   field: 'account',
  //   width: 100,
  // },
  // {
  //   title: '上阶物料',
  //   field: 'advancedMaterials',
  //   width: 100,
  // },
  // {
  //   title: '上阶单据号',
  //   field: 'advancedDocumentNumber',
  //   width: 100,
  // },
  // {
  //   title: '上阶需求日期',
  //   field: 'advancedRequirementDay',
  //   width: 100,
  // },
  // {
  //   title: '计划齐套',
  //   field: 'isPlanComplete',
  //   width: 100,
  // },
  // {
  //   title: '库存齐套',
  //   field: 'isStockComplete',
  //   width: 100,
  // },
  // {
  //   title: '是否有折返工序',
  //   field: 'hasTurnback',
  //   width: 120,
  // },
  // {
  //   title: '风险标识',
  //   field: 'hasRisk',
  //   width: 100,
  // },
]);
@@ -808,24 +808,24 @@
      width: 200,
      align:"center",
    },
    {
      title: '未开工数量',
      field: 'notStartWorkCount',
      width: 90,
      align:"center",
    },
    {
      title: '已完成数量',
      field: 'completedCount',
      width: 90,
      align:"center",
    },
    {
      title: '废弃数量',
      field: 'discardCount',
      width: 90,
      align:"center",
    },
    // {
    //   title: '未开工数量',
    //   field: 'notStartWorkCount',
    //   width: 90,
    //   align:"center",
    // },
    // {
    //   title: '已完成数量',
    //   field: 'completedCount',
    //   width: 90,
    //   align:"center",
    // },
    // {
    //   title: '废弃数量',
    //   field: 'discardCount',
    //   width: 90,
    //   align:"center",
    // },
    {
      title: '标准工时',
      field: 'standardTime',