【前端】智能库房综合管理系统前端项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

251 lines
8.3 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div>
  3. <el-dialog ref="dialogTable" title="新增盘点" :visible.sync="addFormVisible" class="dialog-table">
  4. <span class="dialog-right-top" />
  5. <span class="dialog-left-bottom" />
  6. <div class="setting-dialog">
  7. <el-form
  8. ref="form"
  9. :model="checkForm"
  10. size="small"
  11. label-width="80px"
  12. >
  13. <el-form-item label="选择区域" prop="selectArea" class="down-select" style="padding-top:1px">
  14. <treeselect
  15. v-model="selectAreaValue"
  16. :options="selectArea"
  17. multiple
  18. placeholder="请选择"
  19. style="width:280px;height:30px"
  20. :limit="1"
  21. :limit-text="count => `+${count}`"
  22. />
  23. </el-form-item>
  24. <el-form-item label="选择门类" prop="category" class="down-select">
  25. <el-select
  26. v-model="categoryValue"
  27. style="width: 280px;"
  28. multiple
  29. filterable
  30. clearable
  31. placeholder="请选择"
  32. :collapse-tags="showTags"
  33. @change="selectChange"
  34. >
  35. <el-option
  36. v-for="item in category"
  37. :key="item.value"
  38. :label="item.label"
  39. :value="item.value"
  40. />
  41. </el-select>
  42. </el-form-item>
  43. <el-button type="primary" size="mini" style="margin:0 0 0 10px;height:30px" @click="handleBuild">生成盘点单</el-button>
  44. </el-form>
  45. <el-table :data="tableData" height="calc(100vh - 595px)" :cell-class-name="cell">
  46. <el-table-column type="index" align="center" label="序号" width="80" />
  47. <el-table-column prop="checkState" align="center" label="状态" width="120">
  48. <template slot-scope="scope">
  49. <!-- 未盘点 -->
  50. <span class="clear">{{ scope.row.checkState }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="" align="center" label="子条数目" width="100" />
  54. <el-table-column prop="" align="center" label="门类级别" width="100" />
  55. <el-table-column prop="" align="center" label="门类名称" width="120" />
  56. <el-table-column prop="" align="center" label="全宗号" width="100" />
  57. <el-table-column prop="" align="center" label="档号" width="180" />
  58. <el-table-column prop="" align="center" label="归档年度" width="100" />
  59. <el-table-column prop="" label="题名" align="center" width="180" />
  60. <el-table-column prop="" label="保密程度" align="center" width="85" />
  61. <el-table-column prop="" label="部门" align="center" width="120" />
  62. <el-table-column prop="" label="盒名称" align="center" width="85" />
  63. <el-table-column prop="" label="所在位置" align="center" width="150" />
  64. <el-table-column prop="" label="创建时间" align="center" width="150" />
  65. </el-table>
  66. <!-- 分页器 记得加上!!!!!!!!!!!!!!!!!!!!!! -->
  67. <!-- !!!!!!!!!!!!!!!!!!!!!!!! -->
  68. <div slot="footer" class="dialog-footer">
  69. <el-button @click="handleSave">保存</el-button>
  70. </div>
  71. </div>
  72. </el-dialog>
  73. </div>
  74. </template>
  75. <script>
  76. import Treeselect from '@riophae/vue-treeselect'
  77. import '@riophae/vue-treeselect/dist/vue-treeselect.css'
  78. import { menu } from '@/api/storeManage/levelManage/level'
  79. import { getCategoryTree } from '@/api/category/category'
  80. export default {
  81. name: 'AddCheck',
  82. components: { Treeselect },
  83. data() {
  84. return {
  85. menusIds: [],
  86. tableData: [],
  87. checkForm: {},
  88. addFormVisible: false,
  89. selectAreaValue: [],
  90. selectArea: [],
  91. // deviceTree:[],
  92. defaultProps: { children: 'children', label: 'label' },
  93. nodeKey: 'id',
  94. defaultCheckedKeys: [],
  95. categoryValue: [],
  96. oldCategory: [],
  97. allCategory: [],
  98. category: [],
  99. showTags: true
  100. }
  101. },
  102. created() {
  103. this.getTreeMenu()
  104. this.getCateMenu()
  105. },
  106. methods: {
  107. getTreeMenu() {
  108. menu().then(data => {
  109. const deviceTree = []
  110. let storeroom = {}
  111. let devices = []
  112. // deviceTree.splice(0, deviceTree.length)
  113. data.forEach((item, i) => {
  114. if (!storeroom.id) {
  115. item.storeroomId.label = item.storeroomId.name
  116. storeroom = item.storeroomId
  117. item.label = item.deviceName
  118. devices.push(item)
  119. } else if (storeroom.id !== item.storeroomId.id) {
  120. item.storeroomId.label = item.storeroomId.name
  121. storeroom.children = devices
  122. deviceTree.push(storeroom)
  123. devices = []
  124. item.label = item.deviceName
  125. devices.push(item)
  126. storeroom = item.storeroomId
  127. } else {
  128. item.storeroomId.label = item.storeroomId.name
  129. item.label = item.deviceName
  130. devices.push(item)
  131. }
  132. if (i === data.length - 1) {
  133. item.storeroomId.label = item.storeroomId.name
  134. storeroom.children = devices
  135. deviceTree.push(storeroom)
  136. }
  137. this.selectArea = deviceTree
  138. })
  139. })
  140. },
  141. getCateMenu() {
  142. getCategoryTree().then(res => {
  143. this.category = res[0].children
  144. this.category.forEach(item => {
  145. item.value = item.id
  146. item.label = item.cnName
  147. })
  148. this.category.unshift({ value: 0, label: '全选' })
  149. this.allCategory = this.category.map(item => { return item.value })
  150. this.categoryValue = JSON.parse(JSON.stringify(this.allCategory))
  151. this.oldCategory = JSON.parse(JSON.stringify(this.allCategory))
  152. })
  153. },
  154. handleBuild() {
  155. console.log(this.selectArea, this.category)
  156. console.log(this.selectAreaValue, this.categoryValue)
  157. },
  158. handleSave() {
  159. this.addFormVisible = false
  160. },
  161. // 选择门类
  162. selectChange(val) {
  163. // console.log(val)
  164. const allCategory = JSON.parse(JSON.stringify(this.allCategory))
  165. if (val[val.length - 1] === 0) { // 选择全选
  166. this.categoryValue = allCategory
  167. } else {
  168. const arr1 = this.oldCategory.filter(item => item !== 0)
  169. const arr2 = val.filter(item => item !== 0)
  170. if (arr1.length === arr2.length) { // 取消全选
  171. this.categoryValue = []
  172. } else if (arr1.length < arr2.length && arr2.length === this.category.length - 1) {
  173. this.categoryValue.unshift(0) // 除全选时都选中 此时加入全选
  174. } else {
  175. this.categoryValue = this.categoryValue.filter(item => item !== 0) // 取消其他选项时 去除全选
  176. }
  177. }
  178. this.oldCategory = this.categoryValue
  179. },
  180. // 单元格样式
  181. cell({ row, columnIndex }) {
  182. if (columnIndex === 1) {
  183. return 'fail-clear'
  184. }
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang="scss" scoped>
  190. @import '~@/assets/styles/lend-manage.scss';
  191. .el-form{
  192. display: flex;
  193. padding-left: 12px;
  194. }
  195. ::v-deep .el-dialog{
  196. width: 950px;
  197. height: 520px;
  198. }
  199. ::v-deep .el-dialog .el-dialog__header .el-dialog__close::before{
  200. position: absolute;
  201. right: -160px;
  202. bottom: -12px;
  203. }
  204. ::v-deep .el-dialog__body{
  205. padding: 30px 0;
  206. }
  207. ::v-deep .el-tag.el-tag--info{
  208. height: 26px;
  209. line-height: 26px;
  210. background-color: #13439E;
  211. border: none;
  212. color: #fff;
  213. }
  214. ::v-deep .el-tag.el-tag--info .el-tag__close{
  215. background-color: #fff;
  216. }
  217. ::v-deep .el-input__inner{
  218. height: 30px !important;
  219. }
  220. //滚动条
  221. ::v-deep ::-webkit-scrollbar-corner{
  222. background: transparent;
  223. }
  224. // 树形选择器
  225. ::v-deep .vue-treeselect--has-value .vue-treeselect__multi-value{
  226. margin-bottom: 0;
  227. }
  228. ::v-deep .vue-treeselect__multi-value-item-container{
  229. padding-top: 2px;
  230. line-height: 20px;
  231. }
  232. ::v-deep .el-dialog .el-form .vue-treeselect__control{
  233. line-height: 18px;
  234. }
  235. ::v-deep .vue-treeselect__limit-tip{
  236. background: #13439E;
  237. border-radius: 3px;
  238. margin: 2px;
  239. padding: 0 3px;
  240. .vue-treeselect__limit-tip-text{
  241. padding: 2px 2px;
  242. color: #fff;
  243. }
  244. }
  245. </style>