index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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 multiple v-model="queryParams.modelIds" size="mini" style="width: 200px" clearable>
  19. <el-option v-for="dict in dict.type.oa_templete_id" :key="dict.value" :label="dict.label" :value="dict.value">
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. </el-col>
  24. </el-row>
  25. </el-form>
  26. <div style="position: absolute;top: 18px;right: 10px;">
  27. <el-button type="primary" size="mini" @click="searchList">搜索</el-button>
  28. <el-button size="mini" plain @click="resetList">重置</el-button>
  29. </div>
  30. <div class="btn_grooup">
  31. <!-- <el-button type="primary" size="mini" @click="audits">批量审批</el-button> -->
  32. </div>
  33. <el-table
  34. v-loading="loading"
  35. :data="tableList"
  36. fit
  37. :cell-style="{ borderColor: '#c0c0c0' }"
  38. :header-cell-style="{ borderColor: '#c0c0c0' }"
  39. class="exporttable"
  40. max-height="410"
  41. border
  42. highlight-current-row
  43. style="font-size: 12px;"
  44. @selection-change="handleSelectionChange"
  45. @row-click="rowSelect"
  46. @row-dblclick="doubleClick"
  47. ref="tables"
  48. >
  49. <!-- <el-table-column type="selection" width="55" /> -->
  50. <el-table-column label="序号" type="index" align="center" width="50px"/>
  51. <el-table-column show-overflow-tooltip label="标题" align="center" prop="docSubject"/>
  52. <el-table-column show-overflow-tooltip label="创建人" align="center" prop="docCreate"/>
  53. <el-table-column
  54. fixed="right"
  55. label="操作"
  56. align="center"
  57. width="180"
  58. >
  59. <template slot-scope="scope">
  60. <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
  61. <el-button type="text" size="mini" @click="audit(scope.row)">审批</el-button>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <el-pagination
  66. background
  67. @size-change="handleSizeChange"
  68. @current-change="handleCurrentChange"
  69. :current-page="queryParams.pageNum"
  70. :page-sizes="[10, 20, 50, 100, 200, 500]"
  71. :page-size="20"
  72. layout="total, sizes, prev, pager, next, jumper"
  73. :total=total>
  74. </el-pagination>
  75. <el-card class="box-card" style="margin-top: 10px;">
  76. <div slot="header" class="clearfix">
  77. <span>单据概述</span>
  78. </div>
  79. <el-table
  80. :data="sonTableList"
  81. fit
  82. :cell-style="{ borderColor: '#c0c0c0' }"
  83. :header-cell-style="{ borderColor: '#c0c0c0' }"
  84. class="exporttable"
  85. max-height="410"
  86. border
  87. highlight-current-row
  88. style="font-size: 12px;"
  89. >
  90. <el-table-column label="序号" type="index" align="center" width="50px"/>
  91. <el-table-column v-for="(col,index) in cols" :key="index"
  92. :prop="col.prop"
  93. :label="col.label"
  94. :formatter="col.formatter"
  95. >
  96. </el-table-column>
  97. </el-table>
  98. <el-pagination
  99. background
  100. @size-change="sonSizeChange"
  101. @current-change="sonCurrentChange"
  102. :current-page="sonQuery.pageNum"
  103. :page-sizes="[10, 20, 50, 100, 200, 500]"
  104. :page-size="10"
  105. layout="total, sizes, prev, pager, next, jumper"
  106. :total=sonTotal>
  107. </el-pagination>
  108. </el-card>
  109. </el-card>
  110. </div>
  111. </template>
  112. <script>
  113. import { getWorkSpaceList, auditWork, getWorkDetailList } from '@/api/purchase/workSpace.js'
  114. export default {
  115. name: 'workSpace',
  116. dicts: ['oa_templete_id'],
  117. data() {
  118. return {
  119. queryParams: {
  120. modelIds:[],
  121. docSubject: '',
  122. pageNum: 1,
  123. pageSize: 20
  124. },
  125. loading: false,
  126. tableList: [],
  127. total: 0,
  128. ids: [],
  129. sonTableList: [],
  130. sonQuery: {
  131. pageNum: 1,
  132. pageSize: 10
  133. },
  134. sonTotal: 0,
  135. checkRow: {
  136. billCode: '',
  137. type: ''
  138. },
  139. cols: [
  140. {label: '物料编码', prop: 'materialCode'},
  141. {label: '物料名称', prop: 'materialName'},
  142. {label: '规格', prop: 'specification'},
  143. {label: '型号', prop: 'model'},
  144. {label: '单位', prop: 'unitName'},
  145. {label: '生产厂家/代理人', prop: 'manufacturerName'},
  146. {label: '调出仓库', prop: 'deliveryWarehouseName'},
  147. {label: '调出货位', prop: 'deliveryAllocationName'},
  148. {label: '数量', prop: 'qty'},
  149. {label: '调入仓库', prop: 'storageWarehouseName'},
  150. {label: '调入货位', prop: 'storageAllocationName'},
  151. ],
  152. // 记录点击行的下标
  153. recordIndex: '',
  154. }
  155. },
  156. created() {
  157. this.getList(this.queryParams)
  158. },
  159. methods: {
  160. getList(params){
  161. getWorkSpaceList(params).then(res => {
  162. if (res.code === 200) {
  163. this.tableList = res.rows
  164. this.total = res.total
  165. }
  166. }).then(() => {
  167. this.loading = false
  168. }).catch(err => {
  169. this.loading = false
  170. })
  171. },
  172. searchList() {
  173. this.getList(this.queryParams)
  174. },
  175. resetList() {
  176. this.queryParams = {
  177. modelIds:[],
  178. docSubject: '',
  179. pageNum: 1,
  180. pageSize: 20
  181. }
  182. this.searchList()
  183. },
  184. handleSelectionChange(selection) {
  185. console.log('选中', selection)
  186. this.ids = selection
  187. // console.log('选中数组', this.ids.join())
  188. },
  189. doubleClick(row) {
  190. // this.$refs.tables.toggleRowSelection(row);
  191. this.rowSelect(row)
  192. },
  193. rowSelect(row, column, event) {
  194. // console.log('行信息', row)
  195. // this.recordIndex = this.tableList.findIndex((value, index ,arr) => {
  196. // return value.billCode == row.billCode
  197. // })
  198. // console.log('下标:', this.recordIndex)
  199. // this.check(row)
  200. // 选择行存储便于子表分页
  201. this.checkRow = row
  202. // 采购需求单
  203. if(row.type == 'PU_DEMAND_RULE') {
  204. this.cols = [
  205. {label: '物料编码', prop: 'materialCode'},
  206. {label: '物料名称', prop: 'materialName'},
  207. {label: '规格', prop: 'specification'},
  208. {label: '型号', prop: 'model'},
  209. {label: '单位', prop: 'unitName'},
  210. {label: '生产厂家/代理人', prop: 'manufacturerName'},
  211. {label: '实际(业务)需求量', prop: 'qty'},
  212. {label: '月均销量', prop: 'averageQtyMonth'},
  213. {label: '需求可用周期', prop: 'demandPeriod'},
  214. {label: '业务备注', prop: 'remark'},
  215. {label: '紧急标识', prop: 'isUrgency',
  216. formatter: function(row, column, cellValue, index) {
  217. return row.isUrgency == 'Y' ? '是' : '否'
  218. }
  219. },
  220. {label: '补单标识', prop: 'isReplenishment',
  221. formatter: function(row, column, cellValue, index) {
  222. return row.isReplenishment == 'Y' ? '是' : '否'
  223. }
  224. },
  225. ]
  226. // 调拨订单
  227. } else if (row.type == 'ALLOT_RULE') {
  228. this.cols = [
  229. {label: '物料编码', prop: 'materialCode'},
  230. {label: '物料名称', prop: 'materialName'},
  231. {label: '规格', prop: 'specification'},
  232. {label: '型号', prop: 'model'},
  233. {label: '单位', prop: 'unitName'},
  234. {label: '生产厂家/代理人', prop: 'manufacturerName'},
  235. {label: '调出仓库', prop: 'deliveryWarehouseName'},
  236. {label: '调出货位', prop: 'deliveryAllocationName'},
  237. {label: '数量', prop: 'qty'},
  238. {label: '调入仓库', prop: 'storageWarehouseName'},
  239. {label: '调入货位', prop: 'storageAllocationName'},
  240. ]
  241. // 物料申请单
  242. } else if (row.type == 'MATERIAL_APPLY_RULE') {
  243. this.cols = [
  244. {label: '物料一级分类', prop: 'classOneName'},
  245. {label: '物料基本分类', prop: 'classifyName'},
  246. {label: '物料名称', prop: 'materialName'},
  247. {label: '型号', prop: 'model'},
  248. {label: '规格', prop: 'specification'},
  249. {label: '生产厂家/代理人', prop: 'manufacturerName'},
  250. {label: '注册证号', prop: 'registrationNo'},
  251. {label: '注册人', prop: 'registrant'},
  252. {label: '存储条件', prop: 'storageCondition'},
  253. {label: '运输条件', prop: 'transportationCondition'},
  254. {label: '是否医药物料', prop: 'isMedicine',
  255. formatter: function(row, column, cellValue, index) {
  256. return row.isMedicine == '0' ? '是' : '否'
  257. }
  258. },
  259. {label: '是否药品', prop: 'isDrug',
  260. formatter: function(row, column, cellValue, index) {
  261. return row.isDrug == '0' ? '是' : '否'
  262. }
  263. },
  264. ]
  265. // 价格申报单
  266. } else if (row.type == 'PU_PRICE_APPLY_RULE') {
  267. this.cols = [
  268. {label: '物料编码', prop: 'materialCode'},
  269. {label: '物料名称', prop: 'materialName'},
  270. {label: '型号', prop: 'model'},
  271. {label: '规格', prop: 'specification'},
  272. {label: '生产厂家/代理人', prop: 'manufacturerName'},
  273. {label: '含税单价', prop: 'taxPrice'},
  274. {label: '最近价格', prop: 'recentlyPrice'},
  275. {label: '单价差', prop: 'priceDiffer'},
  276. {label: '客户', prop: 'customerName'},
  277. {label: '供应商名称1', prop: 'supplierName1'},
  278. {label: '单价1', prop: 'unitPrice1'},
  279. ]
  280. // 采购订单
  281. } else if (row.type == 'PU_ORDER_RULE') {
  282. this.cols = [
  283. {label: '收货客户', prop: 'customerName'},
  284. {label: '物料编码', prop: 'materialCode'},
  285. {label: '物料名称', prop: 'materialName'},
  286. {label: '生产厂家', prop: 'manufacturerName'},
  287. {label: '医药物料', prop: 'isMedcine'},
  288. {label: '数量', prop: 'qty'},
  289. {label: '含税单价', prop: 'taxPrice'},
  290. {label: '价税合计', prop: 'money'},
  291. {label: '赠品', prop: 'isGift',
  292. formatter: function(row, column, cellValue, index) {
  293. return row.isGift == 'Y' ? '是' : '否'
  294. }
  295. },
  296. {label: '折扣%', prop: 'nitemdiscountrate'},
  297. {label: '价格类型', prop: 'priceType'},
  298. ]
  299. }
  300. this.getDetailList(this.checkRow)
  301. },
  302. audits() {
  303. if(this.ids.length == 0) {
  304. this.$modal.notifyWarning("请选中至少一条数据");
  305. } else {
  306. this.$modal.confirm('确认审批选中单据?').then(() => {
  307. this.$modal.loading("审批中...");
  308. auditWork(this.ids).then(res => {
  309. if (res.code === 200) {
  310. this.$modal.closeLoading();
  311. this.$modal.notifySuccess("审批成功");
  312. this.searchList()
  313. this.sonTableList = []
  314. }
  315. })
  316. }).catch(() => {
  317. this.$modal.closeLoading();
  318. this.searchList()
  319. this.sonTableList = []
  320. })
  321. }
  322. },
  323. check(row) {
  324. console.log(row)
  325. this.$router.push({path: row.linkUrl ,query: {billCode: row.billCode}})
  326. },
  327. audit(row) {
  328. this.$modal.loading("审批中...");
  329. auditWork([row]).then(res => {
  330. if(res.code === 200) {
  331. this.$modal.closeLoading();
  332. this.$modal.notifySuccess("审批成功");
  333. this.searchList()
  334. this.sonTableList = []
  335. }
  336. })
  337. // .then(() => {
  338. // this.$refs.tables.setCurrentRow(this.tableList[this.recordIndex])
  339. // let param = {
  340. // billCode: this.tableList[this.recordIndex].billCode,
  341. // type: this.tableList[this.recordIndex].type,
  342. // ...this.sonQuery
  343. // }
  344. // getWorkDetailList(param).then(res => {
  345. // if(res.code === 200) {
  346. // this.sonTableList = res.rows
  347. // this.sonTotal = res.total
  348. // }
  349. // }).catch(err => {
  350. // })
  351. // })
  352. .catch(() => {
  353. this.$modal.closeLoading();
  354. this.searchList()
  355. this.sonTableList = []
  356. })
  357. },
  358. handleSizeChange(val) {
  359. this.queryParams.pageSize = val
  360. this.getList(this.queryParams)
  361. },
  362. handleCurrentChange(val) {
  363. this.queryParams.pageNum = val
  364. this.getList(this.queryParams)
  365. },
  366. sonSizeChange(val) {
  367. this.sonQuery.pageSize = val
  368. this.getDetailList(this.checkRow)
  369. },
  370. sonCurrentChange(val) {
  371. this.sonQuery.pageNum = val
  372. this.getDetailList(this.checkRow)
  373. },
  374. // 获取单据概述列表
  375. getDetailList (row) {
  376. this.$modal.loading("加载中...");
  377. let param = {
  378. billCode: row.billCode,
  379. type: row.type,
  380. ...this.sonQuery
  381. }
  382. getWorkDetailList(param).then(res => {
  383. if(res.code === 200) {
  384. this.sonTableList = res.rows
  385. this.sonTotal = res.total
  386. this.$modal.closeLoading();
  387. }
  388. }).catch(err => {
  389. this.$modal.closeLoading();
  390. })
  391. },
  392. }
  393. }
  394. </script>
  395. <style lang="scss" scoped>
  396. #workSpace {
  397. padding: 12px;
  398. box-sizing: border-box;
  399. overflow-y: scroll;
  400. }
  401. .btn_grooup {
  402. margin-bottom: 10px;
  403. display: flex;
  404. justify-content: flex-end;
  405. }
  406. .el-pagination {
  407. margin-top: 10px;
  408. text-align: right;
  409. }
  410. </style>
  411. <style>
  412. .exporttable {
  413. border: solid 1px #c0c0c0;
  414. }
  415. .el-table .el-table__header-wrapper th {
  416. font-size: 14px;
  417. }
  418. </style>