otherRules.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <template>
  2. <div class="m-container">
  3. <div class="m-core">
  4. <!-- <el-button size="mini" type="primary">添加规则</el-button> -->
  5. <el-form :inline="true" :model="form" ref="form">
  6. <el-alert
  7. style="margin: 20px 0"
  8. title="财务规则"
  9. :closable="false"
  10. type="info"
  11. >
  12. </el-alert>
  13. <el-row>
  14. <el-form-item
  15. prop="91"
  16. :rules="[
  17. {
  18. required: false,
  19. pattern:
  20. /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  21. message: '请输入正确的人数',
  22. },
  23. ]"
  24. >
  25. 基本课酬
  26. <el-input v-model="form['91']" size="mini" placeholder="请输入金额">
  27. <template slot="append">元</template>
  28. </el-input>
  29. </el-form-item>
  30. </el-row>
  31. <el-row>
  32. <el-form-item
  33. prop="73"
  34. :rules="[
  35. {
  36. required: false,
  37. pattern:
  38. /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
  39. message: '请输入正确的人数',
  40. },
  41. ]"
  42. >
  43. 全职资源公摊金额
  44. <el-input v-model="form['73']" size="mini" placeholder="请输入金额">
  45. <template slot="append">元</template>
  46. </el-input>
  47. </el-form-item>
  48. </el-row>
  49. <el-alert
  50. style="margin: 20px 0"
  51. title="学员练习参数"
  52. :closable="false"
  53. type="info"
  54. >
  55. </el-alert>
  56. <el-row>
  57. <el-form-item
  58. prop="106"
  59. :rules="[
  60. {
  61. required: false,
  62. pattern: /^[1-9][0-9]*$/,
  63. message: '请输入正确的分钟数',
  64. },
  65. ]"
  66. >
  67. 学员每周使用团练宝时长小于
  68. <el-input
  69. v-model="form['106']"
  70. size="mini"
  71. placeholder="请输入分钟数"
  72. >
  73. <template slot="append">分钟</template> </el-input
  74. >时需要回访
  75. </el-form-item>
  76. </el-row>
  77. <el-row>
  78. <el-form-item
  79. prop="107"
  80. :rules="[
  81. {
  82. required: false,
  83. pattern: /^[1-9][0-9]*$/,
  84. message: '请输入正确的次数',
  85. },
  86. ]"
  87. >
  88. 学员每周使用团练宝练习次数小于
  89. <el-input
  90. v-model="form['107']"
  91. size="mini"
  92. placeholder="请输入次数"
  93. >
  94. <template slot="append">次</template> </el-input
  95. >时需要回访
  96. </el-form-item>
  97. </el-row>
  98. <el-alert
  99. style="margin: 20px 0"
  100. title="特殊参数"
  101. :closable="false"
  102. type="info"
  103. >
  104. </el-alert>
  105. <el-row>
  106. <el-form-item prop="108">
  107. 团练宝活动分部目标
  108. <el-input
  109. class="marginLR5"
  110. style="width: 180px"
  111. v-model="form['108']"
  112. size="mini"
  113. placeholder="请输入分部目标"
  114. >
  115. </el-input>
  116. </el-form-item>
  117. </el-row>
  118. <el-row>
  119. <el-form-item prop="109">
  120. 团练宝活动预约开始时间
  121. <el-date-picker
  122. class="marginLR5"
  123. v-model="form['109']"
  124. type="datetime"
  125. format="yyyy-MM-dd HH:mm:ss"
  126. value-format="yyyy-MM-dd HH:mm:ss"
  127. placeholder="选择开始日期"
  128. size="mini"
  129. >
  130. </el-date-picker>
  131. </el-form-item>
  132. </el-row>
  133. <el-row>
  134. <el-form-item prop="110">
  135. 团练宝活动预约结束时间
  136. <el-date-picker
  137. class="marginLR5"
  138. v-model="form['110']"
  139. type="datetime"
  140. format="yyyy-MM-dd HH:mm:ss"
  141. value-format="yyyy-MM-dd HH:mm:ss"
  142. placeholder="选择开始日期"
  143. size="mini"
  144. >
  145. </el-date-picker>
  146. </el-form-item>
  147. </el-row>
  148. <el-row>
  149. <el-form-item prop="111">
  150. 团练宝活动开屏广告编号
  151. <el-input
  152. class="marginLR5"
  153. v-model="form['111']"
  154. size="mini"
  155. placeholder="请输入编号"
  156. style="width: 180px"
  157. />
  158. </el-form-item>
  159. </el-row>
  160. <el-row>
  161. <el-form-item prop="111">
  162. 支持考级活动报名的分部编号
  163. <el-input
  164. class="marginLR5"
  165. v-model="form['111']"
  166. size="mini"
  167. placeholder="请输入编号"
  168. style="width: 180px"
  169. />
  170. </el-form-item>
  171. </el-row>
  172. <el-row>
  173. <el-form-item prop="199">
  174. 考级活动开始时间
  175. <el-date-picker
  176. class="marginLR5"
  177. v-model="form['199']"
  178. type="datetime"
  179. format="yyyy-MM-dd HH:mm:ss"
  180. value-format="yyyy-MM-dd HH:mm:ss"
  181. placeholder="选择开始日期"
  182. size="mini"
  183. >
  184. </el-date-picker>
  185. </el-form-item>
  186. </el-row>
  187. <el-row>
  188. <el-form-item prop="200">
  189. 考级活动结束时间
  190. <el-date-picker
  191. class="marginLR5"
  192. v-model="form['200']"
  193. type="datetime"
  194. format="yyyy-MM-dd HH:mm:ss"
  195. value-format="yyyy-MM-dd HH:mm:ss"
  196. placeholder="选择开始日期"
  197. size="mini"
  198. >
  199. </el-date-picker>
  200. </el-form-item>
  201. </el-row>
  202. <!-- <el-row>
  203. <el-form-item
  204. prop="203"
  205. :rules="[
  206. {
  207. required: false,
  208. pattern: /^[1-9][0-9]*$/,
  209. message: '请输入正确的分钟数',
  210. },
  211. ]"
  212. >
  213. 云教室可提前
  214. <el-input
  215. v-model="form['203']"
  216. placeholder="请输入分钟数"
  217. size="mini"
  218. >
  219. <template slot="append">分钟</template> </el-input
  220. >进入教室
  221. </el-form-item>
  222. </el-row> -->
  223. <el-row>
  224. <el-form-item
  225. prop="61"
  226. :rules="[
  227. {
  228. required: false,
  229. pattern: /^[1-9][0-9]*$/,
  230. message: '请输入正确的分钟数',
  231. },
  232. ]"
  233. >
  234. 云教室可提前:
  235. <el-input
  236. v-model="form['61']"
  237. placeholder="请输入分钟数"
  238. size="mini"
  239. >
  240. <template slot="append">分钟</template>
  241. </el-input>
  242. 进入教室
  243. </el-form-item>
  244. </el-row>
  245. <el-row>
  246. <el-form-item
  247. prop="60"
  248. :rules="[
  249. {
  250. required: false,
  251. pattern: /^[1-9][0-9]*$/,
  252. message: '请输入正确的分钟数',
  253. },
  254. ]"
  255. >
  256. 课程结束后:
  257. <el-input
  258. v-model="form['60']"
  259. placeholder="请输入分钟数"
  260. size="mini"
  261. >
  262. <template slot="append">分钟</template>
  263. </el-input>
  264. 网络教室自动关闭
  265. </el-form-item>
  266. </el-row>
  267. </el-form>
  268. <el-button
  269. size="mini"
  270. type="primary"
  271. @click="save"
  272. class="saveBtn"
  273. v-if="!isPlatform"
  274. v-permission="'sysTenantConfig/batchUpSet_otherRules'"
  275. >保存</el-button
  276. >
  277. <el-button
  278. size="mini"
  279. type="primary"
  280. @click="save"
  281. class="saveBtn"
  282. v-else
  283. v-permission="'sysConfig/batchUpdate_otherRules'"
  284. >保存</el-button
  285. >
  286. </div>
  287. </div>
  288. </template>
  289. <script>
  290. import {
  291. getSysTenantConfig,
  292. questionnaireTopicQueryPage,
  293. setSysTenantConfig,
  294. } from "@/views/courseRulersManager/api";
  295. import { sysConfigList, sysConfigUpdate } from "@/api/generalSettings"; // 平台的修改和查
  296. export default {
  297. props: ["isPlatform"],
  298. data() {
  299. return {
  300. form: {},
  301. questionList: [],
  302. rulesVisiable: false,
  303. };
  304. },
  305. async mounted() {
  306. this.getRules();
  307. try {
  308. const res = await questionnaireTopicQueryPage({ page: 1, rows: 999 });
  309. this.questionList = res.data.rows.map((item) => {
  310. return {
  311. label: item.title,
  312. value: String(item.id),
  313. };
  314. });
  315. } catch (e) {
  316. console.log(e);
  317. }
  318. },
  319. methods: {
  320. getRules() {
  321. if (this.isPlatform) {
  322. this.getPlatformRules();
  323. } else {
  324. this.getInstitutionRules();
  325. }
  326. },
  327. async getPlatformRules() {
  328. try {
  329. const res = await sysConfigList({ group: "DAYA_BASIC" });
  330. res.data.forEach((item) => {
  331. // this.form[item.paramName] = item.paranValue
  332. this.$set(this.form, item.id, item.paranValue);
  333. });
  334. // this.$forceUpdate()
  335. console.log(this.form);
  336. } catch (e) {
  337. console.log(e);
  338. }
  339. },
  340. async getInstitutionRules() {
  341. try {
  342. const res = await getSysTenantConfig({ group: "DAYA_BASIC" });
  343. res.data.forEach((item) => {
  344. // this.form[item.paramName] = item.paranValue
  345. this.$set(this.form, item.id, item.paranValue);
  346. });
  347. // this.$forceUpdate()
  348. console.log(this.form);
  349. } catch (e) {
  350. console.log(e);
  351. }
  352. },
  353. savePlatform() {
  354. this.$refs.form.validate(async (valid) => {
  355. if (valid) {
  356. let param = [];
  357. for (let i in this.form) {
  358. param.push({
  359. id: i,
  360. paranValue: this.form[i],
  361. });
  362. }
  363. try {
  364. const res = await sysConfigUpdate(param);
  365. this.$message.success("保存成功");
  366. this.getRules();
  367. } catch (e) {
  368. console.log(e);
  369. }
  370. }
  371. });
  372. },
  373. saveInstitution() {
  374. this.$refs.form.validate(async (valid) => {
  375. if (valid) {
  376. let param = [];
  377. for (let i in this.form) {
  378. param.push({
  379. id: i,
  380. paranValue: this.form[i],
  381. });
  382. }
  383. try {
  384. const res = await setSysTenantConfig(param);
  385. this.$message.success("保存成功");
  386. this.getRules();
  387. } catch (e) {
  388. console.log(e);
  389. }
  390. }
  391. });
  392. },
  393. save() {
  394. if (this.isPlatform) {
  395. this.savePlatform();
  396. } else {
  397. this.saveInstitution();
  398. }
  399. },
  400. },
  401. };
  402. </script>
  403. <style lang="scss" scoped>
  404. @import "~@scss/views/courseRulersManager/index.scss";
  405. </style>