index.vue 14 KB

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