giftQuestionPaper.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. <template>
  2. <div id="giftQuestionPaper">
  3. <el-dialog
  4. @closed="loadingClose"
  5. :visible.sync="dialogVisible"
  6. width="1200px"
  7. :show-close="false"
  8. :close-on-click-modal="false"
  9. >
  10. <div slot="title" class="hearders">
  11. <div class="leftTitle">选择题卷</div>
  12. <div class="rightBoxs">
  13. <img
  14. src="@/assets/images/Close@2x.png"
  15. alt=""
  16. @click="dialogVisible = false"
  17. />
  18. </div>
  19. </div>
  20. <div>
  21. <div class="inputListBox">
  22. <div class="fon_s">商品类型:</div>
  23. <div>
  24. <el-button
  25. :type="formData.examType === item.value ? 'primary' : ''"
  26. :size="size"
  27. v-for="(item, index) in lists"
  28. :key="index"
  29. @click="topSearch(item.value)"
  30. >{{ item.label }}</el-button
  31. >
  32. </div>
  33. </div>
  34. <search-box-new
  35. ref="searchBox"
  36. :formData="formData"
  37. :formList="formList"
  38. @search="search"
  39. @init="init"
  40. />
  41. <p style="color: red">注:打勾,即代表选中;仅单选。</p>
  42. <el-table
  43. v-loading="loading"
  44. border
  45. :data="tableData"
  46. style="width: 100%; margin-top: 16px"
  47. ref="elTable"
  48. max-height="529px"
  49. >
  50. <el-table-column label="" width="45" align="center">
  51. <template scope="scope">
  52. <el-radio
  53. :label="scope.row.ids"
  54. v-model="templateRadio"
  55. @change.native="templateRadio = scope.row.ids"
  56. >{{ "" }}</el-radio
  57. >
  58. </template>
  59. </el-table-column>
  60. <el-table-column
  61. align="center"
  62. v-for="(item, index) in tableSet"
  63. :key="index"
  64. :prop="item.prop"
  65. :label="item.label"
  66. :width="item.width"
  67. >
  68. <template slot-scope="scope">
  69. <span v-if="item.scope === 'Status'">
  70. {{
  71. scope.row[item.prop] === 1
  72. ? "发布"
  73. : scope.row[item.prop] === 0
  74. ? "未发布"
  75. : "未知"
  76. }}
  77. </span>
  78. <span v-else-if="item.scope === 'businessType'">
  79. {{ scope.row[item.prop1] }}-{{ scope.row[item.prop2] }}
  80. </span>
  81. <span v-else-if="item.scope === 'type'">
  82. {{
  83. scope.row[item.prop] === 1
  84. ? "模块卷"
  85. : scope.row[item.prop] === 2
  86. ? "章卷"
  87. : scope.row[item.prop] === 3
  88. ? "试卷"
  89. : "未知"
  90. }}
  91. </span>
  92. <span v-else>{{ scope.row[item.prop] }}</span>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <pagination
  97. :total="total"
  98. :pageSize="formData.pageSize"
  99. :currentPage="formData.pageNum"
  100. @handleSizeChange="handleSizeChange"
  101. @handleCurrentChange="handleCurrentChange"
  102. />
  103. </div>
  104. <span slot="footer" class="dialog-footer">
  105. <el-button type="warning" @click="clearFunc">清除选中题卷</el-button>
  106. <el-button @click="dialogVisible = false">取 消</el-button>
  107. <el-button type="primary" @click="submitForm" :loading="disabledBtn"
  108. >确 定</el-button
  109. >
  110. </span>
  111. </el-dialog>
  112. </div>
  113. </template>
  114. <script>
  115. import searchBoxNew from "@/components/searchBoxNew";
  116. import pagination from "@/components/pagination";
  117. export default {
  118. components: { searchBoxNew, pagination },
  119. data() {
  120. return {
  121. loading: false,
  122. size: "small",
  123. dialogVisible: false,
  124. disabledBtn: false,
  125. disActiveList: [], //禁止选择列表
  126. formData: {
  127. examType: 1,
  128. pageSize: 10,
  129. pageNum: 1,
  130. },
  131. templateRadio: "",
  132. total: 0,
  133. lists: [
  134. {
  135. label: "模块卷",
  136. value: 1,
  137. },
  138. {
  139. label: "章卷",
  140. value: 2,
  141. },
  142. {
  143. label: "试卷",
  144. value: 3,
  145. },
  146. ],
  147. tableSet: [
  148. { label: "题卷编码", prop: "code", width: "120" },
  149. { label: "题卷前缀", prop: "prefixName", width: "120" },
  150. { label: "题卷标题", prop: "name", width: "300" },
  151. { label: "科目", prop: "subjectName", width: "160" },
  152. {
  153. label: "业务层次",
  154. prop1: "projectName",
  155. prop2: "businessName",
  156. width: "300",
  157. scope: "businessType",
  158. },
  159. { label: "教育类型", prop: "educationName", width: "160" },
  160. { label: "题库类型", prop: "type", scope: "type", width: "120" },
  161. {
  162. label: "发布状态",
  163. prop: "publishStatus",
  164. scope: "Status",
  165. width: "120",
  166. },
  167. ],
  168. //搜索
  169. formList: [
  170. {
  171. prop: "educationTypeId",
  172. placeholder: "教育类型",
  173. scope: "educationType",
  174. },
  175. {
  176. prop: "businessId",
  177. placeholder: "业务层次",
  178. scope: "businessLevel",
  179. edu: "educationTypeId",
  180. },
  181. {
  182. prop: "subjectId",
  183. placeholder: "科目",
  184. scope: "sujectType",
  185. edu: "educationTypeId",
  186. },
  187. {
  188. prop: "key",
  189. placeholder: "请输入题卷名称/题卷编码",
  190. },
  191. ],
  192. tableData: [],
  193. moduleId: "",
  194. };
  195. },
  196. methods: {
  197. clearFunc() {
  198. this.templateRadio = "";
  199. this.$message.success("已清除选中题卷");
  200. },
  201. loadingClose() {
  202. this.disabledBtn = false;
  203. },
  204. openBoxs(arr) {
  205. if (arr.freeExamId) {
  206. this.templateRadio = arr.examType + "-" + arr.freeExamId;
  207. }
  208. this.moduleId = arr.moduleId;
  209. console.log(arr);
  210. this.search(2);
  211. this.dialogVisible = true;
  212. },
  213. search(v) {
  214. var self = this;
  215. this.loading = true;
  216. if (v === 1) {
  217. this.formData.pageNum = 1;
  218. }
  219. if (v === 2) {
  220. this.formData = {
  221. examType: this.formData.examType,
  222. pageSize: 10,
  223. pageNum: 1,
  224. };
  225. }
  226. var data = JSON.parse(JSON.stringify(this.formData));
  227. if (data.examType === 1) {
  228. self.$api
  229. .inquireBankModule(data)
  230. .then((res) => {
  231. res.rows.forEach((item) => {
  232. item.ids = 1 + "-" + item.moduleExamId;
  233. item.type = 1;
  234. item.name = item.moduleName;
  235. item.sort = 0;
  236. });
  237. self.tableData = res.rows;
  238. self.total = res.total;
  239. })
  240. .finally(() => {
  241. this.loading = false;
  242. });
  243. }
  244. if (data.examType === 2) {
  245. self.$api
  246. .inquirebankchapterList(data)
  247. .then((res) => {
  248. res.rows.forEach((item) => {
  249. item.ids = 2 + "-" + item.chapterExamId;
  250. item.sort = 0;
  251. item.type = 2;
  252. });
  253. self.tableData = res.rows;
  254. self.total = res.total;
  255. })
  256. .finally(() => {
  257. this.loading = false;
  258. });
  259. }
  260. if (data.examType === 3) {
  261. self.$api
  262. .inquirebankexamList(data)
  263. .then((res) => {
  264. res.rows.forEach((item) => {
  265. item.ids = 3 + "-" + item.examId;
  266. item.sort = 0;
  267. item.type = 3;
  268. item.name = item.examName;
  269. });
  270. self.tableData = res.rows;
  271. self.total = res.total;
  272. })
  273. .finally(() => {
  274. this.loading = false;
  275. });
  276. }
  277. },
  278. init() {
  279. this.search(2);
  280. },
  281. submitForm() {
  282. this.disabledBtn = true;
  283. let data = {};
  284. if (this.templateRadio) {
  285. let ids = this.templateRadio.split("-").map(Number);
  286. data = {
  287. examType: ids[0],
  288. freeExamId: ids[1],
  289. moduleId: this.moduleId,
  290. };
  291. } else {
  292. data = {
  293. examType: "",
  294. freeExamId: "",
  295. moduleId: this.moduleId,
  296. };
  297. }
  298. this.$api
  299. .editCoursemodule(data)
  300. .then((res) => {
  301. this.$message.success("成功");
  302. this.dialogVisible = false;
  303. this.$emit("backFunc")
  304. })
  305. .finally(() => {
  306. this.disabledBtn = false;
  307. });
  308. },
  309. handleSizeChange(v) {
  310. this.formData.pageSize = v;
  311. this.formData.pageNum = 1;
  312. this.search();
  313. },
  314. handleCurrentChange(v) {
  315. this.formData.pageNum = v;
  316. this.search();
  317. },
  318. /**
  319. *
  320. * @param {int} status
  321. * @remark 顶部定制按钮-根据题卷类型点击快速搜索
  322. */
  323. topSearch(status) {
  324. this.formData.examType = status;
  325. this.search();
  326. },
  327. },
  328. };
  329. </script>
  330. <style lang="less" scoped>
  331. .dis_box {
  332. background-color: #eee;
  333. padding: 10px 10px 0px;
  334. display: flex;
  335. margin-bottom: 16px;
  336. .left_box {
  337. flex: 1;
  338. }
  339. .clear_style {
  340. flex-shrink: 0;
  341. width: 80px;
  342. vertical-align: top;
  343. text-align: center;
  344. }
  345. }
  346. .elform_style {
  347. max-height: 620px;
  348. overflow: auto;
  349. }
  350. .p_style {
  351. font-size: 12px;
  352. color: #a4a4a4;
  353. margin: 0;
  354. }
  355. .inputListBox {
  356. display: flex;
  357. align-items: center;
  358. margin-bottom: 12px;
  359. }
  360. .inputListBoxs {
  361. display: flex;
  362. margin-bottom: 12px;
  363. }
  364. </style>