otherRules.vue 9.9 KB

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