other.vue 16 KB

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