You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
40 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{"version":3,"file":"js/462-legacy.187cab03.js","mappings":"sKAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,UAAU,CAACA,EAAG,MAAM,CAACE,YAAY,cAAc,CAACF,EAAG,MAAM,CAACE,YAAY,SAAS,CAACF,EAAG,WAAW,CAACG,MAAM,CAAC,MAAQ,SAAS,KAAO,UAAU,OAAS,GAAG,UAAW,MAAU,GAAGH,EAAG,MAAM,CAACE,YAAY,OAAO,CAACF,EAAG,YAAY,CAACG,MAAM,CAAC,KAAO,UAAU,KAAO,QAAQ,MAAQ,GAAG,KAAO,gBAAgBC,GAAG,CAAC,MAAQ,SAASC,GAAQT,EAAIU,4BAA6B,KAAQ,CAACV,EAAIW,GAAG,YAAY,GAAGP,EAAG,MAAM,CAACE,YAAY,SAAS,CAACF,EAAG,WAAW,CAACQ,YAAY,CAAC,MAAQ,QAAQL,MAAM,CAAC,KAAOP,EAAIa,WAAWC,QAChkB,SAAUC,GAAQ,OAAQf,EAAIgB,kBAC5BD,EAAKE,UACFC,cACAC,SAASnB,EAAIgB,iBAAiBE,kBACnC,IAAM,GAAG,KAAO,GAAG,QAAS,EAAK,QAAS,EAAK,yBAAwB,EAAK,aAAa,iBAAiB,CAACd,EAAG,kBAAkB,CAACG,MAAM,CAAC,MAAQ,OAAO,MAAQ,UAAUa,YAAYpB,EAAIqB,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,SAASC,GAAO,MAAO,CAACxB,EAAIW,GAAG,IAAIX,EAAIyB,GAAGD,EAAME,IAAIT,WAAa,MAAM,YAAYb,EAAG,kBAAkB,CAACG,MA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iCAMA,uDACA,iCAPA,SAWA,iDAXA,OAYA,kBACA,+BAbA,kGAeA,mCACA,oCACA,yBAnBA,8CAuBAvB,UA5FA,SA4FA0B,EAAAC,GACA,uBAEA,iCAEA,qBACA,MAGA,OAFA,2CACAA,EAAAA,MAGA,MAGA,OAFA,8CACAA,EAAAA,MAGA,8BAKA1B,iBAjHA,SAiHA2B,EAAAF,EAAAC,GAEA,uCACA,8CAIAjB,iBAxHA,SAwHAkB,EAAAF,EAAAC,GAEA,0CACA,8CAIAE,KA/HA,WAgIA,qDACA,SACA,YACA,yBACAC,EAAAA,KAAAA,EAAAA,EAAAA,EAAAA,EAAAA,EACA,0BAMAC,qBA3IA,SA2IAC,GAEA,QACA,OACA,OACA,OAEA,KAGA,GAFA,KAEA,IAsBA,OApBA,gCACA,cACAC,GAAAA,EAAAA,MACAC,EAAAA,EAAAA,aAIAA,EAAAA,SAAAA,SAAAA,GACA,cACAD,EAAAA,EAAAA,IAAAA,EAAAA,MACAD,EAAAA,EAAAA,aAIAA,EAAAA,SAAAA,SAAAA,GACA,cACAC,EAAAA,EAAAA,IAAAA,EAAAA,UAIA,IAGAE,QA/QA,WAgRA,uBCplBsQ,I,UCOlQC,GAAY,OACd,EACAxF,EACAgE,GACA,EACA,KACA,KACA,MAIF,EAAewB,EAAiB","sources":["webpack://eatwhat-admin/./src/views/Ingredient.vue?2a21","webpack://eatwhat-admin/src/views/Ingredient.vue","webpack://eatwhat-admin/./src/views/Ingredient.vue?c672","webpack://eatwhat-admin/./src/views/Ingredient.vue"],"sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('el-card',[_c('div',{staticClass:\"ingredient\"},[_c('div',{staticClass:\"title\"},[_c('el-alert',{attrs:{\"title\":\"食材管理界面\",\"type\":\"success\",\"center\":\"\",\"closable\":false}})],1),_c('div',{staticClass:\"btn\"},[_c('el-button',{attrs:{\"type\":\"primary\",\"size\":\"small\",\"round\":\"\",\"icon\":\"el-icon-plus\"},on:{\"click\":function($event){_vm.addIngredientDialogVisible = true}}},[_vm._v(\"添加新食材\")])],1),_c('div',{staticClass:\"table\"},[_c('el-table',{staticStyle:{\"width\":\"100%\"},attrs:{\"data\":_vm.ingredient.filter(\n function (data) { return !_vm.ingredientSearch ||\n data.ingreName\n .toLowerCase()\n .includes(_vm.ingredientSearch.toLowerCase()); }\n ),\"fit\":\"\",\"lazy\":\"\",\"stripe\":true,\"border\":true,\"highlight-current-row\":true,\"empty-text\":\"🥶正在努力加载中...\"}},[_c('el-table-column',{attrs:{\"label\":\"食材名称\",\"align\":\"center\"},scopedSlots:_vm._u([{key:\"default\",fn:function(scope){return [_vm._v(\" \"+_vm._s(scope.row.ingreName || \"未知\")+\" \")]}}])}),_c('el-table-column',{attrs:{\"label\":\"图片\",\"align\":\"center\"},scopedSlots:_vm._u([{key:\"default\",fn:function(scope){return [_c('el-image',{staticStyle:{\"width\":\"100px\",\"height\":\"100px\"},attrs:{\"src\":scope.row.ingrePut,\"preview-src-list\":_vm.ingredientImgs}},[_c('div',{staticClass:\"image-slot\",attrs:{\"slot\":\"error\"},slot:\"error\"},[_c('i',{staticClass:\"el-icon-picture-outline\"})])])]}}])}),_c('el-table-column',{attrs:{\"label\":\"产地\",\"align\":\"center\"},scopedSlots:_vm._u([{key:\"default\",fn:function(scope){return [_vm._v(\" \"+_vm._s(scope.row.ingreAdd || \"未知\")+\" \")]}}])}),_c('el-table-column',{attrs:{\"label\":\"属性\",\"align\":\"center\"},scopedSlots:_vm._u([{key:\"default\",fn:function(scope){return [_vm._v(\" \"+_vm._s(scope.row.ingreAttr || \"未知\")+\" \")]}}])}),_c('el-table-column',{attrs:{\"label\":\"价格\",\"align\":\"center\"},scopedSlots:_vm._u([{key:\"default\",fn:function(scope){return [_vm._v(\" \"+_vm._s(scope.row.ingrePrice || \"0\")+\" 元 \")]}}])}),_c('el-table-column',{attrs:{\"align\":\"center\"},scopedSlots:_vm._u([{key:\"header\",fn:function(scope){return [_c('el-input',{attrs:{\"size\":\"mini\",\"placeholder\":\"输入食材名称搜索\"},model:{value:(_vm.ingredientSearch),callback:function ($$v) {_vm.ingredientSearch=$$v},expression:\"ingredientSearch\"}})]}},{key:\"default\",fn:function(scope){return [_c('el-button',{attrs:{\"type\":\"primary\",\"size\":\"mini\",\"plain\":\"\"},on:{\"click\":function($event){return _vm.showUpdateIngredient(scope.row.ingreId)}}},[_vm._v(\"编辑\")]),_c('el-popconfirm',{staticStyle:{\"margin-left\":\"5px\"},attrs:{\"title\":\"确定删除该食材?此操作不可逆\"},on:{\"confirm\":function($event){return _vm.deleteIngredient(scope.row.ingreId)}}},[_c('el-button',{attrs:{\"slot\":\"reference\",\"type\":\"danger\",\"size\":\"mini\",\"plain\":\"\"},slot:\"reference\"},[_vm._v(\"删除\")])],1)]}}])})],1)],1)]),_c('el-dialog',{attrs:{\"title\":\"添加食材\",\"visible\":_vm.addIngredientDialogVisible,\"width\":\"40%\",\"center\":true},on:{\"update:visible\":function($event){_vm.addIngredientDialogVisible=$event},\"close\":_vm.addIngredientDialogClosed}},[_c('el-form',{ref:\"addIngredientFormRef\",attrs:{\"model\":_vm.addIngredientForm,\"label-width\":\"80px\",\"size\":\"small\",\"rules\":_vm.addIngredientFormRules}},[_c('el-form-item',{attrs:{\"label\":\"食材名称\",\"prop\":\"ingreName\"}},[_c('el-input',{attrs:{\"prefix-icon\":\"el-icon-watermelon\",\"autocomplete\":\"off\",\"maxlength\":\"50\",\"clearable\":true},model:{value:(_vm.addIngredientForm.ingreName),callback:function ($$v) {_vm.$set(_vm.addIngredientForm, \"ingreName\", $$v)},expression:\"addIngredientForm.ingreName\"}})],1),_c('el-form-item',{attrs:{\"label\":\"食材产地\",\"prop\":\"ingreAdd\"}},[_c('el-cascader',{staticStyle:{\"width\":\"100%\"},attrs:{\"options\":_vm.citys,\"filterable\":\"\",\"clearable\":\"\",\"props\":{ expandTrigger: 'hover' }},model:{value:(_vm.addIngredientForm.ingreAdd),callback:function ($$v) {_vm.$set(_vm.addIngredientForm, \"ingreAdd\", $$v)},expression:\"addIngredientForm.ingreAdd\"}})],1),_c('el-form-item',{attrs:{\"label\":\"食材属性\",\"prop\":\"ingreAttr\"}},[_c('el-select',{attrs:{\"filterable\":\"\",\"clearable\":\"\",\"placeholder\":\"请选择食材属性\"},model:{value:(_vm.addIngredientForm.ingreAttr),callback:function ($$v) {_vm.$set(_vm.addIngredientForm, \"ingreAttr\", $$v)},expression:\"addIngredientForm.ingreAttr\"}},_vm._l((_vm.ingreAttrs),function(item){return _c('el-option',{key:item.value,attrs:{\"label\":item.label,\"value\":item.value}})}),1)],1),_c('el-form-item',{attrs:{\"label\":\"食材图片\"}},[_c('el-upload',{ref:\"upload\",attrs:{\"action\":\"http://121.37.102.50:3006/ingredient/upload\",\"on-change\":_vm.uploadImg,\"on-success\":_vm.uploadImgSuccess,\"accept\":\".jpeg,.png,.jpg,.bmp,.gif\",\"list-type\":\"picture\",\"limit\":1,\"disabled\":_vm.uploadImgBtnVisible}},[_c('el-button',{directives:[{name:\"show\",rawName:\"v-show\",value:(!_vm.uploadImgBtnVisible),expression:\"!uploadImgBtnVisible\"}],attrs:{\"size\":\"small\",\"type\":\"primary\",\"plain\":\"\",\"round\":\"\"}},[_vm._v(\"选择图片\")])],1)],1),_c('el-form-item',{attrs:{\"label\":\"预估价格\",\"prop\":\"ingrePrice\"}},[_c('el-input',{attrs:{\"autocomplete\":\"off\",\"prefix-icon\":\"el-icon-coin\",\"clearable\":true,\"minlength\":\"1\",\"maxlength\":\"10\"},model:{value:(_vm.addIngredientForm.ingrePrice),callback:function ($$v) {_vm.$set(_vm.addIngredientForm, \"ingrePrice\", _vm._n($$v))},expression:\"addIngredientForm.ingrePrice\"}},[_c('i',{attrs:{\"slot\":\"suffix\"},slot:\"suffix\"},[_vm._v(\"元\")])])],1)],1),_c('div',{staticClass:\"dialog-footer\",attrs:{\"slot\":\"footer\"},slot:\"footer\"},[_c('el-button',{attrs:{\"round\":\"\",\"plain\":\"\",\"size\":\"small\",\"type\":\"info\"},on:{\"click\":function($event){_vm.addIngredientDialogVisible = false}}},[_vm._v(\"取 消\")]),_c('el-button',{attrs:{\"type\":\"primary\",\"round\":\"\",\"plain\":\"\",\"size\":\"small\"},on:{\"click\":_vm.addIngredient}},[_vm._v(\"确 定\")])],1)],1),_c('el-dialog',{attrs:{\"title\":\"更新食材信息\",\"visible\":_vm.updateIngredientDialogVisible,\"width\":\"40%\",\"center\":true},on:{\"update:visible\":function($event){_vm.updateIngredientDialogVisible=$event}}},[_c('el-form',{ref:\"updateIngredientFormRef\",attrs:{\"model\":_vm.updateIngredientForm,\"label-width\":\"80px\",\"size\":\"small\",\"rules\":_vm.addIngredientFormRules}},[_c('el-form-item',{attrs:{\"label\":\"食材名称\",\"prop\":\"ingreName\"}},[_c('el-input',{attrs:{\"prefix-icon\":\"el-icon-watermelon\",\"autocomplete\":\"off\",\"maxlength\":\"50\",\"clearable\":true},model:{value:(_vm.updateIngredientForm.ingreName),callback:function ($$v) {_vm.$set(_vm.updateIngredientForm, \"ingreName\", $$v)},expression:\"updateIngredientForm.ingreName\"}})],1),_c('el-form-item',{attrs:{\"label\":\"食材产地\",\"prop\":\"ingreAdd\"}},[_c('el-cascader',{staticStyle:{\"width\":\"100%\"},attrs:{\"options\":_vm.citys,\"filterable\":\"\",\"clearable\":\"\",\"props\":{ expandTrigger: 'hover' }},model:{value:(_vm.updateIngredientForm.ingreAdd),callback:function ($$v) {_vm.$set(_vm.updateIngredientForm, \"ingreAdd\", $$v)},expression:\"updateIngredientForm.ingreAdd\"}})],1),_c('el-form-item',{attrs:{\"label\":\"食材属性\",\"prop\":\"ingreAttr\"}},[_c('el-select',{attrs:{\"filterable\":\"\",\"clearable\":\"\",\"placeholder\":\"请选择食材属性\"},model:{value:(_vm.updateIngredientForm.ingreAttr),callback:function ($$v) {_vm.$set(_vm.updateIngredientForm, \"ingreAttr\", $$v)},expression:\"updateIngredientForm.ingreAttr\"}},_vm._l((_vm.ingreAttrs),function(item){return _c('el-option',{key:item.value,attrs:{\"label\":item.label,\"value\":item.value}})}),1)],1),_c('el-form-item',{attrs:{\"label\":\"食材图片\"}},[_c('el-upload',{ref:\"updateUpload\",attrs:{\"action\":\"http://121.37.102.50:3006/ingredient/upload\",\"on-change\":_vm.uploadImg,\"on-success\":_vm.updateImgSuccess,\"accept\":\".jpeg,.png,.jpg,.bmp,.gif\",\"list-type\":\"picture\",\"limit\":1,\"disabled\":_vm.uploadImgBtnVisible}},[_c('el-button',{directives:[{name:\"show\",rawName:\"v-show\",value:(!_vm.uploadImgBtnVisible),expression:\"!uploadImgBtnVisible\"}],attrs:{\"size\":\"small\",\"type\":\"primary\",\"plain\":\"\",\"round\":\"\"}},[_vm._v(\"选择图片\")])],1)],1),_c('el-form-item',{attrs:{\"label\":\"预估价格\",\"prop\":\"ingrePrice\"}},[_c('el-input',{attrs:{\"autocomplete\":\"off\",\"prefix-icon\":\"el-icon-coin\",\"clearable\":true,\"minlength\":\"1\",\"maxlength\":\"10\"},model:{value:(_vm.updateIngredientForm.ingrePrice),callback:function ($$v) {_vm.$set(_vm.updateIngredientForm, \"ingrePrice\", _vm._n($$v))},expression:\"updateIngredientForm.ingrePrice\"}},[_c('i',{attrs:{\"slot\":\"suffix\"},slot:\"suffix\"},[_vm._v(\"元\")])])],1)],1),_c('div',{staticClass:\"dialog-footer\",attrs:{\"slot\":\"footer\"},slot:\"footer\"},[_c('el-button',{attrs:{\"round\":\"\",\"plain\":\"\",\"size\":\"small\",\"type\":\"info\"},on:{\"click\":function($event){_vm.updateIngredientDialogVisible = false}}},[_vm._v(\"取 消\")]),_c('el-button',{attrs:{\"type\":\"primary\",\"round\":\"\",\"plain\":\"\",\"size\":\"small\"},on:{\"click\":_vm.updateIngredient}},[_vm._v(\"确 定\")])],1)],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","<template>\r\n <el-card>\r\n <div class=\"ingredient\">\r\n <div class=\"title\">\r\n <el-alert title=\"食材管理界面\" type=\"success\" center :closable=\"false\">\r\n </el-alert>\r\n </div>\r\n <div class=\"btn\">\r\n <el-button\r\n type=\"primary\"\r\n size=\"small\"\r\n round\r\n icon=\"el-icon-plus\"\r\n @click=\"addIngredientDialogVisible = true\"\r\n >添加新食材</el-button\r\n >\r\n </div>\r\n <div class=\"table\">\r\n <el-table\r\n :data=\"\r\n ingredient.filter(\r\n (data) =>\r\n !ingredientSearch ||\r\n data.ingreName\r\n .toLowerCase()\r\n .includes(ingredientSearch.toLowerCase())\r\n )\r\n \"\r\n style=\"width: 100%\"\r\n fit\r\n lazy\r\n :stripe=\"true\"\r\n :border=\"true\"\r\n :highlight-current-row=\"true\"\r\n empty-text=\"🥶正在努力加载中...\"\r\n >\r\n <el-table-column label=\"食材名称\" align=\"center\">\r\n <template slot-scope=\"scope\">\r\n {{ scope.row.ingreName || \"未知\" }}\r\n </template>\r\n </el-table-column>\r\n\r\n <el-table-column label=\"图片\" align=\"center\">\r\n <template slot-scope=\"scope\">\r\n <el-image\r\n style=\"width: 100px; height: 100px\"\r\n :src=\"scope.row.ingrePut\"\r\n :preview-src-list=\"ingredientImgs\"\r\n >\r\n <div slot=\"error\" class=\"image-slot\">\r\n <i class=\"el-icon-picture-outline\"></i>\r\n </div>\r\n </el-image>\r\n </template>\r\n </el-table-column>\r\n\r\n <el-table-column label=\"产地\" align=\"center\">\r\n <template slot-scope=\"scope\">\r\n {{ scope.row.ingreAdd || \"未知\" }}\r\n </template>\r\n </el-table-column>\r\n\r\n <el-table-column label=\"属性\" align=\"center\">\r\n <template slot-scope=\"scope\">\r\n {{ scope.row.ingreAttr || \"未知\" }}\r\n </template>\r\n </el-table-column>\r\n\r\n <el-table-column label=\"价格\" align=\"center\">\r\n <template slot-scope=\"scope\">\r\n {{ scope.row.ingrePrice || \"0\" }} 元\r\n </template>\r\n </el-table-column>\r\n\r\n <el-table-column align=\"center\">\r\n <template slot=\"header\" slot-scope=\"scope\">\r\n <el-input\r\n v-model=\"ingredientSearch\"\r\n size=\"mini\"\r\n placeholder=\"输入食材名称搜索\"\r\n />\r\n </template>\r\n <template slot-scope=\"scope\">\r\n <el-button\r\n type=\"primary\"\r\n size=\"mini\"\r\n plain\r\n @click=\"showUpdateIngredient(scope.row.ingreId)\"\r\n >编辑</el-button\r\n >\r\n <el-popconfirm\r\n title=\"确定删除该食材?此操作不可逆\"\r\n style=\"margin-left: 5px\"\r\n @confirm=\"deleteIngredient(scope.row.ingreId)\"\r\n >\r\n <el-button slot=\"reference\" type=\"danger\" size=\"mini\" plain\r\n >删除</el-button\r\n >\r\n </el-popconfirm>\r\n </template>\r\n </el-table-column>\r\n </el-table>\r\n </div>\r\n </div>\r\n\r\n <!-- 添加食材的dialog -->\r\n <el-dialog\r\n title=\"添加食材\"\r\n :visible.sync=\"addIngredientDialogVisible\"\r\n width=\"40%\"\r\n :center=\"true\"\r\n @close=\"addIngredientDialogClosed\"\r\n >\r\n <el-form\r\n :model=\"addIngredientForm\"\r\n label-width=\"80px\"\r\n size=\"small\"\r\n ref=\"addIngredientFormRef\"\r\n :rules=\"addIngredientFormRules\"\r\n >\r\n <el-form-item label=\"食材名称\" prop=\"ingreName\">\r\n <el-input\r\n prefix-icon=\"el-icon-watermelon\"\r\n v-model=\"addIngredientForm.ingreName\"\r\n autocomplete=\"off\"\r\n maxlength=\"50\"\r\n :clearable=\"true\"\r\n ></el-input>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"食材产地\" prop=\"ingreAdd\">\r\n <el-cascader\r\n style=\"width: 100%\"\r\n v-model=\"addIngredientForm.ingreAdd\"\r\n :options=\"citys\"\r\n filterable\r\n clearable\r\n :props=\"{ expandTrigger: 'hover' }\"\r\n ></el-cascader>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"食材属性\" prop=\"ingreAttr\">\r\n <el-select\r\n v-model=\"addIngredientForm.ingreAttr\"\r\n filterable\r\n clearable\r\n placeholder=\"请选择食材属性\"\r\n >\r\n <el-option\r\n v-for=\"item in ingreAttrs\"\r\n :key=\"item.value\"\r\n :label=\"item.label\"\r\n :value=\"item.value\"\r\n >\r\n </el-option>\r\n </el-select>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"食材图片\">\r\n <el-upload\r\n action=\"http://121.37.102.50:3006/ingredient/upload\"\r\n ref=\"upload\"\r\n :on-change=\"uploadImg\"\r\n :on-success=\"uploadImgSuccess\"\r\n accept=\".jpeg,.png,.jpg,.bmp,.gif\"\r\n list-type=\"picture\"\r\n :limit=\"1\"\r\n :disabled=\"uploadImgBtnVisible\"\r\n >\r\n <el-button\r\n v-show=\"!uploadImgBtnVisible\"\r\n size=\"small\"\r\n type=\"primary\"\r\n plain\r\n round\r\n >选择图片</el-button\r\n >\r\n </el-upload>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"预估价格\" prop=\"ingrePrice\">\r\n <el-input\r\n v-model.number=\"addIngredientForm.ingrePrice\"\r\n autocomplete=\"off\"\r\n prefix-icon=\"el-icon-coin\"\r\n :clearable=\"true\"\r\n minlength=\"1\"\r\n maxlength=\"10\"\r\n >\r\n <i slot=\"suffix\">元</i>\r\n </el-input>\r\n </el-form-item>\r\n </el-form>\r\n <div slot=\"footer\" class=\"dialog-footer\">\r\n <el-button\r\n @click=\"addIngredientDialogVisible = false\"\r\n round\r\n plain\r\n size=\"small\"\r\n type=\"info\"\r\n >取 消</el-button\r\n >\r\n <el-button\r\n type=\"primary\"\r\n @click=\"addIngredient\"\r\n round\r\n plain\r\n size=\"small\"\r\n >确 定</el-button\r\n >\r\n </div>\r\n </el-dialog>\r\n\r\n <!-- 更新食材信息的dialog -->\r\n <el-dialog\r\n title=\"更新食材信息\"\r\n :visible.sync=\"updateIngredientDialogVisible\"\r\n width=\"40%\"\r\n :center=\"true\"\r\n >\r\n <el-form\r\n :model=\"updateIngredientForm\"\r\n label-width=\"80px\"\r\n size=\"small\"\r\n ref=\"updateIngredientFormRef\"\r\n :rules=\"addIngredientFormRules\"\r\n >\r\n <el-form-item label=\"食材名称\" prop=\"ingreName\">\r\n <el-input\r\n prefix-icon=\"el-icon-watermelon\"\r\n v-model=\"updateIngredientForm.ingreName\"\r\n autocomplete=\"off\"\r\n maxlength=\"50\"\r\n :clearable=\"true\"\r\n ></el-input>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"食材产地\" prop=\"ingreAdd\">\r\n <el-cascader\r\n style=\"width: 100%\"\r\n v-model=\"updateIngredientForm.ingreAdd\"\r\n :options=\"citys\"\r\n filterable\r\n clearable\r\n :props=\"{ expandTrigger: 'hover' }\"\r\n ></el-cascader>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"食材属性\" prop=\"ingreAttr\">\r\n <el-select\r\n v-model=\"updateIngredientForm.ingreAttr\"\r\n filterable\r\n clearable\r\n placeholder=\"请选择食材属性\"\r\n >\r\n <el-option\r\n v-for=\"item in ingreAttrs\"\r\n :key=\"item.value\"\r\n :label=\"item.label\"\r\n :value=\"item.value\"\r\n >\r\n </el-option>\r\n </el-select>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"食材图片\">\r\n <el-upload\r\n action=\"http://121.37.102.50:3006/ingredient/upload\"\r\n ref=\"updateUpload\"\r\n :on-change=\"uploadImg\"\r\n :on-success=\"updateImgSuccess\"\r\n accept=\".jpeg,.png,.jpg,.bmp,.gif\"\r\n list-type=\"picture\"\r\n :limit=\"1\"\r\n :disabled=\"uploadImgBtnVisible\"\r\n >\r\n <el-button\r\n v-show=\"!uploadImgBtnVisible\"\r\n size=\"small\"\r\n type=\"primary\"\r\n plain\r\n round\r\n >选择图片</el-button\r\n >\r\n </el-upload>\r\n </el-form-item>\r\n\r\n <el-form-item label=\"预估价格\" prop=\"ingrePrice\">\r\n <el-input\r\n v-model.number=\"updateIngredientForm.ingrePrice\"\r\n autocomplete=\"off\"\r\n prefix-icon=\"el-icon-coin\"\r\n :clearable=\"true\"\r\n minlength=\"1\"\r\n maxlength=\"10\"\r\n >\r\n <i slot=\"suffix\">元</i>\r\n </el-input>\r\n </el-form-item>\r\n </el-form>\r\n <div slot=\"footer\" class=\"dialog-footer\">\r\n <el-button\r\n @click=\"updateIngredientDialogVisible = false\"\r\n round\r\n plain\r\n size=\"small\"\r\n type=\"info\"\r\n >取 消</el-button\r\n >\r\n <el-button\r\n type=\"primary\"\r\n @click=\"updateIngredient\"\r\n round\r\n plain\r\n size=\"small\"\r\n >确 定</el-button\r\n >\r\n </div>\r\n </el-dialog>\r\n </el-card>\r\n</template>\r\n\r\n<script>\r\nimport citys from \"../js/citys\";\r\nexport default {\r\n name: \"Ingredient\",\r\n data() {\r\n return {\r\n ingredient: [],\r\n ingredientSearch: \"\",\r\n ingredientImgs: [],\r\n\r\n //添加新食材dialog对话框可见性\r\n addIngredientDialogVisible: false,\r\n //更新食材信息dialog可见性\r\n updateIngredientDialogVisible: false,\r\n //添加图片按钮的可见性\r\n uploadImgBtnVisible: false,\r\n\r\n //添加食材的表单对象\r\n addIngredientForm: {\r\n ingreName: \"\",\r\n ingreId: \"\",\r\n ingreAdd: \"\",\r\n ingreAttr: \"\",\r\n ingrePut: \"\",\r\n ingrePrice: \"\",\r\n },\r\n\r\n //更新食材的表单对象\r\n updateIngredientForm: {\r\n ingreName: \"\",\r\n ingreId: \"\",\r\n ingreAdd: \"\",\r\n ingreAttr: \"\",\r\n ingrePut: \"\",\r\n ingrePrice: \"\",\r\n },\r\n\r\n //添加食材的验证规则\r\n addIngredientFormRules: {\r\n ingreName: [\r\n { required: true, message: \"请输入食材名称\", trigger: \"blur\" },\r\n {\r\n min: 1,\r\n max: 50,\r\n message: \"长度在 1 到 50 个字符\",\r\n trigger: \"blur\",\r\n },\r\n ],\r\n ingreAdd: [\r\n { required: true, message: \"请输入食材产地\", trigger: \"blur\" },\r\n ],\r\n ingreAttr: [\r\n { required: true, message: \"请输入食材属性\", trigger: \"blur\" },\r\n {\r\n min: 1,\r\n max: 50,\r\n message: \"长度在 1 到 50 个字符\",\r\n trigger: \"blur\",\r\n },\r\n ],\r\n ingrePrice: [\r\n { required: true, message: \"请输入食材价格\", trigger: \"blur\" },\r\n {\r\n min: 1,\r\n max: 1000,\r\n type: \"number\",\r\n message: \"价格低于1000元\",\r\n trigger: \"blur\",\r\n },\r\n ],\r\n },\r\n\r\n //可选城市\r\n citys,\r\n //食材属性\r\n ingreAttrs: [\r\n {\r\n value: \"热性\",\r\n label: \"热性\",\r\n },\r\n {\r\n value: \"温性\",\r\n label: \"温性\",\r\n },\r\n {\r\n value: \"平性\",\r\n label: \"平性\",\r\n },\r\n {\r\n value: \"凉性\",\r\n label: \"凉性\",\r\n },\r\n {\r\n value: \"寒性\",\r\n label: \"寒性\",\r\n },\r\n ],\r\n };\r\n },\r\n methods: {\r\n //获取所有食材\r\n async getIngredient() {\r\n const { data: ingredientRes } = await this.$http.get(\"ingredient\");\r\n this.ingredient = ingredientRes;\r\n ingredientRes.forEach((item) => {\r\n this.ingredientImgs.push(item.ingrePut);\r\n });\r\n },\r\n\r\n //添加食材dialog对话框关闭回调\r\n addIngredientDialogClosed() {\r\n this.$refs.addIngredientFormRef.resetFields();\r\n this.addIngredientForm.ingrePut = \"\";\r\n this.uploadImgBtnVisible = false;\r\n },\r\n\r\n //添加新食材方法\r\n addIngredient() {\r\n //表单验证开始\r\n this.$refs.addIngredientFormRef.validate(async (valid) => {\r\n //表单验证失败\r\n if (!valid) {\r\n this.$message.error(\"添加新食材验证失败\");\r\n return;\r\n }\r\n this.addIngredientForm.ingreId = this.guid().slice(1, 10);\r\n this.addIngredientForm.ingreAdd = this.getLocationTransform(\r\n this.addIngredientForm.ingreAdd\r\n );\r\n const { data: addIngredientRes } = await this.$http.post(\r\n \"ingredient\",\r\n this.addIngredientForm\r\n );\r\n if (addIngredientRes.status !== 1) {\r\n this.$message.error(\"添加新食材失败\");\r\n return;\r\n }\r\n this.getIngredient();\r\n this.$message.success(\"添加新食材成功!\");\r\n });\r\n this.addIngredientDialogVisible = false;\r\n this.uploadImgBtnVisible = false;\r\n this.$refs.upload.uploadFiles = [];\r\n },\r\n\r\n //删除食材的方法\r\n async deleteIngredient(ingreId) {\r\n const { data: deleteIngredientRes } = await this.$http.delete(\r\n \"ingredient/\" + ingreId\r\n );\r\n if (deleteIngredientRes.status !== 1) {\r\n this.$message.error(\"删除食材失败\");\r\n return;\r\n }\r\n this.getIngredient();\r\n this.$message.success(\"删除食材成功\");\r\n },\r\n\r\n //点击编辑按钮\r\n async showUpdateIngredient(ingreId) {\r\n const { data: ingredientRes } = await this.$http.get(\r\n \"ingredient/\" + ingreId\r\n );\r\n this.updateIngredientForm = ingredientRes[0];\r\n this.updateIngredientDialogVisible = true;\r\n },\r\n\r\n //更新食材信息的方法\r\n async updateIngredient() {\r\n //表单验证开始\r\n this.$refs.updateIngredientFormRef.validate(async (valid) => {\r\n //表单验证失败\r\n if (!valid) {\r\n this.$message.error(\"更新食材信息验证失败\");\r\n return;\r\n }\r\n this.updateIngredientForm.ingreAdd = this.getLocationTransform(\r\n this.updateIngredientForm.ingreAdd\r\n );\r\n //表单验证通过\r\n //发起请求\r\n await this.$http.put(\"ingredient\", this.updateIngredientForm);\r\n this.getIngredient();\r\n this.$message.success(\"更新食材信息成功\");\r\n });\r\n this.updateIngredientDialogVisible = false;\r\n this.$refs.updateUpload.uploadFiles = [];\r\n this.uploadImgBtnVisible = false;\r\n },\r\n\r\n //上传图片前验证方法\r\n uploadImg(file, fileList) {\r\n if (file.status === \"ready\") {\r\n //文件类型,只能上传图片\r\n const isIMAGE = file.raw.type === \"jpeg\" || \"png\" || \"jpg\";\r\n //文件大小小于2M\r\n const isLt1M = file.size / 1024 / 1024 < 2;\r\n if (!isIMAGE) {\r\n this.$message.warning(\"上传文件只能是图片格式!\");\r\n fileList.pop();\r\n return;\r\n }\r\n if (!isLt1M) {\r\n this.$message.warning(\"上传文件大小不能超过 2MB!\");\r\n fileList.pop();\r\n return;\r\n }\r\n this.uploadImgBtnVisible = true;\r\n }\r\n },\r\n\r\n //添加食材图片上传成功的回调\r\n uploadImgSuccess(response, file, fileList) {\r\n //将图片路径存储至对象中\r\n this.addIngredientForm.ingrePut = response.data;\r\n this.$message.success(\"图片上传成功,请填写完成后点击确定按钮\");\r\n },\r\n\r\n //更新食材图片上传成功的回调\r\n updateImgSuccess(response, file, fileList) {\r\n //将图片路径存储至对象中\r\n this.updateIngredientForm.ingrePut = response.data;\r\n this.$message.success(\"图片上传成功,请填写完成后点击确定按钮\");\r\n },\r\n\r\n //获取唯一id的方法\r\n guid() {\r\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(\r\n /[xy]/g,\r\n function (c) {\r\n var r = (Math.random() * 16) | 0,\r\n v = c == \"x\" ? r : (r & 0x3) | 0x8;\r\n return v.toString(16);\r\n }\r\n );\r\n },\r\n\r\n //将用户的城市编号转化为中文显示\r\n getLocationTransform(cityArr) {\r\n //将所需要的城市编码信息列出来\r\n const location = cityArr;\r\n const locationProvince = location[0];\r\n const locationCity = location[1];\r\n const locationArea = location[2];\r\n //创建数组保存查询到的数组,减少查询次数\r\n var provinceArr = [];\r\n var cityArr = [];\r\n //最后用于存放城市中文字符的字符串\r\n var tansformLocation = \"\";\r\n //第一次得到省和市级数组\r\n this.citys.forEach((item) => {\r\n if (item.value === locationProvince) {\r\n tansformLocation = tansformLocation + item.label;\r\n provinceArr = item.children;\r\n }\r\n });\r\n //第二次得到市和区域级数组\r\n provinceArr.forEach((item) => {\r\n if (item.value === locationCity) {\r\n tansformLocation = tansformLocation + \"/\" + item.label;\r\n cityArr = item.children;\r\n }\r\n });\r\n //第三次得到完整省市区字符串\r\n cityArr.forEach((item) => {\r\n if (item.value === locationArea) {\r\n tansformLocation = tansformLocation + \"/\" + item.label;\r\n }\r\n });\r\n //返回该字符串\r\n return tansformLocation;\r\n },\r\n },\r\n created() {\r\n this.getIngredient();\r\n },\r\n};\r\n</script>\r\n","import mod from \"-!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40[0].rules[0].use[1]!../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./Ingredient.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js??clonedRuleSet-40[0].rules[0].use[1]!../../node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./Ingredient.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Ingredient.vue?vue&type=template&id=6d1117a3&\"\nimport script from \"./Ingredient.vue?vue&type=script&lang=js&\"\nexport * from \"./Ingredient.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/@vue/vue-loader-v15/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","on","$event","addIngredientDialogVisible","_v","staticStyle","ingredient","filter","data","ingredientSearch","ingreName","toLowerCase","includes","scopedSlots","_u","key","fn","scope","_s","row","ingrePut","ingredientImgs","slot","ingreAdd","ingreAttr","ingrePrice","model","value","callback","$$v","expression","showUpdateIngredient","ingreId","deleteIngredient","addIngredientDialogClosed","ref","addIngredientForm","addIngredientFormRules","$set","citys","expandTrigger","_l","item","label","uploadImg","uploadImgSuccess","uploadImgBtnVisible","directives","name","rawName","_n","addIngredient","updateIngredientDialogVisible","updateIngredientForm","updateImgSuccess","updateIngredient","staticRenderFns","required","message","trigger","min","max","type","ingreAttrs","methods","getIngredient","ingredientRes","valid","addIngredientRes","deleteIngredientRes","file","fileList","response","guid","v","getLocationTransform","cityArr","tansformLocation","provinceArr","created","component"],"sourceRoot":""}