123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495 |
- <template>
- <div>
- <el-card class="box-card">
- <el-tabs v-model="activeName" type="card" @tab-change="changeActiveName">
- <el-tab-pane label="待采购列表" name="first">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- :searchConfig="searchConfig"
- highlight-current-row
- @get-list="getList"
- @clickReset="clickReset">
- <template #code="{ item }">
- <div>
- <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickCode(item)">{{ item.code }}</a>
- </div>
- </template>
- </byTable>
- </el-tab-pane>
- <el-tab-pane label="采购合同" name="second">
- <byTable
- :source="sourceListTwo.data"
- :pagination="sourceListTwo.pagination"
- :config="configTwo"
- :loading="loading"
- :searchConfig="searchConfigTwo"
- highlight-current-row
- @get-list="getListTwo"
- @clickReset="clickResetTwo">
- <template #typeExpand="{ item }">
- <div style="padding: 0 20px">
- <el-table :data="item.purchaseBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader" border>
- <el-table-column label="品号" prop="bomSpecCode" width="120" />
- <el-table-column label="品名" prop="bomSpecName" min-width="240" />
- <el-table-column label="颜色" prop="bomSpecColour" width="180" />
- <el-table-column label="尺寸(长宽高,cm)" width="160">
- <template #default="{ row }">
- <div>{{ row.bomSpecLength }} * {{ row.bomSpecWidth }} * {{ row.bomSpecHeight }}</div>
- </template>
- </el-table-column>
- <el-table-column label="含税单价" prop="unitPrice" width="140" />
- <el-table-column label="税率" prop="taxRate" width="120" />
- <el-table-column label="不含税单价" width="100">
- <template #default="{ row }">
- <div>{{ moneyFormat(Number(Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100)) }}</div>
- </template>
- </el-table-column>
- <el-table-column label="采购数量" prop="purchaseQuantity" width="120" />
- <el-table-column label="含税小计" align="right" width="140">
- <template #default="{ row }">
- <div>{{ moneyFormat(Number(Math.round(row.unitPrice * row.purchaseQuantity * 100) / 100)) }}</div>
- </template>
- </el-table-column>
- <el-table-column label="不含税小计" align="right" width="140">
- <template #default="{ row }">
- <div>
- {{
- moneyFormat(
- Number(Math.round((Math.round(((row.unitPrice * 100) / (100 + row.taxRate)) * 100) / 100) * row.purchaseQuantity * 100) / 100)
- )
- }}
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #code="{ item }">
- <div>
- <a style="color: #409eff; cursor: pointer; word-break: break-all" @click="clickPurchaseCode(item)">{{ item.code }}</a>
- </div>
- </template>
- <template #advancePayment="{ item }">
- <div>{{ item.advancePayment }}%</div>
- </template>
- <template #finalPayment="{ item }">
- <div>{{ 100 - item.advancePayment }}%</div>
- </template>
- </byTable>
- </el-tab-pane>
- </el-tabs>
- </el-card>
- </div>
- </template>
- <script setup>
- import byTable from "/src/components/byTable/index";
- import { ElMessage, ElMessageBox } from "element-plus";
- const { proxy } = getCurrentInstance();
- const activeName = ref("first");
- const flowStatus = ref([
- {
- dictKey: "0",
- dictValue: "未发起",
- },
- {
- dictKey: "1",
- dictValue: "进行中",
- },
- {
- dictKey: "2",
- dictValue: "已通过",
- },
- {
- dictKey: "3",
- dictValue: "已驳回",
- },
- ]);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- code: "",
- beginTime: "",
- endTime: "",
- flowStatus: "2",
- },
- });
- const sourceListTwo = ref({
- data: [],
- pagination: {
- total: 0,
- pageNum: 1,
- pageSize: 10,
- code: "",
- flowStatus: "",
- supplierName: "",
- },
- });
- const loading = ref(false);
- const searchConfig = computed(() => {
- return [
- {
- type: "input",
- prop: "code",
- label: "申购单号",
- },
- {
- type: "date",
- propList: ["beginTime", "endTime"],
- label: "申购日期",
- },
- ];
- });
- const searchConfigTwo = computed(() => {
- return [
- {
- type: "input",
- prop: "code",
- label: "采购单号",
- },
- {
- type: "select",
- prop: "flowStatus",
- data: flowStatus.value,
- label: "流程状态",
- },
- {
- type: "input",
- prop: "supplierName",
- label: "供应商",
- },
- ];
- });
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "申购单号",
- slot: "code",
- width: 220,
- },
- },
- {
- attrs: {
- label: "申购时间",
- prop: "applyTime",
- align: "center",
- width: 160,
- },
- },
- {
- attrs: {
- label: "申购人",
- prop: "applyName",
- width: 160,
- },
- },
- {
- attrs: {
- label: "申购说明",
- prop: "remark",
- },
- },
- {
- attrs: {
- label: "操作",
- width: 80,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- {
- attrs: {
- label: "采购",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickPurchase(row);
- },
- },
- ];
- },
- },
- ];
- });
- const configTwo = computed(() => {
- return [
- {
- type: "expand",
- attrs: {
- label: " ",
- slot: "typeExpand",
- width: 50,
- },
- },
- {
- attrs: {
- label: "采购单号",
- slot: "code",
- width: 160,
- },
- },
- {
- attrs: {
- label: "申购单号",
- prop: "applyBuyCode",
- width: 160,
- },
- },
- {
- attrs: {
- label: "状态",
- prop: "flowStatus",
- width: 100,
- },
- render(val) {
- return proxy.dictKeyValue(val, flowStatus.value);
- },
- },
- {
- attrs: {
- label: "币种",
- prop: "currency",
- width: 100,
- },
- render(val) {
- return proxy.dictKeyValue(val, proxy.useUserStore().allDict["currency"]);
- },
- },
- {
- attrs: {
- label: "预付款",
- slot: "advancePayment",
- width: 80,
- },
- },
- {
- attrs: {
- label: "尾款",
- slot: "finalPayment",
- width: 80,
- },
- },
- {
- attrs: {
- label: "含税总金额",
- prop: "totalAmountIncludingTax",
- width: 120,
- align: "right",
- },
- },
- {
- attrs: {
- label: "不含税总金额",
- prop: "totalAmountExcludingTax",
- width: 120,
- align: "right",
- },
- },
- {
- attrs: {
- label: "结算方式",
- prop: "settlementMethod",
- width: 120,
- },
- render(val) {
- return proxy.dictKeyValue(val, proxy.useUserStore().allDict["settlement_method"]);
- },
- },
- {
- attrs: {
- label: "发票类型",
- prop: "invoiceType",
- width: 140,
- },
- render(val) {
- return proxy.dictKeyValue(val, proxy.useUserStore().allDict["invoice_type"]);
- },
- },
- {
- attrs: {
- label: "交期",
- prop: "deliveryDate",
- width: 160,
- },
- },
- {
- attrs: {
- label: "供应商",
- prop: "supplierName",
- "min-width": 160,
- },
- },
- {
- attrs: {
- label: "创建时间",
- prop: "createTime",
- width: 160,
- },
- },
- {
- attrs: {
- label: "操作",
- width: 120,
- align: "center",
- fixed: "right",
- },
- renderHTML(row) {
- return [
- row.flowStatus == "0" || row.flowStatus == "3"
- ? {
- attrs: {
- label: "编辑",
- type: "primary",
- text: true,
- },
- el: "button",
- click() {
- clickUpdate(row);
- },
- }
- : {},
- row.flowStatus == "0" || row.flowStatus == "3"
- ? {
- attrs: {
- label: "删除",
- type: "danger",
- text: true,
- },
- el: "button",
- click() {
- clickDelete(row);
- },
- }
- : {},
- ];
- },
- },
- ];
- });
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy.post("/applyBuy/page", sourceList.value.pagination).then((res) => {
- sourceList.value.data = res.rows;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- getList();
- const clickReset = () => {
- getList("");
- };
- const getListTwo = async (req, status) => {
- if (status) {
- sourceListTwo.value.pagination = {
- pageNum: sourceListTwo.value.pagination.pageNum,
- pageSize: sourceListTwo.value.pagination.pageSize,
- };
- } else {
- sourceListTwo.value.pagination = { ...sourceListTwo.value.pagination, ...req };
- }
- loading.value = true;
- proxy.post("/purchase/page", sourceListTwo.value.pagination).then((res) => {
- sourceListTwo.value.data = res.rows;
- sourceListTwo.value.pagination.total = res.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const clickResetTwo = () => {
- getListTwo("", true);
- };
- const changeActiveName = (val) => {
- if (val === "first") {
- getList();
- } else {
- getListTwo();
- }
- };
- const clickCode = (item) => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "apply_buy",
- flowName: "申购流程",
- processType: "20",
- id: item.id,
- flowId: item.flowId,
- random: proxy.random(),
- },
- });
- };
- const clickPurchaseCode = (item) => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "purchase",
- flowName: "采购流程",
- processType: "20",
- id: item.id,
- flowId: item.flowId,
- random: proxy.random(),
- },
- });
- };
- const clickPurchase = (item) => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "purchase",
- flowName: "采购流程",
- random: proxy.random(),
- subscribeId: item.id,
- },
- });
- };
- const clickUpdate = (item) => {
- proxy.$router.replace({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: "purchase",
- flowName: "采购流程",
- processType: "40",
- id: item.id,
- random: proxy.random(),
- },
- });
- };
- const clickDelete = (row) => {
- ElMessageBox.confirm("你是否确认此操作", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- proxy.post("/purchase/delete", { id: row.id }).then(() => {
- ElMessage({ message: "删除成功", type: "success" });
- getListTwo();
- });
- })
- .catch(() => {});
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep(.el-input-number .el-input__inner) {
- text-align: left;
- }
- ::v-deep(.el-table__expand-icon) {
- display: grid;
- place-items: center;
- }
- </style>
|