index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <!-- 物料信息基础档案 -->
  2. <template>
  3. <div class="material-basic">
  4. <!-- 操作栏 -->
  5. <el-row :gutter="10" class="mb10">
  6. <!-- 新增、修改、删除、复制 -->
  7. <el-col :span="1.5">
  8. <el-button-group>
  9. <el-button size="small" @click="handleInster">新增</el-button>
  10. <el-button size="small" @click="handleEdit">修改</el-button>
  11. <el-button size="small" @click="handleDel">删除</el-button>
  12. <el-button size="small" @click="handleCopy">复制</el-button>
  13. </el-button-group>
  14. </el-col>
  15. <!-- 查询、刷新、过滤 -->
  16. <el-col :span="1.5">
  17. <el-button-group>
  18. <el-dropdown size="small" @command="handleFilter">
  19. <el-button size="small">
  20. 过滤<i class="el-icon-arrow-down el-icon--right"></i>
  21. </el-button>
  22. <el-dropdown-menu slot="dropdown">
  23. <el-dropdown-item :command="filterCondition('stop')">显示停用</el-dropdown-item>
  24. <el-dropdown-item :command="filterCondition('allot')">显示已分配</el-dropdown-item>
  25. </el-dropdown-menu>
  26. </el-dropdown>
  27. <el-button size="small" @click="handleQuery">查询</el-button>
  28. <el-button size="small" @click="handleRefresh">刷新</el-button>
  29. </el-button-group>
  30. </el-col>
  31. <!-- 启用 -->
  32. <el-col :span="1.5">
  33. <el-button-group>
  34. <el-dropdown split-button size="small" @click="handleIsInvoke(true)" @command="handleIsInvoke">
  35. 启用
  36. <el-dropdown-menu slot="dropdown">
  37. <el-dropdown-item :command="isInvoke(true)">启用</el-dropdown-item>
  38. <el-dropdown-item :command="isInvoke(false)">停用</el-dropdown-item>
  39. </el-dropdown-menu>
  40. </el-dropdown>
  41. </el-button-group>
  42. </el-col>
  43. <!-- 申请单查询 -->
  44. <el-col :span="1.5">
  45. <el-button-group>
  46. <el-button size="small" @click="handleQueryForm">申请单查询</el-button>
  47. </el-button-group>
  48. </el-col>
  49. <!-- 导入导出 -->
  50. <el-col :span="1.5">
  51. <el-button-group>
  52. <el-button size="small" @click="handleImport">批量导入</el-button>
  53. <el-button size="small" @click="handleExport">批量导出</el-button>
  54. </el-button-group>
  55. </el-col>
  56. </el-row>
  57. <el-dialog title="操作提示" :visible.sync="optionDialog.show" width="30%" center top="50vh">
  58. <span>是否确认{{ optionDialog.op }}?</span>
  59. <span slot="footer" class="dialog-footer">
  60. <el-button @click="handleOptionShow('option', false)">取 消</el-button>
  61. <el-button type="primary" @click="handleComfirmOption('cancal')">确 定</el-button>
  62. </span>
  63. </el-dialog>
  64. <el-card class="material-list">
  65. <el-table v-loading="loading" :data="taskList" @cell-dblclick="handledbClick"
  66. @selection-change="handleSelectionChange">
  67. <el-table-column type="selection" width="55" />
  68. <el-table-column type="index" label="序号" width="55" align="center" />
  69. <el-table-column v-for="h in tableHeader" v-if="h.show" :label="h.name" align="center" :prop="h.prop"
  70. show-overflow-tooltip />
  71. </el-table>
  72. <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  73. @pagination="getMaterialList" />
  74. </el-card>
  75. </div>
  76. </template>
  77. <script>
  78. import './style/index.scss';
  79. import materialApi from '@/api/material/basic';
  80. export default {
  81. name: "material-basic",
  82. data() {
  83. return {
  84. // 物料基本信息数据
  85. taskList: [],
  86. // 总条数
  87. total: 1,
  88. loading: false,
  89. // 查询参数
  90. queryParams: {
  91. pageNum: 1,
  92. pageSize: 10,
  93. code: null,
  94. name: null
  95. },
  96. // 表头
  97. tableHeader: [],
  98. // 多选数组
  99. checkedList: [],
  100. // 列表选中数据
  101. checkedList: [],
  102. // 操作弹窗
  103. optionDialog: {
  104. show: false,
  105. op: ''
  106. },
  107. }
  108. },
  109. methods: {
  110. // 新增
  111. handleInster() {
  112. this.$message({
  113. message: '物料只能通过申请审批增加,不能在节点直接录入!',
  114. type: 'warning'
  115. });
  116. },
  117. // 修改
  118. handleEdit() {
  119. console.log(this.checkedList, 'this.checkedList');
  120. if (this.checkedList.length == 1) {
  121. this.$router.push(`/material/basicFile/detail/${this.checkedList[0].id}`);
  122. } else if (this.checkedList.length > 1) {
  123. this.$message({
  124. message: '修改只能选择单个数据!',
  125. type: 'warning'
  126. });
  127. } else {
  128. this.$message({
  129. message: '请选择需要修改的信息!',
  130. type: 'warning'
  131. });
  132. }
  133. },
  134. // 删除
  135. handleDel() {
  136. console.log('删除');
  137. },
  138. // 复制
  139. handleCopy() {
  140. console.log('复制');
  141. },
  142. //查询
  143. handleQuery() {
  144. },
  145. // 刷新
  146. handleRefresh() {
  147. console.log('刷新');
  148. },
  149. // 过滤
  150. handleFilter(e) {
  151. console.log(e, '过滤');
  152. },
  153. filterCondition(type) {
  154. return {
  155. type
  156. }
  157. },
  158. // 启用
  159. handleIsInvoke(e) {
  160. console.log('启用', e);
  161. },
  162. isInvoke(val) {
  163. return val;
  164. },
  165. // 申请单查询
  166. handleQueryForm() {
  167. console.log('申请单查询');
  168. },
  169. // 批量导入
  170. handleImport() {
  171. console.log('批量导入');
  172. },
  173. // 批量导出
  174. handleExport() {
  175. console.log('批量导出');
  176. },
  177. // 取消保存
  178. handleCancel() {
  179. console.log('取消保存');
  180. this.optionDialog.op = '取消';
  181. this.handleOptionShow('option', true);
  182. },
  183. // 保存修改
  184. handleSave() {
  185. console.log('保存修改');
  186. },
  187. // 保存修改并新增
  188. handleSaveAdd() {
  189. console.log('保存修改并新增');
  190. },
  191. // 更新导入
  192. handleUpdateImport() {
  193. console.log('更新导入');
  194. },
  195. // 操作弹窗显隐
  196. handleOptionShow(type, val) {
  197. switch (type) {
  198. case 'option':
  199. this.optionDialog.show = val;
  200. break;
  201. }
  202. },
  203. // 操作弹窗确认按钮
  204. handleComfirmOption(op) {
  205. switch (op) {
  206. case 'cancal':
  207. this.handleOptionShow('option', false);
  208. break;
  209. }
  210. },
  211. // 双击行
  212. handledbClick(e) {
  213. console.log(e, '双击行');
  214. this.$router.push({
  215. path: `/material/basicFile/detail/${e.id}`,
  216. });
  217. },
  218. // 选中数据改变
  219. handleSelectionChange(list) {
  220. this.checkedList = list;
  221. this.$emit('headerOption', JSON.stringify({ checkedList: [...list] }))
  222. },
  223. // 获取物料列表信息
  224. getMaterialList(templateCode) {
  225. this.loading = true;
  226. materialApi.materialList({ templateCode }).then((res) => {
  227. this.loading = false;
  228. console.log(res, '获取物料列表信息以及表头字段');
  229. let { code, data } = res;
  230. if (code == 200) {
  231. this.taskList = data.tableBody.rows;
  232. this.total = data.tableBody.total;
  233. }
  234. })
  235. },
  236. // 获取物料列表表头
  237. getTagList(templateCode) {
  238. materialApi.tagList({ templateCode }).then(res => {
  239. console.log(res, '获取物料列表表头');
  240. if (res.code == 200) {
  241. this.tableHeader = res.data;
  242. }
  243. })
  244. },
  245. },
  246. created() {
  247. this.getMaterialList('material');
  248. this.getTagList('material');
  249. },
  250. };
  251. </script>
  252. <style lang="scss">
  253. .material-list {
  254. height: calc(100% - 42px);
  255. .el-card__body {
  256. height: 100%;
  257. box-sizing: border-box;
  258. .el-table {
  259. height: calc(100% - 70px);
  260. .el-table__body-wrapper {
  261. height: calc(100% - 137px);
  262. // .el-table__body {
  263. // height: 100%;
  264. // }
  265. }
  266. }
  267. }
  268. }
  269. </style>