index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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="存储id 显示名称 下拉选择仓库,对应t_ warehouse_area的f_id" prop="fWarehouseAreaId">
  5. <el-select v-model="queryParams.fWarehouseAreaId" placeholder="请选择存储id 显示名称 下拉选择仓库,对应t_ warehouse_area的f_id" clearable size="small">
  6. <el-option label="请选择字典生成" value="" />
  7. </el-select>
  8. </el-form-item>
  9. <el-form-item label="编号" prop="fNo">
  10. <el-input
  11. v-model="queryParams.fNo"
  12. placeholder="请输入编号"
  13. clearable
  14. size="small"
  15. @keyup.enter.native="handleQuery"
  16. />
  17. </el-form-item>
  18. <el-form-item label="名称" prop="fName">
  19. <el-input
  20. v-model="queryParams.fName"
  21. placeholder="请输入名称"
  22. clearable
  23. size="small"
  24. @keyup.enter.native="handleQuery"
  25. />
  26. </el-form-item>
  27. <el-form-item label="地址" prop="fAddr">
  28. <el-input
  29. v-model="queryParams.fAddr"
  30. placeholder="请输入地址"
  31. clearable
  32. size="small"
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="状态" prop="fStatus">
  37. <el-select v-model="queryParams.fStatus" placeholder="请选择状态" clearable size="small">
  38. <el-option label="请选择字典生成" value="" />
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item>
  42. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  43. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  44. </el-form-item>
  45. </el-form>
  46. <el-row :gutter="10" class="mb8">
  47. <el-col :span="1.5">
  48. <el-button
  49. type="primary"
  50. icon="el-icon-plus"
  51. size="mini"
  52. @click="handleAdd"
  53. v-hasPermi="['basicdata:location:add']"
  54. >新增</el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button
  58. type="success"
  59. icon="el-icon-edit"
  60. size="mini"
  61. :disabled="single"
  62. @click="handleUpdate"
  63. v-hasPermi="['basicdata:location:edit']"
  64. >修改</el-button>
  65. </el-col>
  66. <el-col :span="1.5">
  67. <el-button
  68. type="danger"
  69. icon="el-icon-delete"
  70. size="mini"
  71. :disabled="multiple"
  72. @click="handleDelete"
  73. v-hasPermi="['basicdata:location:remove']"
  74. >删除</el-button>
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="warning"
  79. icon="el-icon-download"
  80. size="mini"
  81. @click="handleExport"
  82. v-hasPermi="['basicdata:location:export']"
  83. >导出</el-button>
  84. </el-col>
  85. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  86. </el-row>
  87. <el-table v-loading="loading" :data="locationList" @selection-change="handleSelectionChange">
  88. <el-table-column type="selection" width="55" align="center" />
  89. <el-table-column label="状态" align="center" prop="fId" />
  90. <el-table-column label="存储id 显示名称 下拉选择仓库,对应t_ warehouse_area的f_id" align="center" prop="fWarehouseAreaId" />
  91. <el-table-column label="编号" align="center" prop="fNo" />
  92. <el-table-column label="名称" align="center" prop="fName" />
  93. <el-table-column label="地址" align="center" prop="fAddr" />
  94. <el-table-column label="状态" align="center" prop="fStatus" />
  95. <el-table-column label="备注" align="center" prop="remark" />
  96. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  97. <template slot-scope="scope">
  98. <el-button
  99. size="mini"
  100. type="text"
  101. icon="el-icon-edit"
  102. @click="handleUpdate(scope.row)"
  103. v-hasPermi="['basicdata:location:edit']"
  104. >修改</el-button>
  105. <el-button
  106. size="mini"
  107. type="text"
  108. icon="el-icon-delete"
  109. @click="handleDelete(scope.row)"
  110. v-hasPermi="['basicdata:location:remove']"
  111. >删除</el-button>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <pagination
  116. v-show="total>0"
  117. :total="total"
  118. :page.sync="queryParams.pageNum"
  119. :limit.sync="queryParams.pageSize"
  120. @pagination="getList"
  121. />
  122. <!-- 添加或修改库位对话框 -->
  123. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  124. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  125. <el-form-item label="存储id 显示名称 下拉选择仓库,对应t_ warehouse_area的f_id" prop="fWarehouseAreaId">
  126. <el-select v-model="form.fWarehouseAreaId" placeholder="请选择存储id 显示名称 下拉选择仓库,对应t_ warehouse_area的f_id">
  127. <el-option label="请选择字典生成" value="" />
  128. </el-select>
  129. </el-form-item>
  130. <el-form-item label="编号" prop="fNo">
  131. <el-input v-model="form.fNo" placeholder="请输入编号" />
  132. </el-form-item>
  133. <el-form-item label="名称" prop="fName">
  134. <el-input v-model="form.fName" placeholder="请输入名称" />
  135. </el-form-item>
  136. <el-form-item label="地址" prop="fAddr">
  137. <el-input v-model="form.fAddr" placeholder="请输入地址" />
  138. </el-form-item>
  139. <el-form-item label="状态">
  140. <el-radio-group v-model="form.fStatus">
  141. <el-radio label="1">请选择字典生成</el-radio>
  142. </el-radio-group>
  143. </el-form-item>
  144. <el-form-item label="删除状态" prop="delFlag">
  145. <el-input v-model="form.delFlag" placeholder="请输入删除状态" />
  146. </el-form-item>
  147. <el-form-item label="备注" prop="remark">
  148. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  149. </el-form-item>
  150. </el-form>
  151. <div slot="footer" class="dialog-footer">
  152. <el-button type="primary" @click="submitForm">确 定</el-button>
  153. <el-button @click="cancel">取 消</el-button>
  154. </div>
  155. </el-dialog>
  156. </div>
  157. </template>
  158. <script>
  159. import { listLocation, getLocation, delLocation, addLocation, updateLocation, exportLocation } from "../../../api/basicdata/location";
  160. export default {
  161. name: "Location",
  162. components: {
  163. },
  164. data() {
  165. return {
  166. // 遮罩层
  167. loading: true,
  168. // 选中数组
  169. ids: [],
  170. // 非单个禁用
  171. single: true,
  172. // 非多个禁用
  173. multiple: true,
  174. // 显示搜索条件
  175. showSearch: true,
  176. // 总条数
  177. total: 0,
  178. // 库位表格数据
  179. locationList: [],
  180. // 弹出层标题
  181. title: "",
  182. // 是否显示弹出层
  183. open: false,
  184. // 查询参数
  185. queryParams: {
  186. pageNum: 1,
  187. pageSize: 10,
  188. fWarehouseAreaId: null,
  189. fNo: null,
  190. fName: null,
  191. fAddr: null,
  192. fStatus: null,
  193. },
  194. // 表单参数
  195. form: {},
  196. // 表单校验
  197. rules: {
  198. fNo: [
  199. { required: true, message: "编号不能为空", trigger: "blur" }
  200. ],
  201. fName: [
  202. { required: true, message: "名称不能为空", trigger: "blur" }
  203. ],
  204. fAddr: [
  205. { required: true, message: "地址不能为空", trigger: "blur" }
  206. ],
  207. }
  208. };
  209. },
  210. created() {
  211. this.getList();
  212. },
  213. methods: {
  214. /** 查询库位列表 */
  215. getList() {
  216. this.loading = true;
  217. listLocation(this.queryParams).then(response => {
  218. this.locationList = response.rows;
  219. this.total = response.total;
  220. this.loading = false;
  221. });
  222. },
  223. // 取消按钮
  224. cancel() {
  225. this.open = false;
  226. this.reset();
  227. },
  228. // 表单重置
  229. reset() {
  230. this.form = {
  231. fId: null,
  232. fWarehouseAreaId: null,
  233. fNo: null,
  234. fName: null,
  235. fAddr: null,
  236. fStatus: "0",
  237. delFlag: null,
  238. createBy: null,
  239. createTime: null,
  240. updateBy: null,
  241. updateTime: null,
  242. remark: null
  243. };
  244. this.resetForm("form");
  245. },
  246. /** 搜索按钮操作 */
  247. handleQuery() {
  248. this.queryParams.pageNum = 1;
  249. this.getList();
  250. },
  251. /** 重置按钮操作 */
  252. resetQuery() {
  253. this.resetForm("queryForm");
  254. this.handleQuery();
  255. },
  256. // 多选框选中数据
  257. handleSelectionChange(selection) {
  258. this.ids = selection.map(item => item.fId)
  259. this.single = selection.length!==1
  260. this.multiple = !selection.length
  261. },
  262. /** 新增按钮操作 */
  263. handleAdd() {
  264. this.reset();
  265. this.open = true;
  266. this.title = "添加库位";
  267. },
  268. /** 修改按钮操作 */
  269. handleUpdate(row) {
  270. this.reset();
  271. const fId = row.fId || this.ids
  272. getLocation(fId).then(response => {
  273. this.form = response.data;
  274. this.open = true;
  275. this.title = "修改库位";
  276. });
  277. },
  278. /** 提交按钮 */
  279. submitForm() {
  280. this.$refs["form"].validate(valid => {
  281. if (valid) {
  282. if (this.form.fId != null) {
  283. updateLocation(this.form).then(response => {
  284. this.msgSuccess("修改成功");
  285. this.open = false;
  286. this.getList();
  287. });
  288. } else {
  289. addLocation(this.form).then(response => {
  290. this.msgSuccess("新增成功");
  291. this.open = false;
  292. this.getList();
  293. });
  294. }
  295. }
  296. });
  297. },
  298. /** 删除按钮操作 */
  299. handleDelete(row) {
  300. const fIds = row.fId || this.ids;
  301. this.$confirm('是否确认删除库位编号为"' + fIds + '"的数据项?', "警告", {
  302. confirmButtonText: "确定",
  303. cancelButtonText: "取消",
  304. type: "warning"
  305. }).then(function() {
  306. return delLocation(fIds);
  307. }).then(() => {
  308. this.getList();
  309. this.msgSuccess("删除成功");
  310. })
  311. },
  312. /** 导出按钮操作 */
  313. handleExport() {
  314. const queryParams = this.queryParams;
  315. this.$confirm('是否确认导出所有库位数据项?', "警告", {
  316. confirmButtonText: "确定",
  317. cancelButtonText: "取消",
  318. type: "warning"
  319. }).then(function() {
  320. return exportLocation(queryParams);
  321. }).then(response => {
  322. this.download(response.msg);
  323. })
  324. }
  325. }
  326. };
  327. </script>