SyCarryList.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline" @keyup.enter.native="searchQuery">
  6. <a-row :gutter="24">
  7. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  8. <a-form-item label="编码">
  9. <a-input placeholder="请输入编码" v-model="queryParam.code"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  13. <a-form-item label="名称">
  14. <a-input placeholder="请输入名称" v-model="queryParam.name"></a-input>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :xl="6" :lg="7" :md="8" :sm="24">
  18. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  19. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  20. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  21. </span>
  22. </a-col>
  23. </a-row>
  24. </a-form>
  25. </div>
  26. <!-- 操作按钮区域 -->
  27. <div class="table-operator">
  28. <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
  29. <!-- <a-button type="primary" icon="download" @click="handleExportXls('搬运装卸费用-搬运工对账单')">导出</a-button>
  30. <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
  31. <a-button type="primary" icon="import">导入</a-button>
  32. </a-upload> -->
  33. <a-dropdown v-if="selectedRowKeys.length > 0">
  34. <a-menu slot="overlay">
  35. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  36. </a-menu>
  37. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  38. </a-dropdown>
  39. </div>
  40. <!-- table区域-begin -->
  41. <div>
  42. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  43. <i class="anticon anticon-info-circle ant-alert-icon"></i>
  44. <span>已选择</span>
  45. <a style="font-weight: 600">
  46. {{ selectedRowKeys.length }}
  47. </a>
  48. <span>项</span>
  49. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  50. </div>
  51. <a-table
  52. ref="table"
  53. size="middle"
  54. bordered
  55. rowKey="id"
  56. :columns="columns"
  57. :dataSource="dataSource"
  58. :pagination="ipagination"
  59. :loading="loading"
  60. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  61. @change="handleTableChange">
  62. <span slot="action" slot-scope="text, record">
  63. <a @click="handleEdit(record,'0')">编辑</a>
  64. <a-divider type="vertical" />
  65. <a-dropdown>
  66. <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
  67. <a-menu slot="overlay">
  68. <a-menu-item>
  69. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  70. <a>删除</a>
  71. </a-popconfirm>
  72. <a @click="handleEdit(record,'1')">详情</a>
  73. </a-menu-item>
  74. </a-menu>
  75. </a-dropdown>
  76. </span>
  77. </a-table>
  78. </div>
  79. <!-- table区域-end -->
  80. <!-- 表单区域 -->
  81. <syCarry-modal ref="modalForm" @ok="modalFormOk" @close='getList'/>
  82. <sy-carry-detail-modal ref="syCarryDetailModal"></sy-carry-detail-modal>
  83. </a-card>
  84. </template>
  85. <script>
  86. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  87. import SyCarryModal from './modules/SyCarryModal'
  88. import SyCarryDetailModal from './modules/SyCarryDetailModal'
  89. import { getAction } from '@/api/manage'
  90. import moment from 'moment'
  91. export default {
  92. name: "SyCarryList",
  93. mixins: [JeecgListMixin],
  94. components: {
  95. SyCarryModal,
  96. SyCarryDetailModal,
  97. moment
  98. },
  99. data () {
  100. return {
  101. description: '搬运装卸费用-搬运工对账单-主表管理页面',
  102. // 表头
  103. columns: [
  104. {
  105. title: '#',
  106. dataIndex: '',
  107. key: 'rowIndex',
  108. width: 60,
  109. align: "center",
  110. customRender:function (t, r, index) {
  111. return parseInt(index)+1;
  112. }
  113. },
  114. {
  115. title: '名称',
  116. align:"center",
  117. dataIndex: 'name'
  118. },
  119. {
  120. title: '编号',
  121. align:"center",
  122. dataIndex: 'code'
  123. },
  124. {
  125. title: '备注',
  126. align:"center",
  127. dataIndex: 'demo'
  128. },
  129. {
  130. title: '操作',
  131. dataIndex: 'action',
  132. align:"center",
  133. scopedSlots: { customRender: 'action' },
  134. }
  135. ],
  136. queryParam:{},
  137. // 请求参数
  138. url: {
  139. list: "/oa/syCarry/list",
  140. delete: "/oa/syCarry/delete",
  141. deleteBatch: "/oa/syCarry/deleteBatch",
  142. exportXlsUrl: "oa/syCarry/exportXls",
  143. importExcelUrl: "oa/syCarry/importExcel",
  144. editListUrl: '/oa/syCarry/querySyCarryBByMainId'
  145. },
  146. }
  147. },
  148. computed: {
  149. importExcelUrl: function(){
  150. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
  151. }
  152. },
  153. methods: {
  154. getList(){
  155. getAction(this.url.list, this.queryParam).then((res) => {
  156. if(res.success){
  157. this.dataSource=res.result.records
  158. }else{
  159. this.$message.warning(res.message)
  160. }
  161. })
  162. },
  163. searchQuery(){
  164. this.getList()
  165. },
  166. searchReset(){
  167. this.queryParam={}
  168. this.getList()
  169. },
  170. async handleEdit(record,data){
  171. var zhuId = ''
  172. await getAction('/oa/syCarry/queryById', {id:record.id}).then((res) => {
  173. if(res.success){
  174. if(data == '0'){
  175. this.$refs.modalForm.formState=res.result //编辑
  176. }else{
  177. this.$refs.syCarryDetailModal.formState=res.result //详情
  178. }
  179. zhuId = res.result.id
  180. }else{
  181. this.$message.warning(res.message)
  182. }
  183. })
  184. getAction(this.url.editListUrl, {id:zhuId}).then((res) => {
  185. if(res.success){
  186. if(data == '0'){
  187. this.$refs.modalForm.visible = true
  188. this.$refs.modalForm.defultMethods = 'edit'
  189. res.result.map(item =>{
  190. if(item.orderDate !==''&& item.orderDate){
  191. item.orderDate = moment(item.orderDate)
  192. }
  193. })
  194. this.$refs.modalForm.syCarryBTable.dataSource = res.result
  195. }else{
  196. this.$refs.syCarryDetailModal.visible = true
  197. res.result.map(item =>{
  198. if(item.orderDate !==''&& item.orderDate){
  199. item.orderDate = moment(item.orderDate)
  200. }
  201. })
  202. this.$refs.syCarryDetailModal.syCarryBTable.dataSource = res.result
  203. }
  204. }else{
  205. this.$message.warning(res.message)
  206. }
  207. })
  208. },
  209. initDictConfig() {
  210. }
  211. }
  212. }
  213. </script>
  214. <style scoped>
  215. @import '~@assets/less/common.less'
  216. </style>