index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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="brand">
  5. <el-select v-model="queryParams.brand" placeholder="请输入品牌" clearable size="small"
  6. @keyup.enter.native="handleQuery">
  7. <el-option v-for="(item, index) in searchOption[0]" :value="item" :key="index">{{ item }}</el-option>
  8. </el-select>
  9. </el-form-item>
  10. <el-form-item label="机组功率(kw)" prop="unitPowerKw">
  11. <el-select v-model="queryParams.unitPowerKw" placeholder="请输入机组功率(kw)" clearable size="small"
  12. @keyup.enter.native="handleQuery">
  13. <el-option v-for="(item, index) in searchOption[1]" :value="item" :key="index">{{ item }}</el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="机组功率(kva)" prop="unitPowerKva">
  17. <el-select v-model="queryParams.unitPowerKva" placeholder="请输入机组功率(kva)" clearable size="small"
  18. @keyup.enter.native="handleQuery">
  19. <el-option v-for="(item, index) in searchOption[2]" :value="item" :key="index">{{ item }}</el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <el-col :span="1.5">
  29. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
  30. v-hasPermi="['price:info:add']">新增</el-button>
  31. </el-col>
  32. <el-col :span="1.5">
  33. <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
  34. v-hasPermi="['price:info:edit']">修改</el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  38. v-hasPermi="['price:info:remove']">删除</el-button>
  39. </el-col>
  40. <el-col :span="1.5">
  41. <el-button type="warning" icon="el-icon-top" size="mini" @click="handleExport"
  42. v-hasPermi="['price:info:export']">导出</el-button>
  43. </el-col>
  44. <el-col :span="1.5">
  45. <el-upload v-hasPermi="['price:info:import']" :show-file-list="false" class="upload-demo" with-credentials :headers="{
  46. 'Authorization': 'Bearer ' + token
  47. }" action="http://xxgl.zzxcx.net/xxgl-admin/price/info/import" :on-success="handleSuccess" multiple
  48. accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  49. :file-list="fileList">
  50. <el-button type="warning" icon="el-icon-bottom" size="mini" v-hasPermi="['price:info:export']">导入</el-button>
  51. </el-upload>
  52. </el-col>
  53. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  54. </el-row>
  55. <el-table fit :row-style="{ height: '35px' }" v-loading="loading" :data="infoList"
  56. @selection-change="handleSelectionChange">
  57. <el-table-column type="selection" width="55" align="center" />
  58. <el-table-column label="品牌" align="center" prop="brand" />
  59. <el-table-column width="180px" label="机组型号" align="center" prop="unitModel" />
  60. <el-table-column label="机组功率(kw)" align="center" prop="unitPowerKw" />
  61. <el-table-column label="机组功率(kva)" align="center" prop="unitPowerKva" />
  62. <el-table-column label="频率(Hz)" align="center" prop="rate" />
  63. <el-table-column width="180px" label="柴油机型号" align="center" prop="dieselEngineModel" />
  64. <el-table-column label="转速" align="center" prop="speed" />
  65. <el-table-column label="动力价格" align="center" prop="powerPrice" />
  66. <el-table-column width="180px" label="发电机型号" align="center" prop="generatorModel" />
  67. <el-table-column label="发电机价格" align="center" prop="generatorPrice" />
  68. <el-table-column label="静音机壳价格" align="center" prop="mutePrice" />
  69. <el-table-column label="开架价格" align="center" prop="openPrice" />
  70. <el-table-column label="ATS型号" align="center" prop="atsModel" />
  71. <el-table-column label="ATS价格" align="center" prop="atsPrice" />
  72. <el-table-column label="电瓶型号" align="center" prop="batteryModel" />
  73. <el-table-column label="电瓶价格" align="center" prop="batteryPrice" />
  74. <el-table-column label="控制器铭贝" align="center" prop="controllerMinbei" />
  75. <el-table-column label="控制器价格" align="center" prop="controllerPrice" />
  76. <el-table-column label="合计含税成本(静音)" align="center" prop="totalCostMute" />
  77. <el-table-column label="合计含税成本(开架)" align="center" prop="totalCostOpen" />
  78. <el-table-column label="静音尺寸" align="center" prop="muteLong" />
  79. <el-table-column label="静音尺寸" align="center" prop="muteWidth" />
  80. <el-table-column label="静音尺寸" align="center" prop="muteHigh" />
  81. <el-table-column label="开架尺寸" align="center" prop="openLong" />
  82. <el-table-column label="开架尺寸" align="center" prop="openWidth" />
  83. <el-table-column label="开架尺寸" align="center" prop="openHigh" />
  84. <el-table-column label="CKD尺寸" align="center" prop="ckdLong" />
  85. <el-table-column label="CKD尺寸" align="center" prop="ckdWidth" />
  86. <el-table-column label="CKD尺寸" align="center" prop="ckdHigh" />
  87. <el-table-column fixed="right" width="180px" label="操作" align="center" class-name="small-padding fixed-width">
  88. <template slot-scope="scope">
  89. <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
  90. v-hasPermi="['price:info:edit']">修改</el-button>
  91. <el-button @click="() => {
  92. $router.push('/gallery?id=' + scope.row.id)
  93. }" size="mini" type="text" icon="el-icon-picture-outline" >图片</el-button>
  94. <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
  95. v-hasPermi="['price:info:remove']">删除</el-button>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  100. @pagination="getList" />
  101. <!-- 添加或修改报价对话框 -->
  102. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  103. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  104. <el-form-item label="品牌" prop="brand">
  105. <el-input v-model="form.brand" placeholder="请输入品牌" />
  106. </el-form-item>
  107. <el-form-item label="机组型号" prop="unitModel">
  108. <el-input v-model="form.unitModel" placeholder="请输入机组型号" />
  109. </el-form-item>
  110. <el-form-item label="机组功率(kw)" prop="unitPowerKw">
  111. <el-input v-model="form.unitPowerKw" placeholder="请输入机组功率(kw)" />
  112. </el-form-item>
  113. <el-form-item label="机组功率(kva)" prop="unitPowerKva">
  114. <el-input v-model="form.unitPowerKva" placeholder="请输入机组功率(kva)" />
  115. </el-form-item>
  116. <el-form-item label="频率(Hz)" prop="rate">
  117. <el-input v-model="form.rate" placeholder="请输入频率(Hz)" />
  118. </el-form-item>
  119. <el-form-item label="柴油机型号" prop="dieselEngineModel">
  120. <el-input v-model="form.dieselEngineModel" placeholder="请输入柴油机型号" />
  121. </el-form-item>
  122. <el-form-item label="转速" prop="speed">
  123. <el-input v-model="form.speed" placeholder="请输入转速" />
  124. </el-form-item>
  125. <el-form-item label="动力价格" prop="powerPrice">
  126. <el-input v-model="form.powerPrice" placeholder="请输入动力价格" />
  127. </el-form-item>
  128. <el-form-item label="发电机型号" prop="generatorModel">
  129. <el-input v-model="form.generatorModel" placeholder="请输入发电机型号" />
  130. </el-form-item>
  131. <el-form-item label="发电机价格" prop="generatorPrice">
  132. <el-input v-model="form.generatorPrice" placeholder="请输入发电机价格" />
  133. </el-form-item>
  134. <el-form-item label="静音机壳价格" prop="mutePrice">
  135. <el-input v-model="form.mutePrice" placeholder="请输入静音机壳价格" />
  136. </el-form-item>
  137. <el-form-item label="开架价格" prop="openPrice">
  138. <el-input v-model="form.openPrice" placeholder="请输入开架价格" />
  139. </el-form-item>
  140. <el-form-item label="ATS型号" prop="atsModel">
  141. <el-input v-model="form.atsModel" placeholder="请输入ATS型号" />
  142. </el-form-item>
  143. <el-form-item label="ATS价格" prop="atsPrice">
  144. <el-input v-model="form.atsPrice" placeholder="请输入ATS价格" />
  145. </el-form-item>
  146. <el-form-item label="电瓶型号" prop="batteryModel">
  147. <el-input v-model="form.batteryModel" placeholder="请输入电瓶型号" />
  148. </el-form-item>
  149. <el-form-item label="电瓶价格" prop="batteryPrice">
  150. <el-input v-model="form.batteryPrice" placeholder="请输入电瓶价格" />
  151. </el-form-item>
  152. <el-form-item label="控制器铭贝" prop="controllerMinbei">
  153. <el-input v-model="form.controllerMinbei" placeholder="请输入控制器铭贝" />
  154. </el-form-item>
  155. <el-form-item label="控制器价格" prop="controllerPrice">
  156. <el-input v-model="form.controllerPrice" placeholder="请输入控制器价格" />
  157. </el-form-item>
  158. <el-form-item label="合计含税成本(静音)" prop="totalCostMute">
  159. <el-input v-model="form.totalCostMute" placeholder="请输入合计含税成本(静音)" />
  160. </el-form-item>
  161. <el-form-item label="合计含税成本(开架)" prop="totalCostOpen">
  162. <el-input v-model="form.totalCostOpen" placeholder="请输入合计含税成本(开架)" />
  163. </el-form-item>
  164. <el-form-item label="静音尺寸" prop="muteLong">
  165. <el-input v-model="form.muteLong" placeholder="请输入静音尺寸" />
  166. </el-form-item>
  167. <el-form-item label="静音尺寸" prop="muteWidth">
  168. <el-input v-model="form.muteWidth" placeholder="请输入静音尺寸" />
  169. </el-form-item>
  170. <el-form-item label="静音尺寸" prop="muteHigh">
  171. <el-input v-model="form.muteHigh" placeholder="请输入静音尺寸" />
  172. </el-form-item>
  173. <el-form-item label="开架尺寸" prop="openLong">
  174. <el-input v-model="form.openLong" placeholder="请输入开架尺寸" />
  175. </el-form-item>
  176. <el-form-item label="开架尺寸" prop="openWidth">
  177. <el-input v-model="form.openWidth" placeholder="请输入开架尺寸" />
  178. </el-form-item>
  179. <el-form-item label="开架尺寸" prop="openHigh">
  180. <el-input v-model="form.openHigh" placeholder="请输入开架尺寸" />
  181. </el-form-item>
  182. <el-form-item label="CKD尺寸" prop="ckdLong">
  183. <el-input v-model="form.ckdLong" placeholder="请输入CKD尺寸" />
  184. </el-form-item>
  185. <el-form-item label="CKD尺寸" prop="ckdWidth">
  186. <el-input v-model="form.ckdWidth" placeholder="请输入CKD尺寸" />
  187. </el-form-item>
  188. <el-form-item label="CKD尺寸" prop="ckdHigh">
  189. <el-input v-model="form.ckdHigh" placeholder="请输入CKD尺寸" />
  190. </el-form-item>
  191. </el-form>
  192. <div slot="footer" class="dialog-footer">
  193. <el-button type="primary" @click="submitForm">确 定</el-button>
  194. <el-button @click="cancel">取 消</el-button>
  195. </div>
  196. </el-dialog>
  197. </div>
  198. </template>
  199. <script>
  200. import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo, getFieldName } from "@/api/price/manage";
  201. import { getToken } from '@/utils/auth'
  202. export default {
  203. name: "Info",
  204. data() {
  205. return {
  206. token: getToken(),
  207. fileList: [],
  208. //搜索下拉选项
  209. searchOption: [[], [], []],
  210. // 遮罩层
  211. loading: true,
  212. // 选中数组
  213. ids: [],
  214. // 非单个禁用
  215. single: true,
  216. // 非多个禁用
  217. multiple: true,
  218. // 显示搜索条件
  219. showSearch: true,
  220. // 总条数
  221. total: 0,
  222. // 报价表格数据
  223. infoList: [],
  224. // 弹出层标题
  225. title: "",
  226. // 是否显示弹出层
  227. open: false,
  228. // 查询参数
  229. queryParams: {
  230. pageNum: 1,
  231. pageSize: 10,
  232. brand: null,
  233. unitModel: null,
  234. unitPowerKw: null,
  235. unitPowerKva: null,
  236. rate: null,
  237. dieselEngineModel: null,
  238. speed: null,
  239. powerPrice: null,
  240. generatorModel: null,
  241. generatorPrice: null,
  242. mutePrice: null,
  243. openPrice: null,
  244. atsModel: null,
  245. atsPrice: null,
  246. batteryModel: null,
  247. batteryPrice: null,
  248. controllerMinbei: null,
  249. controllerPrice: null,
  250. totalCostMute: null,
  251. totalCostOpen: null,
  252. muteLong: null,
  253. muteWidth: null,
  254. muteHigh: null,
  255. openLong: null,
  256. openWidth: null,
  257. openHigh: null,
  258. ckdLong: null,
  259. ckdWidth: null,
  260. ckdHigh: null,
  261. },
  262. // 表单参数
  263. form: {},
  264. // 表单校验
  265. rules: {
  266. }
  267. };
  268. },
  269. created() {
  270. this.getList();
  271. this.getSearchOption()
  272. },
  273. methods: {
  274. handleSuccess() {
  275. this.msgSuccess("上传成功");
  276. this.getList()
  277. },
  278. push(url) {
  279. this.router.push(url)
  280. },
  281. getSearchOption() {
  282. getFieldName('brand').then(response => {
  283. this.$set(this.searchOption, 0, response.data);
  284. })
  285. getFieldName('unit_power_kw').then(response => {
  286. this.$set(this.searchOption, 1, response.data);
  287. })
  288. getFieldName('unit_power_kva').then(response => {
  289. this.$set(this.searchOption, 2, response.data);
  290. })
  291. },
  292. /** 查询报价列表 */
  293. getList() {
  294. this.loading = true;
  295. listInfo(this.queryParams).then(response => {
  296. this.infoList = response.rows;
  297. this.total = response.total;
  298. this.loading = false;
  299. });
  300. },
  301. // 取消按钮
  302. cancel() {
  303. this.open = false;
  304. this.reset();
  305. },
  306. // 表单重置
  307. reset() {
  308. this.form = {
  309. id: null,
  310. brand: null,
  311. unitModel: null,
  312. unitPowerKw: null,
  313. unitPowerKva: null,
  314. rate: null,
  315. dieselEngineModel: null,
  316. speed: null,
  317. powerPrice: null,
  318. generatorModel: null,
  319. generatorPrice: null,
  320. mutePrice: null,
  321. openPrice: null,
  322. atsModel: null,
  323. atsPrice: null,
  324. batteryModel: null,
  325. batteryPrice: null,
  326. controllerMinbei: null,
  327. controllerPrice: null,
  328. totalCostMute: null,
  329. totalCostOpen: null,
  330. muteLong: null,
  331. muteWidth: null,
  332. muteHigh: null,
  333. openLong: null,
  334. openWidth: null,
  335. openHigh: null,
  336. ckdLong: null,
  337. ckdWidth: null,
  338. ckdHigh: null,
  339. createTime: null,
  340. updateTime: null
  341. };
  342. this.resetForm("form");
  343. },
  344. /** 搜索按钮操作 */
  345. handleQuery() {
  346. this.queryParams.pageNum = 1;
  347. this.getList();
  348. },
  349. /** 重置按钮操作 */
  350. resetQuery() {
  351. this.resetForm("queryForm");
  352. this.handleQuery();
  353. },
  354. // 多选框选中数据
  355. handleSelectionChange(selection) {
  356. this.ids = selection.map(item => item.id)
  357. this.single = selection.length !== 1
  358. this.multiple = !selection.length
  359. },
  360. /** 新增按钮操作 */
  361. handleAdd() {
  362. this.reset();
  363. this.open = true;
  364. this.title = "添加报价";
  365. },
  366. /** 修改按钮操作 */
  367. handleUpdate(row) {
  368. this.reset();
  369. const id = row.id || this.ids
  370. getInfo(id).then(response => {
  371. this.form = response.data;
  372. this.open = true;
  373. this.title = "修改报价";
  374. });
  375. },
  376. /** 提交按钮 */
  377. submitForm() {
  378. this.$refs["form"].validate(valid => {
  379. if (valid) {
  380. if (this.form.id != null) {
  381. updateInfo(this.form).then(response => {
  382. this.msgSuccess("修改成功");
  383. this.open = false;
  384. this.getList();
  385. });
  386. } else {
  387. addInfo(this.form).then(response => {
  388. this.msgSuccess("新增成功");
  389. this.open = false;
  390. this.getList();
  391. });
  392. }
  393. }
  394. });
  395. },
  396. /** 删除按钮操作 */
  397. handleDelete(row) {
  398. const ids = row.id || this.ids;
  399. this.$confirm('是否确认删除这' + this.ids.length + '数据项?', "警告", {
  400. confirmButtonText: "确定",
  401. cancelButtonText: "取消",
  402. type: "warning"
  403. }).then(function () {
  404. return delInfo(ids);
  405. }).then(() => {
  406. this.getList();
  407. this.msgSuccess("删除成功");
  408. })
  409. },
  410. /** 导出按钮操作 */
  411. handleExport() {
  412. const queryParams = this.queryParams;
  413. this.$confirm('是否确认导出所有报价数据项?', "警告", {
  414. confirmButtonText: "确定",
  415. cancelButtonText: "取消",
  416. type: "warning"
  417. }).then(function () {
  418. return exportInfo(queryParams);
  419. }).then(response => {
  420. this.download(response.data);
  421. })
  422. }
  423. }
  424. };
  425. </script>