index.vue 9.1 KB

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