index.vue 14 KB

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