index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  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 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',width: 120},
  196. {label: '物料名称', prop: 'materialName'},
  197. {label: '规格', prop: 'specification'},
  198. {label: '单位', prop: 'unitName',width: 50},
  199. {label: '生产厂家/代理人', prop: 'manufacturerName', width: 150},
  200. {label: '实际(业务)需求量', prop: 'qty'},
  201. {label: '月均销量', prop: 'averageQtyMonth', width: 80},
  202. {label: '需求可用周期', prop: 'demandPeriod'},
  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', width: 50},
  224. {label: '生产厂家/代理人', prop: 'manufacturerName', width: 150},
  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'},
  235. {label: '物料基本分类', prop: 'classifyName'},
  236. {label: '物料名称', prop: 'materialName'},
  237. {label: '规格', prop: 'specification'},
  238. {label: '生产厂家/代理人', prop: 'manufacturerName', width: 150},
  239. {label: '注册证号', prop: 'registrationNo'},
  240. {label: '注册人', prop: 'registrant', width: 80},
  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', width: 150},
  262. {label: '含税单价', prop: 'taxPrice', width: 80,
  263. formatter: function(row, column, cellValue, index) {
  264. return row.taxPrice ? parseFloat(row.taxPrice).toFixed(2) : '0.00'
  265. },
  266. },
  267. {label: '最近价格', prop: 'recentlyPrice', width: 80},
  268. {label: '单价差', prop: 'priceDiffer', width: 80},
  269. {label: '客户', prop: 'customerName'},
  270. {label: '供应商名称1', prop: 'supplierName1'},
  271. {label: '单价1', prop: 'unitPrice1', width: 80},
  272. ]
  273. // 采购订单
  274. } else if (row.type == 'PU_ORDER_RULE') {
  275. this.cols = [
  276. {label: '收货客户', prop: 'customerName'},
  277. {label: '物料编码', prop: 'materialCode', width: 120},
  278. {label: '物料名称', prop: 'materialName'},
  279. {label: '生产厂家', prop: 'manufacturerName', width: 150},
  280. // {label: '医药物料', prop: 'isMedcine'},
  281. {label: '数量', prop: 'qty', width: 80,},
  282. {label: '含税单价', prop: 'taxPrice', width: 80,
  283. formatter: function(row, column, cellValue, index) {
  284. return row.taxPrice ? parseFloat(row.taxPrice).toFixed(2) : '0.00'
  285. },
  286. },
  287. {label: '价税合计', prop: 'money', width: 80,},
  288. {label: '赠品', prop: 'isGift', width: 50,
  289. formatter: function(row, column, cellValue, index) {
  290. return row.isGift == 'Y' ? '是' : '否'
  291. }
  292. },
  293. {label: '折扣%', prop: 'nitemdiscountrate', width: 50,},
  294. {label: '价格类型', prop: 'priceType'},
  295. ]
  296. }
  297. this.getDetailList(this.checkRow)
  298. },
  299. audits() {
  300. if(this.ids.length == 0) {
  301. this.$modal.notifyWarning("请选中至少一条数据");
  302. } else {
  303. this.$modal.confirm('确认审批选中单据?').then(() => {
  304. this.$modal.loading("审批中...");
  305. auditWork(this.ids).then(res => {
  306. if (res.code === 200) {
  307. this.$modal.closeLoading();
  308. this.$modal.notifySuccess("审批成功");
  309. this.searchList()
  310. this.sonTableList = []
  311. }
  312. })
  313. }).catch(() => {
  314. this.$modal.closeLoading();
  315. this.searchList()
  316. this.sonTableList = []
  317. })
  318. }
  319. },
  320. check(row) {
  321. console.log(row)
  322. this.$router.push({path: row.linkUrl ,query: {billCode: row.billCode}})
  323. },
  324. audit(row) {
  325. this.$modal.loading("审批中...");
  326. auditWork([row]).then(res => {
  327. if(res.code === 200) {
  328. this.$modal.closeLoading();
  329. this.$modal.notifySuccess("审批成功");
  330. this.searchList()
  331. this.sonTableList = []
  332. }
  333. })
  334. // .then(() => {
  335. // this.$refs.tables.setCurrentRow(this.tableList[this.recordIndex])
  336. // let param = {
  337. // billCode: this.tableList[this.recordIndex].billCode,
  338. // type: this.tableList[this.recordIndex].type,
  339. // ...this.sonQuery
  340. // }
  341. // getWorkDetailList(param).then(res => {
  342. // if(res.code === 200) {
  343. // this.sonTableList = res.rows
  344. // this.sonTotal = res.total
  345. // }
  346. // }).catch(err => {
  347. // })
  348. // })
  349. .catch(() => {
  350. this.$modal.closeLoading();
  351. this.searchList()
  352. this.sonTableList = []
  353. })
  354. },
  355. handleSizeChange(val) {
  356. this.queryParams.pageSize = val
  357. this.getList(this.queryParams)
  358. },
  359. handleCurrentChange(val) {
  360. this.queryParams.pageNum = val
  361. this.getList(this.queryParams)
  362. },
  363. sonSizeChange(val) {
  364. this.sonQuery.pageSize = val
  365. this.getDetailList(this.checkRow)
  366. },
  367. sonCurrentChange(val) {
  368. this.sonQuery.pageNum = val
  369. this.getDetailList(this.checkRow)
  370. },
  371. // 获取单据概述列表
  372. getDetailList (row) {
  373. this.$modal.loading("加载中...");
  374. let param = {
  375. billCode: row.billCode,
  376. type: row.type,
  377. ...this.sonQuery
  378. }
  379. getWorkDetailList(param).then(res => {
  380. if(res.code === 200) {
  381. this.sonTableList = res.rows
  382. this.sonTotal = res.total
  383. this.$modal.closeLoading();
  384. }
  385. }).catch(err => {
  386. this.$modal.closeLoading();
  387. })
  388. },
  389. }
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. #workSpace {
  394. padding: 12px;
  395. box-sizing: border-box;
  396. overflow-y: scroll;
  397. }
  398. .btn_grooup {
  399. margin-bottom: 10px;
  400. display: flex;
  401. justify-content: flex-end;
  402. }
  403. .el-pagination {
  404. margin-top: 10px;
  405. text-align: right;
  406. }
  407. </style>
  408. <style>
  409. .exporttable {
  410. border: solid 1px #c0c0c0;
  411. }
  412. .el-table .el-table__header-wrapper th {
  413. font-size: 14px;
  414. }
  415. </style>