other.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="app-container">
  3. <el-radio-group v-model="formType" size="small" @change="changeType">
  4. <el-radio-button label="first">订单日期设置</el-radio-button>
  5. <el-radio-button label="second">工程登录二次引用设置</el-radio-button>
  6. <el-radio-button label="third">自动预留单生成</el-radio-button>
  7. <el-radio-button label="fourth">库存显示规则设置</el-radio-button>
  8. <el-radio-button label="fifth">二次打印密码设置</el-radio-button>
  9. <el-radio-button label="sixth">机型类别</el-radio-button>
  10. <el-radio-button label="seventh">登录类型</el-radio-button>
  11. <el-radio-button label="eigth">权限分类</el-radio-button>
  12. </el-radio-group>
  13. <div v-show="formType === 'first'">
  14. <div style="margin: 40px 0 30px;">
  15. <span>下单时间超过当天</span>
  16. <el-time-picker v-model="firstForm.input1.dictValue" placeholder="选择时间点" size="small" format="HH:mm" style="width: 150px; margin: 0 10px;"></el-time-picker>
  17. <span>的订单,订单日期计为下一天的日期</span>
  18. </div>
  19. <el-button type="primary" size="small" @click="submitForm('first')">确 定</el-button>
  20. </div>
  21. <div v-show="formType === 'second'">
  22. <div style="margin: 40px 0 30px;">
  23. <div>工程登录二次引用密码设置</div>
  24. <div>
  25. <el-input v-model="secondForm.input1.dictValue" placeholder="请输入密码" size="small" style="width: 150px; margin-top: 20px;"></el-input>
  26. </div>
  27. </div>
  28. <el-button type="primary" size="small" @click="submitForm('second')">确 定</el-button>
  29. </div>
  30. <div v-show="formType === 'third'">
  31. <div style="margin: 40px 0 30px;">
  32. <div>预留单自动生成时间,从订单审单后,第</div>
  33. <el-input v-model="thirdForm.input1.dictValue" type="number" size="small" style="width: 150px; margin-top: 20px; margin-right: 10px"></el-input>
  34. <span>天零时起,按商家提交订单时间顺序,自动生成预留单</span>
  35. </div>
  36. <el-button type="primary" size="small" @click="submitForm('third')">确 定</el-button>
  37. </div>
  38. <div v-show="formType === 'fourth'">
  39. <div style="margin: 40px 0 30px;">
  40. <div>总可发货数 = 总库存数-总预留数-总发货申请暂扣</div>
  41. <div style="margin-top: 20px">订单查询库存时:</div>
  42. <div style="margin-top: 10px">总可发货数为0,显示无货</div>
  43. <div style="margin-top: 10px">
  44. <span>总可发货数</span>
  45. <el-input v-model="fourthForm.input1.dictValue" type="number" size="small" style="width: 100px; margin: 0 10px;"></el-input>
  46. <span>到</span>
  47. <el-input v-model="fourthForm.input2.dictValue" type="number" size="small" style="width: 100px; margin: 0 10px;"></el-input>
  48. <span>,总库存显示具体数量</span>
  49. </div>
  50. <div style="margin-top: 10px">
  51. <span>总可发货数</span>
  52. <el-input v-model="fourthForm.input3.dictValue" type="number" size="small" style="width: 100px; margin: 0 10px;"></el-input>
  53. <span>到</span>
  54. <el-input v-model="fourthForm.input4.dictValue" type="number" size="small" style="width: 100px; margin: 0 10px;"></el-input>
  55. <span>,总库存显示有货</span>
  56. </div>
  57. <div style="margin-top: 10px">
  58. <span>总可发货数大于</span>
  59. <el-input v-model="fourthForm.input5.dictValue" type="number" size="small" style="width: 100px; margin: 0 10px;"></el-input>
  60. <span>,总库存显示充足</span>
  61. </div>
  62. <div style="margin-top: 30px">发货申请查询库存时:</div>
  63. <div style="margin-top: 10px">
  64. <span>可发货数大于</span>
  65. <el-input v-model="fourthForm.input6.dictValue" type="number" size="small" style="width: 100px; margin: 0 10px;"></el-input>
  66. <span>显示充足</span>
  67. </div>
  68. </div>
  69. <el-button type="primary" size="small" @click="submitForm('fourth')">确 定</el-button>
  70. </div>
  71. <div v-show="formType === 'fifth'">
  72. <div style="margin: 40px 0 30px;">
  73. <div>二次打印密码设置</div>
  74. <div>
  75. <el-input v-model="fifthForm.input1.dictValue" placeholder="请输入密码" size="small" style="width: 150px; margin-top: 20px;"></el-input>
  76. </div>
  77. </div>
  78. <el-button type="primary" size="small" @click="submitForm('fifth')">确 定</el-button>
  79. </div>
  80. <div v-show="formType === 'sixth'">
  81. <div style="margin: 40px 0 30px;">
  82. <el-button type="primary" size="mini" @click="addShowFn">新增</el-button>
  83. <!-- 列表 -->
  84. <div class="mymain-container">
  85. <div class="table">
  86. <el-table v-loading="listLoading" :data="sixthForm" element-loading-text="Loading" border fit highlight-current-row stripe>
  87. <el-table-column align="left" label="名称" prop="dictCode" min-width="160" show-overflow-tooltip></el-table-column>
  88. <el-table-column align="left" label="备注" prop="remark" min-width="170" show-overflow-tooltip></el-table-column>
  89. <el-table-column align="center" label="操作" prop="" min-width="160" show-overflow-tooltip fixed="right">
  90. <template slot-scope="scope">
  91. <el-button type="text" class="textColor" @click="editFn(scope.row)">编辑</el-button>
  92. <el-popconfirm @onConfirm="deleFn(scope.row.sysDictId)" v-if="$checkBtnRole('del', $route.meta.roles)" title="这是一段内容确定删除吗?">
  93. <el-button type="text" class="textColor" slot="reference">删除</el-button>
  94. </el-popconfirm>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <div v-show="formType === 'seventh'">
  103. <div style="margin: 40px 0 30px;">
  104. <el-button type="primary" size="mini" @click="addShowFn">新增</el-button>
  105. <!-- 列表 -->
  106. <div class="mymain-container">
  107. <div class="table">
  108. <el-table v-loading="listLoading" :data="seventhForm" element-loading-text="Loading" border fit highlight-current-row stripe>
  109. <el-table-column align="left" label="名称" prop="dictCode" min-width="160" show-overflow-tooltip></el-table-column>
  110. <el-table-column align="left" label="备注" prop="remark" min-width="170" show-overflow-tooltip></el-table-column>
  111. <el-table-column align="center" label="操作" prop="" min-width="160" show-overflow-tooltip fixed="right">
  112. <template slot-scope="scope">
  113. <el-button type="text" class="textColor" @click="editFn(scope.row)">编辑</el-button>
  114. <el-popconfirm @onConfirm="deleFn(scope.row.sysDictId)" v-if="$checkBtnRole('del', $route.meta.roles)" title="这是一段内容确定删除吗?">
  115. <el-button type="text" class="textColor" slot="reference">删除</el-button>
  116. </el-popconfirm>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <div v-show="formType === 'eigth'">
  125. <div style="margin: 40px 0 30px;">
  126. <el-button type="primary" size="mini" @click="addShowFn">新增</el-button>
  127. <!-- 列表 -->
  128. <div class="mymain-container">
  129. <div class="table">
  130. <el-table v-loading="listLoading" :data="eigthForm" element-loading-text="Loading" border fit highlight-current-row stripe>
  131. <el-table-column align="left" label="名称" prop="dictCode" min-width="160" show-overflow-tooltip></el-table-column>
  132. <el-table-column align="left" label="备注" prop="remark" min-width="170" show-overflow-tooltip></el-table-column>
  133. <el-table-column align="center" label="操作" prop="" min-width="160" show-overflow-tooltip fixed="right">
  134. <template slot-scope="scope">
  135. <el-button type="text" class="textColor" @click="editFn(scope.row)">编辑</el-button>
  136. <el-popconfirm @onConfirm="deleFn(scope.row.sysDictId)" v-if="$checkBtnRole('del', $route.meta.roles)" title="这是一段内容确定删除吗?">
  137. <el-button type="text" class="textColor" slot="reference">删除</el-button>
  138. </el-popconfirm>
  139. </template>
  140. </el-table-column>
  141. </el-table>
  142. </div>
  143. </div>
  144. </div>
  145. </div>
  146. <!-- //弹窗 -->
  147. <el-dialog :title="title" :visible.sync="dialogForm" width="30%" :show-close="false" :close-on-click-modal="false">
  148. <el-form size="mini" ref="addForm" :rules="rules" :model="addForm" label-width="120px">
  149. <el-form-item label="名称" prop="dictCode">
  150. <el-input v-model="addForm.dictCode"></el-input>
  151. </el-form-item>
  152. <el-form-item label="备注" prop="remark">
  153. <el-input v-model="addForm.remark"></el-input>
  154. </el-form-item>
  155. </el-form>
  156. <div slot="footer" class="dialog-footer">
  157. <el-button size="mini" @click="cancelFn">取 消</el-button>
  158. <el-button size="mini" type="primary" @click="addDataFn">确 定</el-button>
  159. </div>
  160. </el-dialog>
  161. </div>
  162. </template>
  163. <script>
  164. import {
  165. getDictList,
  166. editDictList,
  167. addDictList,
  168. deleDictList,
  169. } from "@/api/common";
  170. export default {
  171. data() {
  172. return {
  173. listLoading: false, // 列表加载loading
  174. rules: {
  175. dictCode: [{ required: true, message: "请输入名称", trigger: "blur" }],
  176. },
  177. addForm: {
  178. dictCode: "",
  179. remark: "",
  180. },
  181. dialogForm: false,
  182. title: "新增",
  183. formType: "first",
  184. firstForm: {
  185. input1: {},
  186. },
  187. secondForm: {
  188. input1: {},
  189. },
  190. thirdForm: {
  191. input1: {},
  192. },
  193. fourthForm: {
  194. input1: {},
  195. input2: {},
  196. input3: {},
  197. input4: {},
  198. input5: {},
  199. input6: {},
  200. },
  201. fifthForm: {
  202. input1: {},
  203. },
  204. sixthForm: [],
  205. seventhForm: [],
  206. eigthForm: [],
  207. };
  208. },
  209. created() {
  210. this.getDetail("first");
  211. },
  212. methods: {
  213. //删除
  214. async deleFn(id) {
  215. await deleDictList({ id: id });
  216. this.$message.success("删除成功");
  217. this.getDetail(this.formType);
  218. },
  219. //编辑
  220. editFn(value) {
  221. this.$nextTick(() => {
  222. this.title = "编辑";
  223. this.addForm.dictCode = value.dictCode;
  224. this.addForm.remark = value.remark;
  225. this.addForm.sysDictId = value.sysDictId;
  226. this.addForm.dictType = value.dictType;
  227. });
  228. this.dialogForm = true;
  229. },
  230. //弹窗确定
  231. async addDataFn() {
  232. // console.log(this.addForm);
  233. await this.$refs.addForm.validate();
  234. if (this.addForm.sysDictId) {
  235. //编辑
  236. await editDictList([
  237. {
  238. ...this.addForm,
  239. },
  240. ]);
  241. this.$message.success("编辑成功");
  242. } else {
  243. let type = "";
  244. if (this.formType == "sixth") {
  245. type = "MACHINE_TYPE";
  246. } else if (this.formType == "seventh") {
  247. type = "SIGN_TYPE";
  248. } else {
  249. type = "POWER_CATEGORY";
  250. }
  251. await addDictList({
  252. ...this.addForm,
  253. dictValue: this.addForm.dictCode,
  254. dictType: type,
  255. });
  256. this.$message.success("新增成功");
  257. }
  258. this.getDetail(this.formType);
  259. this.addForm = {
  260. dictCode: "",
  261. remark: "",
  262. };
  263. this.dialogForm = false;
  264. },
  265. //cancelFn 弹窗取消
  266. async cancelFn() {
  267. await this.$refs.addForm.resetFields();
  268. this.addForm = {
  269. dictCode: "",
  270. remark: "",
  271. };
  272. this.dialogForm = false;
  273. // this.addForm.dictCode ='';
  274. },
  275. //展示新增弹窗
  276. addShowFn() {
  277. this.title = "新增";
  278. this.dialogForm = true;
  279. },
  280. // 查询按钮权限
  281. checkBtnRole(value) {
  282. // let btnRole = this.$route.meta.roles;
  283. // if(!btnRole) {return true}
  284. // let index = btnRole.indexOf(value);
  285. // return index >= 0 ? true : false;
  286. return true;
  287. },
  288. changeType(val) {
  289. this.getDetail(val);
  290. },
  291. getDetail(type) {
  292. const MAP = {
  293. first: "ORDER_TIME_LIMIT",
  294. second: "ENGIN_TWO_PWD",
  295. third: "RESERVED_DAY",
  296. fourth: "STOCK_ORDER",
  297. fifth: "PRINT_PASSWORD",
  298. sixth: "MACHINE_TYPE",
  299. seventh: "SIGN_TYPE",
  300. eigth: "POWER_CATEGORY",
  301. };
  302. getDictList({ sysDictEnum: MAP[type] }).then((res) => {
  303. let data = res.data.map((item) => {
  304. return {
  305. sysDictId: item.sysDictId,
  306. dictValue: item.dictValue,
  307. };
  308. });
  309. if (type != "fourth") {
  310. this[type + "Form"].input1 = data[0];
  311. } else {
  312. this[type + "Form"].input1 = data[0];
  313. this[type + "Form"].input2 = data[1];
  314. this[type + "Form"].input3 = data[2];
  315. this[type + "Form"].input4 = data[3];
  316. this[type + "Form"].input5 = data[4];
  317. this[type + "Form"].input6 = data[5];
  318. }
  319. if (type == "sixth") {
  320. this.sixthForm = res.data;
  321. }
  322. if (type == "seventh") {
  323. this.seventhForm = res.data;
  324. }
  325. if (type == "eigth") {
  326. this.eigthForm = res.data;
  327. }
  328. });
  329. },
  330. submitForm(type) {
  331. let list = [];
  332. for (var key in this[type + "Form"]) {
  333. console.log(this[type + "Form"], this[type + "Form"][key].dictValue);
  334. if (!this[type + "Form"][key].dictValue) {
  335. return this.$errorMsg("请完善信息");
  336. }
  337. list.push(this[type + "Form"][key]);
  338. }
  339. editDictList(list).then((res) => {
  340. this.$successMsg("保存成功");
  341. this.getDetail(type);
  342. });
  343. },
  344. },
  345. };
  346. </script>
  347. <style scoped lang="scss">
  348. .app-container {
  349. color: #333333;
  350. font-size: 14px;
  351. }
  352. </style>
  353. <style>
  354. .demo-table-expand {
  355. font-size: 0;
  356. }
  357. .demo-table-expand label {
  358. width: 80px;
  359. color: #99a9bf;
  360. }
  361. .demo-table-expand .el-form-item {
  362. margin-right: 0;
  363. margin-bottom: 0;
  364. width: 100%;
  365. }
  366. </style>