index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <script>
  2. import { taskList } from "@/api/business/purchase/purchase-contract";
  3. import AddPurchaseContractDrawer from "./add-purchase-contract.vue";
  4. import SeePurchaseContractDrawer from "./see-purchase-contract.vue";
  5. // import DirectSourcingTable from "./direct-sourcing.vue";
  6. export default {
  7. name: "PuchaseTask",
  8. components: {
  9. AddPurchaseContractDrawer,
  10. SeePurchaseContractDrawer,
  11. // DirectSourcingTable,
  12. },
  13. data() {
  14. const arr2Obj = function (data, keyName, valueName) {
  15. return Object.fromEntries(
  16. data.map((item) => [item[keyName], item[valueName]])
  17. );
  18. };
  19. const searchColumns = [
  20. { title: "合同名称", key: "contractName", type: "Input" },
  21. ];
  22. const initSearchColumns = () => searchColumns;
  23. const initSearchParams = () => arr2Obj(initSearchColumns(), "key", "value");
  24. const tableColumns = [
  25. { key: "id", title: "id" },
  26. { key: "puOrg", title: "采购组织" },
  27. { key: "puOrgName", title: "采购组织名称" },
  28. { key: "code", title: "合同编码" },
  29. { key: "lastPuMoney", title: "上年度采购额" },
  30. { key: "buyer", title: "采购员" },
  31. { key: "buyerName", title: "采购员名称" },
  32. { key: "supplier", title: "供应商" },
  33. { key: "supplierName", title: "供应商名称" },
  34. { key: "contractType", title: "合同类型" },
  35. { key: "puMoneyYear", title: "本年度采购额" },
  36. { key: "puDept", title: "采购部门" },
  37. { key: "puDeptName", title: "采购部门名称" },
  38. { key: "supplierTier", title: "供应商层级" },
  39. { key: "contractName", title: "合同名称" },
  40. { key: "grossRateAverage", title: "平均毛利率" },
  41. { key: "approveFlow", title: "审批流程" },
  42. { key: "consumableClass", title: "耗材类别" },
  43. { key: "effectiveDate", title: "合同生效日期" },
  44. { key: "brandGrossRate", title: "同类品牌及毛利率" },
  45. { key: "contractFormat", title: "合同格式" },
  46. { key: "productName", title: "产品类别&名称" },
  47. { key: "endDate", title: "合同终止日期" },
  48. { key: "invoiceTax", title: "发票税率" },
  49. { key: "emergencyDegree", title: "紧急程度" },
  50. { key: "project", title: "项目医院" },
  51. { key: "signDate", title: "合同签订日期" },
  52. { key: "deliveryType", title: "交货方式" },
  53. { key: "source", title: "合同来源" },
  54. { key: "contractPartyc", title: "合同丙方" },
  55. { key: "contractPartycName", title: "合同丙方名称" },
  56. { key: "guaranteePeriodEnd", title: "质保期限" },
  57. { key: "freightMethods", title: "运费承担方式" },
  58. { key: "isTarget", title: "是否有指标" },
  59. { key: "contractTarget", title: "合同指标" },
  60. { key: "exemptionPostageCondtion", title: "包邮条件" },
  61. { key: "isRebate", title: "是否有返利" },
  62. { key: "rebatePolicy", title: "返利政策" },
  63. { key: "externalContract", title: "外部合同号" },
  64. { key: "rollbackPolicy", title: "退换货政策" },
  65. { key: "contractContent", title: "合同主要内容" },
  66. { key: "refusalReasons", title: "拒绝理由" },
  67. { key: "enquiryCode", title: "询价单号" },
  68. { key: "externalFile", title: "对外附件" },
  69. { key: "supplierFile", title: "供应商盖章合同附件" },
  70. { key: "puFile", title: "采购商盖章合同附件" },
  71. { key: "projectCode", title: "项目编号" },
  72. { key: "projectName", title: "项目名称" },
  73. { key: "area", title: "区域区域" },
  74. { key: "consigneePhone", title: "收货人联系方式" },
  75. { key: "paymentAgreement", title: "付款协议" },
  76. { key: "taxPrice", title: "价税合计" },
  77. { key: "currency", title: "币种" },
  78. { key: "currencyName", title: "币种名称" },
  79. { key: "guaranteePeriod", title: "质保期" },
  80. { key: "tenantId", title: "租户号" },
  81. { key: "revision", title: "乐观锁" },
  82. { key: "createByName", title: "创建人" },
  83. { key: "updateByName", title: "创建人名称" },
  84. { key: "delFlag", title: "删除标记" },
  85. ];
  86. const initTableColumns = () => tableColumns;
  87. return {
  88. loading: false,
  89. isSimpleSearch: true,
  90. searchColumns: initSearchColumns(),
  91. searchParams: {
  92. isAsc: "desc",
  93. reasonable: "",
  94. orderByColumn: "",
  95. ...initSearchParams(),
  96. },
  97. tableColumns: initTableColumns(),
  98. tableData: [{ materialName: 1 }],
  99. page: { pageNum: 1, pageSize: 25 },
  100. total: 0,
  101. pageSizes: [25, 50, 100],
  102. };
  103. },
  104. computed: {
  105. showSearchColumns() {
  106. return this.isSimpleSearch
  107. ? this.searchColumns.slice(0, 4)
  108. : this.searchColumns;
  109. },
  110. },
  111. // watch: {
  112. // $route: {
  113. // handler: function (route) {
  114. // this.redirect = route.query && route.query.redirect;
  115. // },
  116. // immediate: true,
  117. // },
  118. // },
  119. created() {
  120. this.fetchTaskList();
  121. console.log("Vue", this);
  122. },
  123. methods: {
  124. async fetchTaskList() {
  125. this.loading = true;
  126. try {
  127. const { code, msg, rows, total } = await taskList({
  128. ...this.page,
  129. ...this.searchParams,
  130. });
  131. if (code === 200) {
  132. this.total = total;
  133. this.tableData = rows;
  134. this.$notify.success({ title: msg });
  135. } else {
  136. this.$notify.warning({ title: msg });
  137. }
  138. } catch (err) {
  139. this.$notify.error({ title: "error", message: err });
  140. } finally {
  141. this.loading = false;
  142. }
  143. },
  144. handleSearchChange() {
  145. this.isSimpleSearch = !this.isSimpleSearch;
  146. this.$notify.info({
  147. title: this.isSimpleSearch ? "Simple Search" : "All Search",
  148. });
  149. },
  150. handleSizeChange() {},
  151. handleCurrentChange() {},
  152. handleOpenAddDrawer() {
  153. const { setVisible } = this.$refs.addDrawerFef;
  154. setVisible(true);
  155. setTimeout(() => {
  156. this.$notify.info("Open Add Drawer");
  157. }, 250);
  158. },
  159. handleOpenSeeDrawer() {
  160. const { setVisible } = this.$refs.seeDrawerFef;
  161. setVisible(true);
  162. setTimeout(() => {
  163. this.$notify.info("Open See Drawer");
  164. }, 250);
  165. },
  166. },
  167. };
  168. </script>
  169. <template>
  170. <el-card
  171. v-loading="loading"
  172. style="width: calc(100% - 24px); height: 100%; margin: 10px"
  173. :body-style="{ padding: 0 }"
  174. >
  175. <AddPurchaseContractDrawer ref="addDrawerFef"></AddPurchaseContractDrawer>
  176. <SeePurchaseContractDrawer ref="seeDrawerFef"></SeePurchaseContractDrawer>
  177. <el-form
  178. size="mini"
  179. label-position="right"
  180. label-width="85px"
  181. :model="searchParams"
  182. style="padding: 20px 0 0 0"
  183. >
  184. <el-row :gutter="24">
  185. <el-col :span="20">
  186. <el-row :gutter="20">
  187. <el-col
  188. v-for="column in showSearchColumns"
  189. :key="column.title"
  190. :xl="6"
  191. :lg="6"
  192. :md="8"
  193. :sm="12"
  194. :xs="24"
  195. >
  196. <el-form-item :prop="column.key" :label="column.title">
  197. <el-input
  198. v-model="searchParams[column.key]"
  199. :placeholder="column.placeholder"
  200. ></el-input>
  201. </el-form-item>
  202. </el-col>
  203. </el-row>
  204. </el-col>
  205. <el-col
  206. :span="3"
  207. :offset="1"
  208. style="text-align: right; padding-right: 40px"
  209. >
  210. <el-button type="primary" size="mini">搜索</el-button>
  211. <el-button size="mini">重置</el-button>
  212. </el-col>
  213. </el-row>
  214. </el-form>
  215. <el-divider>
  216. <i
  217. :class="isSimpleSearch ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
  218. style="cursor: pointer"
  219. @click="handleSearchChange"
  220. ></i>
  221. </el-divider>
  222. <el-row :gutter="24" style="padding: 0 20px">
  223. <el-col :span="6">123</el-col>
  224. <el-col :span="18" style="text-align: right">
  225. <el-button
  226. size="mini"
  227. type="danger"
  228. style="margin: 0 10px 0 0"
  229. @click="handleOpenAddDrawer"
  230. >
  231. 新增
  232. </el-button>
  233. </el-col>
  234. </el-row>
  235. <el-table
  236. @row-dblclick="handleOpenSeeDrawer"
  237. :data="tableData"
  238. size="mini"
  239. style="width: 100%; margin: 20px 0 0 0"
  240. >
  241. <el-table-column
  242. v-for="(column, index) in tableColumns"
  243. :key="index"
  244. :prop="column.key"
  245. :label="column.title"
  246. :width="column.width || 180"
  247. :show-overflow-tooltip="column.showOverflowTooltip || true"
  248. >
  249. </el-table-column>
  250. </el-table>
  251. <el-pagination
  252. @size-change="handleSizeChange"
  253. @current-change="handleCurrentChange"
  254. :total="total"
  255. :page-sizes="pageSizes"
  256. :page-size="page.pageSize"
  257. :current-page="page.pageNum"
  258. hide-on-single-page
  259. layout="total, prev, pager, next, sizes, jumper"
  260. >
  261. </el-pagination>
  262. </el-card>
  263. </template>