index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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" width="150" fixed="right">
  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. import { addSet, select, resetModule } from "@/api/system/set";
  161. import Cookies from "js-cookie";
  162. import draggable from "vuedraggable";
  163. export default {
  164. name: "Location",
  165. components: {
  166. },
  167. data() {
  168. return {
  169. // 遮罩层
  170. loading: true,
  171. // 选中数组
  172. ids: [],
  173. // 非单个禁用
  174. single: true,
  175. // 非多个禁用
  176. multiple: true,
  177. // 显示搜索条件
  178. showSearch: true,
  179. // 总条数
  180. total: 0,
  181. // 库位表格数据
  182. locationList: [],
  183. // 弹出层标题
  184. title: "",
  185. // 是否显示弹出层
  186. open: false,
  187. // 查询参数
  188. queryParams: {
  189. pageNum: 1,
  190. pageSize: 10,
  191. fWarehouseAreaId: null,
  192. fNo: null,
  193. fName: null,
  194. fAddr: null,
  195. fStatus: null,
  196. },
  197. // 表单参数
  198. form: {},
  199. // 表单校验
  200. rules: {
  201. fNo: [
  202. { required: true, message: "编号不能为空", trigger: "blur" }
  203. ],
  204. fName: [
  205. { required: true, message: "名称不能为空", trigger: "blur" }
  206. ],
  207. fAddr: [
  208. { required: true, message: "地址不能为空", trigger: "blur" }
  209. ],
  210. }
  211. };
  212. },
  213. created() {
  214. this.getList();
  215. },
  216. methods: {
  217. /** 查询库位列表 */
  218. getList() {
  219. this.loading = true;
  220. listLocation(this.queryParams).then(response => {
  221. this.locationList = response.rows;
  222. this.total = response.total;
  223. this.loading = false;
  224. });
  225. },
  226. // 取消按钮
  227. cancel() {
  228. this.open = false;
  229. this.reset();
  230. },
  231. // 表单重置
  232. reset() {
  233. this.form = {
  234. fId: null,
  235. fWarehouseAreaId: null,
  236. fNo: null,
  237. fName: null,
  238. fAddr: null,
  239. fStatus: "0",
  240. delFlag: null,
  241. createBy: null,
  242. createTime: null,
  243. updateBy: null,
  244. updateTime: null,
  245. remark: null
  246. };
  247. this.resetForm("form");
  248. },
  249. /** 搜索按钮操作 */
  250. handleQuery() {
  251. this.queryParams.pageNum = 1;
  252. this.getList();
  253. },
  254. /** 重置按钮操作 */
  255. resetQuery() {
  256. this.resetForm("queryForm");
  257. this.handleQuery();
  258. },
  259. // 多选框选中数据
  260. handleSelectionChange(selection) {
  261. this.ids = selection.map(item => item.fId)
  262. this.single = selection.length!==1
  263. this.multiple = !selection.length
  264. },
  265. /** 新增按钮操作 */
  266. handleAdd() {
  267. this.reset();
  268. this.open = true;
  269. this.title = "添加库位";
  270. },
  271. /** 修改按钮操作 */
  272. handleUpdate(row) {
  273. this.reset();
  274. const fId = row.fId || this.ids
  275. getLocation(fId).then(response => {
  276. this.form = response.data;
  277. this.open = true;
  278. this.title = "修改库位";
  279. });
  280. },
  281. /** 提交按钮 */
  282. submitForm() {
  283. this.$refs["form"].validate(valid => {
  284. if (valid) {
  285. if (this.form.fId != null) {
  286. updateLocation(this.form).then(response => {
  287. this.msgSuccess("修改成功");
  288. this.open = false;
  289. this.getList();
  290. });
  291. } else {
  292. addLocation(this.form).then(response => {
  293. this.msgSuccess("新增成功");
  294. this.open = false;
  295. this.getList();
  296. });
  297. }
  298. }
  299. });
  300. },
  301. /** 删除按钮操作 */
  302. handleDelete(row) {
  303. const fIds = row.fId || this.ids;
  304. this.$confirm('是否确认删除库位编号为"' + fIds + '"的数据项?', "警告", {
  305. confirmButtonText: "确定",
  306. cancelButtonText: "取消",
  307. type: "warning"
  308. }).then(function() {
  309. return delLocation(fIds);
  310. }).then(() => {
  311. this.getList();
  312. this.msgSuccess("删除成功");
  313. })
  314. },
  315. /** 导出按钮操作 */
  316. handleExport() {
  317. const queryParams = this.queryParams;
  318. this.$confirm('是否确认导出所有库位数据项?', "警告", {
  319. confirmButtonText: "确定",
  320. cancelButtonText: "取消",
  321. type: "warning"
  322. }).then(function() {
  323. return exportLocation(queryParams);
  324. }).then(response => {
  325. this.download(response.msg);
  326. })
  327. }
  328. }
  329. };
  330. </script>
  331. <style lang="scss" scoped>
  332. .tabSetting {
  333. display: flex;
  334. justify-content: flex-end;
  335. }
  336. .listStyle {
  337. display: flex;
  338. border-top: 1px solid #dcdfe6;
  339. border-left: 1px solid #dcdfe6;
  340. border-right: 1px solid #dcdfe6;
  341. }
  342. .listStyle:last-child {
  343. border-bottom: 1px solid #dcdfe6;
  344. }
  345. .progress {
  346. display: flex;
  347. align-items: center;
  348. padding: 2px;
  349. background-color: rgba(0, 0, 0, 0.05);
  350. height: 100%;
  351. }
  352. </style>