123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- <template>
- <div class="pageIndexClass">
- <div class="content">
- <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :table-events="{
- select: selectRow,
- 'select-all': selectRow,
- }" :action-list="[
- {
- text: '采购',
- disabled: selectData.length === 0,
- action: () => clickPurchase(),
- },
- ]" @get-list="getList">
- <template #claimTime="{ item }">
- <div style="width: 100%">
- <span v-if="item.claimTime">{{ item.claimTime }}</span>
- <span v-else>未到账</span>
- </div>
- </template>
- <template #timeSpent="{ item }">
- <div style="width: 100%">
- <span>{{ getTimeSpent(item) }}</span>
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog title="交接单" v-if="openAllFile" v-model="openAllFile" width="600">
- <byForm :formConfig="formConfig" :formOption="formOption" v-model="rowData" ref="fileState">
- <template #file>
- <div>
- <div v-for="(file, index) in rowData.fileList" :key="index" style="padding: 4px 0">
- <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
- </div>
- </div>
- </template>
- <template #indication>
- <div>
- <div v-for="(file, index) in rowData.packageFileList" :key="index" style="padding: 4px 0">
- <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
- </div>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="openAllFile = false" size="default">关 闭</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { computed, ref } from "vue";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import moment from "moment";
- const { proxy } = getCurrentInstance();
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- },
- });
- const loading = ref(false);
- const config = computed(() => {
- return [
- {
- type: "selection",
- attrs: {
- checkAtt: "isCheck",
- },
- },
- {
- attrs: {
- label: "外销合同编号",
- prop: "contractCode",
- width: 180,
- },
- },
- {
- attrs: {
- label: "合同到账时间",
- slot: "claimTime",
- width: 160,
- },
- },
- {
- attrs: {
- label: "业务员",
- prop: "userName",
- width: 140,
- },
- },
- // {
- // attrs: {
- // label: "版本号",
- // prop: "contractVersion",
- // width: 100,
- // },
- // },
- {
- attrs: {
- label: "产品编码",
- prop: "productCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "产品名称",
- prop: "productName",
- "min-width": 220,
- },
- },
- // {
- // attrs: {
- // label: "单位",
- // prop: "productUnit",
- // width: 140,
- // },
- // },
- {
- attrs: {
- label: "待采购数量",
- prop: "expendQuantity",
- width: 140,
- },
- },
- {
- attrs: {
- label: "已耗时",
- slot: "timeSpent",
- width: 140,
- },
- },
- {
- attrs: {
- label: "交接单",
- width: 80,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "查看",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- checkTheTransferSlip(row);
- },
- },
- ];
- },
- },
- {
- attrs: {
- label: "操作",
- width: 80,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "采购",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickPurchase(row);
- },
- },
- ];
- },
- },
- ];
- });
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/delivery/contractHandoverPage", sourceList.value.pagination)
- .then((res) => {
- sourceList.value.data = res.rows.map((x) => ({ ...x, isCheck: true }));
- sourceList.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getList();
- const clickPurchase = (row) => {
- let ids = "";
- let dataResourceId = "";
- if (row && row.id) {
- ids = row.id;
- dataResourceId = row.contractId;
- } else {
- ids = selectData.value
- .map((item) => {
- return item.id;
- })
- .join(",");
- dataResourceId = selectData.value[0].contractId;
- }
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "ehsd_purchase_flow",
- flowName: "销售订单采购审批",
- random: proxy.random(),
- ids: ids,
- type: 1,
- submitType: "10",
- dataResourceId,
- },
- });
- };
- const selectData = ref([]);
- const selectRow = (data) => {
- selectData.value = data;
- };
- // 监听选中的值,并动态更新是否可选中
- watch(selectData, (newVal, oldVal) => {
- if (newVal.length == 0) {
- sourceList.value.data.forEach((x) => {
- x.isCheck = true;
- });
- } else if (newVal.length == 1) {
- const current = newVal[0];
- sourceList.value.data.forEach((x) => {
- if (x.contractId !== current.contractId) {
- x.isCheck = false;
- }
- });
- }
- });
- const rowData = ref({
- fileList: [],
- packageFileList: [],
- });
- const openAllFile = ref(false);
- const checkTheTransferSlip = (item) => {
- rowData.value = item;
- rowData.value.fileList = [];
- rowData.value.packageFileList = [];
- openAllFile.value = true;
- proxy
- .post("/fileInfo/getList", {
- businessIdList: [item.contractId],
- fileType: 1,
- })
- .then((fileObj) => {
- rowData.value.fileList = fileObj[item.contractId] || [];
- });
- proxy
- .post("/fileInfo/getList", {
- businessIdList: [item.contractId],
- fileType: 2,
- })
- .then((fileObj) => {
- rowData.value.packageFileList = fileObj[item.contractId] || [];
- });
- };
- const openFile = (path) => {
- window.open(path, "_blank");
- };
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- rules: [],
- });
- const fileState = ref(null);
- const formConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "contractCode",
- label: "合同编号",
- itemType: "text",
- disabled: true,
- },
- {
- type: "input",
- prop: "buyCorporationName",
- label: "客户名称",
- itemType: "text",
- disabled: true,
- },
- {
- type: "slot",
- slotName: "file",
- label: "交接单",
- },
- {
- type: "slot",
- slotName: "indication",
- label: "包装指示",
- },
- ];
- });
- const getTimeSpent = (item) => {
- let text = "";
- if (item.sampleTime && item.updateTime) {
- let data = { days: 0, hours: 0, minutes: 0, seconds: 0 };
- if (proxy.compareTime(item.sampleTime, item.updateTime)) {
- data = proxy.timeInterval(
- item.sampleTime,
- moment().format("yyyy-MM-DD HH:mm:ss")
- );
- } else {
- data = proxy.timeInterval(
- item.updateTime,
- moment().format("yyyy-MM-DD HH:mm:ss")
- );
- }
- if (data.days) {
- text = data.days + "天" + data.hours + "小时" + data.minutes + "分";
- } else {
- if (data.hours) {
- text = data.hours + "小时" + data.minutes + "分";
- } else {
- text = data.minutes + "分";
- }
- }
- }
- return text;
- };
- </script>
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- :deep(.el-table__header-wrapper .el-checkbox) {
- display: none;
- }
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- .baseRow {
- min-height: 24px;
- border-top: 1px solid black;
- border-left: 1px solid black;
- }
- .contentRow {
- border-right: 1px solid black;
- line-height: 24px;
- padding-left: 4px;
- }
- </style>
|