index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. <template>
  2. <div id="workSpace">
  3. <el-card style="position: relative">
  4. <el-form label-width="100px">
  5. <el-row :gutter="10">
  6. <el-col :span="1.5">
  7. <el-form-item label="单据标题">
  8. <el-input
  9. v-model.trim="queryParams.docSubject"
  10. size="mini"
  11. clearable
  12. style="width: 200px"
  13. />
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="1.5">
  17. <el-form-item label="单据类型">
  18. <el-select
  19. multiple
  20. v-model="queryParams.modelIds"
  21. size="mini"
  22. style="width: 200px"
  23. clearable
  24. >
  25. <el-option
  26. v-for="dict in dict.type.oa_templete_id"
  27. :key="dict.value"
  28. :label="dict.label"
  29. :value="dict.value"
  30. >
  31. </el-option>
  32. </el-select>
  33. </el-form-item>
  34. </el-col>
  35. </el-row>
  36. </el-form>
  37. <div style="position: absolute; top: 18px; right: 10px">
  38. <el-button type="primary" size="mini" @click="searchList"
  39. >搜索</el-button
  40. >
  41. <el-button size="mini" plain @click="resetList">重置</el-button>
  42. </div>
  43. <div class="btn_grooup">
  44. <!-- <el-button type="primary" size="mini" @click="audits">批量审批</el-button> -->
  45. </div>
  46. <el-table
  47. v-loading="loading"
  48. :data="tableList"
  49. fit
  50. :cell-style="{ borderColor: '#c0c0c0' }"
  51. :header-cell-style="{ borderColor: '#c0c0c0' }"
  52. class="exporttable"
  53. max-height="410"
  54. border
  55. highlight-current-row
  56. style="font-size: 12px"
  57. @selection-change="handleSelectionChange"
  58. @row-click="rowSelect"
  59. @row-dblclick="doubleClick"
  60. ref="tables"
  61. >
  62. <!-- <el-table-column type="selection" width="55" /> -->
  63. <el-table-column
  64. label="序号"
  65. type="index"
  66. align="center"
  67. width="50px"
  68. />
  69. <el-table-column
  70. show-overflow-tooltip
  71. label="标题"
  72. align="center"
  73. prop="docSubject"
  74. />
  75. <el-table-column
  76. show-overflow-tooltip
  77. label="创建人"
  78. align="center"
  79. prop="docCreate"
  80. width="100px"
  81. />
  82. <el-table-column fixed="right" label="操作" align="center" width="180">
  83. <template slot-scope="scope">
  84. <el-button type="text" size="mini" @click="check(scope.row)"
  85. >查看</el-button
  86. >
  87. <el-button type="text" size="mini" @click="audit(scope.row)"
  88. >审批</el-button
  89. >
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <el-pagination
  94. background
  95. @size-change="handleSizeChange"
  96. @current-change="handleCurrentChange"
  97. :current-page="queryParams.pageNum"
  98. :page-sizes="[10, 20, 50, 100, 200, 500]"
  99. :page-size="20"
  100. layout="total, sizes, prev, pager, next, jumper"
  101. :total="total"
  102. >
  103. </el-pagination>
  104. <el-card class="box-card" style="margin-top: 10px">
  105. <div slot="header" class="clearfix" style="line-height: 38px">
  106. <span>单据概述</span>
  107. </div>
  108. <el-table
  109. :data="sonTableList"
  110. fit
  111. :cell-style="{ borderColor: '#c0c0c0' }"
  112. :header-cell-style="{ borderColor: '#c0c0c0' }"
  113. class="exporttable"
  114. max-height="410"
  115. border
  116. highlight-current-row
  117. style="font-size: 12px"
  118. >
  119. <el-table-column
  120. v-if="cols.length !== 0"
  121. label="序号"
  122. type="index"
  123. align="center"
  124. width="50px"
  125. />
  126. <el-table-column
  127. v-for="(col, index) in cols"
  128. :key="index"
  129. align="center"
  130. :prop="col.prop"
  131. :label="col.label"
  132. :width="col.width"
  133. :formatter="col.formatter"
  134. >
  135. <template slot-scope="scope">
  136. <template v-if="col.attr">
  137. <component
  138. v-if="col.attr.is === 'el-dict-tag'"
  139. v-bind="col.attr"
  140. :size="$attrs.size"
  141. :value="scope.row[col.prop]"
  142. :options="dict.type[col.attr.dictName]"
  143. ></component>
  144. </template>
  145. <template v-else>
  146. <component v-if="col.formatter" is="span">{{
  147. col.formatter(scope.row)
  148. }}</component>
  149. <component v-else is="span">{{
  150. scope.row[col.prop]
  151. }}</component>
  152. </template>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. <el-pagination
  157. background
  158. @size-change="sonSizeChange"
  159. @current-change="sonCurrentChange"
  160. :current-page="sonQuery.pageNum"
  161. :page-sizes="[10, 20, 50, 100, 200, 500]"
  162. :page-size="10"
  163. layout="total, sizes, prev, pager, next, jumper"
  164. :total="sonTotal"
  165. >
  166. </el-pagination>
  167. </el-card>
  168. </el-card>
  169. </div>
  170. </template>
  171. <script>
  172. import {
  173. getWorkSpaceList,
  174. auditWork,
  175. getWorkDetailList,
  176. } from "@/api/purchase/workSpace.js";
  177. export default {
  178. name: "workSpace",
  179. dicts: ["oa_templete_id", "sys_price_type"],
  180. components: {
  181. ElDictTag: () => import("@/components/DictTag/index.vue"),
  182. },
  183. data() {
  184. return {
  185. queryParams: {
  186. modelIds: [],
  187. docSubject: "",
  188. pageNum: 1,
  189. pageSize: 20,
  190. },
  191. loading: false,
  192. tableList: [],
  193. total: 0,
  194. ids: [],
  195. sonTableList: [],
  196. sonQuery: {
  197. pageNum: 1,
  198. pageSize: 10,
  199. },
  200. sonTotal: 0,
  201. checkRow: {
  202. billCode: "",
  203. type: "",
  204. },
  205. cols: [],
  206. // 记录点击行的下标
  207. recordIndex: "",
  208. };
  209. },
  210. created() {
  211. this.getList(this.queryParams);
  212. },
  213. methods: {
  214. getList(params) {
  215. getWorkSpaceList(params)
  216. .then((res) => {
  217. if (res.code === 200) {
  218. this.tableList = res.rows;
  219. this.total = res.total;
  220. }
  221. })
  222. .then(() => {
  223. this.loading = false;
  224. })
  225. .catch((err) => {
  226. this.loading = false;
  227. });
  228. },
  229. searchList() {
  230. this.getList(this.queryParams);
  231. },
  232. resetList() {
  233. this.queryParams = {
  234. modelIds: [],
  235. docSubject: "",
  236. pageNum: 1,
  237. pageSize: 20,
  238. };
  239. this.searchList();
  240. },
  241. handleSelectionChange(selection) {
  242. console.log("选中", selection);
  243. this.ids = selection;
  244. // console.log('选中数组', this.ids.join())
  245. },
  246. doubleClick(row) {
  247. // this.$refs.tables.toggleRowSelection(row);
  248. this.rowSelect(row);
  249. },
  250. rowSelect(row, column, event) {
  251. // console.log('行信息', row)
  252. // this.recordIndex = this.tableList.findIndex((value, index ,arr) => {
  253. // return value.billCode == row.billCode
  254. // })
  255. // console.log('下标:', this.recordIndex)
  256. // this.check(row)
  257. // 选择行存储便于子表分页
  258. this.checkRow = row;
  259. // 采购需求单
  260. if (row.type == "PU_DEMAND_RULE") {
  261. this.cols = [
  262. { label: "物料编码", prop: "materialCode" },
  263. { label: "物料名称", prop: "materialName" },
  264. { label: "规格", prop: "specification" },
  265. { label: "单位", prop: "unitName", width: 50 },
  266. { label: "生产厂家/代理人", prop: "manufacturerName" },
  267. { label: "实际(业务)需求量", prop: "qty", width: 130 },
  268. { label: "月均销量", prop: "averageQtyMonth", width: 80 },
  269. { label: "需求可用周期", prop: "demandPeriod", width: 80 },
  270. { label: "业务备注", prop: "remark" },
  271. {
  272. label: "紧急标识",
  273. prop: "isUrgency",
  274. formatter: function (row, column, cellValue, index) {
  275. return row.isUrgency == "Y" ? "是" : "否";
  276. },
  277. width: 80,
  278. },
  279. {
  280. label: "补单标识",
  281. prop: "isReplenishment",
  282. formatter: function (row, column, cellValue, index) {
  283. return row.isReplenishment == "Y" ? "是" : "否";
  284. },
  285. width: 80,
  286. },
  287. ];
  288. // 调拨订单
  289. } else if (row.type == "ALLOT_RULE") {
  290. this.cols = [
  291. { label: "物料编码", prop: "materialCode", width: 120 },
  292. { label: "物料名称", prop: "materialName" },
  293. { label: "规格", prop: "specification" },
  294. { label: "单位", prop: "unitName" },
  295. { label: "生产厂家/代理人", prop: "manufacturerName" },
  296. { label: "调出仓库", prop: "deliveryWarehouseName" },
  297. { label: "调出货位", prop: "deliveryAllocationName" },
  298. { label: "数量", prop: "qty", width: 50 },
  299. { label: "调入仓库", prop: "storageWarehouseName" },
  300. { label: "调入货位", prop: "storageAllocationName" },
  301. ];
  302. // 物料申请单
  303. } else if (row.type == "MATERIAL_APPLY_RULE") {
  304. this.cols = [
  305. { label: "物料一级分类", prop: "classOneName", width: 120 },
  306. { label: "物料基本分类", prop: "classifyName", width: 120 },
  307. { label: "物料名称", prop: "materialName" },
  308. { label: "规格", prop: "specification" },
  309. { label: "生产厂家/代理人", prop: "manufacturerName" },
  310. { label: "注册证号", prop: "registrationNo" },
  311. { label: "注册人", prop: "registrant" },
  312. { label: "存储条件", prop: "storageCondition" },
  313. { label: "运输条件", prop: "transportationCondition", width: 80 },
  314. // {label: '是否医药物料', prop: 'isMedicine',
  315. // formatter: function(row, column, cellValue, index) {
  316. // return row.isMedicine == '0' ? '是' : '否'
  317. // }
  318. // },
  319. {
  320. label: "是否药品",
  321. prop: "isDrug",
  322. formatter: function (row, column, cellValue, index) {
  323. return row.isDrug == "0" ? "是" : "否";
  324. },
  325. width: 80,
  326. },
  327. ];
  328. // 价格申报单
  329. } else if (row.type == "PU_PRICE_APPLY_RULE") {
  330. // 价格
  331. this.cols = [
  332. { label: "物料编码", prop: "materialCode", width: 120 },
  333. { label: "物料名称", prop: "materialName" },
  334. { label: "规格", prop: "specification" },
  335. { label: "生产厂家/代理人", prop: "manufacturerName" },
  336. { label: "含税单价", prop: "taxPrice", width: 80 },
  337. { label: "最近价格", prop: "recentlyPrice", width: 80 },
  338. { label: "单价差", prop: "priceDiffer", width: 80 },
  339. { label: "申请理由", prop: "explainStr" },
  340. { label: "客户", prop: "customerName" },
  341. { label: "供应商名称1", prop: "supplierName1" },
  342. { label: "单价1", prop: "unitPrice1", width: 70 },
  343. { label: "供应商名称2", prop: "supplierName2" },
  344. { label: "单价2", prop: "unitPrice2", width: 70 },
  345. { label: "供应商名称3", prop: "supplierName3" },
  346. { label: "单价3", prop: "unitPrice3", width: 70 },
  347. {
  348. label: "价格类型",
  349. prop: "priceType",
  350. attr: {
  351. is: "el-dict-tag",
  352. dictName: "sys_price_type",
  353. },
  354. },
  355. {
  356. label: "配送价",
  357. prop: "isDistributionPrice",
  358. formatter: function (row, column, cellValue, index) {
  359. return row.isDistributionPrice == "Y" ? "是" : "否";
  360. },
  361. },
  362. { label: "价格有效期(起)", prop: "periodBegin" },
  363. { label: "价格有效期(止)", prop: "periodEnd" },
  364. { label: "币种名称", prop: "currencyName" },
  365. { label: "无税单价", prop: "price" },
  366. { label: "采购换算率", prop: "conversionRate" },
  367. { label: "采购单位名称", prop: "puUnitName" },
  368. { label: "单位名称", prop: "unitName" },
  369. { label: "调整类型", prop: "isPriceAdjustment" },
  370. {
  371. label: "首次报批",
  372. prop: "isApprovalFirst",
  373. formatter: function (row, column, cellValue, index) {
  374. return row.isApprovalFirst == "Y" ? "是" : "否";
  375. },
  376. },
  377. { label: "预计年采购量", prop: "yPurchaseQuantity" },
  378. { label: "预计年影响量", prop: "yAffectedAmount" },
  379. { label: "涨幅", prop: " increase" },
  380. ];
  381. // 采购订单
  382. } else if (row.type == "PU_ORDER_RULE") {
  383. this.cols = [
  384. { label: "收货客户", prop: "customerName" },
  385. { label: "物料编码", prop: "materialCode", width: 120 },
  386. { label: "物料名称", prop: "materialName" },
  387. { label: "生产厂家", prop: "manufacturerName" },
  388. // {label: '医药物料', prop: 'isMedcine'},
  389. { label: "数量", prop: "qty", width: 60 },
  390. { label: "含税单价", prop: "taxPrice", width: 80 },
  391. {
  392. label: "价税合计",
  393. prop: "money",
  394. width: 80,
  395. formatter: function (row, column, cellValue, index) {
  396. return row.money ? parseFloat(row.money).toFixed(2) : "0.00";
  397. },
  398. },
  399. {
  400. label: "赠品",
  401. prop: "isGift",
  402. width: 50,
  403. formatter: function (row, column, cellValue, index) {
  404. return row.isGift == "Y" ? "是" : "否";
  405. },
  406. },
  407. { label: "折扣%", prop: "nitemdiscountrate", width: 70 },
  408. { label: "价格类型", prop: "priceType", width: 80 },
  409. { label: "规格", prop: "specification" },
  410. { label: "单位", prop: "unitName" },
  411. { label: "税率", prop: "tax" },
  412. { label: "注册证号", prop: "registration" },
  413. { label: "需求单号", prop: "demandCode" },
  414. ];
  415. }
  416. this.getDetailList(this.checkRow);
  417. },
  418. audits() {
  419. if (this.ids.length == 0) {
  420. this.$modal.notifyWarning("请选中至少一条数据");
  421. } else {
  422. this.$modal
  423. .confirm("确认审批选中单据?")
  424. .then(() => {
  425. this.$modal.loading("审批中...");
  426. auditWork(this.ids).then((res) => {
  427. if (res.code === 200) {
  428. this.$modal.closeLoading();
  429. this.$modal.notifySuccess("审批成功");
  430. this.searchList();
  431. this.sonTableList = [];
  432. }
  433. });
  434. })
  435. .catch(() => {
  436. this.$modal.closeLoading();
  437. this.searchList();
  438. this.sonTableList = [];
  439. });
  440. }
  441. },
  442. check(row) {
  443. console.log(row);
  444. this.$router.push({
  445. path: row.linkUrl,
  446. query: { billCode: row.billCode },
  447. });
  448. },
  449. audit(row) {
  450. this.$modal.loading("审批中...");
  451. auditWork([row])
  452. .then((res) => {
  453. if (res.code === 200) {
  454. this.$modal.closeLoading();
  455. this.$modal.notifySuccess("审批成功");
  456. this.searchList();
  457. this.sonTableList = [];
  458. }
  459. })
  460. // .then(() => {
  461. // this.$refs.tables.setCurrentRow(this.tableList[this.recordIndex])
  462. // let param = {
  463. // billCode: this.tableList[this.recordIndex].billCode,
  464. // type: this.tableList[this.recordIndex].type,
  465. // ...this.sonQuery
  466. // }
  467. // getWorkDetailList(param).then(res => {
  468. // if(res.code === 200) {
  469. // this.sonTableList = res.rows
  470. // this.sonTotal = res.total
  471. // }
  472. // }).catch(err => {
  473. // })
  474. // })
  475. .catch(() => {
  476. this.$modal.closeLoading();
  477. this.searchList();
  478. this.sonTableList = [];
  479. });
  480. },
  481. handleSizeChange(val) {
  482. this.queryParams.pageSize = val;
  483. this.getList(this.queryParams);
  484. },
  485. handleCurrentChange(val) {
  486. this.queryParams.pageNum = val;
  487. this.getList(this.queryParams);
  488. },
  489. sonSizeChange(val) {
  490. this.sonQuery.pageSize = val;
  491. this.getDetailList(this.checkRow);
  492. },
  493. sonCurrentChange(val) {
  494. this.sonQuery.pageNum = val;
  495. this.getDetailList(this.checkRow);
  496. },
  497. // 获取单据概述列表
  498. getDetailList(row) {
  499. this.$modal.loading("加载中...");
  500. let param = {
  501. billCode: row.billCode,
  502. type: row.type,
  503. ...this.sonQuery,
  504. };
  505. getWorkDetailList(param)
  506. .then((res) => {
  507. if (res.code === 200) {
  508. this.sonTableList = res.rows;
  509. this.sonTotal = res.total;
  510. this.$modal.closeLoading();
  511. }
  512. })
  513. .catch((err) => {
  514. this.$modal.closeLoading();
  515. });
  516. },
  517. },
  518. };
  519. </script>
  520. <style lang="scss" scoped>
  521. #workSpace {
  522. padding: 12px;
  523. box-sizing: border-box;
  524. overflow-y: scroll;
  525. }
  526. .btn_grooup {
  527. margin-bottom: 10px;
  528. display: flex;
  529. justify-content: flex-end;
  530. }
  531. .el-pagination {
  532. margin-top: 10px;
  533. text-align: right;
  534. }
  535. </style>
  536. <style>
  537. .exporttable {
  538. border: solid 1px #c0c0c0;
  539. }
  540. .el-table .el-table__header-wrapper th {
  541. font-size: 14px;
  542. }
  543. </style>