Selaa lähdekoodia

规则维护下拉框修改

1178232204@qq.com 3 vuotta sitten
vanhempi
commit
a31c67ecaf
2 muutettua tiedostoa jossa 26 lisäystä ja 9 poistoa
  1. 21 8
      src/components/FieldRules/addRules.js
  2. 5 1
      src/components/RegularManage/index.js

+ 21 - 8
src/components/FieldRules/addRules.js

@@ -113,10 +113,24 @@ function ContentForm(props) {
         })
     }
     //表选择
-    function tablechange(value, options) {
-        colList[options.key] = list[options.key].getColumnNameDTOList
-        seDisable(false)
-        setColList([...colList])
+    function tablechange(i, value, options) {
+        console.log(value);
+        const formData = form.getFieldsValue();
+        if (value) {
+            colList[i] = list[options.key].getColumnNameDTOList
+            seDisable(false)
+            setColList([...colList])
+        }else{
+            colList[i] = []
+            setColList([...colList])
+            seDisable(true)
+        }
+        let columnList = formData.columnList;
+        columnList[i].columnCname = undefined
+        columnList[i].columnEname = undefined
+        form.setFieldsValue({
+            columnList: columnList
+        });
     }
     function colchange(value, options) {
         const formData = form.getFieldsValue();
@@ -205,7 +219,6 @@ function ContentForm(props) {
                 arr.push(it.tit)
             }
         });
-        console.log(arr);
         formData.standardValueList = arr
         if (type == 1) {
             url = api.addColumnVerify
@@ -264,7 +277,7 @@ function ContentForm(props) {
                                     <div className='item'>
                                         <div className='item-box'>
                                             <Form.Item label="表名称(中文)" rules={[{ required: true }]} style={{ width: '50%' }} name={['columnList', i, 'tableCname']} labelAlign="right" >
-                                                <Select allowClear showSearch onChange={tablechange} onSearch={cnameSearch} style={{ width: 160 }} placeholder="请选择">
+                                                <Select allowClear showSearch onChange={(value, option) => tablechange(i, value, option)} onSearch={cnameSearch} style={{ width: 160 }} placeholder="请选择">
                                                     {tableList.map((item) => {
                                                         return (
                                                             <Option value={item.tableCname} key={item.index}>{item.tableCname}</Option>
@@ -273,7 +286,7 @@ function ContentForm(props) {
                                                 </Select>
                                             </Form.Item>
                                             <Form.Item label="表名称(英文)" rules={[{ required: true }]} name={['columnList', i, 'tableEname']} labelAlign="right">
-                                                <Select allowClear showSearch onChange={tablechange} onSearch={enameSearch} style={{ width: 160 }} placeholder="请选择" >
+                                                <Select allowClear showSearch onChange={(value, option) => tablechange(i, value, option)} onSearch={enameSearch} style={{ width: 160 }} placeholder="请选择" >
                                                     {tableList.map((item) => {
                                                         return (
                                                             <Option value={item.tableEname} key={item.index}>{item.tableEname}</Option>
@@ -352,7 +365,7 @@ function ContentForm(props) {
                     <TextArea
                         autoSize={{ minRows: 3, maxRows: 5 }}
                         placeholder="请输入"
-                        
+
                     />
                 </Form.Item>
             </Form>

+ 5 - 1
src/components/RegularManage/index.js

@@ -58,7 +58,11 @@ function RegularManage() {
     }
     //删除记录
     function delRegularById() {
-        post(api.delRegularById, { ids: selectedRowKeys }).then((res) => {
+        let arr = []
+        selectedRowKeys.forEach(it => {
+            arr.push(it.split('-')[0])
+        });
+        post(api.delRegularById, { ids: arr }).then((res) => {
             if (res.data.code === 200) {
                 //刷新列表
                 getRegularPage()