1 line
20 KiB
JSON
1 line
20 KiB
JSON
{"remainingRequest":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js!E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!E:\\hz-zhhq-web\\src\\views\\weekfood\\menu\\addMenu\\index.vue?vue&type=script&lang=js","dependencies":[{"path":"E:\\hz-zhhq-web\\src\\views\\weekfood\\menu\\addMenu\\index.vue","mtime":1737610069453},{"path":"E:\\hz-zhhq-web\\babel.config.js","mtime":1737610069371},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1740463332762},{"path":"E:\\hz-zhhq-web\\node_modules\\babel-loader\\lib\\index.js","mtime":1740463332584},{"path":"E:\\hz-zhhq-web\\node_modules\\cache-loader\\dist\\cjs.js","mtime":1740463332762},{"path":"E:\\hz-zhhq-web\\node_modules\\vue-loader\\lib\\index.js","mtime":1740463340941}],"contextDependencies":[],"result":["\"use strict\";\n\nvar _interopRequireDefault = require(\"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _toConsumableArray2 = _interopRequireDefault(require(\"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/toConsumableArray.js\"));\nrequire(\"core-js/modules/es6.string.iterator\");\nrequire(\"core-js/modules/es6.map\");\nrequire(\"core-js/modules/es6.array.find\");\nvar _slicedToArray2 = _interopRequireDefault(require(\"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/slicedToArray.js\"));\nvar _createForOfIteratorHelper2 = _interopRequireDefault(require(\"E:/hz-zhhq-web/node_modules/@babel/runtime/helpers/createForOfIteratorHelper.js\"));\nrequire(\"core-js/modules/es7.array.includes\");\nrequire(\"core-js/modules/es6.string.includes\");\nrequire(\"core-js/modules/web.dom.iterable\");\nvar _paging = _interopRequireDefault(require(\"@/views/Public/paging.vue\"));\nvar _getdata = require(\"@/api/getdata\");\nvar _popup = _interopRequireDefault(require(\"@/views/estate/examine/dialog/popup.vue\"));\nvar _crypto = require(\"crypto\");\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nvar _default = exports.default = {\n components: {\n Paging: _paging.default,\n Popup: _popup.default\n },\n data: function data() {\n return {\n loadingMsg: \"\",\n loading: false,\n //初始化loading\n formInline: {\n foodName: \"\"\n },\n page: {\n limit: 0 /** 当前点击*/,\n sizePage: 10 /** 当前多少页*/,\n total: 0 /**总数 */\n },\n tableData: [],\n UID: 'FOOD_ID',\n selectedList: [],\n choosenType: '',\n //早中晚\n choosenFoodList: [],\n choosedFoodList: [],\n moringFoodList: [],\n noonFoodList: [],\n eveningFoodList: [],\n year: '',\n week: '',\n submitData: {\n one: {},\n two: {},\n three: {},\n four: {},\n five: {}\n },\n dayNum: 1,\n stepStatus: false,\n indexCall: this.$route.query.index ? this.$route.query.index : window.localStorage.getItem(\"foodIndex\"),\n validation: false,\n completeTitle: \"\",\n nav: \"\",\n til: \"添加\",\n id: \"\",\n foodDialog: false\n };\n },\n computed: {\n buttonClassName: function buttonClassName() {\n if (!this.stepStatus) {\n return 'footButton unshow';\n } else {\n return 'footButton';\n }\n }\n },\n created: function created() {},\n directives: {\n debounce: {\n inserted: function inserted(el, binding) {\n var timer;\n el.addEventListener('click', function () {\n if (timer) {\n clearTimeout(timer);\n }\n timer = setTimeout(function () {\n binding.value();\n }, 300);\n });\n }\n }\n },\n mounted: function mounted() {\n var data = typeof this.$route.query.rowdata == \"string\" ? JSON.parse(window.localStorage.getItem(\"foodRowdata\")) : this.$route.query.rowdata;\n this.year = this.$route.query.year;\n this.week = this.$route.query.week;\n // console.log(data);\n if (data) {\n this.submitData.one = data[0];\n this.submitData.two = data[1];\n this.submitData.three = data[2];\n this.submitData.four = data[3];\n this.submitData.five = data[4];\n //进页面反显第一天的数据1\n this.moringFoodList = this.submitData.one.morning;\n this.noonFoodList = this.submitData.one.noon;\n this.eveningFoodList = this.submitData.one.evening;\n }\n console.log(this.submitData, \"submitData\");\n },\n methods: {\n //选择菜品\n choosenFood: function choosenFood(type) {\n this.choosenType = type;\n this.foodDialog = true;\n this.choosenFoodList = [];\n this.choosedFoodList = [];\n if (this.choosenType == '1') {\n this.choosenFoodList = this.moringFoodList;\n }\n if (this.choosenType == '2') {\n this.choosenFoodList = this.noonFoodList;\n }\n if (this.choosenType == '3') {\n this.choosenFoodList = this.eveningFoodList;\n }\n // console.log(this.choosenFoodList,\"this.choosenFoodList\")\n // console.log(this.choosedFoodList,\"this.choosedFoodList\")\n this.page.limit = 1;\n this.getlist();\n },\n // 更新勾选标记\n updateMark: function updateMark() {\n var _this = this;\n this.choosedFoodList = this.reduceList(this.choosedFoodList.concat(this.choosenFoodList));\n //编辑已生成的菜单返回的数据ID不是菜品ID而是菜谱ID\n //使用FOOD_ID再判断一次\n var selectedMarkList = this.choosedFoodList.map(function (item) {\n return item[\"FOOD_ID\"];\n });\n var selectedMarkList2 = this.choosedFoodList.map(function (item) {\n return item[\"ID\"];\n });\n this.tableData.forEach(function (row) {\n if (selectedMarkList.includes(row[\"ID\"] + '')) {\n _this.$nextTick(function () {\n _this.$refs.multipleTable.toggleRowSelection(row);\n });\n } else if (selectedMarkList2.includes(row[\"ID\"])) {\n _this.$nextTick(function () {\n _this.$refs.multipleTable.toggleRowSelection(row);\n });\n }\n });\n },\n // 单行前的勾选状态切换\n selectChange: function selectChange(selectedRows, row) {\n // console.log(this.choosedFoodList,\"this.choosedFoodList\")\n // this.choosedFoodList = this.reduceList(this.choosedFoodList.concat(this.choosenFoodList))\n // true为选中, 0或false为取消选中\n var selected = selectedRows.length && selectedRows.indexOf(row) !== -1;\n // console.log(selected,\"selected\")\n if (selected) {\n this.addItem(row);\n } else {\n this.removeItem(row);\n }\n },\n // 全选/取消全选\n selectAllChange: function selectAllChange(selectedRows) {\n var _this2 = this;\n // console.log(this.choosenFoodList,\"this.choosenFoodList\")\n // console.log(this.choosedFoodList,\"this.choosedFoodList\")\n this.choosedFoodList = this.reduceList(this.choosedFoodList.concat(this.choosenFoodList));\n // console.log(this.choosedFoodList,\"this.choosedFoodList\")\n var selectedMarkList = this.choosedFoodList.map(function (item) {\n return item[_this2.UID];\n });\n // console.log(selectedMarkList,\"selectedMarkList\")\n // 当前页选中行的标记列表\n var pageSelectedMarkList = Array.isArray(selectedRows) ? selectedRows.map(function (item) {\n return item[_this2.UID];\n }) : [];\n // console.log(pageSelectedMarkList,\"pageSelectedMarkList\")\n // console.log(this.tableData,\"this.tableData\")\n this.tableData.forEach(function (row) {\n if (pageSelectedMarkList.includes(row[_this2.UID])) {\n // console.log(selectedMarkList.includes(row[this.UID]+''))\n // console.log(row[this.UID]+'')\n if (!selectedMarkList.includes(row[_this2.UID])) {\n _this2.addItem(row);\n }\n } else if (selectedMarkList.includes(row[_this2.UID] + '')) {\n _this2.removeItem(row);\n } else {\n _this2.removeItem(row);\n }\n });\n },\n // 新增选中项\n addItem: function addItem(item) {\n this.choosedFoodList.push(item);\n },\n // 移除选中项\n removeItem: function removeItem(item) {\n // console.log(this.choosenFoodList,\"this.choosenFoodList\")\n // console.log(this.choosedFoodList,\"this.choosedFoodList\")\n // this.choosedFoodList = this.reduceList(this.choosedFoodList.concat(this.choosenFoodList))\n var _iterator = (0, _createForOfIteratorHelper2.default)(this.choosedFoodList.entries()),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var _step$value = (0, _slicedToArray2.default)(_step.value, 2),\n index = _step$value[0],\n itemTemp = _step$value[1];\n if (itemTemp[\"FOOD_ID\"] == item[\"FOOD_ID\"]) {\n console.log(\"del\");\n this.removeItemByIndex(index);\n break;\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n },\n // 根据下标移除选中项\n removeItemByIndex: function removeItemByIndex(index, item) {\n var _this3 = this;\n this.choosedFoodList.splice(index, 1);\n // 若有item,则是点击标签上的关闭按钮,移除选中项\n if (item) {\n this.$nextTick(function () {\n _this3.$refs.multipleTable.toggleRowSelection(\n // 此处必须在 tableData 中查找对应的数据,否则 toggleRowSelection 会失效\n _this3.tableData.find(function (row) {\n return row[_this3.UID] === item[_this3.UID];\n }), false);\n });\n }\n },\n reduceList: function reduceList(arr) {\n var map = new Map();\n var _iterator2 = (0, _createForOfIteratorHelper2.default)(arr),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var item = _step2.value;\n map.set(item.FOOD_NAME, item);\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n arr = (0, _toConsumableArray2.default)(map.values());\n // console.log(arr)\n return arr;\n },\n //确定选择菜品\n submitForm: function submitForm() {\n var _this4 = this;\n // console.log(\"submitForm\")\n // console.log(this.choosedFoodList,\"this.choosedFoodList\")\n // console.log(this.reduceList(this.choosedFoodList))\n this.choosedFoodList = this.reduceList(this.choosedFoodList);\n if (this.choosenType == '1') {\n this.moringFoodList = this.choosedFoodList;\n }\n if (this.choosenType == '2') {\n this.noonFoodList = this.choosedFoodList;\n }\n if (this.choosenType == '3') {\n this.eveningFoodList = this.choosedFoodList;\n }\n setTimeout(function () {\n _this4.foodDialog = false;\n }, 1000);\n },\n delMoringFood: function delMoringFood(index) {\n this.moringFoodList.splice(index, 1);\n },\n delNoonFood: function delNoonFood(index) {\n this.noonFoodList.splice(index, 1);\n },\n delEveningFood: function delEveningFood(index) {\n this.eveningFoodList.splice(index, 1);\n },\n //关闭弹窗\n cancal: function cancal() {\n console.log(\"close\");\n this.choosenFoodList = [];\n this.choosedFoodList = [];\n this.foodDialog = false;\n },\n //查询菜品\n searchFood: function searchFood() {\n this.page.limit = 1;\n this.getlist();\n },\n //上一步\n upStep: function upStep() {\n if (this.dayNum == 5) {\n this.submitData.five = {\n morning: this.moringFoodList,\n noon: this.noonFoodList,\n evening: this.eveningFoodList\n };\n }\n //先天数减少\n this.dayNum = this.dayNum - 1;\n //先清空选择数据\n this.moringFoodList = [];\n this.noonFoodList = [];\n this.eveningFoodList = [];\n if (this.dayNum == 1) {\n this.stepStatus = false;\n //反显总对象上一天的数据\n this.moringFoodList = this.submitData.one.morning;\n this.noonFoodList = this.submitData.one.noon;\n this.eveningFoodList = this.submitData.one.evening;\n }\n if (this.dayNum == 2) {\n //反显总对象上一天的数据\n this.moringFoodList = this.submitData.two.morning;\n this.noonFoodList = this.submitData.two.noon;\n this.eveningFoodList = this.submitData.two.evening;\n }\n if (this.dayNum == 3) {\n //反显总对象上一天的数据\n this.moringFoodList = this.submitData.three.morning;\n this.noonFoodList = this.submitData.three.noon;\n this.eveningFoodList = this.submitData.three.evening;\n }\n if (this.dayNum == 4) {\n //反显总对象上一天的数据\n this.moringFoodList = this.submitData.four.morning;\n this.noonFoodList = this.submitData.four.noon;\n this.eveningFoodList = this.submitData.four.evening;\n }\n // if(this.dayNum == 5){\n // //反显总对象上一天的数据\n // this.moringFoodList=this.submitData.four.morning;\n // this.noonFoodList=this.submitData.four.noon;\n // this.eveningFoodList=this.submitData.four.evening;\n // }\n },\n //下一步\n nextStep: function nextStep() {\n //判断非空\n if (this.moringFoodList.length == 0 || this.noonFoodList.length == 0 || this.eveningFoodList.length == 0) {\n this.$message({\n message: \"请填写完整信息!\",\n type: \"warning\"\n });\n return false;\n } else {\n // console.log(this.submitData,'nextstep')\n if (this.dayNum == 1) {\n //点击下一天-将当前已选数据赋值给总对象submitData\n this.submitData.one = {\n morning: this.moringFoodList,\n noon: this.noonFoodList,\n evening: this.eveningFoodList\n };\n // 先清空页面选择数组\n this.moringFoodList = [];\n this.noonFoodList = [];\n this.eveningFoodList = [];\n //点击下一天-反显下一天的数据2\n this.moringFoodList = this.submitData.two.morning;\n this.noonFoodList = this.submitData.two.noon;\n this.eveningFoodList = this.submitData.two.evening;\n }\n if (this.dayNum == 2) {\n //点击下一天-将当前已选数据赋值给总对象submitData\n this.submitData.two = {\n morning: this.moringFoodList,\n noon: this.noonFoodList,\n evening: this.eveningFoodList\n };\n // 先清空页面选择数组\n this.moringFoodList = [];\n this.noonFoodList = [];\n this.eveningFoodList = [];\n //点击下一天-反显下一天的数据3\n this.moringFoodList = this.submitData.three.morning;\n this.noonFoodList = this.submitData.three.noon;\n this.eveningFoodList = this.submitData.three.evening;\n }\n if (this.dayNum == 3) {\n //点击下一天-将当前已选数据赋值给总对象submitData\n this.submitData.three = {\n morning: this.moringFoodList,\n noon: this.noonFoodList,\n evening: this.eveningFoodList\n };\n // 先清空页面选择数组\n this.moringFoodList = [];\n this.noonFoodList = [];\n this.eveningFoodList = [];\n //点击下一天-反显下一天的数据4\n this.moringFoodList = this.submitData.four.morning;\n this.noonFoodList = this.submitData.four.noon;\n this.eveningFoodList = this.submitData.four.evening;\n }\n if (this.dayNum == 4) {\n //点击下一天-将当前已选数据赋值给总对象submitData\n this.submitData.four = {\n morning: this.moringFoodList,\n noon: this.noonFoodList,\n evening: this.eveningFoodList\n };\n // 先清空页面选择数组\n this.moringFoodList = [];\n this.noonFoodList = [];\n this.eveningFoodList = [];\n //点击下一天-反显下一天的数据5\n this.moringFoodList = this.submitData.five.morning;\n this.noonFoodList = this.submitData.five.noon;\n this.eveningFoodList = this.submitData.five.evening;\n }\n this.stepStatus = true;\n this.dayNum = this.dayNum + 1;\n }\n },\n //保存按钮\n saveMenu: function saveMenu() {\n var _this5 = this;\n if (this.moringFoodList.length == 0 || this.noonFoodList.length == 0 || this.eveningFoodList.length == 0) {\n this.$message({\n message: \"请填写完整信息!\",\n type: \"warning\"\n });\n return false;\n } else {\n if (this.dayNum == 5) {\n this.submitData.five = {\n morning: this.moringFoodList,\n noon: this.noonFoodList,\n evening: this.eveningFoodList\n };\n }\n this.stepStatus = true;\n }\n var Content = {\n year: this.year,\n weeks: this.week,\n one: this.submitData.one,\n two: this.submitData.two,\n three: this.submitData.three,\n four: this.submitData.four,\n five: this.submitData.five\n };\n // console.log(Content)\n (0, _getdata.addWeeKCookBook)(Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this5.comeBack();\n } else {\n _this5.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(\"error\");\n });\n },\n // 分页\n currentChanges: function currentChanges(val) {\n this.page.limit = val;\n this.getlist();\n },\n getlist: function getlist() {\n var _this6 = this;\n var aa = {\n foodName: this.formInline.foodName.trim()\n };\n var Content = {\n currentPage: this.page.limit == 0 ? 1 : this.page.limit,\n queryObj: aa\n };\n (0, _getdata.getWeekFoodList)(Content).then(function (res) {\n if (res.returnCode == \"1\") {\n _this6.tableData = res.returnData.data;\n _this6.page.total = res.returnData.total;\n _this6.page.limit = res.returnData.currentPage;\n _this6.tableData.id = res.returnData.data.id;\n _this6.updateMark();\n } else {\n _this6.$message({\n message: res.returnMsg,\n type: \"warning\"\n });\n }\n }).catch(function (err) {\n console.log(err);\n });\n },\n /**返回上一级 */comeBack: function comeBack() {\n this.$router.push({\n name: \"weekfood-menu-index\",\n params: {\n index: this.indexCall\n }\n });\n }\n }\n};",null]} |