list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. <template>
  2. <a-card size="small" :bordered="false" class="salesManagementList-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="费用单号" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  10. <a-input id="salesManagementList-expenseAccountNo" v-model.trim="queryParam.expenseAccountNo" allowClear placeholder="请输入销售单号"/>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="申请人" :label-col="{ span:7 }" :wrapper-col="{ span:17}">
  15. <employee style="width: 100%;" id="salesManagementList-Employee" v-model="queryParam.applyPersonSn"></employee>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="费用类型">
  20. <v-select
  21. v-model="queryParam.expenseType"
  22. ref="expenseType"
  23. id="salesManagementList-expenseType"
  24. code="EXPENSE_TYPE"
  25. placeholder="请选择费用类型"
  26. allowClear></v-select>
  27. </a-form-item>
  28. </a-col>
  29. <template v-if="advanced">
  30. <a-col :md="6" :sm="24">
  31. <a-form-item label="费用发生月份">
  32. <a-month-picker
  33. placeholder="请选择月份"
  34. locale="zh-cn"
  35. v-model="queryParam.expenseDate"
  36. @change="onChange"
  37. :disabled-date="disabledDate"
  38. style="width: 100%;"/>
  39. </a-form-item>
  40. </a-col>
  41. <a-col :md="6" :sm="24">
  42. <a-form-item label="主题">
  43. <a-input id="salesManagementList-title" v-model.trim="queryParam.title" allowClear placeholder="请输入主题"/>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :md="6" :sm="24">
  47. <a-form-item label="状态">
  48. <v-select
  49. v-model="queryParam.state"
  50. ref="state"
  51. id="salesManagementList-state"
  52. code="EXPENSE_STATE"
  53. placeholder="请选择状态"
  54. allowClear></v-select>
  55. </a-form-item>
  56. </a-col>
  57. </template>
  58. <a-col :md="6" :sm="24">
  59. <span class="table-page-search-submitButtons">
  60. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  61. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  62. <a @click="advanced=!advanced" style="margin-left: 8px">
  63. {{ advanced ? '收起' : '展开' }}
  64. <a-icon :type="advanced ? 'up' : 'down'"/>
  65. </a>
  66. </span>
  67. </a-col>
  68. </a-row>
  69. </a-form>
  70. </div>
  71. <!-- 操作按钮 -->
  72. <div class="table-operator">
  73. <a-button type="primary" class="button-error" v-if="$hasPermissions('B_eRNew')" @click="handleEdit()">新增</a-button>
  74. </div>
  75. <!-- 列表 -->
  76. <s-table
  77. class="sTable fixPagination"
  78. ref="table"
  79. :style="{ height: tableHeight+70.5+'px' }"
  80. size="small"
  81. :rowKey="(record) => record.id"
  82. :columns="columns"
  83. :data="loadData"
  84. :scroll="{ y: tableHeight }"
  85. :defaultLoadData="false"
  86. bordered>
  87. <!-- 单号 -->
  88. <template slot="expenseAccountNo" slot-scope="text, record">
  89. <span v-if="$hasPermissions('B_eRdetail')" class="link-bule" @click="handleDetail(record)">{{ record.expenseAccountNo }}</span>
  90. <div v-else>{{ record.expenseAccountNo||'--' }}</div>
  91. </template>
  92. <!-- 总数量 -->
  93. <template slot="totalQty" slot-scope="text, record">
  94. {{ record.totalQty }}
  95. </template>
  96. <!-- 操作 -->
  97. <template slot="action" slot-scope="text, record">
  98. <a-button
  99. v-if="record.state=='WAIT_SUBMIT'&&$hasPermissions('B_ERtEdit')"
  100. size="small"
  101. type="link"
  102. class="button-info"
  103. @click="handleEdit(record)"
  104. >
  105. 编辑
  106. </a-button>
  107. <a-button
  108. v-if="record.state=='WAIT_SUBMIT'&&$hasPermissions('B_ERDel')"
  109. size="small"
  110. type="link"
  111. class="button-error"
  112. @click="handleDel(record)"
  113. >
  114. 删除
  115. </a-button>
  116. <a-button
  117. v-if="record.state!='WAIT_SUBMIT'&&$hasPermissions('B_ERAudit')"
  118. size="small"
  119. type="link"
  120. class="button-info"
  121. @click="handleSH(record)"
  122. >
  123. 审核进度
  124. </a-button>
  125. <a-button
  126. v-if="record.state=='AUDIT_REJECT'"
  127. size="small"
  128. type="link"
  129. class="button-info"
  130. @click="againEdit(record)"
  131. >
  132. 再次编辑
  133. </a-button>
  134. <!-- <span v-if="record.state=='AUDIT_REJECT' || record.state=='AUDIT_PASS'">--</span> -->
  135. </template>
  136. </s-table>
  137. </a-spin>
  138. <!-- 审核进度 -->
  139. <verifyModal :openModal="openModal" :itemSn="itemSn" @close="openModal=false"></verifyModal>
  140. <!-- 新增 -->
  141. <baseDataModal :show="openBaseModal" @close="openBaseModal=false"></baseDataModal>
  142. </a-card>
  143. </template>
  144. <script>
  145. import { commonMixin } from '@/utils/mixin'
  146. import locale from 'ant-design-vue/es/date-picker/locale/zh_CN'
  147. import moment from 'moment'
  148. import subarea from '@/views/common/subarea.js'
  149. import employee from './employee.js'
  150. import { STable, VSelect } from '@/components'
  151. import verifyModal from './verifyModal.vue'
  152. import { expenseAccountList, expenseAccountDelete, expenseAccountAgainEdit } from '@/api/expenseManagement'
  153. import baseDataModal from './baseDataModal.vue'
  154. export default {
  155. name: 'ExpenseReimbursementList',
  156. mixins: [commonMixin],
  157. components: { STable, VSelect, subarea, verifyModal, baseDataModal, employee },
  158. data () {
  159. return {
  160. locale,
  161. spinning: false,
  162. advanced: false, // 高级搜索 展开/关闭
  163. disabled: false, // 查询、重置按钮是否可操作
  164. openModal: false, // 审核进度弹框是否显示
  165. openBaseModal: false, // 基础信息新建
  166. itemSn: '', // 费用单sn
  167. tableHeight: 0,
  168. // 查询参数
  169. queryParam: {
  170. expenseDate: moment().format('YYYY-MM'), // 月份
  171. expenseAccountNo: '', // 费用单号
  172. title: '', // 主题
  173. expenseType: undefined, // 费用类型
  174. state: undefined // 状态
  175. },
  176. // 加载数据方法 必须为 Promise 对象
  177. loadData: parameter => {
  178. this.disabled = true
  179. this.spinning = true
  180. delete parameter.tableId
  181. delete parameter.index
  182. const params = Object.assign(parameter, this.queryParam)
  183. if (params.expenseDate) {
  184. params.expenseDate = params.expenseDate + '-01'
  185. }
  186. return expenseAccountList(params).then(res => {
  187. let data
  188. if (res.status == 200) {
  189. data = res.data
  190. const no = (data.pageNo - 1) * data.pageSize
  191. for (var i = 0; i < data.list.length; i++) {
  192. data.list[i].no = no + i + 1
  193. }
  194. this.disabled = false
  195. }
  196. this.spinning = false
  197. return data
  198. })
  199. },
  200. columns: [{ title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  201. { title: '费用单号', width: '12%', align: 'center', scopedSlots: { customRender: 'expenseAccountNo' } },
  202. { title: '申请人', dataIndex: 'applyPersonName', width: '8%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  203. { title: '申请部门', dataIndex: 'applyDepartmentName', width: '8%', align: 'left', customRender: function (text) { return text || '--' } },
  204. { title: '费用类型', dataIndex: 'expenseTypeDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  205. { title: '费用发生月份', dataIndex: 'expenseDate', width: '6%', align: 'center', customRender: function (text) { return moment(text).format('YYYY年MM月') || '--' } },
  206. { title: '主题', dataIndex: 'title', width: '10%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  207. { title: '合计金额', dataIndex: 'applyExpenseTotal', width: '8%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  208. { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  209. { title: '审核时间', dataIndex: 'finishDate', width: '8%', align: 'center', customRender: function (text, record) { return record.state == 'AUDIT_REJECT' || record.state == 'AUDIT_PASS' ? text : '--' } },
  210. { title: '状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  211. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }]
  212. }
  213. },
  214. methods: {
  215. onChange (date, dateString) {
  216. this.queryParam.expenseDate = dateString
  217. },
  218. disabledDate (current) {
  219. return current && current > moment().endOf('day')
  220. },
  221. // 详情
  222. handleDetail (row) {
  223. this.$router.push({ name: 'expenseReimbursementListDetail', params: { sn: row.expenseAccountSn } })
  224. },
  225. // 新增、编辑
  226. handleEdit (row) {
  227. if (row && row.expenseAccountSn) {
  228. this.$router.push({ name: 'expenseReimbursementEdit', params: { sn: row.expenseAccountSn } })
  229. } else {
  230. this.openBaseModal = true
  231. }
  232. },
  233. // 删除
  234. handleDel (row) {
  235. const _this = this
  236. this.$confirm({
  237. title: '提示',
  238. content: '确认要删除吗?',
  239. centered: true,
  240. closable: true,
  241. onOk () {
  242. _this.spinning = true
  243. expenseAccountDelete({ expenseAccountSn: row.expenseAccountSn }).then(res => {
  244. if (res.status == 200) {
  245. _this.$message.success(res.message)
  246. _this.$refs.table.refresh()
  247. _this.spinning = false
  248. } else {
  249. _this.spinning = false
  250. }
  251. })
  252. }
  253. })
  254. },
  255. // 审核进度
  256. handleSH (row) {
  257. this.openModal = true
  258. this.itemSn = row.expenseAccountSn
  259. },
  260. // 再次编辑
  261. againEdit (row) {
  262. const _this = this
  263. this.$confirm({
  264. title: '操作提示',
  265. content: '系统将自动生成一个新的费用报销单,与原审核不通过的单据内容相同。您可以对新单据进行编辑、提交等操作,原单据保持不变,确认操作吗?',
  266. centered: true,
  267. closable: true,
  268. onOk () {
  269. _this.spinning = true
  270. expenseAccountAgainEdit({ expenseAccountSn: row.expenseAccountSn }).then(res => {
  271. if (res.status == 200) {
  272. _this.$message.success(res.message)
  273. _this.resetSearchForm()
  274. }
  275. _this.spinning = false
  276. })
  277. }
  278. })
  279. },
  280. // 重置
  281. resetSearchForm () {
  282. this.queryParam = {
  283. expenseDate: '', // 月份
  284. expenseAccountNo: '', // 费用单号
  285. title: '', // 主题
  286. expenseType: undefined, // 费用类型
  287. state: undefined, // 状态
  288. applyPersonSn: undefined
  289. }
  290. this.$refs.table.refresh(true)
  291. },
  292. pageInit () {
  293. const _this = this
  294. this.$nextTick(() => { // 页面渲染完成后的回调
  295. _this.setTableH()
  296. })
  297. },
  298. setTableH () {
  299. const tableSearchH = this.$refs.tableSearch.offsetHeight
  300. this.tableHeight = window.innerHeight - tableSearchH - 235
  301. }
  302. },
  303. watch: {
  304. advanced (newValue, oldValue) {
  305. const _this = this
  306. this.$nextTick(() => { // 页面渲染完成后的回调
  307. _this.setTableH()
  308. })
  309. },
  310. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  311. this.setTableH()
  312. }
  313. },
  314. mounted () {
  315. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  316. this.pageInit()
  317. this.resetSearchForm()
  318. }
  319. },
  320. activated () {
  321. // 如果是新页签打开,则重置当前页面
  322. if (this.$store.state.app.isNewTab) {
  323. this.pageInit()
  324. this.resetSearchForm()
  325. }
  326. // 仅刷新列表,不重置页面
  327. if (this.$store.state.app.updateList) {
  328. this.pageInit()
  329. this.$refs.table.refresh()
  330. }
  331. },
  332. beforeRouteEnter (to, from, next) {
  333. next(vm => {})
  334. }
  335. }
  336. </script>
  337. <style lang="less">
  338. .salesManagementList-wrap{
  339. .sTable{
  340. margin-top: 10px;
  341. .badge-con-t{
  342. .ant-badge-count{
  343. transform: scale(0.8);
  344. font-size: 13px;
  345. }
  346. }
  347. }
  348. }
  349. </style>