index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div class="app-container">
  3. <router-view />
  4. <div class="header boxShadow">
  5. <div class="header-title">仓房基本信息</div>
  6. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  7. <el-form-item label="仓房名称" prop="houseName">
  8. <el-input v-model="formInline.houseName" placeholder="请输入" clearable></el-input>
  9. </el-form-item>
  10. <el-form-item label="仓房编号" prop="houseCode">
  11. <el-input v-model="formInline.houseCode" placeholder="请输入" clearable></el-input>
  12. </el-form-item>
  13. <el-form-item class="fr">
  14. <el-button @click="onSubmit">查 询</el-button>
  15. <el-button @click="onSubmit" icon="el-icon-document-add">导 入</el-button>
  16. <el-button type="primary" @click="handleAdd" icon="el-icon-plus">新 增</el-button>
  17. </el-form-item>
  18. </el-form>
  19. </div>
  20. <van-list>
  21. <!-- <van-cell v-for="item in list" :key="item" :title="item" /> -->
  22. <div class="list boxShadow" v-for="(item,index) in list" :key="index">
  23. <div class="list-main">
  24. <div class="list-content">
  25. <div class="list-title">{{ item.houseName}} <span class="dc" v-if="item.isDc">代储</span></div>
  26. <van-row class="content-1">
  27. <van-col span="6">仓房编号: <span>{{item.houseCode}}</span></van-col>
  28. <van-col span="6">仓房类型: <span>{{item.houseType}}</span></van-col>
  29. <van-col span="6">实际仓容: <span>{{item.actualCapacity}} </span></van-col>
  30. <!-- <van-col span="6">是否存在异常:<span><strong>{{item.isAbnormal}}</strong> </span></van-col> -->
  31. </van-row>
  32. <van-row class="content-1">
  33. <van-col span="6">货位: <span>{{item.state}} </span></van-col>
  34. <van-col span="6">设备数量: <span>{{item.operator}} </span></van-col>
  35. <van-col span="6">保管员: <span>{{item.keeperName}} </span></van-col>
  36. </van-row>
  37. <div class='ribbon tf' v-if="item.isTongFeng">
  38. <span class="tfz">通风中</span>
  39. </div>
  40. <div class='ribbon kw' v-if="item.isKongWen">
  41. <span class="tfz">控温中</span>
  42. </div>
  43. </div>
  44. <div class="list-btns">
  45. <el-button type="primary" @click="handleDetail(item)">详情</el-button>
  46. <el-button type="primary" @click="handleEdit(item)">修改</el-button>
  47. <el-button type="primary" @click="handleDelete(item)">删除</el-button>
  48. </div>
  49. </div>
  50. </div>
  51. </van-list>
  52. <div class="pagination-container">
  53. <el-pagination class="right" background :current-page.sync="listQuery.page" :page-size="listQuery.limit" :page-sizes="[5, 10, 20, 30]" :total="listQuery.total" @size-change="sizeChange" @current-change="pageChange" layout="total, sizes, prev, pager, next, jumper"></el-pagination>
  54. </div>
  55. </div>
  56. </template>
  57. <script>
  58. import { getHouseInfoList ,deleteHouseInfoItem} from '@/api/equipConfig/barnBasicInfo/index'
  59. export default {
  60. filters: {
  61. },
  62. data () {
  63. return {
  64. notice: false,
  65. formInline: {
  66. type: '',
  67. houseName: '',
  68. houseCode: ''
  69. },
  70. list: [
  71. {
  72. houseName: '1号仓', houseCode: '1001', houseType: '45', actualCapacity: '2021-01-12', state: '蓝牙', keeperName: '王全德', runTime: '6h',
  73. isTongFeng: false, isKongWen: true, isDc:true
  74. },
  75. {
  76. houseName: '2号仓', houseCode: '1001', houseType: '45', actualCapacity: '2021-01-12', state: '蓝牙', keeperName: '王全德', runTime: '6h',
  77. isTongFeng: false, isKongWen: false,isDc:false
  78. },
  79. {
  80. houseName: '3号仓', houseCode: '1001', houseType: '45', actualCapacity: '2021-01-12', state: '蓝牙', keeperName: '王全德', runTime: '6h',
  81. isTongFeng: true, isKongWen: false,isDc:true
  82. },
  83. {
  84. houseName: '4号仓', houseCode: '1001', houseType: '45', actualCapacity: '2021-01-12', state: '蓝牙', keeperName: '王全德', runTime: '6h',
  85. isTongFeng: false, isKongWen: false, isDc:false
  86. },
  87. {
  88. houseName: '5号仓', houseCode: '1001', houseType: '45', actualCapacity: '2021-01-12', state: '蓝牙', keeperName: '王全德', runTime: '6h',
  89. isTongFeng: false, isKongWen: false, isDc:false
  90. },
  91. {
  92. houseName: '6号仓', houseCode: '1001', houseType: '45', actualCapacity: '2021-01-12', state: '蓝牙', keeperName: '王全德', runTime: '6h',
  93. isTongFeng: false, isKongWen: true, isDc:false
  94. },
  95. ],
  96. loading: 'false',
  97. finished: 'false',
  98. listQuery: {
  99. condition: "",
  100. page: 1,
  101. limit: 10,
  102. total: 10,
  103. },
  104. }
  105. },
  106. created () {
  107. },
  108. mounted() {
  109. this.getList()
  110. },
  111. methods: {
  112. onSubmit () {
  113. console.log('submit!');
  114. },
  115. getList () {
  116. let condition = {
  117. houseName: this.formInline.houseName.trim(),
  118. houseCode: this.formInline.houseCode,
  119. }
  120. let data = {
  121. pageIndex: this.listQuery.page,
  122. pageSize: this.listQuery.limit,
  123. condition: JSON.stringify(condition)
  124. }
  125. getHouseInfoList(data).then(res => {
  126. console.log(res, 'getHouseInfoList')
  127. if (res.code == 200) {
  128. this.list = res.data.records
  129. this.listQuery.limit = res.data.size
  130. this.listQuery.total = res.data.total
  131. }
  132. }).catch(err => {
  133. console.log(err)
  134. })
  135. },
  136. handleDelete (data) {
  137. console.log(data, 'data')
  138. this.$confirm('此操作将删除该条数据, 是否继续?', '提示', {
  139. confirmButtonText: '确定',
  140. cancelButtonText: '取消',
  141. type: 'warning'
  142. }).then(() => {
  143. deleteHouseInfoItem(data.id).then(res => {
  144. console.log(res, 'delete')
  145. if (res.code == 200) {
  146. // this.loading = false
  147. this.getList()
  148. this.$message({
  149. type: 'success',
  150. message: '删除成功!'
  151. });
  152. } else {
  153. // this.loading = false
  154. }
  155. })
  156. }).catch(() => {
  157. // this.loading = false
  158. this.$message({
  159. type: 'info',
  160. message: '已取消删除'
  161. });
  162. });
  163. },
  164. handleAdd () {
  165. this.$router.push({ name: 'BarnBasicInfoAdd' })
  166. },
  167. handleDetail (data) {
  168. this.$router.push({ name: 'BarnBasicInfoDetail',params:{data:data} })
  169. },
  170. handleEdit (data) {
  171. this.$router.push({ name: 'BarnBasicInfoEdit',params:{data:data} })
  172. },
  173. sizeChange (v) {
  174. this.listQuery.limit = v
  175. console.log(`每页 ${v} 条`);
  176. this.list.splice(v, this.list.length - 1)
  177. },
  178. pageChange (v) {
  179. this.listQuery.page = v
  180. console.log(`当前页: ${v}`);
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang='scss' scoped>
  186. .boxShadow {
  187. box-shadow: 5px -5px 10px -4px #efe3e3, -5px 5px 10px -4px #efe3e3;
  188. }
  189. ::v-deep .van-notice-bar {
  190. font-weight: 600;
  191. padding: 0;
  192. cursor: pointer;
  193. }
  194. .header {
  195. background-color: #fff;
  196. border-radius: 15px;
  197. padding: 15px;
  198. // height: 160px;
  199. min-height: 100px;
  200. display: flex;
  201. flex-direction: column;
  202. justify-content: space-between;
  203. .header-title {
  204. font-size: 14px;
  205. font-weight: 600;
  206. padding-left: 10px;
  207. border-left: 4px solid #5283e7;
  208. }
  209. .van-notice-bar {
  210. padding: 10px 0 10px 0;
  211. }
  212. .el-form {
  213. .el-form-item {
  214. margin-bottom: 0;
  215. }
  216. .fr {
  217. float: right;
  218. }
  219. }
  220. }
  221. .list {
  222. background-color: #fff;
  223. border-radius: 15px;
  224. margin-top: 10px;
  225. .list-main {
  226. padding-left: 15px;
  227. margin-top: 15px;
  228. display: flex;
  229. justify-content: space-between;
  230. .list-title {
  231. font-size: 15px;
  232. font-weight: 700;
  233. padding: 10px 0;
  234. display: flex;
  235. .dc {
  236. display: block;
  237. width: 60px;
  238. height: 20px;
  239. line-height: 20px;
  240. text-align: center;
  241. font-size: 12px;
  242. color: #fff;
  243. background-color: #b2b2b2;
  244. border-radius: 5px;
  245. margin-left: 15px;
  246. }
  247. }
  248. .list-content {
  249. width: 78%;
  250. padding: 10px 10px 10px 5px;
  251. position: relative;
  252. overflow: hidden;
  253. display: flex;
  254. flex-direction: column;
  255. justify-content: space-between;
  256. .content-1 {
  257. font-size: 13px;
  258. display: flex;
  259. justify-content: space-between;
  260. margin-top: 10px;
  261. // padding: 5px 0;
  262. strong {
  263. color: #d24848;
  264. }
  265. .text-colorc {
  266. color: #b8b8b8;
  267. }
  268. }
  269. .content-1:nth-last-child(1) {
  270. padding-bottom: 10px;
  271. }
  272. }
  273. .ribbon {
  274. /* 右上角飘带 */
  275. // background-color: #b7c2f9; /* 左上角飘带的背景颜色 */
  276. overflow: hidden;
  277. white-space: nowrap; /* 文字不换行*/
  278. position: absolute; /* 绝对定位 */
  279. right: -40px;
  280. top: 10px;
  281. transform: rotate(45deg); /* 旋转45°*/
  282. // box-shadow: 0 0 10px #888; /* 飘带的阴影*/
  283. span {
  284. // border: 1px solid #54cbff;
  285. // color: #b7c2f9;
  286. display: block;
  287. font: bold 100% "Helvetica Neue", Helvetica, Arial, sans-serif;
  288. margin: 1px 0;
  289. padding: 5px 42px;
  290. text-align: center;
  291. // text-shadow: 0 0 5px #444;
  292. }
  293. .tf {
  294. color: #a9bef7;
  295. }
  296. }
  297. .list-btns {
  298. width: 22%;
  299. background-color: #edf2fd;
  300. display: flex;
  301. justify-content: space-evenly;
  302. align-items: center;
  303. }
  304. }
  305. }
  306. .tf {
  307. background-color: #9de7c2; /* 左上角飘带的背景颜色 */
  308. span {
  309. color: #21ae68;
  310. }
  311. }
  312. .kw {
  313. background-color: #b7c2f9; /* 左上角飘带的背景颜色 */
  314. span {
  315. color: #6d8ce1;
  316. }
  317. }
  318. </style>