add.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .supervise-content{
  5. width: 60%;
  6. height: auto;
  7. margin-bottom: 20px;
  8. border: 1px solid #c3c3c3;
  9. box-shadow:4px 4px 15px #f1f1f1;
  10. padding: 10px;
  11. margin-left: 7%;
  12. }
  13. .question-form{
  14. height: 34px;
  15. line-height: 34px;
  16. margin: 5px 0;
  17. overflow: hidden;
  18. }
  19. .question-form-option{
  20. width: auto;
  21. height: auto;
  22. margin: 5px 0;
  23. overflow: hidden;
  24. }
  25. .question-form-title{
  26. display: inline-block;
  27. width: 70px;
  28. height: 100%;
  29. }
  30. .question-form-input{
  31. display: inline-block;
  32. width: 65%;
  33. height: 100%;
  34. }
  35. .question-form-input1{
  36. display: inline-block;
  37. width: 80%;
  38. height: 100%;
  39. }
  40. .question-form-option{
  41. height: auto;
  42. margin: 5px 0;
  43. overflow: hidden;
  44. }
  45. .question-form-title{
  46. display: inline-block;
  47. width: 70px;
  48. height: 100%;
  49. }
  50. .question-options{
  51. /*width: 640px;*/
  52. width: 90%;
  53. height: 32px;
  54. color: #606266!important;
  55. font-size: 13px!important;
  56. padding: 5px 15px!important;
  57. border-width: 1px;
  58. border-style: solid;
  59. border-color: rgb(229, 230, 231);
  60. }
  61. .xz:focus,.form-select:focus,.question-options:focus{
  62. border-color: #6eb7ff !important;
  63. outline:0;
  64. }
  65. ul, ol {
  66. margin: 0;
  67. }
  68. .standard-table{
  69. overflow: hidden;
  70. }
  71. .standard-input{
  72. width: 100%;
  73. height: 100%;
  74. color: #606266!important;
  75. font-size: 13px!important;
  76. padding: 5px 15px!important;
  77. border-width: 1px;
  78. border-style: solid;
  79. border-color: rgb(229, 230, 231);
  80. }
  81. .list-group-item{
  82. width: 74%;
  83. margin-bottom: 20px;
  84. border: 2px solid var(--themeColor) !important;
  85. position: relative;
  86. z-index: 20;
  87. }
  88. .a_add{
  89. width: 100%;
  90. height: 35px;
  91. line-height: 35px;
  92. text-align: center;
  93. }
  94. .sub_standard{
  95. border: 1px solid #0a6aa1;
  96. margin-bottom: 10px;
  97. padding: 8px;
  98. position: relative;
  99. z-index: 20;
  100. }
  101. .text-danger{
  102. position: absolute;
  103. z-index: 19;
  104. top: 10px;
  105. right: 10px;
  106. /*float: right;*/
  107. }
  108. </style>
  109. <div class="row">
  110. <div class="col-sm-12">
  111. <div class="ibox float-e-margins">
  112. <div class="ibox-title">
  113. <h5>{$meta_title}</h5>
  114. <div class="ibox-tools">
  115. <a class="toback" href="{:url('index')}">
  116. 返回上一页
  117. </a>
  118. </div>
  119. </div>
  120. <div class="ibox-content" id="vueapp">
  121. <form method="post" action="{:url('add')}" class="form-horizontal">
  122. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  123. <input type="hidden" name="content" value="" id="content">
  124. <div class="question-form">
  125. <div class="question-form-title">名称</div>
  126. <div class="question-form-input">
  127. <input type="text" v-model="title" name="title" class="form-control">
  128. </div>
  129. </div>
  130. <div class="question-form">
  131. <div class="question-form-title">备注</div>
  132. <div class="question-form-input">
  133. <input type="text" v-model="remark" name="remark" class="form-control">
  134. </div>
  135. </div>
  136. <div class="question-form">
  137. <a href="javascript:;" style="margin-left:34.5%" @click="addStandard()">添加标准</a>
  138. </div>
  139. <div class="question-form-option">
  140. <ul class="list-group">
  141. <li class="list-group-item" v-for="(item,index) in content" :key="index">
  142. <a href="javascript:void(0)" class="text-danger" @click="delStandard(index)">删除</a>
  143. <div class="question-form">
  144. <div class="question-form-title">标准名称</div>
  145. <div class="question-form-input1">
  146. <input type="text" v-model="item.title" class="question-options">
  147. </div>
  148. </div>
  149. <div class="a_add">
  150. <a href="javascript:;" @click="addSubStandard(index)">添加子标准</a>
  151. </div>
  152. <div class="sub_standard" v-for="(item1,index1) in item.sub" :key="index1">
  153. <a href="javascript:void(0)" class="text-danger" @click="delSubStandard(index,index1)">删除</a>
  154. <div class="question-form">
  155. <div class="question-form-title">子标准名称</div>
  156. <div class="question-form-input1">
  157. <input type="text" v-model="item1.title" class="question-options">
  158. </div>
  159. </div>
  160. <!-- <div class="question-form">-->
  161. <!-- <div class="question-form-title">评分</div>-->
  162. <!-- <div class="question-form-input">-->
  163. <!-- <input type="number" v-model="item1.score" class="question-options">-->
  164. <!-- </div>-->
  165. <!-- </div>-->
  166. <div class="question-form">
  167. <div class="question-form-title">评分标准</div>
  168. <div class="question-form-input1">
  169. <input type="text" v-model="item1.standard" class="question-options">
  170. </div>
  171. </div>
  172. <a href="javascript:;" @click="addkhbz(index,index1)">添加考核标准</a>
  173. <div class="standard-table" >
  174. <table class="table table-bordered">
  175. <thead>
  176. <tr>
  177. <th style="width: 60%;">考核标准内容</th>
  178. <th>分值</th>
  179. <th>操作</th>
  180. </tr>
  181. </thead>
  182. <tbody>
  183. <tr v-for="(item2,index2) in item1.sub" :key="index2">
  184. <td style="width: 60%;"><input type="text" v-model="item2.title" class="standard-input"></td>
  185. <td><input type="number" onkeyup="clearNoNum1(this)" v-model="item2.score" class="standard-input"></td>
  186. <td><a href="javascript:;" @click="delkhbz(index,index1,index2)" style="color:#ed5565">删除</a></td>
  187. </tr>
  188. </tbody>
  189. </table>
  190. </div>
  191. </div>
  192. </li>
  193. </ul>
  194. </div>
  195. <div class="hr-line-dashed"></div>
  196. <div class="form-group">
  197. <div class="col-sm-6 col-sm-offset-2">
  198. <button class="btn btn-primary ajax-post" target-form="form-horizontal" type="submit">确 定</button>
  199. <a href="{:url('index')}" class="btn btn-default">取 消</a>
  200. </div>
  201. </div>
  202. </form>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. {/block}
  208. {block name="script"}
  209. <script type="text/javascript" src="/static/vuejs/require.js"></script>
  210. <script>
  211. $(document).ready(function(){
  212. // formSetValue("cate", {$info.cate|default=0});
  213. });
  214. var vm = new Vue({
  215. el: '#vueapp',
  216. data: {
  217. title:'名称',
  218. remark:'',
  219. content:[
  220. {
  221. title:'工作标准名称',
  222. score:0,
  223. sub:[{
  224. title:'子标准名称',
  225. score:0,
  226. standard:'评分标准',
  227. sub:[{
  228. title:'考核标准内容',
  229. score:0,
  230. }]
  231. }]
  232. }
  233. ],
  234. maxid:0,
  235. maxsubid:0,
  236. },
  237. computed: {
  238. resoptions: function () {
  239. return JSON.parse(JSON.stringify(this.content));
  240. }
  241. },
  242. watch: {
  243. resoptions: function (newval, oldval) {
  244. const str = JSON.stringify(newval)
  245. $('#content').val(str);
  246. },
  247. },
  248. created: function () {
  249. },
  250. methods: {
  251. addStandard(){
  252. const sub = {
  253. title:'工作标准名称',
  254. score:0,
  255. sub:[{
  256. title:'子标准名称',
  257. score:0,
  258. standard:'评分标准',
  259. sub:[{
  260. title:'考核标准内容',
  261. score:0,
  262. }]
  263. }]
  264. }
  265. this.content.push(sub);
  266. },
  267. addSubStandard(index){
  268. for(let i in this.content){
  269. if(i == Number(index)){
  270. const info = this.content[i];
  271. const sub = {
  272. title:'子标准名称',
  273. score:0,
  274. standard:'评分标准',
  275. sub:[{
  276. title:'考核标准内容',
  277. score:0,
  278. }]
  279. }
  280. info.sub.push(sub);
  281. }
  282. }
  283. },
  284. addkhbz(index,index1){
  285. for(let i in this.content){
  286. if(i == Number(index)){
  287. const info = this.content[i].sub;
  288. for (let o in info){
  289. const info2 = info[o];
  290. if(o == Number(index1)){
  291. const sub = {
  292. title:'考核标准内容',
  293. score:0,
  294. }
  295. info2.sub.push(sub);
  296. }
  297. }
  298. }
  299. }
  300. },
  301. delStandard(index){
  302. const newsArr = []
  303. for (let i in this.content){
  304. if(i != Number(index)){
  305. newsArr.push(this.content[i])
  306. }
  307. }
  308. this.content = newsArr;
  309. },
  310. delSubStandard(index,index1){
  311. for (let i in this.content){
  312. if(i == Number(index)){
  313. const sub = this.content[i].sub;
  314. const newsub = [];
  315. for (let o in sub){
  316. if(o != Number(index1)){
  317. newsub.push(sub[i]);
  318. }
  319. }
  320. this.content[i].sub = newsub;
  321. }
  322. }
  323. },
  324. delkhbz(index,index1,index2){
  325. for (let i in this.content){
  326. if(i == Number(index)){
  327. const sub = this.content[i].sub;
  328. for (let o in sub){
  329. if(o == Number(index1)){
  330. const subsub = sub[o].sub;
  331. const newsub = [];
  332. for (let t in subsub){
  333. if(t != Number(index2)){
  334. newsub.push(subsub[t]);
  335. }
  336. }
  337. this.content[i].sub[o].sub = newsub;
  338. }
  339. }
  340. }
  341. }
  342. },
  343. }
  344. })
  345. </script>
  346. {/block}