index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <search-table @search="reload"></search-table>
  5. <!-- 数据表格 -->
  6. <ele-pro-table
  7. ref="table"
  8. :columns="columns"
  9. :datasource="datasource"
  10. height="calc(100vh - 325px)"
  11. full-height="calc(100vh - 116px)"
  12. tool-class="ele-toolbar-form"
  13. :selection.sync="selection"
  14. cache-key="eomContactPageTable"
  15. >
  16. <!-- 表头工具栏 -->
  17. <template v-slot:toolbar>
  18. <el-button
  19. size="small"
  20. type="primary"
  21. icon="el-icon-plus"
  22. class="ele-btn-icon"
  23. @click="handleAddOrEdit('', 'add')"
  24. >
  25. 新建
  26. </el-button>
  27. <el-button
  28. size="small"
  29. type="danger"
  30. el-icon-delete
  31. class="ele-btn-icon"
  32. @click="allDelBtn"
  33. :disabled="selection?.length === 0"
  34. >
  35. 批量删除
  36. </el-button>
  37. </template>
  38. <!-- 操作 -->
  39. <template v-slot:action="{ row }">
  40. <el-link
  41. type="primary"
  42. :underline="false"
  43. icon="el-icon-edit"
  44. @click="handleAddOrEdit(row, 'update')"
  45. >
  46. 修改
  47. </el-link>
  48. <el-popconfirm
  49. class="ele-action"
  50. title="确定要删除此信息吗?"
  51. @confirm="remove([row.id])"
  52. >
  53. <template v-slot:reference>
  54. <el-link type="danger" :underline="false" icon="el-icon-delete">
  55. 删除
  56. </el-link>
  57. </template>
  58. </el-popconfirm>
  59. </template>
  60. <template v-slot:code="{ row }">
  61. <el-link
  62. type="primary"
  63. :underline="false"
  64. @click="handleAddOrEdit(row, 'view')"
  65. >
  66. {{ row.code }}
  67. </el-link>
  68. </template>
  69. </ele-pro-table>
  70. </el-card>
  71. <add-or-edit-dialog
  72. ref="addOrEditDialogRef"
  73. @reload="reload"
  74. ></add-or-edit-dialog>
  75. <viewDialog ref="viewDialogRef"></viewDialog>
  76. </div>
  77. </template>
  78. <script>
  79. import dictMixins from '@/mixins/dictMixins';
  80. import addOrEditDialog from './components/addOrEditDialog.vue';
  81. import viewDialog from './components/viewDialog.vue';
  82. import searchTable from './components/searchTable.vue';
  83. import { salesTargetPage } from '@/api/targetManage/index.js';
  84. export default {
  85. mixins: [dictMixins],
  86. components: {
  87. addOrEditDialog,
  88. searchTable,
  89. viewDialog
  90. },
  91. data() {
  92. return {
  93. // 加载状态
  94. loading: false,
  95. delVisible: false,
  96. selection: []
  97. };
  98. },
  99. computed: {
  100. columns() {
  101. return [
  102. {
  103. width: 45,
  104. type: 'selection',
  105. columnKey: 'selection',
  106. align: 'center'
  107. },
  108. {
  109. width: 60,
  110. label: '序号',
  111. type: 'index',
  112. columnKey: 'index',
  113. align: 'center'
  114. },
  115. {
  116. minWidth: 200,
  117. prop: 'code',
  118. label: '编码',
  119. align: 'center',
  120. slot: 'code',
  121. showOverflowTooltip: true
  122. },
  123. {
  124. minWidth: 200,
  125. prop: 'name',
  126. label: '名称',
  127. align: 'center',
  128. showOverflowTooltip: true
  129. },
  130. {
  131. minWidth: 80,
  132. prop: 'type',
  133. label: '类型',
  134. align: 'center',
  135. showOverflowTooltip: true,
  136. formatter: (row, column) => {
  137. return row.type == 1 ? '年度' : row.type == 2 ? '季度' : '月度';
  138. }
  139. },
  140. {
  141. minWidth: 200,
  142. prop: 'assessmentObject',
  143. label: '目标对象',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. formatter: (row, column) => {
  147. return row.assessmentObject == 1
  148. ? '公司'
  149. : row.type == 2
  150. ? '部门'
  151. : '个人';
  152. }
  153. },
  154. {
  155. minWidth: 150,
  156. prop: 'departmentName',
  157. label: '部门',
  158. align: 'center',
  159. showOverflowTooltip: true
  160. },
  161. {
  162. minWidth: 100,
  163. prop: 'userName',
  164. label: '姓名',
  165. align: 'center',
  166. showOverflowTooltip: true
  167. },
  168. {
  169. minWidth: 200,
  170. prop: 'assessmentDimensions',
  171. label: '统计财年',
  172. align: 'center',
  173. showOverflowTooltip: true
  174. },
  175. {
  176. minWidth: 80,
  177. prop: 'enabled',
  178. label: '状态',
  179. align: 'center',
  180. slot: 'modelType',
  181. showOverflowTooltip: true,
  182. formatter: (row, column) => {
  183. return row.enabled ? '进行中' : '已完成';
  184. }
  185. },
  186. {
  187. minWidth: 100,
  188. prop: 'createTime',
  189. label: '创建时间',
  190. align: 'center',
  191. slot: 'createTime',
  192. showOverflowTooltip: true
  193. },
  194. {
  195. columnKey: 'action',
  196. label: '操作',
  197. width: 120,
  198. align: 'center',
  199. resizable: false,
  200. slot: 'action',
  201. showOverflowTooltip: true,
  202. fixed: 'right'
  203. }
  204. ];
  205. }
  206. },
  207. created() {},
  208. methods: {
  209. //新增、修改
  210. handleAddOrEdit(row = {}, type) {
  211. if (type == 'view') {
  212. this.$nextTick(() => {
  213. this.$refs.viewDialogRef.open(row);
  214. });
  215. return;
  216. }
  217. this.$nextTick(() => {
  218. this.$refs.addOrEditDialogRef.open(row, type);
  219. });
  220. },
  221. //新增、修改
  222. handleDetail(row = {}, type) {
  223. this.detailDialogFlag = true;
  224. this.$nextTick(() => {
  225. this.$refs.detailDialogRef.init(row, type);
  226. });
  227. },
  228. /* 表格数据源 */
  229. datasource({ page, limit, where, order }) {
  230. return salesTargetPage({
  231. pageNum: page,
  232. size: limit,
  233. ...where
  234. });
  235. },
  236. /* 刷新表格 */
  237. reload(where = {}) {
  238. console.log(1111);
  239. this.$refs.table.reload({ page: 1, where });
  240. },
  241. //批量删除
  242. allDelBtn() {
  243. if (this.selection.length === 0) return;
  244. let flag = this.selection.some((item) =>
  245. [1, 2].includes(item.approvalStatus)
  246. );
  247. if (flag)
  248. return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查');
  249. this.delVisible = true;
  250. },
  251. commitBtn() {
  252. const dataId = this.selection.map((v) => v.id);
  253. settlementAccountRemoveAPI(dataId).then((res) => {
  254. this.$message.success('删除成功!');
  255. this.reload();
  256. });
  257. },
  258. remove(row) {
  259. settlementAccountRemoveAPI(row).then((res) => {
  260. this.$message.success('删除成功!');
  261. this.reload();
  262. });
  263. },
  264. sub(res) {
  265. settlementAccountSubmit({
  266. businessId: res.id
  267. })
  268. .then((res) => {
  269. this.$message.success('提交成功');
  270. this.reload();
  271. })
  272. .catch((e) => {
  273. this.$message.error(e.message);
  274. });
  275. }
  276. }
  277. };
  278. </script>
  279. <style lang="scss" scoped>
  280. :deep(.el-link--inner) {
  281. margin-left: 0px !important;
  282. }
  283. .sys-organization-list {
  284. height: calc(100vh - 264px);
  285. box-sizing: border-box;
  286. border-width: 1px;
  287. border-style: solid;
  288. overflow: auto;
  289. }
  290. .sys-organization-list :deep(.el-tree-node__content) {
  291. height: 40px;
  292. & > .el-tree-node__expand-icon {
  293. margin-left: 10px;
  294. }
  295. }
  296. </style>