index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <div class="ele-border-lighter form-content" v-loading="loading">
  5. <search-index @search="reload"></search-index>
  6. <div style="margin-bottom: 10px">
  7. <el-button
  8. size="small"
  9. type="primary"
  10. icon="el-icon-plus"
  11. class="ele-btn-icon"
  12. @click="openEdit('add', {})"
  13. >
  14. 新建
  15. </el-button>
  16. </div>
  17. <el-table
  18. :data="tableList"
  19. style="width: 100%;margin-bottom: 20px;"
  20. height="calc(100vh - 375px)"
  21. row-key="id"
  22. border
  23. default-expand-all
  24. :tree-props="{children: 'sonPurchasePlanList', hasChildren: 'hasChildren'}">
  25. <el-table-column
  26. prop=""
  27. type="index"
  28. label="序号"
  29. :width="60"
  30. :showOverflowTooltip="true"
  31. align="center">
  32. </el-table-column>
  33. <el-table-column
  34. prop="FLMC"
  35. label="分类名称"
  36. :minWidth="160"
  37. :showOverflowTooltip="true"
  38. align="center">
  39. </el-table-column>
  40. <el-table-column
  41. prop="createTime"
  42. label="创建时间"
  43. :minWidth="160"
  44. :showOverflowTooltip="true"
  45. align="center">
  46. </el-table-column>
  47. <el-table-column
  48. prop="status"
  49. label="状态"
  50. :minWidth="80"
  51. :showOverflowTooltip="true"
  52. align="center">
  53. <template slot-scope="{ row }">
  54. {{ getStatus(row.status) }}
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. prop=""
  59. label="操作"
  60. :minWidth="200"
  61. :resizable="false"
  62. align="center">
  63. <template slot-scope="{ row }">
  64. <el-link
  65. type="primary"
  66. :underline="false"
  67. icon="el-icon-edit"
  68. v-if="[0, 3].includes(row.status)&&!row.isCut"
  69. @click="openEdit('edit', row)"
  70. >
  71. 修改
  72. </el-link>
  73. <el-link
  74. type="primary"
  75. :underline="false"
  76. icon="el-icon-edit"
  77. v-if="[2].includes(row.status)&&!row.isCut"
  78. @click="handleSplit(row)"
  79. >
  80. 拆分
  81. </el-link>
  82. <el-link
  83. type="primary"
  84. :underline="false"
  85. v-if="[2].includes(row.status)&&(!row.isCut||(row.parentId&&row.parentId!=0))"
  86. icon="el-icon-plus"
  87. @click="addInquiry('add', row)"
  88. >
  89. 生成核价单
  90. </el-link>
  91. <el-popconfirm
  92. class="ele-action"
  93. title="确定要删除此信息吗?"
  94. v-if="[0, 3].includes(row.status)&&!row.isCut"
  95. @confirm="remove([row.id])"
  96. >
  97. <template v-slot:reference>
  98. <el-link type="danger" :underline="false" icon="el-icon-delete">
  99. 删除
  100. </el-link>
  101. </template>
  102. </el-popconfirm>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. <el-pagination
  107. @size-change="handleSizeChange"
  108. @current-change="handleCurrentChange"
  109. :current-page="pageNum"
  110. :page-sizes="[10, 20, 30, 40,50,100]"
  111. :page-size="pageSize"
  112. layout="total, sizes, prev, pager, next, jumper"
  113. :total="total">
  114. </el-pagination>
  115. </div>
  116. </el-card>
  117. <!-- 多选删除弹窗 -->
  118. <!-- <pop-modal
  119. :visible.sync="delVisible"
  120. content="是否确定删除?"
  121. @done="commitBtn"
  122. /> -->
  123. </div>
  124. </template>
  125. <script>
  126. import searchIndex from "./components/searchIndex.vue";
  127. export default {
  128. components: {
  129. searchIndex,
  130. },
  131. data() {
  132. return {
  133. pageSize: 10,
  134. pageNum: 1,
  135. where: {},
  136. total: 0,
  137. selection: [], //单选中集合
  138. tableList: [], //单选中集合
  139. delVisible: false, //批量删除弹框状态
  140. loading: false, // 加载状态
  141. splitDialogFlag: false, // 加载状态
  142. };
  143. },
  144. computed: {
  145. columns() {
  146. return [
  147. {
  148. width: 45,
  149. type: 'selection',
  150. columnKey: 'selection',
  151. align: 'center'
  152. },
  153. {
  154. columnKey: 'index',
  155. label: '序号',
  156. type: 'index',
  157. width: 55,
  158. align: 'center',
  159. showOverflowTooltip: true,
  160. fixed: 'left'
  161. },
  162. {
  163. prop: '',
  164. slot: '',
  165. label: '分类名称',
  166. align: 'center',
  167. showOverflowTooltip: true,
  168. minWidth: 200
  169. },
  170. {
  171. prop: 'createTime',
  172. label: '创建时间',
  173. align: 'center',
  174. showOverflowTooltip: true,
  175. minWidth: 180
  176. },
  177. {
  178. prop: 'status',
  179. label: '状态',
  180. align: 'center',
  181. slot: 'status',
  182. showOverflowTooltip: true,
  183. minWidth: 120
  184. },
  185. // {
  186. // prop: 'remark',
  187. // label: '备注',
  188. // align: 'center',
  189. // showOverflowTooltip: true,
  190. // minWidth: 170
  191. // },
  192. {
  193. columnKey: 'action',
  194. label: '操作',
  195. width: 230,
  196. align: 'center',
  197. resizable: false,
  198. slot: 'action',
  199. showOverflowTooltip: true,
  200. fixed: 'right'
  201. }
  202. ]
  203. },
  204. },
  205. created() {
  206. //this.datasource();
  207. },
  208. methods: {
  209. /* 表格数据源 */
  210. async datasource(pageNum = this.pageNum, pageSize = this.pageSize, where=this.where) {
  211. const row = await getTableList({
  212. pageNum: pageNum,
  213. size: pageSize,
  214. ...where
  215. });
  216. this.tableList = row.list
  217. this.total = row.count
  218. },
  219. handleSizeChange(val) {
  220. this.pageSize = val
  221. this.datasource()
  222. },
  223. handleCurrentChange(val) {
  224. this.pageNum = val
  225. this.datasource()
  226. },
  227. /* 刷新表格 */
  228. reload(where) {
  229. this.where = where
  230. this.pageNum = 1
  231. this.datasource(this.pageNum, this.pageSize, this.where)
  232. },
  233. //批量删除
  234. allDelBtn() {
  235. if (this.selection.length === 0) return;
  236. let flag = this.selection.some(item => [1, 2].includes(item.status))
  237. if (flag) return this.$message.warning('抱歉已审核、审核中的数据不能删除,请检查')
  238. this.delVisible = true;
  239. },
  240. //删除接口
  241. remove(delData) {
  242. deleteInformation(delData).then((res) => {
  243. this.$message.success('删除成功!');
  244. this.reload();
  245. });
  246. },
  247. //删除弹框确定
  248. commitBtn() {
  249. const dataId = this.selection.map((v) => v.id);
  250. this.remove(dataId);
  251. },
  252. }
  253. };
  254. </script>
  255. <style lang="scss" scoped>
  256. :deep(.el-link--inner) {
  257. margin-left: 0px !important;
  258. }
  259. .sys-organization-list {
  260. height: calc(100vh - 264px);
  261. box-sizing: border-box;
  262. border-width: 1px;
  263. border-style: solid;
  264. overflow: auto;
  265. }
  266. .sys-organization-list :deep(.el-tree-node__content) {
  267. height: 40px;
  268. & > .el-tree-node__expand-icon {
  269. margin-left: 10px;
  270. }
  271. }
  272. ::v-deep .el-pager li.active {
  273. color: #ffffff;
  274. background: #1890ff;
  275. border-radius: 50%;
  276. cursor: default;
  277. }
  278. ::v-deep .el-pager li {
  279. padding: 0 4px;
  280. background: var(--color-white);
  281. vertical-align: top;
  282. display: inline-block;
  283. font-size: 13px;
  284. min-width: 28px;
  285. height: 28px;
  286. line-height: 28px;
  287. cursor: pointer;
  288. box-sizing: border-box;
  289. text-align: center;
  290. margin: 0;
  291. }
  292. </style>