index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  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="fNo">
  5. <el-input
  6. v-model="queryParams.fNo"
  7. placeholder="请输入编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="名称" prop="fName">
  14. <el-input
  15. v-model="queryParams.fName"
  16. placeholder="请输入名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="费用属性" prop="fFeetype">
  23. <el-select v-model="queryParams.fFeetype" placeholder="请选择费用属性" clearable size="small">
  24. <el-option
  25. v-for="dict in fFeetypeOptions"
  26. :key="dict.dictValue"
  27. :label="dict.dictLabel"
  28. :value="dict.dictValue"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="计量单位" prop="fFeeunitid">
  33. <el-select v-model="queryParams.fFeeunitid" placeholder="请选择计量单位" clearable size="small">
  34. <el-option
  35. v-for="dict in fFeeunitidOptions"
  36. :key="dict.dictValue"
  37. :label="dict.dictLabel"
  38. :value="dict.dictValue"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="币种" prop="fCurrency">
  43. <el-input
  44. v-model="queryParams.fCurrency"
  45. placeholder="请输入币种"
  46. clearable
  47. size="small"
  48. @keyup.enter.native="handleQuery"
  49. />
  50. </el-form-item>
  51. <el-form-item label="状态" prop="fStatus">
  52. <!-- <el-select v-model="queryParams.fStatus" placeholder="请选择状态" clearable size="small">
  53. <el-option label="请选择字典生成" value="" />
  54. </el-select>-->
  55. <el-select
  56. v-model="queryParams.fStatus"
  57. placeholder="请选择状态"
  58. clearable
  59. size="small"
  60. style="width: 240px"
  61. >
  62. <el-option
  63. v-for="dict in fDocumentOptions"
  64. :key="dict.dictValue"
  65. :label="dict.dictLabel"
  66. :value="dict.dictValue"
  67. />
  68. </el-select>
  69. </el-form-item>
  70. <el-form-item>
  71. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  72. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  73. </el-form-item>
  74. </el-form>
  75. <el-row :gutter="10" class="mb8">
  76. <el-col :span="1.5">
  77. <el-button
  78. type="primary"
  79. icon="el-icon-plus"
  80. size="mini"
  81. @click="handleAdd"
  82. v-hasPermi="['basicdata:fees:add']"
  83. >新增</el-button>
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. type="success"
  88. icon="el-icon-edit"
  89. size="mini"
  90. :disabled="single"
  91. @click="handleUpdate"
  92. v-hasPermi="['basicdata:fees:edit']"
  93. >修改</el-button>
  94. </el-col>
  95. <el-col :span="1.5">
  96. <el-button
  97. type="danger"
  98. icon="el-icon-delete"
  99. size="mini"
  100. :disabled="multiple"
  101. @click="handleDelete"
  102. v-hasPermi="['basicdata:fees:remove']"
  103. >删除</el-button>
  104. </el-col>
  105. <el-col :span="1.5">
  106. <el-button
  107. type="warning"
  108. icon="el-icon-download"
  109. size="mini"
  110. @click="handleExport"
  111. v-hasPermi="['basicdata:fees:export']"
  112. >导出</el-button>
  113. </el-col>
  114. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  115. </el-row>
  116. <el-table v-loading="loading" :data="feesList" @selection-change="handleSelectionChange">
  117. <el-table-column type="selection" width="55" align="center" />
  118. <el-table-column type="index" label="序号" align="center"/>
  119. <el-table-column label="编号" align="center" prop="fNo" />
  120. <el-table-column label="名称" align="center" prop="fName" />
  121. <el-table-column label="费用属性" align="center" prop="fFeetype" :formatter="fFeetypeFormat" />
  122. <el-table-column label="计量单位" align="center" prop="fFeeunitid" :formatter="fFeeunitidFormat" />
  123. <el-table-column label="币种" align="center" prop="fCurrency" />
  124. <el-table-column label="状态" align="center" prop="fStatus" :formatter="statusFormat" />
  125. <el-table-column label="备注" align="center" prop="remark" />
  126. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  127. <template slot-scope="scope">
  128. <el-button
  129. size="mini"
  130. type="text"
  131. icon="el-icon-edit"
  132. @click="handleUpdate(scope.row)"
  133. v-hasPermi="['basicdata:fees:edit']"
  134. >修改</el-button>
  135. <el-button
  136. size="mini"
  137. type="text"
  138. icon="el-icon-delete"
  139. @click="handleDelete(scope.row)"
  140. v-hasPermi="['basicdata:fees:remove']"
  141. >删除</el-button>
  142. </template>
  143. </el-table-column>
  144. </el-table>
  145. <pagination
  146. v-show="total>0"
  147. :total="total"
  148. :page.sync="queryParams.pageNum"
  149. :limit.sync="queryParams.pageSize"
  150. @pagination="getList"
  151. />
  152. <!-- 添加或修改费用信息对话框 -->
  153. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="500px" append-to-body>
  154. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  155. <el-row>
  156. <el-col :span="12">
  157. <el-form-item label="编号" prop="fNo">
  158. <el-input v-model="form.fNo" placeholder="请输入编号" />
  159. </el-form-item>
  160. </el-col>
  161. <el-col :span="12">
  162. <el-form-item label="名称" prop="fName">
  163. <el-input v-model="form.fName" placeholder="请输入名称" />
  164. </el-form-item>
  165. </el-col>
  166. </el-row>
  167. <el-row>
  168. <el-col :span="12">
  169. <el-form-item label="费用属性" prop="fFeetype">
  170. <el-select v-model="form.fFeetype" placeholder="请选择费用属性">
  171. <el-option
  172. v-for="dict in fFeetypeOptions"
  173. :key="dict.dictValue"
  174. :label="dict.dictLabel"
  175. :value="dict.dictValue"
  176. ></el-option>
  177. </el-select>
  178. </el-form-item>
  179. </el-col>
  180. <el-col :span="12">
  181. <el-form-item label="计量单位" prop="fFeeunitid">
  182. <el-select v-model="form.fFeeunitid" placeholder="请选择计量单位">
  183. <el-option
  184. v-for="dict in fFeeunitidOptions"
  185. :key="dict.dictValue"
  186. :label="dict.dictLabel"
  187. :value="dict.dictValue"
  188. ></el-option>
  189. </el-select>
  190. </el-form-item>
  191. </el-col>
  192. </el-row>
  193. <el-row>
  194. <el-col :span="12">
  195. <el-form-item label="币种" prop="fCurrency">
  196. <el-input v-model="form.fCurrency" placeholder="请输入币种" />
  197. </el-form-item>
  198. </el-col>
  199. <el-col :span="12">
  200. <el-form-item label="状态">
  201. <el-select v-model="form.fStatus" placeholder="状态">
  202. <el-option
  203. v-for="dict in fDocumentOptions"
  204. :key="dict.dictValue"
  205. :label="dict.dictLabel"
  206. :value="dict.dictValue"
  207. ></el-option>
  208. </el-select>
  209. </el-form-item>
  210. </el-col>
  211. </el-row>
  212. <el-form-item label="备注" prop="remark">
  213. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
  214. </el-form-item>
  215. </el-form>
  216. <div slot="footer" class="dialog-footer">
  217. <el-button type="primary" @click="submitForm">确 定</el-button>
  218. <el-button @click="cancel">取 消</el-button>
  219. </div>
  220. </el-dialog>
  221. </div>
  222. </template>
  223. <script>
  224. import { listFees, getFees, delFees, addFees, updateFees, exportFees } from "../../../api/basicdata/fees";
  225. export default {
  226. name: "Fees",
  227. components: {
  228. },
  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. feesList: [],
  245. // 弹出层标题
  246. title: "",
  247. // 是否显示弹出层
  248. open: false,
  249. // 费用属性(数据字典)"全部、仓储、海运、空运"字典
  250. fFeetypeOptions: [],
  251. // 计量单位(数据字典)"对应t_unitfees的f_id"字典
  252. fFeeunitidOptions: [],
  253. // 单据状态
  254. fDocumentOptions: [],
  255. // 查询参数
  256. queryParams: {
  257. pageNum: 1,
  258. pageSize: 10,
  259. fNo: null,
  260. fName: null,
  261. fFeetype: null,
  262. fFeeunitid: null,
  263. fCurrency: null,
  264. fStatus: null,
  265. },
  266. // 表单参数
  267. form: {},
  268. // 表单校验
  269. rules: {
  270. fNo: [
  271. { required: true, message: "编号不能为空", trigger: "blur" }
  272. ],
  273. fName: [
  274. { required: true, message: "名称不能为空", trigger: "blur" }
  275. ],
  276. }
  277. };
  278. },
  279. created() {
  280. this.getList();
  281. this.getDicts("data_cost_attribute").then(response => {
  282. this.fFeetypeOptions = response.data;
  283. });
  284. this.getDicts("document_status").then(response => {
  285. this.fDocumentOptions = response.data;
  286. });
  287. this.getDicts("data_unitfees").then(response => {
  288. this.fFeeunitidOptions = response.data;
  289. });
  290. },
  291. methods: {
  292. /** 查询费用信息列表 */
  293. getList() {
  294. this.loading = true;
  295. listFees(this.queryParams).then(response => {
  296. this.feesList = response.rows;
  297. this.total = response.total;
  298. this.loading = false;
  299. });
  300. },
  301. // 费用属性(数据字典)"全部、仓储、海运、空运"字典翻译
  302. fFeetypeFormat(row, column) {
  303. return this.selectDictLabel(this.fFeetypeOptions, row.fFeetype);
  304. },
  305. // 计量单位(数据字典)"对应t_unitfees的f_id"字典翻译
  306. fFeeunitidFormat(row, column) {
  307. return this.selectDictLabel(this.fFeeunitidOptions, row.fFeeunitid);
  308. },
  309. // 字典状态字典翻译
  310. statusFormat(row, column) {
  311. return this.selectDictLabel(this.fDocumentOptions, row.fStatus);
  312. },
  313. // 取消按钮
  314. cancel() {
  315. this.open = false;
  316. this.reset();
  317. },
  318. // 表单重置
  319. reset() {
  320. this.form = {
  321. fId: null,
  322. fNo: null,
  323. fName: null,
  324. fFeetype: null,
  325. fFeeunitid: null,
  326. fCurrency: null,
  327. fStatus: "0",
  328. delFlag: null,
  329. createBy: null,
  330. createTime: null,
  331. updateBy: null,
  332. updateTime: null,
  333. remark: null
  334. };
  335. this.resetForm("form");
  336. },
  337. /** 搜索按钮操作 */
  338. handleQuery() {
  339. this.queryParams.pageNum = 1;
  340. this.getList();
  341. },
  342. /** 重置按钮操作 */
  343. resetQuery() {
  344. this.resetForm("queryForm");
  345. this.handleQuery();
  346. },
  347. // 多选框选中数据
  348. handleSelectionChange(selection) {
  349. this.ids = selection.map(item => item.fId)
  350. this.single = selection.length!==1
  351. this.multiple = !selection.length
  352. },
  353. /** 新增按钮操作 */
  354. handleAdd() {
  355. this.reset();
  356. this.open = true;
  357. this.title = "添加费用信息";
  358. },
  359. /** 修改按钮操作 */
  360. handleUpdate(row) {
  361. this.reset();
  362. const fId = row.fId || this.ids
  363. getFees(fId).then(response => {
  364. this.form = response.data;
  365. this.open = true;
  366. this.title = "修改费用信息";
  367. });
  368. },
  369. /** 提交按钮 */
  370. submitForm() {
  371. this.$refs["form"].validate(valid => {
  372. if (valid) {
  373. if (this.form.fId != null) {
  374. updateFees(this.form).then(response => {
  375. this.msgSuccess("修改成功");
  376. this.open = false;
  377. this.getList();
  378. });
  379. } else {
  380. addFees(this.form).then(response => {
  381. this.msgSuccess("新增成功");
  382. this.open = false;
  383. this.getList();
  384. });
  385. }
  386. }
  387. });
  388. },
  389. /** 删除按钮操作 */
  390. handleDelete(row) {
  391. const fIds = row.fId || this.ids;
  392. this.$confirm('是否确认删除费用信息编号为"' + fIds + '"的数据项?', "警告", {
  393. confirmButtonText: "确定",
  394. cancelButtonText: "取消",
  395. type: "warning"
  396. }).then(function() {
  397. return delFees(fIds);
  398. }).then(() => {
  399. this.getList();
  400. this.msgSuccess("删除成功");
  401. })
  402. },
  403. /** 导出按钮操作 */
  404. handleExport() {
  405. const queryParams = this.queryParams;
  406. this.$confirm('是否确认导出所有费用信息数据项?', "警告", {
  407. confirmButtonText: "确定",
  408. cancelButtonText: "取消",
  409. type: "warning"
  410. }).then(function() {
  411. return exportFees(queryParams);
  412. }).then(response => {
  413. this.download(response.msg);
  414. })
  415. }
  416. }
  417. };
  418. </script>