123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373 |
- <template>
- <div class="pageIndexClass" style="font-size:12px !important">
- <div>
- <byTable :source="sourceList.data" :tableBorder="true" :pagination="sourceList.pagination" :config="config" :loading="loading"
- highlight-current-row :selectConfig="selectConfig" :hidePagination="true" :action-list="[
-
- ]" @get-list="getList">
- <template #product="{ item }">
- <div style="width:100%; ">
- <el-popover placement="bottom-start" title="" :width="300" trigger="hover">
- <div default>
- {{item.productName}}
- </div>
- <template #reference>
- <div style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer">
- {{item.productName}}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- <template #date="{ item }">
- <div style="width:100%; ">
- <div><el-icon :size="16" style="cursor:pointer;margin-right: 3px;position:relative;top:4px" color="#409EFF"
- @click="clickDistributeProduction(item)" v-if="isCurrentCompanyData(item.companyId)">
- <Clock />
- </el-icon>
- <span style="padding:0 8px" v-else></span>
- {{item.produceTime}} ~ {{item.deliveryPeriod}}
- </div>
- </div>
- </template>
- <template v-for="(row) in allDay" v-slot:[row.key]="{ index }" :key="row.key">
- <div style="width:100%">
- <div style="height:12px" class="is-bk"
- :class="{'left-class':index>=0? isAddLeftClass(row,index):false,'right-class':index>=0? isAddRightClass(row,index):false,'all-class':index>=0? (isAddLeftClass(row,index)&&isAddRightClass(row,index)):false}"
- v-if="index>=0 &&sourceList.data && sourceList.data.length>0 && isAddClass(row.day,index)"></div>
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog :title="'打印二维码'" v-model="dialogVisible" width="350px" destroy-on-close>
- <div>
- <div id="pdfDom" style="width:100%">
- <div style="font-size:20px;text-align:center">
- {{printData.name}}
- </div>
- <div style="border-top: 1px solid #000;border-bottom: 1px solid #000; padding: 10px 0; margin:10px auto;text-align:center">
- <div :ref="printData.id" style="width:200px;margin-left:55px">
- {{printData.scanValue}}
- </div>
- <div style="font-size:20px;text-align:center;font-weight:700;margin-top:10px">
- {{printData.produceTime}}
- </div>
- <!-- 换页 -->
- <!-- <div style="page-break-after: always"></div> -->
- </div>
- <div style="margin-left:10px;display:flex;flex-direction:column;justify-content:space-around">
- <div style="font-size:14px;margin-top:8px"> 产品编码:{{printData.productName}}</div>
- <div style="font-size:14px;margin-top:8px">
- 产品名称:{{printData.productSpec}}
- </div>
- <div style="font-size:14px;margin-top:8px">
- 原材料编码:{{printData.productSpec}}
- </div>
- <div style="font-size:14px;margin-top:8px">
- 原材料名称:{{printData.productSpec}}
- </div>
- </div>
- </div>
- </div>
- <template #footer>
- <el-button @click="dialogVisible = false" size="defualt">取 消</el-button>
- <el-button type="primary" v-print="printObj" size="defualt">打 印</el-button>
- </template>
- </el-dialog>
- <el-dialog :title="'投产'" v-model="productionDialog" width="500px" destroy-on-close>
- <byForm :formConfig="productionFormConfig" :formOption="formOption" v-model="formData.data" :rules="productionRules" ref="productionFormDom"
- v-loading="formLoading">
- </byForm>
- <template #footer>
- <el-button @click="productionDialog =false" size="default" v-debounce>取 消</el-button>
- <el-button @click="submitProduction" type="primary" size="default" v-debounce>提 交</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import QRCode from "qrcodejs2-fix";
- import { getDateAllDay } from "@/utils/date.js";
- import moment from "moment";
- import { watch } from "vue";
- const { proxy } = getCurrentInstance();
- const companyData = ref([]);
- const loading = ref(false);
- const submitLoading = ref(false);
- let str = moment().format("yyyy-MM");
- const sourceList = ref({
- data: [],
- pagination: {
- total: 3,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- produceStatus: "",
- beginDate: str,
- endDeliveryPeriod: "",
- beginTime: "",
- endTime: "",
- },
- });
- const treeData = ref([]);
- const dialogVisible = ref(false);
- const modalType = ref("add");
- const statusData = ref([
- {
- label: "未开始",
- value: "0",
- },
- {
- label: "进行中",
- value: "1",
- },
- {
- label: "已完成",
- value: "2",
- },
- ]);
- const allDay = ref([]);
- const changDay = (val) => {
- getList();
- allDay.value = [];
- config.value.splice(4, config.value.length - 4);
- let days = getDateAllDay(val);
- let list = [];
- for (let i = 0; i < days.length; i++) {
- const ele = days[i];
- list.push({
- key: "day" + ele,
- day: ele,
- });
- let attrs = {
- label: `${ele.substr(8, 10)}`,
- slot: "day" + ele,
- isNeedHeaderSlot: false,
- width: 35,
- align: "center",
- fixed: "right",
- };
- config.value.push({
- attrs,
- });
- }
- allDay.value = list;
- };
- const selectConfig = computed(() => [
- {
- label: "生产公司",
- prop: "companyId",
- data: companyData.value,
- },
- {
- type: "time",
- itemType: "month",
- label: "排程日期",
- placeholder: "请选择生产日期",
- prop: "beginDate",
- clearable: false,
- placeholderOne: "",
- propOne: "",
- fn: (val) => {
- changDay(val);
- },
- },
- ]);
- const config = ref([
- {
- attrs: {
- label: "生产公司",
- prop: "companyName",
- width: 100,
- align: "center",
- },
- },
- {
- attrs: {
- label: "生产订单号",
- prop: "code",
- width: 130,
- align: "center",
- },
- },
- {
- attrs: {
- label: "生产日期",
- slot: "date",
- width: 200,
- align: "center",
- },
- },
- {
- attrs: {
- label: "产品",
- slot: "product",
- "min-width": 280,
- // align: "center",
- },
- },
- ]);
- const getList = (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy.post("/produceOrder/schedulingList", sourceList.value.pagination).then(
- (res) => {
- sourceList.value.data = res.map((x, index) => ({
- ...x,
- // id: "id" + index,
- produceTimeOne: x.produceTime,
- produceTime: x.produceTime.substr(0, 10),
- deliveryPeriod: x.deliveryPeriod.substr(0, 10),
- }));
- // sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- },
- (err) => {
- loading.value = false;
- }
- );
- };
- changDay(str);
- const isAddClass = (day, index) => {
- if (index >= 0 && sourceList.value.data[index]) {
- let row = sourceList.value.data[index];
- let start = new Date(row.produceTime).getTime();
- let end = new Date(row.deliveryPeriod + " 23:59:59").getTime();
- let now = new Date(day + " 23:59:59").getTime();
- if (now >= start && now <= end) {
- return true;
- } else {
- return false;
- }
- }
- };
- const isAddLeftClass = (day, index) => {
- if (index >= 0 && sourceList.value.data[index]) {
- let row = sourceList.value.data[index];
- let start = row.produceTime;
- if (day.day == start) {
- return true;
- } else {
- return false;
- }
- }
- };
- const isAddRightClass = (day, index) => {
- if (index >= 0 && sourceList.value.data[index]) {
- let row = sourceList.value.data[index];
- let start = row.deliveryPeriod;
- if (day.day == start) {
- return true;
- } else {
- return false;
- }
- }
- };
- const formData = reactive({
- data: {},
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- });
- const productionFormDom = ref(null);
- const productionDialog = ref(false);
- const formLoading = ref(false);
- const productionFormConfig = computed(() => [
- {
- type: "date",
- itemType: "datetime",
- label: "投产时间",
- prop: "produceTime",
- // placeholder: "合同开始时间",
- itemWidth: 100,
- clearable: true,
- disabledFn: (date) => {
- return moment(date).isBefore(moment());
- },
- },
- ]);
- const productionRules = ref({
- produceTime: [
- { required: true, message: "请选择投产时间", trigger: "change" },
- ],
- });
- const clickDistributeProduction = (row) => {
- formData.data = {
- id: row.id,
- produceTime: row.produceTimeOne,
- };
- productionDialog.value = true;
- };
- const submitProduction = () => {
- productionFormDom.value.handleSubmit(() => {
- formLoading.value = true;
- proxy.post("/produceOrder/editProduceTime", formData.data).then((res) => {
- proxy.msgTip("操作成功");
- formLoading.value = false;
- productionDialog.value = false;
- getList();
- });
- });
- };
- const getDict = () => {
- proxy
- .get("/tenantDept/list", {
- pageNum: 1,
- pageSize: 9999,
- keyword: "",
- tenantId: proxy.useUserStore().user.tenantId,
- type: 0,
- })
- .then((res) => {
- companyData.value = res.data.map((x) => ({
- ...x,
- label: x.deptName,
- value: x.deptId,
- }));
- // treeData.value = proxy.handleTree(res.data, "deptId");
- });
- };
- getDict();
- </script>
- <style lang="scss" scoped>
- ::v-deep(.el-progress__text) {
- font-size: 14px !important;
- }
- .is-bk {
- background: #0066ff;
- }
- .left-class {
- border-radius: 6px 0 0 6px;
- }
- .right-class {
- border-radius: 0px 6px 6px 0px;
- }
- .all-class {
- border-radius: 6px !important ;
- }
- :deep(.el-table .cell) {
- padding: 0px !important;
- font-size: 12px;
- line-height: 28px;
- }
- </style>
|