|
@@ -1,136 +1,46 @@
|
|
|
<script>
|
|
|
-import { list } from "@/api/business/purchase/purchase-contract";
|
|
|
-import AddPurchaseContractDrawer from "./add/index.vue";
|
|
|
-import SeePurchaseContractDrawer from "./see-purchase-contract.vue";
|
|
|
-// import DirectSourcingTable from "./direct-sourcing.vue";
|
|
|
+import { TableColumns, SearchColumns } from "./column";
|
|
|
+import { list, remove } from "@/api/business/purchase/purchase-contract";
|
|
|
+import { initPage, initLayout, initPageSizes, initParams } from "@/utils/init";
|
|
|
export default {
|
|
|
- name: "PuchaseTask",
|
|
|
+ name: "PuchaseContract",
|
|
|
components: {
|
|
|
- AddPurchaseContractDrawer,
|
|
|
- SeePurchaseContractDrawer,
|
|
|
- // DirectSourcingTable,
|
|
|
+ AddDrawer: () => import("./add/index.vue"),
|
|
|
+ SeeDrawer: () => import("./see/index.vue"),
|
|
|
},
|
|
|
data() {
|
|
|
- const arr2Obj = function (data, keyName, valueName) {
|
|
|
- return Object.fromEntries(
|
|
|
- data.map((item) => [item[keyName], item[valueName]])
|
|
|
- );
|
|
|
- };
|
|
|
- const searchColumns = [
|
|
|
- { title: "合同名称", key: "contractName", type: "Input" },
|
|
|
- ];
|
|
|
- const initSearchColumns = () => searchColumns;
|
|
|
- const initSearchParams = () => arr2Obj(initSearchColumns(), "key", "value");
|
|
|
- const tableColumns = [
|
|
|
- { key: "id", title: "id" },
|
|
|
- { key: "puOrg", title: "采购组织" },
|
|
|
- { key: "puOrgName", title: "采购组织名称" },
|
|
|
- { key: "code", title: "合同编码" },
|
|
|
- { key: "lastPuMoney", title: "上年度采购额" },
|
|
|
- { key: "buyer", title: "采购员" },
|
|
|
- { key: "buyerName", title: "采购员名称" },
|
|
|
- { key: "supplier", title: "供应商" },
|
|
|
- { key: "supplierName", title: "供应商名称" },
|
|
|
- { key: "contractType", title: "合同类型" },
|
|
|
- { key: "puMoneyYear", title: "本年度采购额" },
|
|
|
- { key: "puDept", title: "采购部门" },
|
|
|
- { key: "puDeptName", title: "采购部门名称" },
|
|
|
- { key: "supplierTier", title: "供应商层级" },
|
|
|
- { key: "contractName", title: "合同名称" },
|
|
|
- { key: "grossRateAverage", title: "平均毛利率" },
|
|
|
- { key: "approveFlow", title: "审批流程" },
|
|
|
- { key: "consumableClass", title: "耗材类别" },
|
|
|
- { key: "effectiveDate", title: "合同生效日期" },
|
|
|
- { key: "brandGrossRate", title: "同类品牌及毛利率" },
|
|
|
- { key: "contractFormat", title: "合同格式" },
|
|
|
- { key: "productName", title: "产品类别&名称" },
|
|
|
- { key: "endDate", title: "合同终止日期" },
|
|
|
- { key: "invoiceTax", title: "发票税率" },
|
|
|
- { key: "emergencyDegree", title: "紧急程度" },
|
|
|
- { key: "project", title: "项目医院" },
|
|
|
- { key: "signDate", title: "合同签订日期" },
|
|
|
- { key: "deliveryType", title: "交货方式" },
|
|
|
- { key: "source", title: "合同来源" },
|
|
|
- { key: "contractPartyc", title: "合同丙方" },
|
|
|
- { key: "contractPartycName", title: "合同丙方名称" },
|
|
|
- { key: "guaranteePeriodEnd", title: "质保期限" },
|
|
|
- { key: "freightMethods", title: "运费承担方式" },
|
|
|
- { key: "isTarget", title: "是否有指标" },
|
|
|
- { key: "contractTarget", title: "合同指标" },
|
|
|
- { key: "exemptionPostageCondtion", title: "包邮条件" },
|
|
|
- { key: "isRebate", title: "是否有返利" },
|
|
|
- { key: "rebatePolicy", title: "返利政策" },
|
|
|
- { key: "externalContract", title: "外部合同号" },
|
|
|
- { key: "rollbackPolicy", title: "退换货政策" },
|
|
|
- { key: "contractContent", title: "合同主要内容" },
|
|
|
- { key: "refusalReasons", title: "拒绝理由" },
|
|
|
- { key: "enquiryCode", title: "询价单号" },
|
|
|
- { key: "externalFile", title: "对外附件" },
|
|
|
- { key: "supplierFile", title: "供应商盖章合同附件" },
|
|
|
- { key: "puFile", title: "采购商盖章合同附件" },
|
|
|
- { key: "projectCode", title: "项目编号" },
|
|
|
- { key: "projectName", title: "项目名称" },
|
|
|
- { key: "area", title: "区域区域" },
|
|
|
- { key: "consigneePhone", title: "收货人联系方式" },
|
|
|
- { key: "paymentAgreement", title: "付款协议" },
|
|
|
- { key: "taxPrice", title: "价税合计" },
|
|
|
- { key: "currency", title: "币种" },
|
|
|
- { key: "currencyName", title: "币种名称" },
|
|
|
- { key: "guaranteePeriod", title: "质保期" },
|
|
|
- { key: "tenantId", title: "租户号" },
|
|
|
- { key: "revision", title: "乐观锁" },
|
|
|
- { key: "createByName", title: "创建人" },
|
|
|
- { key: "updateByName", title: "创建人名称" },
|
|
|
- { key: "delFlag", title: "删除标记" },
|
|
|
- ];
|
|
|
- const initTableColumns = () => tableColumns;
|
|
|
return {
|
|
|
loading: false,
|
|
|
- isSimpleSearch: true,
|
|
|
- searchColumns: initSearchColumns(),
|
|
|
- searchParams: {
|
|
|
- isAsc: "desc",
|
|
|
- reasonable: "",
|
|
|
- orderByColumn: "",
|
|
|
- ...initSearchParams(),
|
|
|
- },
|
|
|
- tableColumns: initTableColumns(),
|
|
|
- tableData: [{ materialName: 1 }],
|
|
|
- page: { pageNum: 1, pageSize: 25 },
|
|
|
- total: 0,
|
|
|
- pageSizes: [25, 50, 100],
|
|
|
+
|
|
|
+ pageSizes: initPageSizes(),
|
|
|
+ layout: initLayout(),
|
|
|
+ page: initPage(),
|
|
|
+
|
|
|
+ searchColumns: SearchColumns,
|
|
|
+ params: initParams(SearchColumns),
|
|
|
+
|
|
|
+ tableColumns: TableColumns,
|
|
|
+ tableData: [],
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- showSearchColumns() {
|
|
|
- return this.isSimpleSearch
|
|
|
- ? this.searchColumns.slice(0, 4)
|
|
|
- : this.searchColumns;
|
|
|
- },
|
|
|
- },
|
|
|
- // watch: {
|
|
|
- // $route: {
|
|
|
- // handler: function (route) {
|
|
|
- // this.redirect = route.query && route.query.redirect;
|
|
|
- // },
|
|
|
- // immediate: true,
|
|
|
- // },
|
|
|
- // },
|
|
|
+ computed: {},
|
|
|
created() {
|
|
|
- this.fetchTaskList();
|
|
|
- console.log("Vue", this);
|
|
|
+ this.handleQueryList();
|
|
|
},
|
|
|
methods: {
|
|
|
- async fetchTaskList() {
|
|
|
- this.loading = true;
|
|
|
+ //
|
|
|
+ async fetchList(params, page) {
|
|
|
try {
|
|
|
+ this.loading = true;
|
|
|
+ const { pageNum, pageSize } = page;
|
|
|
const { code, msg, rows, total } = await list({
|
|
|
- ...this.page,
|
|
|
- ...this.searchParams,
|
|
|
+ pageNum,
|
|
|
+ pageSize,
|
|
|
+ ...params,
|
|
|
});
|
|
|
if (code === 200) {
|
|
|
- this.total = total;
|
|
|
this.tableData = rows;
|
|
|
+ this.page.total = total;
|
|
|
this.$notify.success({ title: msg });
|
|
|
} else {
|
|
|
this.$notify.warning({ title: msg });
|
|
@@ -141,27 +51,60 @@ export default {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
},
|
|
|
- handleSearchChange() {
|
|
|
- this.isSimpleSearch = !this.isSimpleSearch;
|
|
|
- this.$notify.info({
|
|
|
- title: this.isSimpleSearch ? "Simple Search" : "All Search",
|
|
|
- });
|
|
|
+ // 查询操作
|
|
|
+ handleQueryList() {
|
|
|
+ this.fetchList(this.params, this.page);
|
|
|
+ },
|
|
|
+ // 重置操作
|
|
|
+ handleResetList() {
|
|
|
+ this.page = initPage();
|
|
|
+ this.params = initParams();
|
|
|
+ this.fetchList(this.params, this.page);
|
|
|
},
|
|
|
- handleSizeChange() {},
|
|
|
- handleCurrentChange() {},
|
|
|
+ // 刷新操作
|
|
|
+ handleRefreshList() {
|
|
|
+ this.fetchList(this.params, this.page);
|
|
|
+ },
|
|
|
+ // 删除操作
|
|
|
+ async handleDeleteList(prop) {
|
|
|
+ try {
|
|
|
+ this.loading = true;
|
|
|
+ const { id } = prop;
|
|
|
+ const { code, msg } = await remove(id);
|
|
|
+ if (code === 200) {
|
|
|
+ this.$notify.success({ title: msg });
|
|
|
+ this.fetchList(this.params, this.page);
|
|
|
+ } else {
|
|
|
+ this.$notify.warning({ title: msg });
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ this.$notify.error({ title: "error", message: err });
|
|
|
+ } finally {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 页大小变
|
|
|
+ handleSizeChange(prop) {
|
|
|
+ this.page.pageSize = prop;
|
|
|
+ this.fetchList(this.params, this.page);
|
|
|
+ },
|
|
|
+ // 当前页变
|
|
|
+ handleCurrentChange(prop) {
|
|
|
+ this.page.pageNum = prop;
|
|
|
+ this.fetchList(this.params, this.page);
|
|
|
+ },
|
|
|
+ // 打开新增drawer
|
|
|
handleOpenAddDrawer() {
|
|
|
- const { setVisible } = this.$refs.addDrawerFef;
|
|
|
+ console.log(this.$refs.AddDrawerFef);
|
|
|
+ const { setVisible } = this.$refs.AddDrawerFef;
|
|
|
setVisible(true);
|
|
|
- setTimeout(() => {
|
|
|
- this.$notify.info("Open Add Drawer");
|
|
|
- }, 250);
|
|
|
},
|
|
|
- handleOpenSeeDrawer() {
|
|
|
- const { setVisible } = this.$refs.seeDrawerFef;
|
|
|
- setVisible(true);
|
|
|
- setTimeout(() => {
|
|
|
- this.$notify.info("Open See Drawer");
|
|
|
- }, 250);
|
|
|
+ // 打开查看drawer
|
|
|
+ async handleOpenSeeDrawer(prop) {
|
|
|
+ const { id } = prop;
|
|
|
+ const { setVisible, fetchItem } = this.$refs.SeeDrawerFef;
|
|
|
+ await setVisible(true);
|
|
|
+ await fetchItem(id);
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -173,64 +116,46 @@ export default {
|
|
|
style="width: calc(100% - 24px); height: 100%; margin: 10px"
|
|
|
:body-style="{ padding: 0 }"
|
|
|
>
|
|
|
- <AddPurchaseContractDrawer ref="addDrawerFef"></AddPurchaseContractDrawer>
|
|
|
- <SeePurchaseContractDrawer ref="seeDrawerFef"></SeePurchaseContractDrawer>
|
|
|
+ <add-drawer ref="AddDrawerFef" @close="handleResetList"></add-drawer>
|
|
|
+ <see-drawer ref="SeeDrawerFef"></see-drawer>
|
|
|
<el-form
|
|
|
size="mini"
|
|
|
label-position="right"
|
|
|
label-width="85px"
|
|
|
- :model="searchParams"
|
|
|
+ :model="params"
|
|
|
style="padding: 20px 0 0 0"
|
|
|
>
|
|
|
<el-row :gutter="24">
|
|
|
- <el-col :span="20">
|
|
|
- <el-row :gutter="20">
|
|
|
- <el-col
|
|
|
- v-for="column in showSearchColumns"
|
|
|
- :key="column.title"
|
|
|
- :xl="6"
|
|
|
- :lg="6"
|
|
|
- :md="8"
|
|
|
- :sm="12"
|
|
|
- :xs="24"
|
|
|
- >
|
|
|
- <el-form-item :prop="column.key" :label="column.title">
|
|
|
- <el-input
|
|
|
- v-model="searchParams[column.key]"
|
|
|
- :placeholder="column.placeholder"
|
|
|
- ></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-col>
|
|
|
<el-col
|
|
|
- :span="3"
|
|
|
- :offset="1"
|
|
|
- style="text-align: right; padding-right: 40px"
|
|
|
+ v-for="column in searchColumns"
|
|
|
+ :key="column.title"
|
|
|
+ :xl="6"
|
|
|
+ :lg="6"
|
|
|
+ :md="8"
|
|
|
+ :sm="12"
|
|
|
+ :xs="24"
|
|
|
>
|
|
|
- <el-button type="primary" size="mini">搜索</el-button>
|
|
|
- <el-button size="mini">重置</el-button>
|
|
|
+ <el-form-item :prop="column.key" :label="column.title">
|
|
|
+ <el-input
|
|
|
+ v-model="params[column.key]"
|
|
|
+ :placeholder="column.placeholder"
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xl="6" :lg="6" :md="8" :sm="12" :xs="24">
|
|
|
+ <el-button type="primary" size="mini" @click="handleQueryList"
|
|
|
+ >搜 索</el-button
|
|
|
+ >
|
|
|
+ <el-button size="mini" @click="handleResetList">重 置</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
- <el-divider>
|
|
|
- <i
|
|
|
- :class="isSimpleSearch ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
|
|
|
- style="cursor: pointer"
|
|
|
- @click="handleSearchChange"
|
|
|
- ></i>
|
|
|
- </el-divider>
|
|
|
<el-row :gutter="24" style="padding: 0 20px">
|
|
|
- <el-col :span="6">123</el-col>
|
|
|
- <el-col :span="18" style="text-align: right">
|
|
|
- <el-button
|
|
|
- size="mini"
|
|
|
- type="danger"
|
|
|
- style="margin: 0 10px 0 0"
|
|
|
- @click="handleOpenAddDrawer"
|
|
|
- >
|
|
|
- 新增
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-button size="mini" type="danger" @click="handleOpenAddDrawer">
|
|
|
+ 新 增
|
|
|
</el-button>
|
|
|
+ <el-button size="mini" @click="handleRefreshList"> 刷 新 </el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-table
|
|
@@ -248,16 +173,27 @@ export default {
|
|
|
:show-overflow-tooltip="column.showOverflowTooltip || true"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column fixed="right" label="操作" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ @click.native.prevent="handleDeleteList(scope.row)"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ 删 除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<el-pagination
|
|
|
@size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange"
|
|
|
- :total="total"
|
|
|
+ :total="page.total"
|
|
|
:page-sizes="pageSizes"
|
|
|
:page-size="page.pageSize"
|
|
|
:current-page="page.pageNum"
|
|
|
- hide-on-single-page
|
|
|
- layout="total, prev, pager, next, sizes, jumper"
|
|
|
+ :layout="layout"
|
|
|
+ style="margin: 16px 0"
|
|
|
>
|
|
|
</el-pagination>
|
|
|
</el-card>
|