index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. <template>
  2. <template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
  3. :operationColumnWidth="50" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
  4. :column-parsing="columnParsing" :operation="operation()" :exportList="exportList">
  5. <el-dialog title="" width="1200px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
  6. :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
  7. <zj-form-container ref="formRef" :form-data="formData" :styleSwitch="false">
  8. <zj-form-module :title="formDialogTitles[formDialogType]" label-width="170px" :showPackUp="false"
  9. :form-data="formData" :form-items="formItems" :disabled="formDialogType == 2">
  10. </zj-form-module>
  11. </zj-form-container>
  12. <div slot="footer" class="dialog-footer">
  13. <el-button size="mini" @click="formCancel">取 消</el-button>
  14. <el-button size="mini" type="primary" @click="formConfirm()">确定</el-button>
  15. </div>
  16. </el-dialog>
  17. </template-page>
  18. </template>
  19. <script>
  20. import TemplatePage from '@/components/template/template-page-1.vue'
  21. import import_mixin from '@/components/template/import_mixin.js'
  22. import ImageUpload from '@/components/file-upload'
  23. import { downloadFiles } from '@/utils/util'
  24. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  25. import { listPageV2, pageExport, getDetail, add, edit, updateStatus, listImport1, listImport2, getTypeList, getCategoryList } from "@/api/auxiliaryFittings/attachmentProfile";
  26. import { commonTemplateDownload } from '@/api/common.js'
  27. import operation_mixin from '@/components/template/operation_mixin.js'
  28. export default {
  29. components: { TemplatePage, ImageUpload },
  30. mixins: [import_mixin, operation_mixin],
  31. data() {
  32. return {
  33. // 表格属性
  34. tableAttributes: {
  35. // 启用勾选列
  36. selectColumn: true
  37. },
  38. // 表格事件
  39. tableEvents: {
  40. 'selection-change': this.selectionChange
  41. },
  42. // 勾选选中行
  43. recordSelected: [],
  44. /** 表单变量 */
  45. formDialogType: 0,
  46. formDialogTitles: ["新增", "编辑", "详情"],
  47. formDialog: false,
  48. formData: {
  49. companyName: JSON.parse(localStorage.getItem('greemall_user')).companyName,
  50. goodsType: 'P',
  51. goodsStockUnit: '',
  52. goodsCode: '',
  53. goodsName: '',
  54. normType: 'M',
  55. status: 'ON',
  56. categoryList: [],
  57. brandList: [],
  58. marketPrice: '',
  59. normAmount: '',
  60. selfWebsitAmount: '',
  61. selfWorkerAmount: '',
  62. outWebsitAmount: '',
  63. outWorkerAmount: '',
  64. remark: ''
  65. },
  66. partsUnitList: [],
  67. brandList: [],
  68. categoryList: []
  69. }
  70. },
  71. computed: {
  72. // 事件组合
  73. optionsEvensGroup() {
  74. return [
  75. [
  76. [
  77. this.optionsEvensAuth("add", {
  78. click: this.addData
  79. }),
  80. ],
  81. ],
  82. [
  83. [
  84. this.optionsEvensAuth("shelfInBulk", {
  85. click: () => {
  86. this.updateStatus('ON')
  87. }
  88. }),
  89. ],
  90. ],
  91. [
  92. [
  93. this.optionsEvensAuth("batchRemoval", {
  94. click: () => {
  95. this.updateStatus('OFF')
  96. }
  97. }),
  98. ],
  99. ],
  100. [
  101. [
  102. this.optionsEvensAuth("template", {
  103. click: this.handleDownload1
  104. }),
  105. ],
  106. [
  107. this.optionsEvensAuth("imp", ({ moduleName }) => {
  108. return {
  109. name: moduleName,
  110. render: () => {
  111. return this.importButton(listImport1, moduleName)
  112. }
  113. }
  114. }),
  115. ],
  116. ],
  117. [
  118. [
  119. this.optionsEvensAuth("importTemplate", {
  120. click: this.handleDownload2
  121. }),
  122. ],
  123. [
  124. this.optionsEvensAuth("Import", ({ moduleName }) => {
  125. return {
  126. name: moduleName,
  127. render: () => {
  128. return this.importButton(listImport2, moduleName)
  129. }
  130. }
  131. }),
  132. ],
  133. ]
  134. ]
  135. },
  136. // 更多参数
  137. moreParameters() {
  138. return []
  139. },
  140. //加法
  141. accAdd() {
  142. return function (arg1, arg2) {
  143. var r1, r2, m;
  144. try { r1 = arg1.toString().split(".")[1].length } catch (e) { r1 = 0 }
  145. try { r2 = arg2.toString().split(".")[1].length } catch (e) { r2 = 0 }
  146. m = Math.pow(10, Math.max(r1, r2))
  147. return (arg1 * m + arg2 * m) / m
  148. }
  149. },
  150. //减法
  151. Subtr() {
  152. return function (arg1, arg2) {
  153. var r1, r2, m, n;
  154. try { r1 = arg1.toString().split(".")[1].length } catch (e) { r1 = 0 }
  155. try { r2 = arg2.toString().split(".")[1].length } catch (e) { r2 = 0 }
  156. m = Math.pow(10, Math.max(r1, r2));
  157. n = (r1 >= r2) ? r1 : r2;
  158. return ((arg1 * m - arg2 * m) / m).toFixed(2);
  159. }
  160. },
  161. formItems() {
  162. return [{
  163. md: 12,
  164. isShow: true,
  165. name: 'el-input',
  166. attributes: { placeholder: '请输入', disabled: true },
  167. formItemAttributes: {
  168. label: '所属商户',
  169. prop: 'companyName',
  170. rules: [...required]
  171. },
  172. }, {
  173. md: 12,
  174. isShow: true,
  175. name: 'slot-component',
  176. attributes: {},
  177. formItemAttributes: {
  178. label: '状态',
  179. prop: 'status',
  180. rules: [...required]
  181. },
  182. render: (h, { props, onInput }) => {
  183. var { value } = props
  184. return (
  185. <el-radio-group v-model={this.formData.status}>
  186. <el-radio disabled={this.formDialogType == 2} label="ON">上架</el-radio>
  187. <el-radio disabled={this.formDialogType == 2} label="OFF">下架</el-radio>
  188. </el-radio-group>
  189. )
  190. }
  191. }, {
  192. md: 12,
  193. isShow: true,
  194. name: 'el-input',
  195. attributes: { placeholder: '请输入配件名称', },
  196. formItemAttributes: {
  197. label: '配件名称',
  198. prop: 'goodsName',
  199. rules: [...required]
  200. }
  201. }, {
  202. md: 12,
  203. isShow: true,
  204. name: 'el-select-add',
  205. labelKey: 'dictValue',
  206. valueKey: 'dictValue',
  207. options: this.partsUnitList,
  208. attributes: { placeholder: '请选择单位', filterable: true, clearable: true },
  209. formItemAttributes: {
  210. label: '单位',
  211. prop: 'goodsStockUnit',
  212. rules: [...required]
  213. },
  214. events: {
  215. change: (e) => {
  216. this.$refs.formRef.validateField(['goodsStockUnit'], (valid, invalidFields, errLabels) => { })
  217. }
  218. }
  219. }, {
  220. md: 12,
  221. isShow: true,
  222. name: 'el-input',
  223. attributes: { placeholder: '请输入配件代码' },
  224. formItemAttributes: {
  225. label: '配件代码',
  226. prop: 'goodsCode',
  227. rules: [...required]
  228. }
  229. }, {
  230. md: 12,
  231. isShow: true,
  232. name: 'slot-component',
  233. attributes: {},
  234. formItemAttributes: {
  235. label: '收费类型',
  236. prop: 'normType',
  237. rules: [...required]
  238. },
  239. render: (h, { props, onInput }) => {
  240. var { value } = props
  241. return (
  242. <el-radio-group v-model={this.formData.normType}>
  243. <el-radio disabled={this.formDialogType == 2} label="M">配件物料</el-radio>
  244. <el-radio disabled={this.formDialogType == 2} label="S">服务收费</el-radio>
  245. </el-radio-group>
  246. )
  247. }
  248. }, {
  249. md: 24,
  250. isShow: this.formData.normType == 'M' ? true : false,
  251. name: 'el-checkbox-add',
  252. labelKey: 'dictValue',
  253. valueKey: 'dictCode',
  254. attributes: {},
  255. options: this.brandList,
  256. formItemAttributes: {
  257. label: '适用品牌',
  258. prop: 'brandList',
  259. rules: [...required]
  260. },
  261. events: {
  262. change: (e) => {
  263. this.$refs.formRef.validateField(['brandList'], (valid, invalidFields, errLabels) => { })
  264. }
  265. }
  266. }, {
  267. md: 24,
  268. isShow: this.formData.normType == 'M' ? true : false,
  269. name: 'el-checkbox-add',
  270. labelKey: 'name',
  271. valueKey: 'categoryId',
  272. attributes: {},
  273. options: this.categoryList,
  274. formItemAttributes: {
  275. label: '适用产品大类',
  276. prop: 'categoryList',
  277. rules: [...required]
  278. },
  279. events: {
  280. change: (e) => {
  281. this.$refs.formRef.validateField(['categoryList'], (valid, invalidFields, errLabels) => { })
  282. }
  283. }
  284. }, {
  285. md: 12,
  286. isShow: this.formData.normType == 'M' ? true : false,
  287. name: 'slot-component',
  288. attributes: { placeholder: '请输入', type: 'number' },
  289. formItemAttributes: {
  290. label: '销售价格',
  291. prop: 'marketPrice',
  292. rules: [...required]
  293. },
  294. render: (h, { props, onInput }) => {
  295. var { value } = props
  296. return (
  297. <div style="position: relative;">
  298. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  299. <el-input v-model={this.formData.marketPrice} type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">元</span>
  300. </div>
  301. <div style="color: #EA8000">注:维护网点销售给师傅的价格</div>
  302. </div>
  303. )
  304. }
  305. }, {
  306. md: 12,
  307. isShow: this.formData.normType == 'M' ? true : false,
  308. name: 'slot-component',
  309. attributes: { placeholder: '请输入', type: 'number' },
  310. formItemAttributes: {
  311. label: '收费标准',
  312. prop: 'normAmount',
  313. rules: [...required]
  314. },
  315. render: (h, { props, onInput }) => {
  316. var { value } = props
  317. return (
  318. <div style="position: relative;">
  319. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  320. <el-input v-model={this.formData.normAmount} onChange={(e) => {
  321. this.formData.normAmount = Number(e).toFixed(2)
  322. if (this.formData.selfWorkerAmount > e) {
  323. this.formData.normAmount = ''
  324. return this.$message.warning('自有库存师傅分账金额必须小于收费标准!');
  325. } else if (this.formData.outWorkerAmount > e) {
  326. this.formData.outWorkerAmount = ''
  327. return this.$message.warning('外购配件师傅分账金额必须小于收费标准!');
  328. }
  329. this.formData.selfWebsitAmount = this.Subtr(e, this.formData.selfWorkerAmount)
  330. this.formData.outWebsitAmount = this.Subtr(e, this.formData.outWorkerAmount)
  331. this.$refs.formRef.validateField(['selfWebsitAmount'], (valid, invalidFields, errLabels) => { })
  332. this.$refs.formRef.validateField(['outWebsitAmount'], (valid, invalidFields, errLabels) => { })
  333. }} type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">元</span>
  334. </div>
  335. <div style="color: #EA8000">注:分账金额需扣除手续费0.6%</div>
  336. </div>
  337. )
  338. }
  339. }, {
  340. md: 12,
  341. isShow: this.formData.normType == 'M' ? true : false,
  342. name: 'slot-component',
  343. attributes: { placeholder: '请输入', type: 'number' },
  344. formItemAttributes: {
  345. label: '自有库存师傅分账金额',
  346. prop: 'selfWorkerAmount',
  347. rules: [...required]
  348. },
  349. render: (h, { props, onInput }) => {
  350. var { value } = props
  351. const that = this
  352. return (
  353. <div style="position: relative;">
  354. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  355. <el-input v-model={this.formData.selfWorkerAmount} onChange={(e) => {
  356. this.formData.selfWorkerAmount = Number(this.formData.selfWorkerAmount).toFixed(2)
  357. if (e && (Number(e) > Number(that.formData.normAmount))) {
  358. that.formData.selfWorkerAmount = ''
  359. return this.$message.warning('自有库存师傅分账金额必须小于收费标准!');
  360. }
  361. that.formData.selfWebsitAmount = this.Subtr(that.formData.normAmount, e)
  362. }} type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">元</span>
  363. </div>
  364. </div>
  365. )
  366. }
  367. }, {
  368. md: 12,
  369. isShow: this.formData.normType == 'M' ? false : true,
  370. name: 'slot-component',
  371. attributes: { placeholder: '请输入', type: 'number' },
  372. formItemAttributes: {
  373. label: '师傅分账比例',
  374. prop: 'selfWorkerAmount',
  375. rules: [...required]
  376. },
  377. render: (h, { props, onInput }) => {
  378. var { value } = props
  379. const that = this
  380. return (
  381. <div style="position: relative;">
  382. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  383. <el-input v-model={this.formData.selfWorkerAmount} onChange={(e) => {
  384. this.formData.selfWorkerAmount = Number(this.formData.selfWorkerAmount).toFixed(2)
  385. if (e && (Number(e) < 0)) {
  386. return this.$message.warning('师傅分账比例不能为0!');
  387. }
  388. if (e && (this.accAdd(Number(e), Number(that.formData.selfWebsitAmount)) > 100)) {
  389. this.formData.selfWorkerAmount = 0
  390. return this.$message.warning('商户与师傅分账比例和最大只能100%!');
  391. } else {
  392. that.formData.selfWebsitAmount = this.Subtr(100, e)
  393. }
  394. }} type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">%</span>
  395. </div>
  396. </div>
  397. )
  398. }
  399. }, {
  400. md: 12,
  401. isShow: this.formData.normType == 'M' ? true : false,
  402. name: 'slot-component',
  403. attributes: { placeholder: '请输入', type: 'number' },
  404. formItemAttributes: {
  405. label: '外购配件师傅分账金额',
  406. prop: 'outWorkerAmount',
  407. rules: [...required]
  408. },
  409. render: (h, { props, onInput }) => {
  410. var { value } = props
  411. const that = this
  412. return (
  413. <div style="position: relative;">
  414. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  415. <el-input v-model={this.formData.outWorkerAmount} onChange={(e) => {
  416. this.formData.outWorkerAmount = Number(this.formData.outWorkerAmount).toFixed(2)
  417. if (Number(e) > Number(that.formData.normAmount)) {
  418. this.formData.outWorkerAmount = ''
  419. return this.$message.warning('外购配件师傅分账金额必须小于收费标准!');
  420. }
  421. this.formData.outWebsitAmount = this.Subtr(this.formData.normAmount, e)
  422. }} type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">元</span>
  423. </div>
  424. </div>
  425. )
  426. }
  427. }, {
  428. md: 12,
  429. isShow: this.formData.normType == 'M' ? true : false,
  430. name: 'slot-component',
  431. attributes: { placeholder: '请输入', type: 'number' },
  432. formItemAttributes: {
  433. label: '自有库存商户分账金额',
  434. prop: 'selfWebsitAmount',
  435. rules: [...required]
  436. },
  437. render: (h, { props, onInput }) => {
  438. var { value } = props
  439. return (
  440. <div style="position: relative;">
  441. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  442. <el-input v-model={this.formData.selfWebsitAmount} disabled type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">元</span>
  443. </div>
  444. </div>
  445. )
  446. }
  447. }, {
  448. md: 12,
  449. isShow: this.formData.normType == 'M' ? false : true,
  450. name: 'slot-component',
  451. attributes: { placeholder: '请输入', type: 'number' },
  452. formItemAttributes: {
  453. label: '商户分账比例',
  454. prop: 'selfWebsitAmount',
  455. rules: [...required]
  456. },
  457. render: (h, { props, onInput }) => {
  458. var { value } = props
  459. const that = this
  460. return (
  461. <div style="position: relative;">
  462. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  463. <el-input v-model={this.formData.selfWebsitAmount} onChange={(e) => {
  464. this.formData.selfWebsitAmount = Number(this.formData.selfWebsitAmount).toFixed(2)
  465. if (e && (Number(e) < 0)) {
  466. return this.$message.warning('商户分账比例不能为0!');
  467. }
  468. if (e && (this.accAdd(Number(e), Number(that.formData.selfWorkerAmount)) > 100)) {
  469. this.formData.selfWebsitAmount = 0
  470. return this.$message.warning('商户与师傅分账比例和最大只能100%!');
  471. } else {
  472. that.formData.selfWorkerAmount = this.Subtr(100, e)
  473. }
  474. }} type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">%</span>
  475. </div>
  476. </div>
  477. )
  478. }
  479. }, {
  480. md: 12,
  481. isShow: this.formData.normType == 'M' ? true : false,
  482. name: 'slot-component',
  483. attributes: { placeholder: '请输入', type: 'number' },
  484. formItemAttributes: {
  485. label: '外购配件商户分账金额',
  486. prop: 'outWebsitAmount',
  487. rules: [...required]
  488. },
  489. render: (h, { props, onInput }) => {
  490. var { value } = props
  491. return (
  492. <div style="position: relative;">
  493. <div style="display: flex;justify-content: space-around;align-items: center;position: relative;">
  494. <el-input v-model={this.formData.outWebsitAmount} disabled type="number" placeholder="请输入"></el-input><span style="margin-left: 10px;">元</span>
  495. </div>
  496. </div>
  497. )
  498. }
  499. }, {
  500. md: 24,
  501. isShow: true,
  502. name: 'el-input',
  503. attributes: { placeholder: '请输入备注内容', type: "textarea", rows: 5 },
  504. formItemAttributes: {
  505. label: '备注',
  506. prop: 'remark',
  507. rules: []
  508. }
  509. }]
  510. }
  511. },
  512. methods: {
  513. // 列表请求函数
  514. getList(p, cb) {
  515. try {
  516. var pam = JSON.parse(JSON.stringify(p))
  517. if (this.examineStatus) {
  518. pam.params.push({ "param": "b.examine_status", "compare": "=", "value": this.examineStatus })
  519. }
  520. cb && cb(pam)
  521. return listPageV2(pam)
  522. } catch (error) {
  523. console.log(error)
  524. }
  525. },
  526. getTypeList(value, type) {
  527. getTypeList({ "pageNum": 1, "pageSize": -1, "params": [{ "param": "a.dict_type", "compare": "=", "value": `${value}` }, { "param": "a.status", "compare": "=", "value": "ON" }] }).then(res => {
  528. this[type] = res.data.records
  529. })
  530. },
  531. getCategoryList() {
  532. getCategoryList({ "type": 2 }).then(res => {
  533. this.categoryList = res.data
  534. })
  535. },
  536. // 列表导出函数
  537. exportList: pageExport,
  538. // 表格列解析渲染数据更改
  539. columnParsing(item, defaultData) {
  540. if (item.jname === 'idCardImg') {
  541. defaultData.render = (h, { row, index, column }) => {
  542. return (
  543. <div style="padding:0 6px;cursor: pointer;">
  544. {row.idCardImg ? row.idCardImg.split(",").map(url => <el-image src={url} preview-src-list={[url]} fit="fit" style="width:80px;height:80px;" />) : null}
  545. </div>
  546. )
  547. }
  548. }
  549. if (item.jname === 'selfWorkerAmount') {
  550. defaultData.render = (h, { row, index, column }) => {
  551. return (
  552. <div>{row.normType == 'M' ? row.selfWorkerAmount : (row.selfWorkerAmount + '%')}</div>
  553. )
  554. }
  555. }
  556. if (item.jname === 'selfWebsitAmount') {
  557. defaultData.render = (h, { row, index, column }) => {
  558. return (
  559. <div>{row.normType == 'M' ? row.selfWebsitAmount : (row.selfWebsitAmount + '%')}</div>
  560. )
  561. }
  562. }
  563. return defaultData
  564. },
  565. // 监听勾选变化
  566. selectionChange(data) {
  567. this.recordSelected = data
  568. },
  569. operation() {
  570. return this.operationBtn({
  571. edit: {
  572. click: ({ row, index, column }) => {
  573. getDetail({ id: row.goodsId }).then(res => {
  574. Object.assign(this.formData, res.data, {
  575. brandList: res.data.brandList ? res.data.brandList : [],
  576. categoryList: res.data.categoryList ? res.data.categoryList : [],
  577. })
  578. console.log(this.formData)
  579. this.formDialogType = 1
  580. this.openForm()
  581. })
  582. }
  583. },
  584. })
  585. },
  586. addData() {
  587. this.formDialogType = 0
  588. this.openForm()
  589. console.log(this.partsUnitList, this.brandList, this.categoryList)
  590. },
  591. openForm() {
  592. this.getTypeList('PARTS_UNIT', 'partsUnitList')
  593. this.getTypeList('BRAND', 'brandList')
  594. this.getCategoryList()
  595. this.formDialog = true;
  596. },
  597. formCancel() {
  598. this.$refs.formRef.$refs.inlineForm.clearValidate()
  599. this.$data.formData = this.$options.data().formData
  600. this.formDialog = false
  601. },
  602. updateStatus(stateEnum) {
  603. if (this.recordSelected.length == 0) {
  604. return this.$message.warning('请至少勾选一条数据!');
  605. }
  606. console.log(this.recordSelected)
  607. this.$confirm(`请确认是否${stateEnum == 'OFF' ? '下架' : '上架'}该配件, 是否继续?`, '提示', {
  608. confirmButtonText: '确定',
  609. cancelButtonText: '取消',
  610. type: 'warning'
  611. }).then(() => {
  612. updateStatus({
  613. stateEnum,
  614. ids: this.recordSelected.map(item => { return item.goodsId }).join(',')
  615. }).then(res => {
  616. if (res.code == 200) {
  617. this.$message({ type: 'success', message: `${stateEnum == 'ON' ? '上架' : '下架'}成功!` })
  618. this.$refs.pageRef.refreshList()
  619. } else {
  620. this.$message.error(res.msg);
  621. }
  622. })
  623. });
  624. },
  625. formConfirm() {
  626. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  627. if (valid) {
  628. ([add, edit][this.formDialogType])(this.formData).then(res => {
  629. this.$message({ type: 'success', message: `${this.formDialogTitles[this.formDialogType]}成功!` })
  630. this.formCancel()
  631. this.$refs.pageRef.refreshList()
  632. })
  633. }
  634. })
  635. },
  636. // 下载导入模版
  637. handleDownload1() {
  638. commonTemplateDownload({ name: '配件模板(配件物料).xlsx' }, `${this.$route.meta.title}`).then(res => {
  639. this.$message({
  640. message: '下载成功',
  641. type: 'success'
  642. })
  643. }).catch(err => {
  644. this.$message.error('下载失败')
  645. })
  646. // downloadFiles('charging/standard/download');
  647. },
  648. handleDownload2() {
  649. commonTemplateDownload({ name: '配件模板(服务收费).xlsx' }, `${this.$route.meta.title}`).then(res => {
  650. this.$message({
  651. message: '下载成功',
  652. type: 'success'
  653. })
  654. }).catch(err => {
  655. this.$message.error('下载失败')
  656. })
  657. // downloadFiles('charging/standard/download');
  658. },
  659. }
  660. }
  661. </script>
  662. <style lang="scss" scoped>
  663. .tab {
  664. padding: 20px 20px 0 20px;
  665. }
  666. </style>