index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="容器编号" prop="boxNo">
  5. <el-input
  6. v-model="queryParams.boxNo"
  7. placeholder="请输入容器编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="容器类型" prop="boxType">
  14. <el-select v-model="queryParams.boxType" placeholder="请选择容器类型" clearable size="small">
  15. <el-option
  16. v-for="dict in dict.type.box_type"
  17. :key="dict.value"
  18. :label="dict.label"
  19. :value="dict.value"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="状态" prop="boxState">
  24. <el-select v-model="queryParams.boxState" placeholder="请选择状态" clearable size="small">
  25. <el-option
  26. v-for="dict in dict.type.active_state"
  27. :key="dict.value"
  28. :label="dict.label"
  29. :value="dict.value"
  30. />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="是否有货" prop="isEmpty">
  34. <el-select v-model="queryParams.isEmpty" placeholder="请选择是否有货" clearable size="small">
  35. <el-option
  36. v-for="dict in dict.type.sys_yes_no"
  37. :key="dict.value"
  38. :label="dict.label"
  39. :value="dict.value"
  40. />
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="绑定库位" prop="locationNo">
  44. <el-input
  45. v-model="queryParams.locationNo"
  46. placeholder="请输入绑定库位"
  47. clearable
  48. size="small"
  49. @keyup.enter.native="handleQuery"
  50. />
  51. </el-form-item>
  52. <el-form-item label="是否满托" prop="isFull">
  53. <el-select v-model="queryParams.isFull" placeholder="请选择是否满托" clearable size="small">
  54. <el-option
  55. v-for="dict in dict.type.sys_yes_no"
  56. :key="dict.value"
  57. :label="dict.label"
  58. :value="dict.value"
  59. />
  60. </el-select>
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  64. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  65. </el-form-item>
  66. </el-form>
  67. <el-row :gutter="10" class="mb8">
  68. <el-col :span="1.5">
  69. <el-button
  70. type="primary"
  71. plain
  72. icon="el-icon-plus"
  73. size="mini"
  74. @click="handleAdd"
  75. v-hasPermi="['box:boxInfo:add']"
  76. >新增</el-button>
  77. </el-col>
  78. <el-col :span="1.5">
  79. <el-button
  80. type="success"
  81. plain
  82. icon="el-icon-edit"
  83. size="mini"
  84. :disabled="single"
  85. @click="handleUpdate"
  86. v-hasPermi="['box:boxInfo:edit']"
  87. >修改</el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="danger"
  92. plain
  93. icon="el-icon-delete"
  94. size="mini"
  95. :disabled="multiple"
  96. @click="handleDelete"
  97. v-hasPermi="['box:boxInfo:remove']"
  98. >删除</el-button>
  99. </el-col>
  100. <el-col :span="1.5">
  101. <el-button
  102. type="warning"
  103. plain
  104. icon="el-icon-download"
  105. size="mini"
  106. @click="handleExport"
  107. v-hasPermi="['box:boxInfo:export']"
  108. >导出</el-button>
  109. </el-col>
  110. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  111. </el-row>
  112. <el-table v-loading="loading" :data="boxInfoList" @selection-change="handleSelectionChange">
  113. <el-table-column type="selection" width="55" align="center" />
  114. <el-table-column label="主键" align="center" prop="id" />
  115. <el-table-column label="容器编号" align="center" prop="boxNo" />
  116. <el-table-column label="容器类型" align="center" prop="boxType">
  117. <template slot-scope="scope">
  118. <dict-tag :options="dict.type.box_type" :value="scope.row.boxType"/>
  119. </template>
  120. </el-table-column>
  121. <el-table-column label="备注" align="center" prop="boxRemark" />
  122. <el-table-column label="状态" align="center" prop="boxState">
  123. <template slot-scope="scope">
  124. <dict-tag :options="dict.type.active_state" :value="scope.row.boxState"/>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="是否有货" align="center" prop="isEmpty">
  128. <template slot-scope="scope">
  129. <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isEmpty"/>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="绑定库位" align="center" prop="locationNo" />
  133. <el-table-column label="是否满托" align="center" prop="isFull">
  134. <template slot-scope="scope">
  135. <dict-tag :options="dict.type.sys_yes_no" :value="scope.row.isFull"/>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  139. <template slot-scope="scope">
  140. <el-button
  141. size="mini"
  142. type="text"
  143. icon="el-icon-edit"
  144. @click="handleUpdate(scope.row)"
  145. v-hasPermi="['box:boxInfo:edit']"
  146. >修改</el-button>
  147. <el-button
  148. size="mini"
  149. type="text"
  150. icon="el-icon-delete"
  151. @click="handleDelete(scope.row)"
  152. v-hasPermi="['box:boxInfo:remove']"
  153. >删除</el-button>
  154. </template>
  155. </el-table-column>
  156. </el-table>
  157. <pagination
  158. v-show="total>0"
  159. :total="total"
  160. :page.sync="queryParams.pageNum"
  161. :limit.sync="queryParams.pageSize"
  162. @pagination="getList"
  163. />
  164. <!-- 添加或修改容器管理对话框 -->
  165. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  166. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  167. <el-form-item label="容器编号" prop="boxNo">
  168. <el-input v-model="form.boxNo" placeholder="请输入容器编号" />
  169. </el-form-item>
  170. <el-form-item label="容器类型" prop="boxType">
  171. <el-select v-model="form.boxType" placeholder="请选择容器类型">
  172. <el-option
  173. v-for="dict in dict.type.box_type"
  174. :key="dict.value"
  175. :label="dict.label"
  176. :value="dict.value"
  177. ></el-option>
  178. </el-select>
  179. </el-form-item>
  180. <el-form-item label="备注" prop="boxRemark">
  181. <el-input v-model="form.boxRemark" placeholder="请输入备注" />
  182. </el-form-item>
  183. <el-form-item label="状态" prop="boxState">
  184. <el-select v-model="form.boxState" placeholder="请选择状态">
  185. <el-option
  186. v-for="dict in dict.type.active_state"
  187. :key="dict.value"
  188. :label="dict.label"
  189. :value="parseInt(dict.value)"
  190. ></el-option>
  191. </el-select>
  192. </el-form-item>
  193. <el-form-item label="是否无货" prop="isEmpty">
  194. <el-select v-model="form.isEmpty" placeholder="请选择是否无货">
  195. <el-option
  196. v-for="dict in dict.type.sys_yes_no"
  197. :key="dict.value"
  198. :label="dict.label"
  199. :value="dict.value"
  200. ></el-option>
  201. </el-select>
  202. </el-form-item>
  203. <el-form-item label="绑定库位" prop="locationId">
  204. <el-input v-model="form.locationId" placeholder="请输入绑定库位" />
  205. </el-form-item>
  206. <el-form-item label="是否满托" prop="isFull">
  207. <el-select v-model="form.isFull" placeholder="请选择是否满托">
  208. <el-option
  209. v-for="dict in dict.type.sys_yes_no"
  210. :key="dict.value"
  211. :label="dict.label"
  212. :value="dict.value"
  213. ></el-option>
  214. </el-select>
  215. </el-form-item>
  216. </el-form>
  217. <div slot="footer" class="dialog-footer">
  218. <el-button type="primary" @click="submitForm">确 定</el-button>
  219. <el-button @click="cancel">取 消</el-button>
  220. </div>
  221. </el-dialog>
  222. </div>
  223. </template>
  224. <script>
  225. import { listBoxInfo, getBoxInfo, delBoxInfo, addBoxInfo, updateBoxInfo } from "@/api/box/boxInfo";
  226. export default {
  227. name: "BoxInfo",
  228. dicts: ['sys_yes_no', 'box_type', 'active_state'],
  229. data() {
  230. return {
  231. // 遮罩层
  232. loading: true,
  233. // 选中数组
  234. ids: [],
  235. // 非单个禁用
  236. single: true,
  237. // 非多个禁用
  238. multiple: true,
  239. // 显示搜索条件
  240. showSearch: true,
  241. // 总条数
  242. total: 0,
  243. // 容器管理表格数据
  244. boxInfoList: [],
  245. // 弹出层标题
  246. title: "",
  247. // 是否显示弹出层
  248. open: false,
  249. // 查询参数
  250. queryParams: {
  251. pageNum: 1,
  252. pageSize: 10,
  253. boxNo: null,
  254. boxType: null,
  255. boxState: null,
  256. isEmpty: null,
  257. locationId: null,
  258. locationNo: null,
  259. isFull: null
  260. },
  261. // 表单参数
  262. form: {},
  263. // 表单校验
  264. rules: {
  265. }
  266. };
  267. },
  268. created() {
  269. this.getList();
  270. },
  271. methods: {
  272. /** 查询容器管理列表 */
  273. getList() {
  274. this.loading = true;
  275. listBoxInfo(this.queryParams).then(response => {
  276. this.boxInfoList = response.rows;
  277. this.total = response.total;
  278. this.loading = false;
  279. });
  280. },
  281. // 取消按钮
  282. cancel() {
  283. this.open = false;
  284. this.reset();
  285. },
  286. // 表单重置
  287. reset() {
  288. this.form = {
  289. id: null,
  290. boxNo: null,
  291. boxType: null,
  292. boxRemark: null,
  293. boxState: null,
  294. isEmpty: null,
  295. createBy: null,
  296. createTime: null,
  297. updateBy: null,
  298. updateTime: null,
  299. userdefine1: null,
  300. userdefine2: null,
  301. locationNo: null,
  302. locationId: null,
  303. isFull: null
  304. };
  305. this.resetForm("form");
  306. },
  307. /** 搜索按钮操作 */
  308. handleQuery() {
  309. this.queryParams.pageNum = 1;
  310. this.getList();
  311. },
  312. /** 重置按钮操作 */
  313. resetQuery() {
  314. this.resetForm("queryForm");
  315. this.handleQuery();
  316. },
  317. // 多选框选中数据
  318. handleSelectionChange(selection) {
  319. this.ids = selection.map(item => item.id)
  320. this.single = selection.length!==1
  321. this.multiple = !selection.length
  322. },
  323. /** 新增按钮操作 */
  324. handleAdd() {
  325. this.reset();
  326. this.open = true;
  327. this.title = "添加容器管理";
  328. },
  329. /** 修改按钮操作 */
  330. handleUpdate(row) {
  331. this.reset();
  332. const id = row.id || this.ids
  333. getBoxInfo(id).then(response => {
  334. this.form = response.data;
  335. this.open = true;
  336. this.title = "修改容器管理";
  337. });
  338. },
  339. /** 提交按钮 */
  340. submitForm() {
  341. this.$refs["form"].validate(valid => {
  342. if (valid) {
  343. if (this.form.id != null) {
  344. updateBoxInfo(this.form).then(response => {
  345. this.$modal.msgSuccess("修改成功");
  346. this.open = false;
  347. this.getList();
  348. });
  349. } else {
  350. addBoxInfo(this.form).then(response => {
  351. this.$modal.msgSuccess("新增成功");
  352. this.open = false;
  353. this.getList();
  354. });
  355. }
  356. }
  357. });
  358. },
  359. /** 删除按钮操作 */
  360. handleDelete(row) {
  361. const ids = row.id || this.ids;
  362. this.$modal.confirm('是否确认删除容器管理编号为"' + ids + '"的数据项?').then(function() {
  363. return delBoxInfo(ids);
  364. }).then(() => {
  365. this.getList();
  366. this.$modal.msgSuccess("删除成功");
  367. }).catch(() => {});
  368. },
  369. /** 导出按钮操作 */
  370. handleExport() {
  371. this.download('box/boxInfo/export', {
  372. ...this.queryParams
  373. }, `boxInfo_${new Date().getTime()}.xlsx`)
  374. }
  375. }
  376. };
  377. </script>